Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## path
Class AStarNode

    java.lang.Object
      path.AStarNode

All Implemented Interfaces:
  java.io.Serializable, java.lang.Comparable

Direct Known Subclasses:
  GridNode

    public abstract class AStarNode

extends java.lang.Object
implements java.io.Serializable, 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.

Author:
  David Brackeen (Book: Developing games in Java)
See Also:
  Serialized Form

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.
`int` | `sign(float v)` Returns the sign of the number.

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.

### sign

    public int sign(float v)

  Returns the sign of the number. Returns -1 for negative, 1 for positive, and 0 otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD