|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread vanetsim.simulation.SimulationMaster
public final class SimulationMaster
This thread delegates the simulation processing to subthreads and then calls a repaint on the drawing area.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
TIME_PER_STEP
How much time passes in one step (in milliseconds). 40ms results in a smooth animation with 25fps. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SimulationMaster()
Instantiates a new simulation master. |
Method Summary | |
---|---|
WorkerThread[] |
createWorkers(int timePerStep,
int threads)
Function to set up the worker threads with their corresponding regions. |
void |
doOneStep()
Proceed one single step forward. |
static long |
getStartTime()
|
boolean |
isGuiEnabled()
|
static boolean |
isLogPerformance_()
|
boolean |
isSimulationRunning()
Returns if a simulation is currently running or not. |
void |
jumpToTime(int time)
Allows to jump to a specific time. |
void |
run()
The main method for the simulation master initializes the worker threads, manages them and initiates the render process and statistics updates. |
void |
setGuiEnabled(boolean guiEnabled)
|
static void |
setStartTime(long theStartTime)
|
void |
setTargetStepTime(int time)
Sets the target step time. |
void |
startThread()
Method to let this thread start delegating work to subthreads. |
void |
stopThread()
Method to let this thread stop delegating work to subthreads. |
static void |
writeAnyTextToFile(java.lang.String anyText,
java.lang.String fileName,
boolean append)
Writes any data to file |
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 |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TIME_PER_STEP
Constructor Detail |
---|
public SimulationMaster()
Method Detail |
---|
public void startThread()
public void stopThread()
public void jumpToTime(int time)
time
- the target time in millisecondspublic void setTargetStepTime(int time)
time
- public void doOneStep()
public WorkerThread[] createWorkers(int timePerStep, int threads)
timePerStep
- the time per step in millisecondsthreads
- the amount of threads that shall be created
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public boolean isSimulationRunning()
true
if a simulation is running, else false
public boolean isGuiEnabled()
public void setGuiEnabled(boolean guiEnabled)
public static void writeAnyTextToFile(java.lang.String anyText, java.lang.String fileName, boolean append)
public static boolean isLogPerformance_()
public static long getStartTime()
public static void setStartTime(long theStartTime)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |