Skip to content

ManualClockBridge

final class ManualClockBridge
Implements: IClockBridge
Package: dev.joid.lib.bridge.clock · Module: core · Source: ManualClockBridge.java

A clock that moves only when you set or advance it, so that every animation gives the same frame on every run.

Register it above the system clock in a test, then unregister it at the end, once the UIs of the test are closed: the system clock takes over again.

ReturnsSignatureSummary
ManualClockBridge(long time)Creates a clock at that time, in milliseconds.

PropertyTypeDefaultSummary
timelongset at creationSets the clock to an absolute time, in milliseconds, and returns the clock.

ReturnsSignatureSummary
voidadvance(long milliseconds)Moves the clock forward by that many milliseconds.
longnanoTime()Returns the nanoseconds of the clock registered when this one was created, moved by the time set or advanced since.
longcurrentTimeMillis()Returns the time of the clock, in milliseconds.

ManualClockBridge(long time)

Creates a clock at that time, in milliseconds. Its nanoseconds start from those of the clock registered at that moment, so that the durations already measured go on.

  • this time(long time) fluent

Default: set at creation

Sets the clock to an absolute time, in milliseconds, and returns the clock.

void advance(long milliseconds)

Moves the clock forward by that many milliseconds.

long nanoTime()

Returns the nanoseconds of the clock registered when this one was created, moved by the time set or advanced since.

long currentTimeMillis()

Returns the time of the clock, in milliseconds.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page