|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmovement.map.MapNode
public class MapNode
A node in a SimMap. Node has a location, 0-n neighbors that it is connected to and possibly a type identifier.
Field Summary | |
---|---|
static int |
MAX_TYPE
Biggest valid type of a node: 31 |
static int |
MIN_TYPE
Smallest valid type of a node: 1 |
Constructor Summary | |
---|---|
MapNode(Coord location)
Constructor. |
Method Summary | |
---|---|
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 |
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 |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MIN_TYPE
public static final int MAX_TYPE
Constructor Detail |
---|
public MapNode(Coord location)
location
- The location of the node.Method Detail |
---|
public void addType(int type)
type
- An integer from range [1, 31]public boolean isType(int type)
type
- The type (integer from range [1,
31])
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.Object
public int compareTo(MapNode o)
compareTo
in interface java.lang.Comparable<MapNode>
o
- The other MapNode
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |