#16 Update priority queue
This commit is contained in:
parent
38f2974bd9
commit
318a915b84
1 changed files with 8 additions and 2 deletions
|
@ -52,6 +52,8 @@ public class Finder {
|
|||
|
||||
if (!openSet.contains(neighbor)) {
|
||||
openSet.add(neighbor);
|
||||
updatePriority(openSet, neighbor, fScore.get(neighbor));
|
||||
|
||||
} else if (tentativeGScore >= gScore.get(neighbor)) {
|
||||
continue; // This is not a better path.
|
||||
}
|
||||
|
@ -80,12 +82,16 @@ public class Finder {
|
|||
return totalPath;
|
||||
}
|
||||
|
||||
public void updatePriority(PriorityQueue<Stop> openSet, Stop node, double newF) {
|
||||
openSet.remove(node);
|
||||
node.setF(newF);
|
||||
openSet.add(node);
|
||||
}
|
||||
|
||||
//TODO:
|
||||
public List<Stop> findPath(double longitude, double latitude){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue