ch.aplu.jgamegrid
Enum Location.CompassDirection

java.lang.Object
  extended by java.lang.Enum<Location.CompassDirection>
      extended by ch.aplu.jgamegrid.Location.CompassDirection
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Location.CompassDirection>
Enclosing class:
Location

public static enum Location.CompassDirection
extends java.lang.Enum<Location.CompassDirection>

Class to represent the 8 compass directions.


Enum Constant Summary
EAST
          The compass direction for east.
NORTH
          The compass direction for north.
NORTHEAST
          The compass direction for northeast.
NORTHWEST
          The compass direction for northwest.
SOUTH
          The compass direction for south.
SOUTHEAST
          The compass direction for southeast.
SOUTHWEST
          The compass direction for southwest.
WEST
          The compass direction for west.
 
Method Summary
 int getDirection()
          Returns the direction in degrees (0 to east, clockwise).
static Location.CompassDirection valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Location.CompassDirection[] 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, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

EAST

public static final Location.CompassDirection EAST
The compass direction for east.


SOUTHEAST

public static final Location.CompassDirection SOUTHEAST
The compass direction for southeast.


SOUTH

public static final Location.CompassDirection SOUTH
The compass direction for south.


SOUTHWEST

public static final Location.CompassDirection SOUTHWEST
The compass direction for southwest.


WEST

public static final Location.CompassDirection WEST
The compass direction for west.


NORTHWEST

public static final Location.CompassDirection NORTHWEST
The compass direction for northwest.


NORTH

public static final Location.CompassDirection NORTH
The compass direction for north.


NORTHEAST

public static final Location.CompassDirection NORTHEAST
The compass direction for northeast.

Method Detail

values

public static Location.CompassDirection[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Location.CompassDirection c : Location.CompassDirection.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Location.CompassDirection valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getDirection

public int getDirection()
Returns the direction in degrees (0 to east, clockwise).

Returns:
the direction in degrees, rounded to an integer