1 package tim.prune.correlate;
4 * Simple class to hold a time and an index.
5 * Used in a TreeSet for calculating median time difference
7 public class TimeIndexPair implements Comparable<TimeIndexPair>
10 private long _time = 0L;
12 private int _index = 0;
17 * @param inTime time as long
18 * @param inIndex index as int
20 public TimeIndexPair(long inTime, int inIndex)
37 * Compare two TimeIndexPair objects
38 * @see java.lang.Comparable#compareTo(java.lang.Object)
40 public int compareTo(TimeIndexPair inOther)
42 return (int) (_time - inOther._time);
46 * Override equals method to match compareTo
48 public boolean equals(Object inOther)
50 if (inOther instanceof TimeIndexPair) {
51 TimeIndexPair otherPair = (TimeIndexPair) inOther;
52 return _time == otherPair._time;