Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.sim.engine
Class ThinController

    java.lang.Object
      uchicago.src.sim.engine.BaseController
          uchicago.src.sim.engine.ThinController

All Implemented Interfaces:
  IController, SimEventListener, TickCounter

    public class ThinController

extends BaseController

Provides minimal (thin) controller support for running a simulation. ThinController is intended to provide batch-like non-gui programmatic control over a simulation for those who want to do batch type runs without using RePast's batch run mechansim. Thin controller thus provides methods to start, stop, pause and exit a simulation, but virtually nothing else. In particular loading parameters into a model is not done here. Loading parameters using some sort of custom parameter file or mechanism will have to be done elsewhere.

ThinController can be used in conjuntion with a tool like Drone (drone.sf.net) where an instance of the model and a controller are created for each run of the model. The main method of a model might then look like:

      public static void main( String[] args ) {
        MyModel model = new MyModel();
        ThinController controller = new ThinController();
        model.setController(controller);
        controller.setExitOnExit(true);
        controller.setModel(model);
        model.addSimEventListener(controller);
        // custom parameter loading here ...
        ...
        control.startSimulation();
     }

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

Field Summary
`protected boolean` | `isGui`

Fields inherited from class uchicago.src.sim.engine.BaseController
`done, doStep, executeBegin, exitOnExit, go, listenerList, model, monitor, params, pauseActionsExecuted, pauseAt, pauseAtAction, pauseSim, persistentObj, runFinished, runThread, schedule, simRun, sleepValue, time`

Constructor Summary
`ThinController(boolean isGui)` Creates a ThinController, specifying whether this is a graphical controller or not.

Method Summary
`void` | `exitSim()` Exits a simulation.
`long` | `getRunCount()` Always returns 1.
`boolean` | `isBatch()` Returns true if this ThinController is a batch controller.
`boolean` | `isGUI()` Returns true if this ThinController is a gui controller.
`protected void` | `onTickCountUpdate()` Called whenever the tick count is incremented.
`void` | `simEventPerformed(SimEvent evt)` Listens for SimEvents and responds accordingly.

Methods inherited from class uchicago.src.sim.engine.BaseController
`addSimEventListener, beginModel, fireSimEvent, getCellDepth, getCellHeight, getCellWidth, getCurrentTime, getDefaultModelParameters, getExitOnExit, getModel, getModelParameters, getPauseAt, getPersistentObj, getRandomSeed, getSchedule, notifyMonitor, pauseSim, putPersistentObj, removeSimEventListener, setCellDepth, setCellHeight, setCellWidth, setExitOnExit, setModel, setPauseAt, setRandomSeed, setSchedule, setupSchedule, startSim, stopSim`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### isGui

    protected boolean isGui

Constructor Detail

### ThinController

    public ThinController(boolean isGui)

  Creates a ThinController, specifying whether this is a graphical controller or not. The isGui parameter only determines what value is returned by the isGUI method, nothing more.

  Parameters:
    `isGui` - whether or not this ThinController will identify itself as a gui controller or not

Method Detail

### exitSim

    public void exitSim()

  Exits a simulation.

### onTickCountUpdate

    protected void onTickCountUpdate()

  Description copied from class: `BaseController`
  Called whenever the tick count is incremented. Allows subclasses to update a display, data point etc. when the tick count is updated.

  Specified by:
    `onTickCountUpdate` in class `BaseController`

### simEventPerformed

    public void simEventPerformed(SimEvent evt)

  Listens for SimEvents and responds accordingly.

  Parameters:
    `evt` -

### isGUI

    public boolean isGUI()

  Returns true if this ThinController is a gui controller. The actual value returned depends the value passed to the contructor.

### isBatch

    public boolean isBatch()

  Returns true if this ThinController is a batch controller. The actual value returned depends the value passed to the contructor.

  Specified by:
    `isBatch` in interface `IController`
  Overrides:
    `isBatch` in class `BaseController`

### getRunCount

    public long getRunCount()

  Always returns 1.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD