org.jscience.computing.ai
Class AStarPathfinder.AStarNode

java.lang.Object
  extended by org.jscience.computing.ai.AStarPathfinder.AStarNode
All Implemented Interfaces:
Pathfinder.Node
Enclosing class:
AStarPathfinder

public static class AStarPathfinder.AStarNode
extends java.lang.Object
implements Pathfinder.Node

The pathfinder node.


Field Summary
 double f
          The f-value.
 double g
          The g-value.
 double h
          The h-value.
 int nodeNumber
          The node identifier.
 int numChildren
          The number of children the node has.
protected  AStarPathfinder.AStarNode parent
          The parent of the node.
protected  int x
          The x-position of the node.
protected  int y
          The y-position of the node.
 
Constructor Summary
AStarPathfinder.AStarNode()
          The default constructor.
AStarPathfinder.AStarNode(int xx, int yy)
          The default constructor with positional information.
 
Method Summary
 void addChild(AStarPathfinder.AStarNode node)
          Add a child to the node.
 AStarPathfinder.AStarNode getParent()
          Return the parent node.
 int getX()
          Return the x-position of the node.
 int getY()
          Return the y-position of the node.
 void reset()
          Resets the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f

public double f
The f-value.


g

public double g
The g-value.


h

public double h
The h-value.


x

protected int x
The x-position of the node.


y

protected int y
The y-position of the node.


numChildren

public int numChildren
The number of children the node has.


nodeNumber

public int nodeNumber
The node identifier.


parent

protected AStarPathfinder.AStarNode parent
The parent of the node.

Constructor Detail

AStarPathfinder.AStarNode

public AStarPathfinder.AStarNode()
The default constructor.


AStarPathfinder.AStarNode

public AStarPathfinder.AStarNode(int xx,
                                 int yy)
The default constructor with positional information.

Parameters:
xx - the x-position of the node.
yy - the y-position of the node.
Method Detail

reset

public void reset()
Resets the node. This involves all f, g and h-values to 0 as well as removing all children.


addChild

public void addChild(AStarPathfinder.AStarNode node)
Add a child to the node.

Parameters:
node - the child node.

getX

public int getX()
Return the x-position of the node.

Specified by:
getX in interface Pathfinder.Node
Returns:
the x-position of the node.

getY

public int getY()
Return the y-position of the node.

Specified by:
getY in interface Pathfinder.Node
Returns:
the y-position of the node.

getParent

public AStarPathfinder.AStarNode getParent()
Return the parent node.

Returns:
the parent node.