/Users/lyon/j4p/src/collections/sortable/Cshort.java
|
1 package collections.sortable;
2
3
4 public class Cshort implements Comparable2 {
5 short i;
6
7 public Cshort(short a) {
8 i = a;
9 }
10
11 public Cshort(int a) {
12 i = (short) a;
13 }
14
15 public short getValue() {
16 return i;
17 }
18
19 public void setValue(short a) {
20 i = a;
21 }
22
23 public void setValue(int a) {
24 i = (short) a;
25 }
26
27 public boolean equals(Object other) {
28 return (i == ((Cshort) other).i);
29 }
30
31 public int hashCode() {
32 return i;
33 }
34
35 public boolean isLess(Object other) {
36 return (i < ((Cshort) other).i);
37 }
38
39 public boolean isGreater(Object other) {
40 return (i > ((Cshort) other).i);
41 }
42
43 public String toString() {
44 return i + " ";
45 }
46
47 }
48