|
The Physiologist's Friend Simulation API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.unizh.ini.friend.simulation.AbstractSimulation
public abstract class AbstractSimulation
Provides a few default implementations for the SimulationTask
interface.
Field Summary | |
---|---|
protected long |
delay
delay in ms between thread simulation update cycles |
protected boolean |
on
False iff the simulation should stop. |
protected SimulationStep |
step
The simulation step. |
Constructor Summary | |
---|---|
AbstractSimulation(SimulationStep step)
Creates a new instance with the given simulation step. |
Method Summary | |
---|---|
abstract void |
addUpdateable(Updateable u)
Adds an updateable to the simulation. |
long |
getDelay()
|
int |
getNumberOfIterationsPerStep()
|
SimulationStep |
getStep()
Returns the simulation step instance. |
boolean |
isOn()
Returns true if the simulation is running. |
abstract void |
removeUpdateable(Updateable u)
Removes an updateable from the simulation. |
void |
setDelay(long ms)
set the timer delay in ms between each simulation step |
void |
setNumberOfIterationsPerStep(int n)
set the number of iterations over the updateables for each step. |
abstract void |
start()
Starts the simulation. |
abstract void |
stop()
Stops the simulation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile boolean on
protected SimulationStep step
protected long delay
Constructor Detail |
---|
public AbstractSimulation(SimulationStep step)
step
- The simulation step instance.Method Detail |
---|
public SimulationStep getStep()
getStep
in interface SimulationTask
public boolean isOn()
public abstract void addUpdateable(Updateable u)
addUpdateable
in interface SimulationTask
u
- An updateable.public long getDelay()
getDelay
in interface SimulationTask
setDelay(long)
public int getNumberOfIterationsPerStep()
getNumberOfIterationsPerStep
in interface SimulationTask
setNumberOfIterationsPerStep(int)
public abstract void removeUpdateable(Updateable u)
removeUpdateable
in interface SimulationTask
u
- An updateable.public void setDelay(long ms)
setDelay
in interface SimulationTask
ms
- the delay in msgetDelay()
public void setNumberOfIterationsPerStep(int n)
setNumberOfIterationsPerStep
in interface SimulationTask
n
- the numberpublic abstract void start()
start
in interface SimulationTask
public abstract void stop()
stop
in interface SimulationTask
|
http://www.ini.unizh.ch/~tobi/friend | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |