Class SimuTimer<T extends Comparable<? super T>>
java.lang.Object
madkit.simulation.scheduler.SimuTimer<T>
- Type Parameters:
T- the type used for modeling the time
- Direct Known Subclasses:
DateBasedTimer,TickBasedTimer
Class representing time in a simulation.
- Since:
- MaDKit 6.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current time objectReturns the ending time objectReturns the starting timeReturns a label synchronized with the current time.booleanChecks if this timer has reached its end time.voidreset()Resets the timer to its initial time.voidsetCurrentTime(T currentTime) Sets the current time objectvoidsetEndTime(T endTime) Sets the ending time objectvoidsetStartTime(T startTime) Sets the starting timevoidsetTimeFormat(String format) Sets the formatting of the current time as specified inFormatter.toString()To string.
-
Constructor Details
-
SimuTimer
-
-
Method Details
-
hasReachedEndTime
public boolean hasReachedEndTime()Checks if this timer has reached its end time.- Returns:
trueif the current time has reached the end time.
-
getTimeLabel
Returns a label synchronized with the current time.- Returns:
- a label to be used in UI
-
setTimeFormat
-
getCurrentTime
-
setCurrentTime
Sets the current time object- Parameters:
currentTime- the currentTime to set
-
getEndTime
-
setEndTime
Sets the ending time object- Parameters:
endTime- the endTime to set
-
toString
-
reset
public void reset()Resets the timer to its initial time. -
getStartTime
-
setStartTime
Sets the starting time- Parameters:
startTime- the startTime to set
-