-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandle.java
More file actions
59 lines (55 loc) · 1.16 KB
/
Handle.java
File metadata and controls
59 lines (55 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* This class stores a Handle.
*
* @author karl88
* @author sfbahr
* @version Sep 17, 2014
*/
public class Handle implements Comparable<Handle>
{
private int index;
// ----------------------------------------------------------
/**
* Creates a new Handle object.
*
* @param initIndex the Handle being stored
*/
public Handle(int initIndex)
{
index = initIndex;
}
// ----------------------------------------------------------
/**
* A getter method for the handle.
*
* @return the handle
*/
public int get()
{
return index;
}
/**
* Compares one handle to another.
*
* @param that The Handle that this one is being compared to
* @return 1 if this is greater than that, 0 if equal, -1 if less than
*/
@Override
public int compareTo(Handle that)
{
if (this.index > that.get())
{
return 1;
}
else if (this.index == that.get())
{
return 0;
}
return -1;
}
@Override
public String toString()
{
return ((Integer) index).toString();
}
}