1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18import java.util.Vector;
19
20
21
22public
23class List <T extends Ordering>
24 extends Vector<T>
25 implements Ordering<List<T>>
26{
27
28
29
30
31
32 public
33 boolean eq(List <T> l2) {
34
35 if ( elementCount != l2.elementCount )
36
37 return
38 false;
39
40 for(int i = 0;
41 i < elementCount;
42 ++i) {
43
44 if ( get(i).ne(l2.get(i)) )
45
46 return
47 false;
48 }
49
50
51 return
52 true;
53 }
54
55
56
57
58 public
59 boolean ge(List <T> l2) {
60 int len1 = elementCount;
61 int len2 = l2.elementCount;
62
63 for(int i = 0; ; ++i) {
64 if ( i == len2 )
65 return
66 true;
67
68 if ( i == len1 )
69 return
70 false;
71
72
73 {
74 T e1 = get(i);
75 T e2 = l2.get(i);
76
77 if ( e1.ne(e2) )
78
79 return
80 e1.ge(e2);
81
82
83 }
84 }
85 }
86
87
88
89
90
91
92 public
93 boolean ne(List <T> v2) {
94 return
95 ! eq(v2);
96 }
97
98 public
99 boolean gr(List <T> v2) {
100 return
101 ge(v2) && ! eq(v2);
102 }
103
104 public
105 boolean le(List <T> v2) {
106 return
107 ! gr(v2);
108 }
109
110 public
111 boolean lt(List <T> v2) {
112 return
113 ! ge(v2);
114 }
115
116}
117
118