jfreerails.controller
Class SimpleAStarPathFinder
java.lang.Object
jfreerails.controller.SimpleAStarPathFinder
- All Implemented Interfaces:
- java.io.Serializable, IncrementalPathFinder
public class SimpleAStarPathFinder
- extends java.lang.Object
- implements java.io.Serializable, IncrementalPathFinder
A simple A* pathfinder implementation. It uses int's to avoid the cost of
object creation and garbage collection. 26-Nov-2002
- Author:
- Luke Lindsay
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
logger
private static final java.util.logging.Logger logger
openList
private OpenList openList
startingPositions
private final java.util.HashSet<java.lang.Integer> startingPositions
closedList
private final java.util.HashMap<java.lang.Integer,java.lang.Integer> closedList
shortestPath
private final java.util.HashMap<java.lang.Integer,java.lang.Integer> shortestPath
status
private int status
path
private transient IntArray path
- Note, IntArray is not Serializable.
bestPath
private int bestPath
bestPathF
private int bestPathF
explorer
private GraphExplorer explorer
searchStartTime
private long searchStartTime
SimpleAStarPathFinder
public SimpleAStarPathFinder()
getStatus
public int getStatus()
- Specified by:
getStatus
in interface IncrementalPathFinder
retrievePath
public IntArray retrievePath()
findstep
public int findstep(int currentPosition,
int[] targets,
GraphExplorer tempExplorer)
findpath
public IntArray findpath(int[] currentPosition,
int[] targets,
GraphExplorer e)
throws PathNotFoundException
- Throws:
PathNotFoundException
search
public void search(long maxDuration)
throws PathNotFoundException
- Specified by:
search
in interface IncrementalPathFinder
- Throws:
PathNotFoundException
setupSearch
public void setupSearch(int[] currentPosition,
int[] targets,
GraphExplorer e)
throws PathNotFoundException
- Throws:
PathNotFoundException
abandonSearch
public void abandonSearch()
- Specified by:
abandonSearch
in interface IncrementalPathFinder