Package com.illumon.iris.db.v2.select
Class SimulationClock
java.lang.Object
com.illumon.iris.db.v2.select.SimulationClock
- All Implemented Interfaces:
com.fishlib.base.clock.Clock
Clock implementation for use with ClockFilter implementations to advance simulation time.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fishlib.base.clock.Clock
com.fishlib.base.clock.Clock.Cached, com.fishlib.base.clock.Clock.CachedOnDemand, com.fishlib.base.clock.Clock.Factory, com.fishlib.base.clock.Clock.Null
-
Field Summary
Fields inherited from interface com.fishlib.base.clock.Clock
NULL
-
Constructor Summary
ConstructorsConstructorDescriptionSimulationClock
(DBDateTime startTime, DBDateTime endTime, long stepNanos) Create a simulation clock for the specified time range and step.SimulationClock
(String startTime, String endTime, String stepSize) Create a simulation clock for the specified time range and step. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
advance()
Advance the simulation.void
Wait for the simulation to be done.void
Wait for the simulation to be done, without ever throwing InterruptedException.long
long
boolean
done()
Is the simulation done?protected DBDateTime
protected long
protected void
setTime
(DBDateTime time) void
start()
Start the simulation.void
start
(boolean maxSpeed) Start the simulation.void
-
Constructor Details
-
SimulationClock
public SimulationClock(@NotNull String startTime, @NotNull String endTime, @NotNull String stepSize) Create a simulation clock for the specified time range and step.- Parameters:
startTime
- The initial time that will be returned by this clock, before it is startedendTime
- The final time that will be returned by this clock, when the simulation has completedstepSize
- The time to "elapse" in each refresh loop
-
SimulationClock
Create a simulation clock for the specified time range and step.- Parameters:
startTime
- The initial time that will be returned by this clock, before it is startedendTime
- The final time that will be returned by this clock, when the simulation has completedstepNanos
- The number of nanoseconds to "elapse" in each refresh loop
-
-
Method Details
-
currentTimeMillis
public long currentTimeMillis()- Specified by:
currentTimeMillis
in interfacecom.fishlib.base.clock.Clock
-
currentTimeMicros
public long currentTimeMicros()- Specified by:
currentTimeMicros
in interfacecom.fishlib.base.clock.Clock
-
currentTime
-
start
public void start()Start the simulation. -
start
public void start(boolean maxSpeed) Start the simulation.- Parameters:
maxSpeed
- run the simulation clock at the max possible speed.
-
startForUnitTests
public void startForUnitTests() -
advance
protected void advance()Advance the simulation. Package access for unit tests. -
getEndTime
-
getStepNanos
protected long getStepNanos() -
setTime
-
done
public boolean done()Is the simulation done?- Returns:
- True if the simulation is done
-
awaitDoneUninterruptibly
public void awaitDoneUninterruptibly()Wait for the simulation to be done, without ever throwing InterruptedException. -
awaitDone
Wait for the simulation to be done.- Throws:
InterruptedException
-