-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArc.java
More file actions
31 lines (28 loc) · 841 Bytes
/
Copy pathArc.java
File metadata and controls
31 lines (28 loc) · 841 Bytes
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
public class Arc implements Comparable<Arc> {
Choreographer Xi, Xj;
public Arc(Choreographer choreo_i, Choreographer choreo_j) {
if (choreo_i.equals(choreo_j)) {
try {
throw new Exception(choreo_i + " is equal to " + choreo_j);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
Xi = choreo_i;
Xj = choreo_j;
}
@Override
public int compareTo(Arc otherArc) {
// Assuming Choreographer implements Comparable
int compareXi = this.Xi.compareTo(otherArc.Xi);
if (compareXi != 0) {
return compareXi;
}
return this.Xj.compareTo(otherArc.Xj);
}
@Override
public String toString() {
return "(" + Xi + "," + Xj + ")";
}
}