|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--cad.simcad.pathfinding.astar.AStarAlgo
Abstract class to use as a framework to implement A* algorithms NOT APPLICABLE the Runnable interface is used because we are only overriding the run() method and no other Thread methods. This is important because classes should not be subclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class. Once the class has been instantiated, you have to give it to a thread object and start it.
| Field Summary | |
protected java.lang.String |
_algoType
|
protected int |
_assoId
|
protected java.util.TreeSet |
_closed
|
protected Path |
_cp
|
protected PathPlace |
_finish
|
protected java.lang.Thread |
_loop
|
protected java.util.Hashtable |
_mapTable
Hasthtable mapping a PathPlace with a cost |
protected PathFindable |
_myMap
|
protected java.util.TreeSet |
_open
|
protected PathUser |
_pu
|
protected double |
_rebuildingFudgeFactor
|
protected PathPlace |
_start
|
protected int |
_state
|
int |
FOUND
|
int |
NO_PATH
|
int |
NOT_FOUND
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
AStarAlgo(PathFindable map)
|
|
AStarAlgo(PathFindable map,
Path cp)
Creates new AStarAlgo |
|
| Method Summary | |
protected void |
buildReferences(Path cp)
This method should only be invoked if the algorithm needs to to trace the best path from the destination back to the origin |
protected void |
buildReferencesFudged(Path cp)
This method should only be invoked if the algorithm needs to to trace the best path from the destination back to the origin |
protected void |
firePathComputation(PathPlaceSet pp)
|
protected void |
firePathPlaceChange(PathPlace pp)
|
protected PathPlace |
getFudgedLowestAdjacent(PathPlace mp)
Returns the best PathPlace adjacent to the given PathPlace. |
protected PathPlace |
getLowestAdjacent(PathPlace mp)
Returns the best PathPlace adjacent to the given PathPlace. |
PathPlaceSet |
getShortestPath()
Returns the Path of the Algorithm |
PathPlaceSet |
getShortestPath(PathPlace origin,
PathPlace dest,
PathUser pu)
Find the shortest path between two places. |
boolean |
isApplicable(Path cp)
|
boolean |
isSequential()
Returns true if the PathFinder does not run in its own thread |
abstract void |
run()
|
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final int NO_PATH
public final int NOT_FOUND
public final int FOUND
protected PathFindable _myMap
protected Path _cp
protected java.util.TreeSet _open
protected java.util.TreeSet _closed
protected int _state
protected java.util.Hashtable _mapTable
protected java.lang.Thread _loop
protected int _assoId
protected PathPlace _finish
protected PathPlace _start
protected java.lang.String _algoType
protected PathUser _pu
protected double _rebuildingFudgeFactor
| Constructor Detail |
public AStarAlgo(PathFindable map,
Path cp)
public AStarAlgo(PathFindable map)
| Method Detail |
public boolean isApplicable(Path cp)
public abstract void run()
run in interface java.lang.Runnablerun in class java.lang.Threadprotected PathPlace getLowestAdjacent(PathPlace mp)
protected PathPlace getFudgedLowestAdjacent(PathPlace mp)
protected void buildReferences(Path cp)
cp - the Path to updateprotected void buildReferencesFudged(Path cp)
cp - the Path to updatepublic PathPlaceSet getShortestPath()
getShortestPath in interface PathFinderpublic boolean isSequential()
PathFinder
isSequential in interface PathFinder
public PathPlaceSet getShortestPath(PathPlace origin,
PathPlace dest,
PathUser pu)
getShortestPath in interface PathFinderorigin - The origin of the Pathdest - The destination of the Pathprotected void firePathPlaceChange(PathPlace pp)
protected void firePathComputation(PathPlaceSet pp)
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||