| Enum Constant and Description |
|---|
EAST
The east direction
|
NORTH
The north direction
|
NORTH_EAST
The north-east direction
|
NORTH_WEST
The north-west direction
|
SOUTH
The south direction
|
SOUTH_EAST
The south-east direction
|
SOUTH_WEST
The south-west direction
|
WEST
The west direction
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
arePerpendicular(Direction direction1,
Direction direction2)
Checks whether two directions are perpendicular
|
static Direction |
getDirectionFromID(int directionID)
Gets a direction from its numerical id
|
int |
getDirectionID()
Gets the numerical identifier used for alternate identification of a direction
|
static Direction |
getLeftRotatedDirection(Direction direction)
Gets the direction if something rotated to the left
A rotation is assumed to be a ninety degrees rotation, so NORTH would become WEST and so on.
|
static Direction |
getReverseDirection(Direction direction)
Gets the reverse of a direction
|
static Direction |
getRightRotatedDirection(Direction direction)
Gets the direction if something rotated to the right
A rotation is assumed to be a ninety degrees rotation, so NORTH would become EAST and so on.
|
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 are declared.
|
public static final Direction NORTH
public static final Direction NORTH_EAST
public static final Direction EAST
public static final Direction SOUTH_EAST
public static final Direction SOUTH
public static final Direction SOUTH_WEST
public static final Direction WEST
public static final Direction NORTH_WEST
public static 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 namejava.lang.NullPointerException - if the argument is nullpublic static Direction getDirectionFromID(int directionID)
directionID - The numerical representation of a directionpublic static boolean arePerpendicular(Direction direction1, Direction direction2)
direction1 - The first directiondirection2 - The second directionpublic static Direction getReverseDirection(Direction direction)
direction - A directionpublic static Direction getLeftRotatedDirection(Direction direction)
A rotation is assumed to be a ninety degrees rotation, so NORTH would become WEST and so on.
direction - A directionpublic static Direction getRightRotatedDirection(Direction direction)
A rotation is assumed to be a ninety degrees rotation, so NORTH would become EAST and so on.
direction - A directionpublic int getDirectionID()