uchicago.src.sim.engine
Class AsynchAgent

java.lang.Object
  extended by uchicago.src.sim.network.DefaultNode
      extended by uchicago.src.sim.network.DefaultDrawableNode
          extended by uchicago.src.sim.engine.AsynchAgent
All Implemented Interfaces:
java.io.Serializable, IAsynchAgent, Drawable2DGridNode, DrawableNonGridNode, Moveable, NonGridDrawable, Node
Direct Known Subclasses:
Employee

public class AsynchAgent
extends DefaultDrawableNode
implements java.io.Serializable, IAsynchAgent

An asynchronously executed agent class.

Since:
3.0
Version:
$Revision: 1.7 $ $Date: 2005/08/12 16:13:29 $
Author:
Michael North
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class uchicago.src.sim.network.DefaultNode
DefaultNode.OrderedHashMap
 
Field Summary
 
Fields inherited from class uchicago.src.sim.network.DefaultDrawableNode
item
 
Fields inherited from class uchicago.src.sim.network.DefaultNode
inEdges, inMap, label, outEdges, outMap
 
Constructor Summary
AsynchAgent()
          Default creator, sets up this agent with a random distribution of type Uniform running on a MersenneTwister.
AsynchAgent(SimModel model)
          Default creator, sets up this agent with a random distribution of type Uniform running on a MersenneTwister and a model
 
Method Summary
 void clearUtilization()
           
 double findNextTaskCompletionTime()
           
static java.util.ArrayList getAgentList()
           
 double getDelayMaximum()
           
 double getDelayMinimum()
           
 int getID()
           
 SimModel getModel()
          The model this agent is working with, used to get the schedule for the scheduling methods
 double getNextAvailableTime()
           
 double getNextDelay()
           
 cern.jet.random.AbstractContinousDistribution getRandomDistribution()
           
 double getUtilization()
           
 double getUtilizedTime()
           
 void initialize()
           
 BasicAction scheduleAfterWaiting(java.lang.String methodName)
          Schedules a method to be called on this agent after a certain waiting period.
 BasicAction scheduleAfterWaiting(java.lang.String methodName, java.lang.Object param0)
          Schedules a method to be called on this agent after a certain waiting period.
 BasicAction scheduleAfterWaiting(java.lang.String methodName, java.lang.Object param0, java.lang.Object param1)
          Schedules a method to be called on this agent after a certain waiting period.
 BasicAction scheduleAfterWaiting(java.lang.String methodName, java.lang.Object param0, java.lang.Object param1, java.lang.Object param2)
          Schedules a method to be called on this agent after a certain waiting period.
 BasicAction scheduleAt(double time, java.lang.String methodName)
          Schedules a method to be called on this agent at a certain time.
 BasicAction scheduleAt(double time, java.lang.String methodName, java.lang.Object param0)
          Schedules a method to be called on this agent at a certain time.
 BasicAction scheduleAt(double time, java.lang.String methodName, java.lang.Object param0, java.lang.Object param1)
          Schedules a method to be called on this agent at a certain time.
 BasicAction scheduleAt(double time, java.lang.String methodName, java.lang.Object param0, java.lang.Object param1, java.lang.Object param2)
          Schedules a method to be called on this agent at a certain time.
 BasicAction scheduleNow(java.lang.String methodName)
          Schedules a method to be called on this agent after a cerain waiting period.
 BasicAction scheduleNow(java.lang.String methodName, java.lang.Object param0)
           
 BasicAction scheduleNow(java.lang.String methodName, java.lang.Object param0, java.lang.Object param1)
           
 BasicAction scheduleNow(java.lang.String methodName, java.lang.Object param0, java.lang.Object param1, java.lang.Object param2)
           
 BasicAction scheduleWhenAvailable(java.lang.String methodName)
          Schedules a method to be called when the agent is next available.
 BasicAction scheduleWhenAvailable(java.lang.String methodName, java.lang.Object param0)
          Schedules a method to be called when the agent is next available.
 BasicAction scheduleWhenAvailable(java.lang.String methodName, java.lang.Object param0, java.lang.Object param1)
          Schedules a method to be called when the agent is next available.
 BasicAction scheduleWhenAvailable(java.lang.String methodName, java.lang.Object param0, java.lang.Object param1, java.lang.Object param2)
          Schedules a method to be called when the agent is next available.
