Class TickBasedTimer
A timer based on ticks for simulation purposes. This class extends the SimuTimer class
and uses BigDecimal for tick values.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TickBasedTimer with an initial tick value ofBigDecimal.ZERO
.TickBasedTimer
(BigDecimal initialTick) Constructs a TickBasedTimer with the specified initial tick value and an end tick value ofDouble.MAX_VALUE
.TickBasedTimer
(BigDecimal initialTick, BigDecimal endTick) Constructs a TickBasedTimer with the specified initial and end tick values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDeltaTime
(BigDecimal delta) Adds the specified delta time to the current tick.void
Adds one time unit to the current tick.void
incrementCurrentTick
(double delta) Increments the current tick by the specified delta value.void
incrementCurrentTick
(BigDecimal delta) Increments the current tick by the specified delta value.Methods inherited from class madkit.simulation.scheduler.SimuTimer
getCurrentTime, getEndTime, getStartTime, getTimeLabel, hasReachedEndTime, reset, setCurrentTime, setEndTime, setStartTime, setTimeFormat, toString
-
Constructor Details
-
TickBasedTimer
Constructs a TickBasedTimer with the specified initial and end tick values.- Parameters:
initialTick
- the initial tick valueendTick
- the end tick value
-
TickBasedTimer
public TickBasedTimer()Constructs a TickBasedTimer with an initial tick value ofBigDecimal.ZERO
. -
TickBasedTimer
Constructs a TickBasedTimer with the specified initial tick value and an end tick value ofDouble.MAX_VALUE
.- Parameters:
initialTick
- the initial tick value
-
-
Method Details
-
incrementCurrentTick
public void incrementCurrentTick(double delta) Increments the current tick by the specified delta value.- Parameters:
delta
- the amount to increment the current tick by
-
incrementCurrentTick
Increments the current tick by the specified delta value.- Parameters:
delta
- the amount to increment the current tick by
-
addDeltaTime
Adds the specified delta time to the current tick. Shortcut forsetCurrentTick(getCurrentTick().add(delta));
- Parameters:
delta
- specifies how much time should be added
-
addOneTimeUnit
public void addOneTimeUnit()Adds one time unit to the current tick.
-