public abstract class AStarNodeBase<T>
extends java.lang.Object
implements java.lang.Comparable<T>
Modifier and Type | Field and Description |
---|---|
protected int |
costFromStart |
protected int |
costToGoal |
T |
origin |
int |
pq_i |
protected byte |
state
0 means in no list 1 means in openList 2 means in closedList
|
protected int |
totalCost |
protected int |
x |
protected int |
y |
protected int |
z |
Constructor and Description |
---|
AStarNodeBase() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
getCostFromStart()
Returns the cost of the partial path from start node to the node.
|
int |
getCostToGoal()
Returns the probably inaccurate cost estimation for the partial part from
the node to the goal node.
|
int |
getTotalCost()
Returns the node's total cost.
A node's total cost is the sum of the cost from the start position to the node and the estimated cost from the node to the goal position. |
int |
getX()
Returns the X-position of the node.
|
int |
getY()
Returns the Y-position of the node.
|
int |
getZ()
Returns the Z-position of the node.
|
void |
initialize(T origin,
int costFromStart,
int costToGoal,
int totalCost,
int x,
int y,
int z)
Initialises a node for usage.
|
boolean |
isClosed()
Returns if the node is contained in the closed list.
|
boolean |
isOpen()
Returns if the node is contained in the open list.
|
void |
markAsClosed()
Marks the node as contained in the closed list.
|
void |
markAsNoList()
Marks the node as contained in no list, neither in open list, nor in closed
list.
|
void |
markAsOpen()
Marks the node as contained in the open list.
|
java.lang.String |
toString() |
public int pq_i
public T origin
protected int costFromStart
protected int costToGoal
protected int totalCost
protected int x
protected int y
protected int z
protected byte state
public java.lang.String toString()
toString
in class java.lang.Object
public void initialize(T origin, int costFromStart, int costToGoal, int totalCost, int x, int y, int z)
origin
- Node the node originated from.costFromStart
- Movement costs from start position to the position
associated with the node.costToGoal
- Estimated cost from the position associated with the node
to goal position.totalCost
- Total cost from start to goal, moving via the node's
position.x
- X-position the node corresponds to.y
- Y-position the node corresponds to.z
- Z-position the node corresponds to.public int getCostFromStart()
public int getCostToGoal()
public int getTotalCost()
public int getX()
public int getY()
public int getZ()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void markAsOpen()
public void markAsClosed()
public void markAsNoList()
public boolean isClosed()
true
if the node is in the closed list,
false
otherwise.public boolean isOpen()
true
if the node is in the open list,
false
otherwise.