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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| ManualClockBridge(long time) | Creates a clock at that time, in milliseconds. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| time | long | set at creation | Sets the clock to an absolute time, in milliseconds, and returns the clock. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
Creation details
Section titled “Creation details”ManualClockBridge
Section titled “ManualClockBridge”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.
Property details
Section titled “Property details”this time(long time)fluent
Default: set at creation
Sets the clock to an absolute time, in milliseconds, and returns the clock.
Method details
Section titled “Method details”advance
Section titled “advance”void advance(long milliseconds)
Moves the clock forward by that many milliseconds.
nanoTime
Section titled “nanoTime”long nanoTime()
Returns the nanoseconds of the clock registered when this one was created, moved by the time set or advanced since.
currentTimeMillis
Section titled “currentTimeMillis”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
