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
public class SimulationClock extends Object implements com.fishlib.base.clock.Clock
Clock implementation for use with ClockFilter implementations to advance simulation time.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SimulationClock(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 Type Method Description protected voidadvance()Advance the simulation.voidawaitDone()Wait for the simulation to be done.voidawaitDoneUninterruptibly()Wait for the simulation to be done, without ever throwing InterruptedException.DBDateTimecurrentTime()longcurrentTimeMicros()longcurrentTimeMillis()booleandone()Is the simulation done?protected DBDateTimegetEndTime()protected longgetStepNanos()protected voidsetTime(DBDateTime time)voidstart()Start the simulation.voidstart(boolean maxSpeed)Start the simulation.voidstartForUnitTests()
-
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:
currentTimeMillisin interfacecom.fishlib.base.clock.Clock
-
currentTimeMicros
public long currentTimeMicros()- Specified by:
currentTimeMicrosin 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
-