cz.cuni.amis.pathfinding.alg.astar
Class AStarHeapComparator<NODE>
java.lang.Object
cz.cuni.amis.pathfinding.alg.astar.AStarHeapComparator<NODE>
- Type Parameters:
NODE
-
- All Implemented Interfaces:
- Comparator
public class AStarHeapComparator<NODE>
- extends Object
- implements Comparator
This comparator is a tricky object - it serves for the AStarHeap
to compare nodes inside the heap.
The trick is, that it is initialized AStarHeapComparator(Map)
with a map
that contains node's costs that are used during the compare inside compare(Object, Object)
.
No magic yet, ha? Well, the magic is that this map is not cloned... simply a pointer to this very instance passed
inside the constructor is saved to you may alter the cost as you wish to! Which is truly needed by the AStar
class
that is obtaining nodes' costs from the AStarMap
implementor.
- Author:
- Jimmy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AStarHeapComparator
public AStarHeapComparator(Map<NODE,Integer> estimatedCosts)
compare
public int compare(Object arg0,
Object arg1)
- Specified by:
compare
in interface Comparator
Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.