Record Class Timeline

java.lang.Object
java.lang.Record
lol.trq.orpheus.Timeline
Record Components:
positionMillis - the position at anchorNanos
anchorNanos - a System.nanoTime() reading
rate - playback speed, 1 is normal
running - whether the position is advancing
durationMillis - 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
    Modifier and Type
    Field
    Description
    static final Timeline
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Timeline(long positionMillis, long anchorNanos, double rate, boolean running, long durationMillis)
    Creates an instance of a Timeline record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the value of the anchorNanos record component.
    at(long newPositionMillis, long nanos)
     
    long
    Returns the value of the durationMillis record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the positionMillis record component.
    long
    positionMillisAt(long nanos)
    The position at nanos, a System.nanoTime() reading, clamped to the track.
    float
    progressAt(long nanos)
    The fraction played at nanos, 0 to 1, or 0 when the length is unknown.
    double
    Returns the value of the rate record component.
    boolean
    Returns the value of the running record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NONE

      public static final Timeline NONE
  • Constructor Details

    • Timeline

      public Timeline(long positionMillis, long anchorNanos, double rate, boolean running, long durationMillis)
      Creates an instance of a Timeline record class.
      Parameters:
      positionMillis - the value for the positionMillis record component
      anchorNanos - the value for the anchorNanos record component
      rate - the value for the rate record component
      running - the value for the running record component
      durationMillis - the value for the durationMillis record component
  • Method Details

    • positionMillisAt

      public long positionMillisAt(long nanos)
      The position at nanos, a System.nanoTime() reading, clamped to the track.
    • progressAt

      public float progressAt(long nanos)
      The fraction played at nanos, 0 to 1, or 0 when the length is unknown.
    • at

      public Timeline at(long newPositionMillis, long nanos)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • positionMillis

      public long positionMillis()
      Returns the value of the positionMillis record component.
      Returns:
      the value of the positionMillis record component
    • anchorNanos

      public long anchorNanos()
      Returns the value of the anchorNanos record component.
      Returns:
      the value of the anchorNanos record component
    • rate

      public double rate()
      Returns the value of the rate record component.
      Returns:
      the value of the rate record component
    • running

      public boolean running()
      Returns the value of the running record component.
      Returns:
      the value of the running record component
    • durationMillis

      public long durationMillis()
      Returns the value of the durationMillis record component.
      Returns:
      the value of the durationMillis record component