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

Package class diagram package AStarHeapComparator
java.lang.Object
  extended by cz.cuni.amis.utils.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 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.

Author:
Jimmy

Constructor Summary
AStarHeapComparator(Map<NODE,Integer> estimatedCosts)
           
 
Method Summary
 int compare(Object arg0, 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(Map<NODE,Integer> estimatedCosts)
Method Detail

compare

public int compare(Object arg0,
                   Object arg1)
Specified by:
compare in interface Comparator


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.