public class Worker
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected int |
frameskip
Amount of simulation steps between two frames
in the view.
|
protected MainActivity
|
gui
the MainActivity of the gui
|
protected Renderer |
renderer
the Renderer drawing the Track
|
protected boolean |
stop
Stop flag, indicating that the worker shall
stop
|
protected Track |
track
the track to simulate
|
Constructor and Description |
---|
Worker(Track track,
MainActivity gui,
Renderer renderer,
int frameskip)
Construct a new worker.
|
Modifier and Type | Method and Description |
---|---|
void |
run()
Method which is automatically executed when
the thread is started.
|
void |
setFrameskip(int frames)
Updates the amount of simulation steps
between to view frames.
|
void |
setStop(boolean stop)
Sets a flag that causes the worker to stop.
|
activeCount, checkAccess, clone, 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
protected Track track
protected boolean stop
protected MainActivity gui
protected Renderer renderer
protected int frameskip
public Worker(Track track, MainActivity gui, Renderer renderer, int frameskip)
track
- the track to simulategui
- the MainActivity of the guirenderer
- the Renderer drawing the Trackframeskip
- Amount of simulation steps between
two frames in the view. Zero means
that every simulation step is drawn
public void setStop(boolean stop)
stop
- flag whether the thread shall stoppublic void setFrameskip(int frames)
frames
- amount of stepspublic void run()
run
in interface java.lang.Runnable
run
in
class java.lang.Thread