battlecode.common
public enum Direction extends Enum<Direction>
switch
statements, it has all the standard enum methods (valueOf,
values, etc.), and you can safely use == for
equality tests.| Enum Constant and Description |
|---|
EAST |
NONE
No direction.
|
NORTH |
NORTH_EAST |
NORTH_WEST |
OMNI
All directions.
|
SOUTH |
SOUTH_EAST |
SOUTH_WEST |
WEST |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDiagonal()
Determines whether or not this direction is a diagonal one.
|
Direction |
opposite()
Computes the direction opposite this one.
|
Direction |
rotateLeft()
Computes the direction 45 degrees to the left (counter-clockwise)
of this one.
|
Direction |
rotateRight()
Computes the direction 45 degrees to the right (clockwise)
of this one.
|
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.
|
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 final Direction NONE
public static final Direction OMNI
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 nameNullPointerException - if the argument is nullpublic boolean isDiagonal()
public Direction opposite()
public Direction rotateLeft()
public Direction rotateRight()