com.brackeen.javagamebook.path
Class AStarNode

java.lang.Object
  extended bycom.brackeen.javagamebook.path.AStarNode
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
AStarSearchWithBSP.LeafNode, Portal

public abstract class AStarNode
extends java.lang.Object
implements java.lang.Comparable

The AStarNode class, along with the AStarSearch class, implements a generic A* search algorthim. The AStarNode class should be subclassed to provide searching capability.


Constructor Summary
AStarNode()
           
 
Method Summary
 int compareTo(java.lang.Object other)
           
 float getCost()
           
abstract  float getCost(AStarNode node)
          Gets the cost between this node and the specified adjacent (aka "neighbor" or "child") node.
abstract  float getEstimatedCost(AStarNode node)
          Gets the estimated cost between this node and the specified node.
abstract  java.util.List getNeighbors()
          Gets the children (aka "neighbors" or "adjacent nodes") of this node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AStarNode

public AStarNode()
Method Detail

getCost

public float getCost()

compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable

getCost

public abstract float getCost(AStarNode node)
Gets the cost between this node and the specified adjacent (aka "neighbor" or "child") node.


getEstimatedCost

public abstract float getEstimatedCost(AStarNode node)
Gets the estimated cost between this node and the specified node. The estimated cost should never exceed the true cost. The better the estimate, the more effecient the search.


getNeighbors

public abstract java.util.List getNeighbors()
Gets the children (aka "neighbors" or "adjacent nodes") of this node.