|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectassignment6.Node
public class Node
Represents a single square cell on the map.
Method Summary | ||
---|---|---|
int |
compareTo(Node arg)
Lexicographic sort order based on (x,y) coordinates |
|
|
getUserData()
Retrieve the previously stored userData value. |
|
int |
getX()
Get the X coordinate of this node on the map. |
|
int |
getY()
Get the Y coordinate of this node on the map. |
|
boolean |
isAdjacent(Node other)
Tests whether this node is adjacent to another (i.e., whether the naturalist can move from one to the other) |
|
boolean |
isGrassy()
Returns true if node is covered with grass. |
|
boolean |
isShip()
Return true if this node contains the ship. |
|
|
setUserData(T data)
Store a value of an arbitrary type in this node. |
|
java.lang.String |
toString()
Return a string representation of this node, "(x,y)" |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public int getX()
public int getY()
public boolean isAdjacent(Node other)
other
-
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isShip()
public int compareTo(Node arg)
compareTo
in interface java.lang.Comparable<Node>
public <T> void setUserData(T data)
T
- The type of data being stored.data
- public <T> T getUserData()
T
- Type of userData. Must be the same as what was originally stored (or a superclass).
public boolean isGrassy()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |