public abstract class AStarMapBase<T extends AStarNodeBase<T>>
extends java.lang.Object
null
for coordinates outside the map. Furthermore, it should
return its size in the methods getMaxXNodes
,
getMaxYNodes
and getMaxZNodes
.Modifier and Type | Field and Description |
---|---|
protected ObjectPool<T> |
objectPool |
Constructor and Description |
---|
AStarMapBase() |
Modifier and Type | Method and Description |
---|---|
abstract void |
clearMapKeepBlocks() |
abstract AStarMapBase<T> |
clone() |
abstract int |
getMaxXNodes()
Returns the horizontal size of the map.
|
abstract int |
getMaxYNodes()
Returns the vertical size of the map.
|
abstract int |
getMaxZNodes()
Returns the number of layers of the map.
|
abstract boolean |
isTileBlocked(int x,
int y,
int z)
Returns if the specified position is blocked.
|
abstract T |
nodeAt(int x,
int y,
int z)
Returns the node at the given coordinates.
|
void |
setObjectPool(ObjectPool<T> objectPool) |
abstract 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.
|
boolean |
tryInsertPath(java.util.List<T> path) |
protected void |
visitIfNotBlocked(AStarMapVisitorBase<T> visitor,
T origin,
int x,
int y,
int z) |
abstract void |
visitNeighboursOf(T origin,
AStarMapVisitorBase<T> visitor)
Lets the provided visitor visit all non-blocked neighbours of a given node.
|
protected void |
visitNeighboursOf4(T origin,
AStarMapVisitorBase<T> visitor) |
protected void |
visitNeighboursOf8(T origin,
AStarMapVisitorBase<T> visitor) |
protected ObjectPool<T extends AStarNodeBase<T>> objectPool
public abstract T nodeAt(int x, int y, int z)
null
in these cases.x
- Horizontal positiony
- Vertical positionnull
if none exists
there.public abstract void setTileBlocked(int x, int y, int z, boolean blockedStatus)
x
- Horizontal positiony
- Vertical positionblockedStatus
- true
if this position should be blocked,
false
otherwise.public abstract boolean isTileBlocked(int x, int y, int z)
x
- Horizontal positiony
- Vertical positionz
- Layertrue
if this position is blocked, false
otherwise.protected void visitIfNotBlocked(AStarMapVisitorBase<T> visitor, T origin, int x, int y, int z)
public abstract void visitNeighboursOf(T origin, AStarMapVisitorBase<T> visitor)
origin
- Node whose neighbours shall be visited.visitor
- Visitor to use.protected void visitNeighboursOf8(T origin, AStarMapVisitorBase<T> visitor)
protected void visitNeighboursOf4(T origin, AStarMapVisitorBase<T> visitor)
public abstract void clearMapKeepBlocks()
public abstract AStarMapBase<T> clone()
clone
in class java.lang.Object
public boolean tryInsertPath(java.util.List<T> path)
public abstract int getMaxXNodes()
0
.public abstract int getMaxYNodes()
0
.public abstract int getMaxZNodes()
0
.public void setObjectPool(ObjectPool<T> objectPool)