public class RandomSelfGeneratingNode extends Node
Modifier and Type | Field and Description |
---|---|
private int |
connections |
private boolean |
firstCall
firstCall indicates if getNeighbors() has been called yet.
|
private static Node |
goal |
private float |
maxDist |
MULTIPLIER, x, y
Constructor and Description |
---|
RandomSelfGeneratingNode(float x,
float y,
float maxDist,
int connections)
Creates a node that will randomly generate 'connections' number of neighbors when getNeighbors()
is called.
|
RandomSelfGeneratingNode(float x,
float y,
float maxDist,
int connections,
Node goal)
Creates a node that will randomly generate 'connections' number of neighbors when getNeighbors()
is called.
|
Modifier and Type | Method and Description |
---|---|
java.util.Collection<Node> |
getNeighbors()
When this method is called the first time, it randomly generates a set of neighbors according to
the parameters in the constructor.
|
addNeighbor, calculateG, calculateH, getF_Score, getG_Score, getPredecessor, neighbors, removeNeighbor, setG_Score, setH_Score, setPredecessor
private boolean firstCall
private int connections
private float maxDist
private static Node goal
public RandomSelfGeneratingNode(float x, float y, float maxDist, int connections)
x
- The x coordinate of this node.y
- The y coordinate of this node.maxDist
- The maximum x or y distance to create new nodes randomly.connections
- The number of neighbors to randomly generate and connect with.public RandomSelfGeneratingNode(float x, float y, float maxDist, int connections, Node goal)
x
- The x coordinate of this node.y
- The y coordinate of this node.maxDist
- The maximum x or y distance to create new nodes randomly.connections
- The number of neighbors to randomly generate and connect with.goal
- The goal node which is added to this set and connected to any nodes within range.public java.util.Collection<Node> getNeighbors()
getNeighbors
in class Node