aa.application.AdaptiveQuad
Class QuadActor

java.lang.Object
  extended byaa.core.Actor
      extended byaa.application.AdaptiveQuad.QuadActor
All Implemented Interfaces:
java.io.Serializable

public class QuadActor
extends Actor

Author:
xinghuizhao This class comes from QuadWork, we change it a little bit in order to allocation resource according to the computation complexity (the more error, the more resource)
See Also:
Serialized Form

Field Summary
(package private)  ActorName client
          The first response we have received from a child fib actor.
(package private)  java.lang.String meth
           
(package private)  int numResponses
           
(package private)  double partialResponse
           
(package private)  java.lang.Double tolerance
           
 
Fields inherited from class aa.core.Actor
m_athread
 
Constructor Summary
QuadActor(ActorName p_anClient, java.lang.String p_strMeth, java.lang.Double p_douTolerance)
           
QuadActor(java.lang.Double p_douTolerance)
          Creates a new instance of QuadWorker
QuadActor(java.lang.Double p_douTolerance, ActorName p_anClient)
           
 
Method Summary
 double divideSum(java.lang.Double a, java.lang.Double b)
          Calculate the sum of areas of two sub trapezoids
 double error(java.lang.Double a, java.lang.Double b)
           
 double func(double x)
          The function
 void quadrature(java.lang.Double a, java.lang.Double b, ActorName p_anClient, java.lang.String p_strMeth)
          This method is called to do the quadrature computation a: lower bound b: upper bound tolerance: the error tolerance p_anClient: the actor which is suppose to receive result from this actor p_strMeth: the name of the method to calculate result in client actor
 void result(java.lang.Double p_douVal)
          This method is called from another child actor to pass a partial result.
 double trapezoid(java.lang.Double a, java.lang.Double b)
          Calculate the area of a trapezoid
 
Methods inherited from class aa.core.Actor
become, become, become, become, become, become, become, become, become, become, become, becomeActor, call, call, call, call, call, call, call, call, call, call, call, callMessage, create, create, create, create, create, create, create, create, create, create, create, createActor, createRemote, createRemote, createRemote, createRemote, createRemote, createRemote, createRemote, createRemote, createRemote, createRemote, createRemote, createRemoteActor, destroy, echo, getActorName, getDefaultDirectoryManager, getDefaultDirectoryManager, getLastErrorMessage, migrate, print, printLastErrorMessage, println, send, send, send, send, send, send, send, send, send, send, send, sendMessage, setErrorMessage, uninit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numResponses

int numResponses

partialResponse

double partialResponse

tolerance

java.lang.Double tolerance

client

ActorName client
The first response we have received from a child fib actor. We save this value until we receive the second response, and send our clint the sum of both values


meth

java.lang.String meth
Constructor Detail

QuadActor

public QuadActor(java.lang.Double p_douTolerance)
Creates a new instance of QuadWorker


QuadActor

public QuadActor(java.lang.Double p_douTolerance,
                 ActorName p_anClient)

QuadActor

public QuadActor(ActorName p_anClient,
                 java.lang.String p_strMeth,
                 java.lang.Double p_douTolerance)
Method Detail

quadrature

public void quadrature(java.lang.Double a,
                       java.lang.Double b,
                       ActorName p_anClient,
                       java.lang.String p_strMeth)
This method is called to do the quadrature computation a: lower bound b: upper bound tolerance: the error tolerance p_anClient: the actor which is suppose to receive result from this actor p_strMeth: the name of the method to calculate result in client actor


func

public double func(double x)
The function


trapezoid

public double trapezoid(java.lang.Double a,
                        java.lang.Double b)
Calculate the area of a trapezoid


divideSum

public double divideSum(java.lang.Double a,
                        java.lang.Double b)
Calculate the sum of areas of two sub trapezoids


error

public double error(java.lang.Double a,
                    java.lang.Double b)

result

public void result(java.lang.Double p_douVal)
This method is called from another child actor to pass a partial result. We wait until we have two such results, add them, and return the result to client.