|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPosition
public class Position
A Position is an (x,y) coordinate in the World, much like the Positions for the maze program.
Field Summary | |
---|---|
static int |
EAST
The East compass point. |
static int |
NORTH
The North compass point. |
static int |
SOUTH
The South compass point. |
static int |
WEST
The West compass point. |
Constructor Summary | |
---|---|
Position(int x,
int y)
Create a new position for the given x and y coordinates. |
Method Summary | |
---|---|
Position |
getAdjacent(int direction)
Return a new position that is in one of the four compass directions from this. |
int |
getX()
Return the x coordinate for the position. |
int |
getY()
Return the y coordinate for the position. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NORTH
public static final int EAST
public static final int SOUTH
public static final int WEST
Constructor Detail |
---|
public Position(int x, int y)
Method Detail |
---|
public int getX()
public int getY()
public String toString()
toString
in class Object
public Position getAdjacent(int direction)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |