Class AStar
raft.kilavuz.runtime
java.lang.Object
  raft.kilavuz.runtime.AStar

public class AStar
extends Object
an generic A* path finding implementation. for those which are unfamiliar with A* we suggest this A* tutorial.

Nested Class Summary
abstract static class
AStar.Node
base class of all A* nodes
static class
AStar.Path
result of a successfull path find attempt
static interface
AStar.Transition
a transition between two nodes
Field Summary
static boolean
USE_BITSET
closed list is maintained as a BitSet.
static boolean
USE_INTSET
closed list is maintained as a SortedSet.
Constructor Summary
AStar()
creates a new AStar pathfinder
AStar(boolean useBitSet)
creates a new AStar pathfinder.
Method Summary
findPath(AStar.Node from, AStar.Node to, PathContext context)
tries to find path between given nodes
getClosedList()
returns an unmodifiable view of closed list.
getOpenList()
returns an unmodifiable view of open list.
Field Detail
USE_BITSET
public static final boolean USE_BITSET
closed list is maintained as a BitSet. this is far more faster and normally requires less memory. each Node is assigned an id during creation and if you create more and more nodes in same JVM this may cause memory problems. more and more means more than ten million. consider using a kind of node pool even instead of creating many many nodes. this is default
See Also:

USE_INTSET
public static final boolean USE_INTSET
closed list is maintained as a SortedSet. this is slower and generally requires more memory. see discussion at USE_BITSET
See Also:
Constructor Detail
AStar
public AStar()
creates a new AStar pathfinder

AStar
public AStar(boolean useBitSet)
creates a new AStar pathfinder.
Parameters:
useBitSet - if true closed list is stored as a BitSet
See Also:
Method Detail
findPath
public synchronized AStar.Path findPath(AStar.Node from,
                                        AStar.Node to,
                                        PathContext context)
                                 throws NoPathException
tries to find path between given nodes
Parameters:
from - source node
to - target node
context - information about path finding enviroment
Returns:
found path
Throws:
NoPathException - if no path found
See Also:

getOpenList
public SortedSet<AStar.NodegetOpenList()
returns an unmodifiable view of open list. provided for debug and visualizing purposes
Since:
0.91

getClosedList
public SortedSet<IntegergetClosedList()
returns an unmodifiable view of closed list. if this AStar uses bitset for closed list, it's first converted to a sorted set provided for debug and visualizing purposes
Since:
0.91
Java API documentation generated with DocFlex/Doclet v1.5.2
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com