Class TimerThread
java.lang.Object
java.lang.Thread
common.controller.TimerThread
- All Implemented Interfaces:
Runnable
Title:
Description: An inner thread used to stop simulation after timeout elapsed
- Author:
- Francesco D'Aquino, Bertoli Marco Date: 7-feb-2006 Time: 23.53.25
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected booleanprotected longprotected booleanprotected booleanprotected DispatcherJSIMschemaprotected longFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns elapsed percentagelongReturns elapsed timevoidkill()This method have to be called when simulation is stopped before timeoutvoidpause()This method have to be called when simulation is pausedvoidrestart()This method have to be called when simulation is restarted after pausevoidrun()Thread run's method.Methods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Field Details
-
sim
-
totalTime
protected long totalTime -
elapsedTime
protected long elapsedTime -
initialTime
protected long initialTime -
paused
protected boolean paused -
killed
protected boolean killed -
ended
protected boolean ended
-
-
Constructor Details
-
TimerThread
-
-
Method Details
-
run
-
pause
public void pause()This method have to be called when simulation is paused -
restart
public void restart()This method have to be called when simulation is restarted after pause -
kill
public void kill()This method have to be called when simulation is stopped before timeout -
getElapsedTime
public long getElapsedTime()Returns elapsed time- Returns:
- elapsed time
-
getElapsedPercentage
public double getElapsedPercentage()Returns elapsed percentage- Returns:
- elapsed percentage
-