static void setAgentList(java.util.ArrayList list)
           
 void setDelayMaximum(double d)
           
 void setDelayMinimum(double d)
           
 void setID(int i)
           
 void setModel(SimModel model)
           
 void setNextAvailableTime(double d)
           
 void setRandomDistribution(cern.jet.random.AbstractContinousDistribution randomDistribution)
           
 void setUtilizedTime(double d)
           
 
Methods inherited from class uchicago.src.sim.network.DefaultDrawableNode
allowResizing, calcSize, contains, draw, getBorderColor, getBorderWidth, getColor, getFont, getHeight, getLabelColor, getNode, getWidth, getX, getY, setBorderColor, setBorderWidth, setColor, setDrawable, setDrawableNoCopy, setFont, setHeight, setLabelColor, setNodeLabel, setWidth, setX, setX, setY, setY
 
Methods inherited from class uchicago.src.sim.network.DefaultNode
addInEdge, addInEdges, addOutEdge, addOutEdges, clearInEdges, clearOutEdges, getEdgesFrom, getEdgesTo, getFromNodes, getId, getInDegree, getInEdges, getInNodes, getNodeLabel, getNumInEdges, getNumOutEdges, getOutDegree, getOutEdges, getOutNodes, getRandomFromNode, getRandomNodeIn, getRandomNodeOut, getRandomToNode, getToNodes, hasEdgeFrom, hasEdgeTo, hasEdgeToOrFrom, makeRandomInEdge, makeRandomOutEdge, removeEdgesFrom, removeEdgesTo, removeInEdge, removeOutEdge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.gui.DrawableNonGridNode
getOutEdges
 
Methods inherited from interface uchicago.src.sim.gui.Drawable2DGridNode
getOutEdges
 

Constructor Detail

AsynchAgent

public AsynchAgent()
Default creator, sets up this agent with a random distribution of type Uniform running on a MersenneTwister. You must call setModel before running the simulation or none of the schedule methods will work.


AsynchAgent

public AsynchAgent(SimModel model)
Default creator, sets up this agent with a random distribution of type Uniform running on a MersenneTwister and a model

Parameters:
model - the model this agent uses when scheduling
Method Detail

findNextTaskCompletionTime

public double findNextTaskCompletionTime()
Specified by:
findNextTaskCompletionTime in interface IAsynchAgent
Returns:

initialize

public void initialize()

scheduleNow

public BasicAction scheduleNow(java.lang.String methodName)
Schedules a method to be called on this agent after a cerain waiting period. This method must have 1 parameter. methodName(param0, param1, param2)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleNow

public BasicAction scheduleNow(java.lang.String methodName,
                               java.lang.Object param0)

scheduleNow

public BasicAction scheduleNow(java.lang.String methodName,
                               java.lang.Object param0,
                               java.lang.Object param1)

scheduleNow

public BasicAction scheduleNow(java.lang.String methodName,
                               java.lang.Object param0,
                               java.lang.Object param1,
                               java.lang.Object param2)

scheduleAfterWaiting

public BasicAction scheduleAfterWaiting(java.lang.String methodName)
Schedules a method to be called on this agent after a certain waiting period. This method must have no parameters. methodName()

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
Returns:
the BasicAction that was scheduled

scheduleAfterWaiting

public BasicAction scheduleAfterWaiting(java.lang.String methodName,
                                        java.lang.Object param0)
Schedules a method to be called on this agent after a certain waiting period. This method must have 1 parameter. methodName(param0)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
Returns:
the BasicAction that was scheduled

scheduleAfterWaiting

public BasicAction scheduleAfterWaiting(java.lang.String methodName,
                                        java.lang.Object param0,
                                        java.lang.Object param1)
Schedules a method to be called on this agent after a certain waiting period. This method must have 2 parameters. methodName(param0, param1)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
param1 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleAfterWaiting

