public class SuperdenseTime
extends java.lang.Object
implements java.lang.Comparable
Two superdense time objects can be compared to see which one happens first. The order is defined by the relationship between their time stamps and indexes. In particular, given s_1 = (t_1, n_1) and s_2 = (t_2, n_2), s_1 happens earlier than s_2 (denoted as s_1 ≤ s_2), if t_1 < t_2 or (t_1 == t_2 and n_1 ≤ n_2). The equality relation holds only if both t_1 == t_2 and n_1 == n_2 hold.
Constructor and Description |
---|
SuperdenseTime(Time timeStamp,
int index)
Construct a superdense time object with the specified timestamp and
index.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object superdenseTime)
Compare this superdense time object with the argument superdense
time object for an order.
|
int |
compareTo(SuperdenseTime superdenseTime)
Compare this superdense time object with the argument superdense
time object for an order.
|
boolean |
equals(java.lang.Object superdenseTime)
Return true if this SuperdenseTime object has the same
timestamp and index as that of the given SuperdenseTime
object.
|
int |
hashCode()
Return the hash code for the SuperdenseTime object.
|
int |
index()
Return the index.
|
Time |
timestamp()
Return the timestamp.
|
java.lang.String |
toString()
Return a description of this superdense time object.
|
public SuperdenseTime(Time timeStamp, int index)
timeStamp
- The time stamp.index
- The index.public final int compareTo(java.lang.Object superdenseTime)
compareTo
in interface java.lang.Comparable
superdenseTime
- The superdense time object to compare against.java.lang.ClassCastException
- If the argument is not a superdense
time object.public final int compareTo(SuperdenseTime superdenseTime)
Their timestamps are compared first. If the two timestamps are not equal, their order defines the objects' order. Otherwise, the indexes are compared for the order, where the object with a smaller index happens earlier. If the two objects have the same timestamp and index, then they happen simultaneously.
superdenseTime
- The superdense time object to compare against.public boolean equals(java.lang.Object superdenseTime)
equals
in class java.lang.Object
superdenseTime
- The SuperDenseTime object that this
SuperdenseTime object is compared to.public int hashCode()
hashCode
in class java.lang.Object
public final int index()
public final Time timestamp()
public final java.lang.String toString()
toString
in class java.lang.Object