]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/correlate/TimeIndexPair.java
Version 4, January 2008
[GpsPrune.git] / tim / prune / correlate / TimeIndexPair.java
1 package tim.prune.correlate;
2
3 /**
4  * Simple class to hold a time and an index.
5  * Used in a TreeSet for calculating median time difference
6  */
7 public class TimeIndexPair implements Comparable
8 {
9         /** Time as long */
10         private long _time = 0L;
11         /** Index as int */
12         private int _index = 0;
13
14
15         /**
16          * Constructor
17          * @param inTime time as long
18          * @param inIndex index as int
19          */
20         public TimeIndexPair(long inTime, int inIndex)
21         {
22                 _time = inTime;
23                 _index = inIndex;
24         }
25
26
27         /**
28          * @return the index
29          */
30         public int getIndex()
31         {
32                 return _index;
33         }
34
35
36         /**
37          * Compare two TimeIndexPair objects
38          * @see java.lang.Comparable#compareTo(java.lang.Object)
39          */
40         public int compareTo(Object inOther)
41         {
42                 TimeIndexPair other = (TimeIndexPair) inOther;
43                 return (int) (_time - other._time);
44         }
45 }