1package ds.util;
2
3
4
5
6public
7 class K implements Comparable<K> {
8
9 public final int key;
10
11 public K(int k) {
12 key = k;
13 }
14
15
16 public static K mkK(int v) {
17 return
18 new K(v);
19 }
20
21
22 public int intValue() {
23 return
24 key;
25 }
26
27 public int compareTo(K k2) {
28 if (key == k2.key)
29 return 0;
30 if (key > k2.key)
31 return 1;
32 else
33 return -1;
34 }
35
36 public boolean equalTo(K k2) {
37 return
38 compareTo(k2) == 0;
39 }
40
41 public String toString() {
42 return "" + key;
43 }
44
45 public int hash() {
46
47 return
48 key;
49 }
50}