Record Class Timeline
java.lang.Object
java.lang.Record
lol.trq.orpheus.Timeline
- Record Components:
positionMillis- the position atanchorNanosanchorNanos- aSystem.nanoTime()readingrate- playback speed, 1 is normalrunning- whether the position is advancingdurationMillis- the track length, or -1 when unknown
public record Timeline(long positionMillis, long anchorNanos, double rate, boolean running, long durationMillis)
extends Record
A position that can be advanced locally: where playback was at one instant and how fast it moves.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimeline(long positionMillis, long anchorNanos, double rate, boolean running, long durationMillis) Creates an instance of aTimelinerecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of theanchorNanosrecord component.at(long newPositionMillis, long nanos) longReturns the value of thedurationMillisrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of thepositionMillisrecord component.longpositionMillisAt(long nanos) The position atnanos, aSystem.nanoTime()reading, clamped to the track.floatprogressAt(long nanos) The fraction played atnanos, 0 to 1, or 0 when the length is unknown.doublerate()Returns the value of theraterecord component.booleanrunning()Returns the value of therunningrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NONE
-
-
Constructor Details
-
Timeline
public Timeline(long positionMillis, long anchorNanos, double rate, boolean running, long durationMillis) Creates an instance of aTimelinerecord class.- Parameters:
positionMillis- the value for thepositionMillisrecord componentanchorNanos- the value for theanchorNanosrecord componentrate- the value for theraterecord componentrunning- the value for therunningrecord componentdurationMillis- the value for thedurationMillisrecord component
-
-
Method Details
-
positionMillisAt
public long positionMillisAt(long nanos) The position atnanos, aSystem.nanoTime()reading, clamped to the track. -
progressAt
public float progressAt(long nanos) The fraction played atnanos, 0 to 1, or 0 when the length is unknown. -
at
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
positionMillis
public long positionMillis()Returns the value of thepositionMillisrecord component.- Returns:
- the value of the
positionMillisrecord component
-
anchorNanos
public long anchorNanos()Returns the value of theanchorNanosrecord component.- Returns:
- the value of the
anchorNanosrecord component
-
rate
-
running
-
durationMillis
public long durationMillis()Returns the value of thedurationMillisrecord component.- Returns:
- the value of the
durationMillisrecord component
-