|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<Direction>
util.Direction
public enum Direction
Representation of the four directional orientations: up, right, down, and left.
Enum Constant Summary | |
---|---|
DOWN
|
|
LEFT
|
|
RIGHT
|
|
UP
|
Method Summary | |
---|---|
Direction |
clockwise()
Returns the next clockwise rotation. |
Direction |
counterClockwise()
Returns the next counter-clockwise rotation. |
static Direction |
fromString(String str)
Returns the enum representation of a string. |
Point |
getOffset(Point loc)
Returns a point offset in this direction according to inverted cartesian coordinates (the same as Graphics objects). |
boolean |
isVertical()
Returns if the direction concerns vertical or horizontal directions. |
static Direction |
random()
Returns a random direction. |
Direction |
reverse()
Returns the opposite facing direction. |
String |
toString()
|
static Direction |
valueOf(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 are declared. |
Methods inherited from class java.lang.Enum |
---|
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final Direction UP
public static final Direction RIGHT
public static final Direction DOWN
public static final Direction LEFT
Method Detail |
---|
public static Direction[] values()
for (Direction c : Direction.values()) System.out.println(c);
public static Direction valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static Direction fromString(String str)
str
- toString representation of this enum
IllegalArgumentException
- if argument is not represented by this enum.public static Direction random()
public Direction clockwise()
Orientation
clockwise
in interface Orientation
public Direction counterClockwise()
Orientation
counterClockwise
in interface Orientation
public Direction reverse()
Orientation
reverse
in interface Orientation
public Point getOffset(Point loc)
Orientation
getOffset
in interface Orientation
loc
- location to be offset
public boolean isVertical()
public String toString()
toString
in class Enum<Direction>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |