public class HashedInfiniteMap<T extends AStarNodeBase<T>> extends AStarMapBase<T>
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.String,java.lang.Boolean> |
blockedMap |
protected ObjectPool<T> |
nodePool |
objectPool
Constructor and Description |
---|
HashedInfiniteMap(ObjectPool<T> nodePool) |
Modifier and Type | Method and Description |
---|---|
void |
clearMapKeepBlocks() |
AStarMapBase<T> |
clone() |
int |
getMaxXNodes()
Returns the horizontal size of the map.
|
int |
getMaxYNodes()
Returns the vertical size of the map.
|
int |
getMaxZNodes()
Returns the number of layers of the map.
|
boolean |
isTileBlocked(int x,
int y,
int z)
Returns if the specified position is blocked.
|
T |
nodeAt(int x,
int y,
int z)
Returns the node at the given coordinates.
As this implementation provides an unbounded map, nodeAt never
returns null . |
void |
setTileBlocked(int x,
int y,
int z,
boolean blockedStatus)
Marks the specified position as blocked, which means that there is no valid
movement from any adjacent tile to this one.
|
void |
visitNeighboursOf(T origin,
AStarMapVisitorBase<T> visitor)
Lets the provided visitor visit all non-blocked neighbours of a given node.
|
setObjectPool, tryInsertPath, visitIfNotBlocked, visitNeighboursOf4, visitNeighboursOf8
protected ObjectPool<T extends AStarNodeBase<T>> nodePool
protected java.util.HashMap<java.lang.String,java.lang.Boolean> blockedMap
public HashedInfiniteMap(ObjectPool<T> nodePool)
public boolean isTileBlocked(int x, int y, int z)
AStarMapBase
isTileBlocked
in class AStarMapBase<T extends AStarNodeBase<T>>
x
- Horizontal positiony
- Vertical positionz
- Layertrue
if this position is blocked, false
otherwise.public void setTileBlocked(int x, int y, int z, boolean blockedStatus)
AStarMapBase
setTileBlocked
in class AStarMapBase<T extends AStarNodeBase<T>>
x
- Horizontal positiony
- Vertical positionblockedStatus
- true
if this position should be blocked,
false
otherwise.public T nodeAt(int x, int y, int z)
nodeAt
never
returns null
.nodeAt
in class AStarMapBase<T extends AStarNodeBase<T>>
x
- Horizontal positiony
- Vertical positionpublic void clearMapKeepBlocks()
clearMapKeepBlocks
in class AStarMapBase<T extends AStarNodeBase<T>>
public AStarMapBase<T> clone()
clone
in class AStarMapBase<T extends AStarNodeBase<T>>
public void visitNeighboursOf(T origin, AStarMapVisitorBase<T> visitor)
AStarMapBase
visitNeighboursOf
in class AStarMapBase<T extends AStarNodeBase<T>>
origin
- Node whose neighbours shall be visited.visitor
- Visitor to use.public int getMaxXNodes()
AStarMapBase
0
.getMaxXNodes
in class AStarMapBase<T extends AStarNodeBase<T>>
public int getMaxYNodes()
AStarMapBase
0
.getMaxYNodes
in class AStarMapBase<T extends AStarNodeBase<T>>
public int getMaxZNodes()
AStarMapBase
0
.getMaxZNodes
in class AStarMapBase<T extends AStarNodeBase<T>>