uchicago.src.sim.engine
Interface IController

All Superinterfaces:
TickCounter
All Known Implementing Classes:
AbstractGUIController, BaseController, BatchController, Controller, RemoteBatchController, ThinController

public interface IController
extends TickCounter

Defines methods for controlling the execution of a SimModel. Implementors will add code to work with loading and saving parameters and perhaps a GUI for controlling the execution.

Version:
$Revision: 1.10 $ $Date: 2004/11/03 19:50:57 $

Method Summary
 void addSimEventListener(SimEventListener listener)
          Adds a listener for SimEvents fired by this IController.
 void exitSim()
          Exits the entire simulation.
 double getCurrentTime()
          Returns the current tick value.
 boolean getExitOnExit()
          Gets whether the simulation application should exit with a System.exit(0) call on exit (pressing the exit button), or dispose of all windows, release the model without killing this instance of the virtual machine.
 SimModel getModel()
          Returns the SimModel executed by this IController.
 java.lang.Object getPersistentObj(java.lang.Object key)
          Gets a stored persistent (over the life of many runs) object.
 long getRunCount()
          Gets the number of the run that this controller is running.
 Schedule getSchedule()
          Returns the Schedule of execution for the SimModel for this IController.
 boolean isBatch()
          Returns whether or not this Controller is a batch controller.
 boolean isGUI()
          Returns whether or not this Controller is a GUI controller.
 void pauseSim()
          Pauses a simulation run.
 void putPersistentObj(java.lang.Object key, java.lang.Object val)
          Allows for the storage of objects to persist beyond the life of a single run by objects that do not so persist.
 void removeSimEventListener(SimEventListener listener)
          Removes the specified SimEventListener from this IController.
 void setExitOnExit(boolean val)
          Sets whether the simulation application should exit with a System.exit(0) call on exit (pressing the exit button), or dispose of all windows, release the model without killing this instance of the virtual machine.
 void setModel(SimModel model)
          Sets the SimModel to be executed by this IController.
 void setSchedule(Schedule schedule)
          Sets he Schedule of execution for the SimModel for this IController.
 void startSim()
          Starts a simulation run.
 void stopSim()
          Stops a simulation run.
 

Method Detail

startSim

void startSim()
Starts a simulation run.


getCurrentTime

double getCurrentTime()
Returns the current tick value.

Specified by:
getCurrentTime in interface TickCounter
Returns:
the current time, the current tick count

stopSim

void stopSim()
Stops a simulation run.


pauseSim

void pauseSim()
Pauses a simulation run.


exitSim

void exitSim()
Exits the entire simulation. No more runs can be executed after a simulation has exited.


getModel

SimModel getModel()
Returns the SimModel executed by this IController. This may be null.


setModel

void setModel(SimModel model)
Sets the SimModel to be executed by this IController. This may be null.

Parameters:
model - the SimModel to be executed by this IController

getSchedule

Schedule getSchedule()
Returns the Schedule of execution for the SimModel for this IController.


setSchedule

void setSchedule(Schedule schedule)
Sets he Schedule of execution for the SimModel for this IController.

Parameters:
schedule - the Schedule of exectution

addSimEventListener

void addSimEventListener(SimEventListener listener)
Adds a listener for SimEvents fired by this IController.

Parameters:
listener - listens for SimEvents fired by this IController

removeSimEventListener

void removeSimEventListener(SimEventListener listener)
Removes the specified SimEventListener from this IController.

Parameters:
listener - the SimEventListener to remove

isGUI

boolean isGUI()
Returns whether or not this Controller is a GUI controller. A GUI controller controls (starts, stops, etc.) a simulation run in response to GUI input from a user.


isBatch

boolean isBatch()
Returns whether or not this Controller is a batch controller. A batch controller controls (starts, stops, etc.) a simulation run programmatically.


putPersistentObj

void putPersistentObj(java.lang.Object key,
                      java.lang.Object val)
Allows for the storage of objects to persist beyond the life of a single run by objects that do not so persist.

Parameters:
key - a unique identifier for the object to store
val - the actual object to store

getPersistentObj

java.lang.Object getPersistentObj(java.lang.Object key)
Gets a stored persistent (over the life of many runs) object.

Parameters:
key - the unique identifier for the persistent object

getRunCount

long getRunCount()
Gets the number of the run that this controller is running. For a "batch" controller this may be greater than 1. For others it will be 1.


setExitOnExit

void setExitOnExit(boolean val)
Sets whether the simulation application should exit with a System.exit(0) call on exit (pressing the exit button), or dispose of all windows, release the model without killing this instance of the virtual machine.


getExitOnExit

boolean getExitOnExit()
Gets whether the simulation application should exit with a System.exit(0) call on exit (pressing the exit button), or dispose of all windows, release the model without killing this instance of the virtual machine.