This commit is contained in:
Mikael Capelle
2018-02-16 15:29:11 +01:00
parent 65c81b9921
commit cfb59ac0f1
37 changed files with 1511 additions and 473 deletions

View File

@@ -2,7 +2,7 @@ package org.insa.graph;
import java.util.ArrayList;
public class Node {
public class Node implements Comparable<Node> {
// ID of the node.
private int id;
@@ -49,4 +49,17 @@ public class Node {
*/
public Point getPoint() { return point; }
@Override
public boolean equals(Object other) {
if (other instanceof Node) {
return getId() == ((Node) other).getId();
}
return false;
}
@Override
public int compareTo(Node other) {
return Integer.compare(getId(), other.getId());
}
}