cz.cuni.amis.pathfinding.alg.astar
Interface IAStarResult<NODE>

Package class diagram package IAStarResult
All Known Implementing Classes:
AStarResult

public interface IAStarResult<NODE>

This interface is returned by AStar#AStar.findPath(cz.cuni.amis.pathfinding.map.IPFGoal, long). It contains results from the search as well as method for finding the path from the startNode to the goalNode.


Method Summary
 int getCostToNode(NODE node)
          Returns cost of the path from startNode to node if the node was touched by A* algorithm (if A* was successful, then this always contains the goalNode and every node on the path at least).
 int getDistanceToGoal()
          If the AStar succeeded then it returns the distance to the goal from the start node.
 int getEstimatedCostToNode(NODE node)
          Returns estimated cost of the path from startNode to goal through node.
 List<NODE> getPath()
          Returns the path from startNode to goalNode.
 NODE getPreviousNode(NODE node)
          Previous node in the path to the goal node.
 boolean isSuccess()
          Whether this result represents the success, i.e., path from start to goal node has been found.
 

Method Detail

getPreviousNode

NODE getPreviousNode(NODE node)
Previous node in the path to the goal node.

Parameters:
node -
Returns:
previous node of supplied node | null

getCostToNode

int getCostToNode(NODE node)
Returns cost of the path from startNode to node if the node was touched by A* algorithm (if A* was successful, then this always contains the goalNode and every node on the path at least).

If node wasn't touched by A* algorithm, then it returns -1.

Parameters:
node -
Returns:
cost of the path from startNode to node

getEstimatedCostToNode

int getEstimatedCostToNode(NODE node)
Returns estimated cost of the path from startNode to goal through node. If the node was touched by A* algorithm then it has this value stored here (if A* was successful, then this always contains the goalNode and every node on the path at least).

If node wasn't touched by A* algorithm, then it returns -1.

Parameters:
node -
Returns:
cost of the path from startNode to node

getPath

List<NODE> getPath()
Returns the path from startNode to goalNode. (Don't change it as it's cached, if you want to alter it - then copy it :-)

First item is startNode and the last item is goalNode. If startNode == goalNode then it contains only one item. For each index ... path[index] has neighbor path[index+1].

If the path doesn't exist - returns null.

Returns:
path

getDistanceToGoal

int getDistanceToGoal()
If the AStar succeeded then it returns the distance to the goal from the start node.

Returns -1 otherwise.

Returns:
distance | -1

isSuccess

boolean isSuccess()
Whether this result represents the success, i.e., path from start to goal node has been found.

Returns:


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.