public BasicAction scheduleAfterWaiting(java.lang.String methodName,
                                        java.lang.Object param0,
                                        java.lang.Object param1,
                                        java.lang.Object param2)
Schedules a method to be called on this agent after a certain waiting period. This method must have 3 parameters. methodName(param0, param1, param2)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
param1 - a parameter passed to the method.
param2 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleWhenAvailable

public BasicAction scheduleWhenAvailable(java.lang.String methodName)
Schedules a method to be called when the agent is next available. This method must have no parameters. methodName(param0)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
Returns:
the BasicAction that was scheduled

scheduleWhenAvailable

public BasicAction scheduleWhenAvailable(java.lang.String methodName,
                                         java.lang.Object param0)
Schedules a method to be called when the agent is next available. This method must have 1 parameter. methodName(param0)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleWhenAvailable

public BasicAction scheduleWhenAvailable(java.lang.String methodName,
                                         java.lang.Object param0,
                                         java.lang.Object param1)
Schedules a method to be called when the agent is next available. This method must have 2 parameters. methodName(param0, param1)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
param1 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleWhenAvailable

public BasicAction scheduleWhenAvailable(java.lang.String methodName,
                                         java.lang.Object param0,
                                         java.lang.Object param1,
                                         java.lang.Object param2)
Schedules a method to be called when the agent is next available. This method must have 3 parameters. methodName(param0, param1, param2)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
param1 - a parameter passed to the method.
param2 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleAt

public BasicAction scheduleAt(double time,
                              java.lang.String methodName)
Schedules a method to be called on this agent at a certain time. This method must have no parameters. methodName()

Parameters:
o - the agent to call the method on
methodName - the method to call on the object.
Returns:
the BasicAction that was scheduled

scheduleAt

public BasicAction scheduleAt(double time,
                              java.lang.String methodName,
                              java.lang.Object param0)
Schedules a method to be called on this agent at a certain time. This method must have 1 parameter. methodName(param0)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
Returns:
the BasicAction that was scheduled

scheduleAt

public BasicAction scheduleAt(double time,
                              java.lang.String methodName,
                              java.lang.Object param0,
                              java.lang.Object param1)
Schedules a method to be called on this agent at a certain time. This method must have 2 parameters. methodName(param0, param1)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
param1 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

scheduleAt

public BasicAction scheduleAt(double time,
                              java.lang.String methodName,
                              java.lang.Object param0,
                              java.lang.Object param1,
                              java.lang.Object param2)
Schedules a method to be called on this agent at a certain time. This method must have 3 parameters. methodName(param0, param1, param2)

Parameters:
o - the agent to call the method on
methodName - the method to call on the object
param0 - a parameter passed to the method.
param1 - a parameter passed to the method.
param2 - a parameter passed to the method.
Returns:
the BasicAction that was scheduled

getDelayMaximum

public double getDelayMaximum()

getDelayMinimum

public double getDelayMinimum()

getModel

public SimModel getModel()
The model this agent is working with, used to get the schedule for the scheduling methods


getNextAvailableTime

public double getNextAvailableTime()
Specified by:
getNextAvailableTime in interface IAsynchAgent
Returns:
the next time the agent is available to perform an action

getNextDelay

public double getNextDelay()

setDelayMaximum

public void setDelayMaximum(double d)

setDelayMinimum

public void setDelayMinimum(double d)

setModel

public void setModel(SimModel model)

setNextAvailableTime

public void setNextAvailableTime(double d)

getUtilization

public double getUtilization()

clearUtilization

public void clearUtilization()

getAgentList

public static java.util.ArrayList getAgentList()

setAgentList

public static void setAgentList(java.util.ArrayList list)

getID

public int getID()

getUtilizedTime

public double getUtilizedTime()

setID

public void setID(int i)

setUtilizedTime

public void setUtilizedTime(double d)

getRandomDistribution

public cern.jet.random.AbstractContinousDistribution getRandomDistribution()
Returns:
the distribution used to compute delays

setRandomDistribution

public void setRandomDistribution(cern.jet.random.AbstractContinousDistribution randomDistribution)
Parameters:
randomDistribution - the distribution used to compute delays