|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object robocraft.common.CommonEnum robocraft.common.Direction
Direction represents one of the eight directions from a square to an adjacent square. Included are the Directions OMNI and NONE, which are "non-directional". The other Directions are considered "directional".
The only instances of this class are those found
in the static fields described below. This means that instances can
always be meaningfully compared using ==
.
Robot.getDirection()
,
AbstractRobotPlayer.setDirection(robocraft.common.Direction)
,
Serialized Form
Field Summary | |
static Direction |
EAST
|
static Direction |
NONE
Represents "no direction" for the purposes of methods dealing with Directions that need such a representation. |
static Direction |
NORTH
|
static Direction |
NORTH_EAST
|
static Direction |
NORTH_WEST
|
static Direction |
OMNI
Represents "every direction" for the purposes of methods dealing with Directions that need such a representation. |
static Direction |
SOUTH
|
static Direction |
SOUTH_EAST
|
static Direction |
SOUTH_WEST
|
static Direction |
WEST
|
Method Summary | |
boolean |
isDiagonal()
Returns whether this direction represents the Direction from one square to an adjacent square that shares only a corner. |
Direction |
opposite()
Returns the opposite of a directional Direction. |
Direction |
rotateLeft()
Returns a Direction that is the result of rotating this Direction 45 degrees to the left. |
Direction |
rotateRight()
Returns a Direction that is the result of rotating this Direction 45 degrees to the right. |
java.lang.String |
toString()
Returns a textual representation of the Direction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Direction OMNI
public static final Direction NONE
public static final Direction WEST
public static final Direction NORTH_WEST
public static final Direction SOUTH_WEST
public static final Direction EAST
public static final Direction NORTH_EAST
public static final Direction SOUTH_EAST
public static final Direction NORTH
public static final Direction SOUTH
Method Detail |
public java.lang.String toString()
public Direction opposite()
java.lang.RuntimeException
- if this Direction is non-directionalpublic boolean isDiagonal()
public Direction rotateLeft()
java.lang.RuntimeException
- if this Direction is non-directionalpublic Direction rotateRight()
java.lang.RuntimeException
- if this Direction is non-directional
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |