public class AStarOpenListCheapList<T extends AStarNodeBase<T>> extends java.lang.Object implements AStarOpenListBase<T>
Constructor and Description |
---|
AStarOpenListCheapList() |
Modifier and Type | Method and Description |
---|---|
void |
addNodeToOpenList(T node)
Inserts a node in the list of nodes to be visited later while searching.
|
void |
clearOpenList()
Removes all nodes from the open list.
|
java.util.Collection<T> |
dumpOpenList() |
T |
findOpenNode(int x,
int y,
int z)
If this position has not yet been visited by the A* search, this method
returns the node associated with the given position.
|
boolean |
isOpenListEmpty()
Returns if there are no nodes to be visited.
|
void |
reinitializeCheapList(int fillingSize)
Reinitializes the CheapList.
|
T |
removeCheapestOpenNode()
Returns the node with the cheapest total cost, and removes it from the open
list.
|
void |
removeNodeFromOpenList(T node)
If contained in the list of nodes to be visited later, the given node is
removed.
|
void |
setMap(AStarMapBase<T> map) |
public void setMap(AStarMapBase<T> map)
public void reinitializeCheapList(int fillingSize)
CHEAPLIST_INIT_SIZE
times to find (and remove) the
best ones. Then insert the found elements into the CheapList in O(
CHEAPLIST_INIT_SIZE
²)fillingSize
- number of elements to be move to CheapList.public void addNodeToOpenList(T node)
AStarOpenListBase
addNodeToOpenList
in interface AStarOpenListBase<T extends AStarNodeBase<T>>
node
- The node to add.public java.util.Collection<T> dumpOpenList()
public void clearOpenList()
AStarOpenListBase
clearOpenList
in interface AStarOpenListBase<T extends AStarNodeBase<T>>
public T findOpenNode(int x, int y, int z)
AStarOpenListBase
findOpenNode
in interface AStarOpenListBase<T extends AStarNodeBase<T>>
x
- X-position of the map to be checked.y
- Y-position of the map to be checked.z
- Z-position of the map to be checked.null
otherwise.public boolean isOpenListEmpty()
AStarOpenListBase
isOpenListEmpty
in interface AStarOpenListBase<T extends AStarNodeBase<T>>
true
if there are no nodes left, false
otherwise.public T removeCheapestOpenNode()
AStarOpenListBase
removeCheapestOpenNode
in interface AStarOpenListBase<T extends AStarNodeBase<T>>
null
otherwise.public void removeNodeFromOpenList(T node)
AStarOpenListBase
removeNodeFromOpenList
in interface AStarOpenListBase<T extends AStarNodeBase<T>>
node
- The node to be removed.