These are the Delaunay Refinement files with the generics removed. It was a bit tedio...
[IRC.git] / Robust / src / Benchmarks / oooJava / DelaunayRefinement / ElementEdge.java
1
2 public class ElementEdge {
3
4 public boolean equals(Object obj) {
5 if(!(obj instanceof ElementEdge))
6 return false;
7 ElementEdge edge = (ElementEdge)obj;
8 return p1.equals(edge.p1) && p2.equals(edge.p2);
9 }
10
11 public int hashCode() {
12 return hashvalue;
13 }
14
15 public boolean notEqual(ElementEdge rhs) {
16 return !equals(rhs);
17 }
18
19 public boolean lessThan(ElementEdge rhs) {
20 return p1.lessThan(rhs.p1) || p1.equals(rhs.p1) && p2.lessThan(rhs.p2);
21 }
22
23 public boolean greaterThan(ElementEdge rhs) {
24 return p1.greaterThan(rhs.p1) || p1.equals(rhs.p1) && p2.greaterThan(rhs.p2);
25 }
26
27 public Tuple getPoint(int i) {
28 if(i == 0)
29 return p1;
30 if(i == 1) {
31 return p2;
32 } else {
33 System.exit(-1);
34 return null;
35 }
36 }
37
38 public String toString() {
39 return (new StringBuilder("<")).append(p1.toString()).append(", ").append(p2.toString()).append(">").toString();
40 }
41
42 private final Tuple p1;
43 private final Tuple p2;
44 private final int hashvalue;
45
46 public ElementEdge() {
47 p1 = null;
48 p2 = null;
49 hashvalue = 1;
50 }
51
52 public ElementEdge(Tuple a, Tuple b) {
53 if(a.lessThan(b)) {
54 p1 = a;
55 p2 = b;
56 } else {
57 p1 = b;
58 p2 = a;
59 }
60 int tmphashval = 17;
61 tmphashval = 37 * tmphashval + p1.hashCode();
62 tmphashval = 37 * tmphashval + p2.hashCode();
63 hashvalue = tmphashval;
64 }
65
66 public ElementEdge(ElementEdge rhs) {
67 p1 = rhs.p1;
68 p2 = rhs.p2;
69 hashvalue = rhs.hashvalue;
70 }
71 }