feat(dijkstra): implement Comparable in Label class
This commit is contained in:
parent
19ec6b6220
commit
7e0955ecb2
1 changed files with 6 additions and 1 deletions
|
@ -2,7 +2,7 @@ package org.insa.graphs.algorithm.shortestpath;
|
|||
|
||||
import org.insa.graphs.model.Node;
|
||||
|
||||
public class Label {
|
||||
public class Label implements Comparable<Label> {
|
||||
Node node;
|
||||
boolean marked;
|
||||
float pathCost;
|
||||
|
@ -28,4 +28,9 @@ public class Label {
|
|||
// function will be modified later
|
||||
return pathCost;
|
||||
}
|
||||
|
||||
public int compareTo(Label other) {
|
||||
// TODO ensure this works properly
|
||||
return (int)(this.pathCost - other.pathCost);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue