Class SimulationClock
java.lang.Object
io.deephaven.engine.table.impl.select.SimulationClock
- All Implemented Interfaces:
Clock
Clock implementation for use with ClockFilter implementations to advance simulation time.
-
Constructor Summary
ConstructorsConstructorDescriptionSimulationClock(@NotNull String startTime, @NotNull String endTime, @NotNull String stepSize) Create a simulation clock for the specified time range and step.SimulationClock(@NotNull Instant startTime, @NotNull Instant endTime, long stepNanos) Create a simulation clock for the specified time range and step. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance()Advance the simulation.voidWait for the simulation to be done.voidWait for the simulation to be done, without ever throwing InterruptedException.longMicroseconds since the epoch, 1970-01-01T00:00:00Z.longMilliseconds since the epoch, 1970-01-01T00:00:00Z.longNanoseconds since the epoch, 1970-01-01T00:00:00Z.booleandone()Is the simulation done?The instant.The instant.voidstart()Start the simulation.voidstart(boolean maxSpeed) Start the simulation.
-
Constructor Details
-
SimulationClock
public SimulationClock(@NotNull @NotNull String startTime, @NotNull @NotNull String endTime, @NotNull @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 run loop
-
SimulationClock
public SimulationClock(@NotNull @NotNull Instant startTime, @NotNull @NotNull Instant endTime, long stepNanos) 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 run loop
-
-
Method Details
-
currentTimeMillis
public long currentTimeMillis()Description copied from interface:ClockMilliseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation.
- Specified by:
currentTimeMillisin interfaceClock- Returns:
- epoch millis
-
currentTimeMicros
public long currentTimeMicros()Description copied from interface:ClockMicroseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation. The resolution is greater than or equal to
Clock.currentTimeMillis().- Specified by:
currentTimeMicrosin interfaceClock- Returns:
- epoch microseconds
-
currentTimeNanos
public long currentTimeNanos()Description copied from interface:ClockNanoseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation. The resolution is greater than or equal to
Clock.currentTimeMicros()andClock.currentTimeMillis().- Specified by:
currentTimeNanosin interfaceClock- Returns:
- epoch nanoseconds
-
instantNanos
Description copied from interface:ClockThe instant.Has resolution equal to
Clock.currentTimeNanos().If you don't need the resolution provided by
Clock.currentTimeNanos(), preferClock.instantMillis().- Specified by:
instantNanosin interfaceClock- Returns:
- the instant
-
instantMillis
Description copied from interface:ClockThe instant.Has resolution greater than or equal to
Clock.currentTimeMillis().- Specified by:
instantMillisin interfaceClock- Returns:
- the instant.
-
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.
-
advance
Advance the simulation. Public access for unit tests. -
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
-