fern.simulation.controller
Class DefaultController

java.lang.Object
  extended by fern.simulation.controller.DefaultController
All Implemented Interfaces:
SimulationController

public class DefaultController
extends Object
implements SimulationController

The probably most common implementation of an SimulationController. It causes the simulation to stop, after a given moment in time is crossed.

Author:
Florian Erhard

Constructor Summary
DefaultController(double maxTime)
          Creates the controller for a given time where the simulation has to stop.
 
Method Summary
 double getTime()
          Gets the time where the simulation has to stop.
 boolean goOn(Simulator sim)
          Returns whether or not to go on with the given simulation
 void setTime(double time)
          Sets the time where the simulation has to stop.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultController

public DefaultController(double maxTime)
Creates the controller for a given time where the simulation has to stop.

Parameters:
maxTime - the moment in time where to stop the simulation
Method Detail

goOn

public boolean goOn(Simulator sim)
Description copied from interface: SimulationController
Returns whether or not to go on with the given simulation

Specified by:
goOn in interface SimulationController
Parameters:
sim - simulation
Returns:
whether or not to go on

setTime

public void setTime(double time)
Sets the time where the simulation has to stop.

Parameters:
time - the moment in time where to stop the simulation

getTime

public double getTime()
Gets the time where the simulation has to stop.

Returns:
the moment in time where to stop the simulation