Update.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user