|
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
ch.unizh.ini.friend.simulation.ThreadedSimulation
public class ThreadedSimulation
Implementation of the simulation loop in a separate thread.
Field Summary | |
---|---|
protected Thread |
thread
The simulation thread. |
Fields inherited from class ch.unizh.ini.friend.simulation.AbstractSimulation |
---|
delay, on, step |
Constructor Summary | |
---|---|
ThreadedSimulation(SimulationStep step)
Creates a new instance with the given simulation step. |
|
ThreadedSimulation(SimulationStep step,
long delay)
|
Method Summary | |
---|---|
void |
addUpdateable(Updateable u)
Adds an updateable to the simulation. |
void |
removeUpdateable(Updateable u)
Removes an updateable from the simulation. |
void |
run()
The main-loop of the simulation. |
void |
start()
Starts the thread on the main-loop. |
void |
stop()
Tells the main-loop to stop by the end of the current iteration. |
Methods inherited from class ch.unizh.ini.friend.simulation.AbstractSimulation |
---|
getDelay, getNumberOfIterationsPerStep, getStep, isOn, setDelay, setNumberOfIterationsPerStep |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Thread thread
Constructor Detail |
---|
public ThreadedSimulation(SimulationStep step)
step
- The simulation step instance.public ThreadedSimulation(SimulationStep step, long delay)
step
- the simulation stepdelay
- sleep delay between iterationsMethod Detail |
---|
public void run()
run
in interface Runnable
public void start()
start
in interface SimulationTask
start
in class AbstractSimulation
public void stop()
stop
in interface SimulationTask
stop
in class AbstractSimulation
public void addUpdateable(Updateable u)
addUpdateable
in interface SimulationTask
addUpdateable
in class AbstractSimulation
u
- An updateable.public void removeUpdateable(Updateable u)
removeUpdateable
in interface SimulationTask
removeUpdateable
in class AbstractSimulation
u
- An updateable.
|
http://www.ini.unizh.ch/~tobi/friend | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |