Record Class CombinedTimestamp<TimestampT extends Comparable<TimestampT>,PeerIdT extends Comparable<PeerIdT>>

java.lang.Object
java.lang.Record
com.usatiuk.kleppmanntree.CombinedTimestamp<TimestampT,PeerIdT>
Type Parameters:
TimestampT - the type of the timestamp
PeerIdT - the type of the node ID
Record Components:
timestamp - the timestamp
nodeId - the node ID. If null, then only the timestamp is used for ordering.
All Implemented Interfaces:
Serializable, Comparable<CombinedTimestamp<TimestampT,PeerIdT>>

public record CombinedTimestamp<TimestampT extends Comparable<TimestampT>,PeerIdT extends Comparable<PeerIdT>>(TimestampT extends Comparable<TimestampT> timestamp, PeerIdT extends Comparable<PeerIdT> nodeId) extends Record implements Comparable<CombinedTimestamp<TimestampT,PeerIdT>>, Serializable
CombinedTimestamp is a record that represents a timestamp and a node ID, ordered first by timestamp and then by node ID.
See Also:
  • Constructor Details

    • CombinedTimestamp

      public CombinedTimestamp(TimestampT timestamp, PeerIdT nodeId)
      Creates an instance of a CombinedTimestamp record class.
      Parameters:
      timestamp - the value for the timestamp record component
      nodeId - the value for the nodeId record component
  • Method Details

    • compareTo

      public int compareTo(CombinedTimestamp<TimestampT,PeerIdT> o)
      Specified by:
      compareTo in interface Comparable<TimestampT extends Comparable<TimestampT>>
    • 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 Objects::equals(Object,Object).
      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.
    • timestamp

      public TimestampT timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • nodeId

      public PeerIdT nodeId()
      Returns the value of the nodeId record component.
      Returns:
      the value of the nodeId record component