| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_TYPE
Biggest valid type of a node: 31
|
static int |
MIN_TYPE
Smallest valid type of a node: 1
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNeighbor(MapNode node)
Adds the node as this node's neighbour (unless the node is null)
|
void |
addType(int type)
Adds a type indicator to this node
|
void |
close()
Close the node
|
int |
compareTo(MapNode o)
Compares two map nodes by their coordinates
|
Coord |
getLocation()
Returns the location of the node
|
java.util.List<MapNode> |
getNeighbors()
Returns the neighbors of this node.
|
boolean |
isClosed()
True if the node is "closed"
|
boolean |
isType(int type)
Returns true if this node is of given type, false if none of node's
type(s) match to given type or node doesn't have type at all
|
boolean |
isType(int[] types)
Returns true if the node's types match any of the given types
|
java.lang.String |
toString()
Returns a String representation of the map node
|
public static final int MIN_TYPE
public static final int MAX_TYPE
public MapNode(Coord location)
location - The location of the node.public void addType(int type)
public boolean isType(int type)
public boolean isType(int[] types)
types - The types to check (array of values in range
[1, 31])isType(int)public void addNeighbor(MapNode node)
node - The node to add or null for no actionpublic Coord getLocation()
public java.util.List<MapNode> getNeighbors()
public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(MapNode o)
compareTo in interface java.lang.Comparable<MapNode>o - The other MapNodepublic boolean isClosed()
public void close()