|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<Direction>
Direction
public enum Direction
An enumeration type that represents the four cardinal directions in a maze. We use an enumeration because we know in advance that there will be exactly four instances of Direction. We also include some helper methods for moving clockwise and counter-clockwise given a direction.
Enum Constant Summary | |
---|---|
EAST
The direction representing east. |
|
NORTH
The direction representing north. |
|
SOUTH
The direction representing south. |
|
WEST
The direction representing west. |
Method Summary | |
---|---|
Direction |
clockwise90()
Returns the direction that is 90 degrees clockwise from the current direction. |
Direction |
counterClockwise90()
Returns the direction that is 90 degrees counter-clockwise from the current direction. |
static Direction |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Direction[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final Direction NORTH
public static final Direction EAST
public static final Direction SOUTH
public static final Direction WEST
Method Detail |
---|
public static final Direction[] values()
for(Direction c : Direction.values()) System.out.println(c);
public static Direction valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namepublic Direction clockwise90()
public Direction counterClockwise90()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |