public class Node
extends java.lang.Object
SearchAlgorithm
Modifier and Type  Field and Description 

float 
x
The x coordinate of this node.

float 
y
The y coordinate of this node.

Constructor and Description 

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

Modifier and Type  Method and Description 

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.

java.util.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.

public float x
public float y
public Node(float x, float y)
x
 The x coordinate of this node.y
 The y coordinate of this node.public java.util.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
