public class AstarSearchAlgorithm extends java.lang.Object implements SearchAlgorithm
NodePathFinder
Modifier and Type | Field and Description |
---|---|
(package private) int |
main_loop |
(package private) int |
neighbor_loop |
private static java.lang.String |
STRING_NAME |
Constructor and Description |
---|
AstarSearchAlgorithm() |
Modifier and Type | Method and Description |
---|---|
Path |
findPath(Node start,
Node goal)
Method accepts a start node and a goal node, and returns a path consisting of a collection of waypoints which
includes the startNode coordinates as the first waypoint, and the goal node coordinates as the final waypoint.
|
private static Node |
getLowestCost(java.util.Collection<Node> nodeSet)
Finds the node within a set of neighbors with the least cost (potentially shortest distance to goal).
|
private static void |
reconstructPath(Node current_node,
Node start,
java.util.Collection<Waypoint> path)
Given the current node and the start node, this method retraces the completed path.
|
java.lang.String |
toString() |
private static final java.lang.String STRING_NAME
int main_loop
int neighbor_loop
public Path findPath(Node start, Node goal)
SearchAlgorithm
findPath
in interface SearchAlgorithm
private static Node getLowestCost(java.util.Collection<Node> nodeSet)
private static final void reconstructPath(Node current_node, Node start, java.util.Collection<Waypoint> path)
current_node
- start
- path
- The path output by this algorithm.public java.lang.String toString()
toString
in class java.lang.Object