|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
verinec.netsim.gui.SimulatorThread
public class SimulatorThread
This thread is responsible for animating the simulation. Calls the animate methode of the events in well defined time intervals. It also manages a time subunit and when this subunit reaches a defined value, the progressbar of the Toolbar will be updated. If the environment variable verinec.netsim.loop is set, the simulation loops endlessly instead of stopping when the last step has been reached.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
private int |
end
|
private boolean |
freeze
|
private boolean |
running
|
private SimulationScheduler |
simuScheduler
|
private int |
speed
|
private int |
start
|
private int |
substep
|
static int |
SUBSTEP_UNITY
Number of substeps for each step. |
private SimulationToolbar |
toolbar
|
private VerinecStudio |
verinecStudio
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
SimulatorThread(Element events,
int initSpeed,
SimulationToolbar toolbar,
VerinecStudio parent)
Initalizes the thread and creates a scheduler for the events. |
|
| Method Summary | |
|---|---|
void |
pauseSimulation()
Pauses the simulation. |
void |
playSimulation()
Launches the thread. |
void |
progress(int time)
Loads the new events to the panel. |
void |
run()
Animates in every slope the events. |
void |
setSimulationBoundaries(int start,
int end)
Set start and stop time of the simulation. |
void |
setSpeed(int value)
Changes the simulationspeed. |
void |
stepBackward()
Jumps one time unit backward and animates the steps. |
void |
stepForward()
Jumps one time unit forward and animates the steps. |
void |
stopSimulation()
Stops the simulation. |
void |
terminateSimulation()
Terminates the simulation, that is set running=false, stop the simulation and notify the scheduler. |
private void |
wakeup()
Wakes up the sleeping thread. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int SUBSTEP_UNITY
private SimulationToolbar toolbar
private SimulationScheduler simuScheduler
private VerinecStudio verinecStudio
private int speed
private int start
private int end
private int substep
private boolean freeze
private boolean running
| Constructor Detail |
|---|
public SimulatorThread(Element events,
int initSpeed,
SimulationToolbar toolbar,
VerinecStudio parent)
throws SimulationException
events - The whole testfile.initSpeed - The current speed.toolbar - A reference to the toolbar. (needed to perform updates to the progressbar)parent - A reference to the main application window.
SimulationException - When a network ressource cannot be found or the events are invalid.| Method Detail |
|---|
public void setSimulationBoundaries(int start,
int end)
start - the startvalue.end - the endvalue.public void playSimulation()
private void wakeup()
public void pauseSimulation()
public void stopSimulation()
public void stepForward()
public void stepBackward()
public void setSpeed(int value)
value - the new speed of the simulation.public void progress(int time)
time - The time point to load events for.public void terminateSimulation()
public void run()
run in interface Runnablerun in class Thread
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||