cz.cuni.amis.utils.astar
Class AStarHeapComparator<NODE>

java.lang.Object
  extended by cz.cuni.amis.utils.astar.AStarHeapComparator<NODE>
Type Parameters:
NODE -
All Implemented Interfaces:
java.util.Comparator

public class AStarHeapComparator<NODE>
extends java.lang.Object
implements java.util.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 comparation 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.


Constructor Summary
AStarHeapComparator(java.util.Map<NODE,java.lang.Integer> estimatedCosts)
           
 
Method Summary
 int compare(java.lang.Object arg0, java.lang.Object arg1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

AStarHeapComparator

public AStarHeapComparator(java.util.Map<NODE,java.lang.Integer> estimatedCosts)
Method Detail

compare

public int compare(java.lang.Object arg0,
                   java.lang.Object arg1)
Specified by:
compare in interface java.util.Comparator