org.mitre.sim.api3.exec.reference
Class ReferenceExecutive

java.lang.Object
  extended byorg.mitre.sim.api3.exec.reference.ReferenceExecutive
All Implemented Interfaces:
Executive

public class ReferenceExecutive
extends java.lang.Object
implements Executive

Reference implementation of the Executive interface.


Copyright © 2003-2004 The MITRE Corporation


Constructor Summary
ReferenceExecutive()
           
 
Method Summary
 void actionMethodInvoked(LogicalProcess lp)
          Inform the executive that LogicalProcess lp has received an action method invocation.
 Population createPopulation(java.lang.Class c, LogicalProcess lp)
          Create a population of class c entities for entity lp.
 java.util.Set getLogicalProcessesByState(State s)
          Used to test Executive implementations and is not needed by simulation developers.
 long getPace()
          Get the minimum amount of real time that must pass before the simulation advances one unit of simulation time.
 double getTimeLast()
          Called by LogicalProcess
 double getTimeNow()
          Called by LogicalProcess
 void registerLogicalProcess(LogicalProcess lp)
          Add the supplied lp to the collection of logical processes managed by an implementation of Executive.
 void runLogicalProcess(LogicalProcess lp)
          Begin the execution of the LogicalProcess.
 void schedule(java.lang.reflect.Method eventMethod, double eventDelay, LogicalProcess lp, java.lang.Object[] arguments)
          Schedule a method for execution.
 void setFlow(Flow f)
           
 void setLogger(java.util.logging.Logger l)
          Provides a logger that the executive uses to log diagnostic and other error messages.
 void setPace(long period)
          Set the minimum amount of real time that must pass before the simulation advances one unit of simulation time.
 void setProperties(java.util.Properties p)
           
 void setTimeLast(double last)
          Set the final value of simulation time that the Executive implementation will recognize.
 void startSimulation()
          Begin the evolution of simulation time.
 void stopSimulation(LogicalProcess lp)
          Stop the evolution of simulation time and end the simulation.
 java.lang.String version()
          Returns the version of the class implementing interface Executive.
 WaitResult waitForEvent(Trigger[] conditions, double backStop, LogicalProcess lp)
          Wait for a Trigger to be true or an action method invocation.
 WaitResult waitForTime(double t, LogicalProcess lp)
          Wait for simulation time to pass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceExecutive

public ReferenceExecutive()
Method Detail

version

public java.lang.String version()
Description copied from interface: Executive
Returns the version of the class implementing interface Executive. Used not only to confirm the version of the implementation but also the nature of the implementation (which scheduling algorithm is used).

Specified by:
version in interface Executive
Returns:
Executive implementation version

setFlow

public void setFlow(Flow f)
Specified by:
setFlow in interface Executive

startSimulation

public final void startSimulation()
Description copied from interface: Executive
Begin the evolution of simulation time.

Called by Simulation

Specified by:
startSimulation in interface Executive

stopSimulation

public final void stopSimulation(LogicalProcess lp)
Description copied from interface: Executive
Stop the evolution of simulation time and end the simulation.

Called by LogicalProcess

Specified by:
stopSimulation in interface Executive

registerLogicalProcess

public final void registerLogicalProcess(LogicalProcess lp)
Description copied from interface: Executive
Add the supplied lp to the collection of logical processes managed by an implementation of Executive.

Called by Simulation and LogicalProcess

Specified by:
registerLogicalProcess in interface Executive
Parameters:
lp -

actionMethodInvoked

public final void actionMethodInvoked(LogicalProcess lp)
                               throws java.lang.IllegalStateException
Description copied from interface: Executive
Inform the executive that LogicalProcess lp has received an action method invocation.

Called by LogicalProcess

Specified by:
actionMethodInvoked in interface Executive
Parameters:
lp -
Throws:
java.lang.IllegalStateException

waitForTime

public WaitResult waitForTime(double t,
                              LogicalProcess lp)
Description copied from interface: Executive
Wait for simulation time to pass.

Called by LogicalProcess

Specified by:
waitForTime in interface Executive
Parameters:
t -
lp -
Returns:
WaitResult

waitForEvent

public WaitResult waitForEvent(Trigger[] conditions,
                               double backStop,
                               LogicalProcess lp)
Description copied from interface: Executive
Wait for a Trigger to be true or an action method invocation.

Called by LogicalProcess

Specified by:
waitForEvent in interface Executive
Parameters:
conditions -
backStop -
lp -
Returns:
WaitResult

runLogicalProcess

public final void runLogicalProcess(LogicalProcess lp)
Description copied from interface: Executive
Begin the execution of the LogicalProcess.

Called by LogicalProcess

Specified by:
runLogicalProcess in interface Executive
Parameters:
lp -
See Also:
runLogicalProcess(LogicalProcess)

setPace

public void setPace(long period)
Description copied from interface: Executive
Set the minimum amount of real time that must pass before the simulation advances one unit of simulation time.

Specified by:
setPace in interface Executive
Parameters:
period - Minimum number of real milliseconds that must pass before one unit of simulation time passes.

getPace

public long getPace()
Description copied from interface: Executive
Get the minimum amount of real time that must pass before the simulation advances one unit of simulation time.

Specified by:
getPace in interface Executive
Returns:
Minimum number of real milliseconds that must pass before one unit of simulation time passes.

getTimeNow

public final double getTimeNow()
Description copied from interface: Executive

Called by LogicalProcess

Specified by:
getTimeNow in interface Executive
Returns:
The current simulation time.

setTimeLast

public final void setTimeLast(double last)
Description copied from interface: Executive
Set the final value of simulation time that the Executive implementation will recognize.

Called by LogicalProcess

Specified by:
setTimeLast in interface Executive
Parameters:
last -

getTimeLast

public final double getTimeLast()
Description copied from interface: Executive

Called by LogicalProcess

Specified by:
getTimeLast in interface Executive
Returns:
The current simulation time at which the simulation will stop.

setProperties

public void setProperties(java.util.Properties p)
Specified by:
setProperties in interface Executive

createPopulation

public Population createPopulation(java.lang.Class c,
                                   LogicalProcess lp)
Description copied from interface: Executive
Create a population of class c entities for entity lp.

Specified by:
createPopulation in interface Executive
Parameters:
c - All entities in the population must be of this class.
lp - Entity that created the population.
Returns:
Population of entities of class c.

schedule

public void schedule(java.lang.reflect.Method eventMethod,
                     double eventDelay,
                     LogicalProcess lp,
                     java.lang.Object[] arguments)
Description copied from interface: Executive
Schedule a method for execution. Method eventMethod will be invoked by the executive after the amount of simulation time given by eventDelay as elapsed.

Specified by:
schedule in interface Executive
Parameters:
eventMethod - Method to be invoked.
eventDelay - Amount of simulation time that must pass before eventMethod is invoked.
lp - Entity instance that contains method eventMethod.

getLogicalProcessesByState

public java.util.Set getLogicalProcessesByState(State s)
Description copied from interface: Executive
Used to test Executive implementations and is not needed by simulation developers.

Specified by:
getLogicalProcessesByState in interface Executive

setLogger

public void setLogger(java.util.logging.Logger l)
Description copied from interface: Executive
Provides a logger that the executive uses to log diagnostic and other error messages.

Specified by:
setLogger in interface Executive
Parameters:
l - The logger for the executive