org.mitre.sim.api3.exec
Interface Executive

All Known Implementing Classes:
ReferenceExecutive

public interface Executive

Simulation executive interface. Each Simulation contains one instance of a class implementing Executive. Model developers use Executive implementation methods indirectly by extending classes Simulation and Entity. These extensions inherit methods that use Executive implementation methods.


Copyright © 2003-2004 The MITRE Corporation


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 t)
          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[] triggers, 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.
 

Method Detail

version

public java.lang.String version()
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).

Returns:
Executive implementation version

startSimulation

public void startSimulation()
Begin the evolution of simulation time.

Called by Simulation


stopSimulation

public void stopSimulation(LogicalProcess lp)
Stop the evolution of simulation time and end the simulation.

Called by LogicalProcess


registerLogicalProcess

public void registerLogicalProcess(LogicalProcess lp)
Add the supplied lp to the collection of logical processes managed by an implementation of Executive.

Called by Simulation and LogicalProcess

Parameters:
lp -

runLogicalProcess

public void runLogicalProcess(LogicalProcess lp)
Begin the execution of the LogicalProcess.

Called by LogicalProcess

Parameters:
lp -
See Also:
ReferenceExecutive.runLogicalProcess(LogicalProcess)

actionMethodInvoked

public void actionMethodInvoked(LogicalProcess lp)
                         throws java.lang.IllegalStateException
Inform the executive that LogicalProcess lp has received an action method invocation.

Called by LogicalProcess

Parameters:
lp -
Throws:
java.lang.IllegalStateException

getTimeNow

public double getTimeNow()

Called by LogicalProcess

Returns:
The current simulation time.

setTimeLast

public void setTimeLast(double t)
Set the final value of simulation time that the Executive implementation will recognize.

Called by LogicalProcess

Parameters:
t -

getTimeLast

public double getTimeLast()

Called by LogicalProcess

Returns:
The current simulation time at which the simulation will stop.

setPace

public void setPace(long period)
Set the minimum amount of real time that must pass before the simulation advances one unit of simulation time.

Parameters:
period - Minimum number of real milliseconds that must pass before one unit of simulation time passes.

getPace

public long getPace()
Get the minimum amount of real time that must pass before the simulation advances one unit of simulation time.

Returns:
Minimum number of real milliseconds that must pass before one unit of simulation time passes.

waitForTime

public WaitResult waitForTime(double t,
                              LogicalProcess lp)
Wait for simulation time to pass.

Called by LogicalProcess

Parameters:
t -
lp -
Returns:
WaitResult

waitForEvent

public WaitResult waitForEvent(Trigger[] triggers,
                               double backStop,
                               LogicalProcess lp)
Wait for a Trigger to be true or an action method invocation.

Called by LogicalProcess

Parameters:
triggers -
backStop -
lp -
Returns:
WaitResult

setFlow

public void setFlow(Flow f)

setProperties

public void setProperties(java.util.Properties p)

getLogicalProcessesByState

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


createPopulation

public Population createPopulation(java.lang.Class c,
                                   LogicalProcess lp)
Create a population of class c entities for entity lp.

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)
Schedule a method for execution. Method eventMethod will be invoked by the executive after the amount of simulation time given by eventDelay as elapsed.

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.

setLogger

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

Parameters:
l - The logger for the executive