

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object lejos.robotics.pathfinding.Node
public class Node
This class represents a Node which can be connected to other neighboring nodes. Node sets can be searched using search algorithms. Typically the search algorithm only requires one starting node and one goal node. It assumes these nodes are linked by intermediate nodes.
SearchAlgorithm
Field Summary  

float 
x
The x coordinate of this node. 
float 
y
The y coordinate of this node. 
Constructor Summary  

Node(float x,
float y)
Creates a new instance of a node. 
Method Summary  

boolean 
addNeighbor(Node neighbor)
Adds a neighboring node to this node, connecting them together. 
protected float 
calculateG(Node neighbor)
Calculates the distance to a neighbor node. 
protected float 
calculateH(Node goal)
Calculates the distance to the goal node. 
protected float 
getF_Score()
Method used by A* to calculate search score. 
protected float 
getG_Score()
Method used by A* to calculate search score. 
Collection<Node> 
getNeighbors()
Returns all the neighbors which this node is connected to. 
protected Node 
getPredecessor()
Used by A* search. 
int 
neighbors()
Indicates the number of neighbors (nodes connected to this node). 
boolean 
removeNeighbor(Node neighbor)
Removes a node from this node as neighbors, effectively disconnecting them. 
protected void 
setG_Score(float g)
Method used by A* to calculate search score. 
protected void 
setH_Score(float h)
Method used by A* to calculate search score. 
protected void 
setPredecessor(Node orig)
Used by A* search. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public float x
public float y
Constructor Detail 

public Node(float x, float y)
x
 The x coordinate of this node.y
 The y coordinate of this node.Method Detail 

public Collection<Node> getNeighbors()
public int neighbors()
public boolean addNeighbor(Node neighbor)
neighbor
 The neighboring node to connect with.
public boolean removeNeighbor(Node neighbor)
neighbor
 The neighboring node to disconnect from.
protected void setH_Score(float h)
h
 protected float calculateG(Node neighbor)
neighbor

protected float calculateH(Node goal)
goal

protected void setG_Score(float g)
g
 protected float getG_Score()
protected float getF_Score()
protected Node getPredecessor()
protected void setPredecessor(Node orig)
orig



PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 