net.sf.freecol.common.model
Enum Map.Direction

java.lang.Object
  extended by java.lang.Enum<Map.Direction>
      extended by net.sf.freecol.common.model.Map.Direction
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Map.Direction>
Enclosing class:
Map

public static enum Map.Direction
extends java.lang.Enum<Map.Direction>

The directions a Unit can move to. Includes deltas for moving to adjacent squares, which are required due to the isometric map. Starting north and going clockwise.


Enum Constant Summary
E
           
N
           
NE
           
NW
           
S
           
SE
           
SW
           
W
           
 
Field Summary
static Map.Direction[] longSides
           
 
Method Summary
 int getEvenDX()
           
 int getEvenDY()
           
 Map.Direction getNextDirection()
           
 int getOddDX()
           
 int getOddDY()
           
 Map.Direction getPreviousDirection()
           
static Map.Direction getRandomDirection(java.util.Random random)
          Returns a random Direction.
static Map.Direction[] getRandomDirectionArray(java.util.Random random)
          Creates an array of the eight directions in a random order.
 Map.Direction getReverseDirection()
          Returns the reverse direction of the given direction.
static Map.Direction valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Map.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, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

N

public static final Map.Direction N

NE

public static final Map.Direction NE

E

public static final Map.Direction E

SE

public static final Map.Direction SE

S

public static final Map.Direction S

SW

public static final Map.Direction SW

W

public static final Map.Direction W

NW

public static final Map.Direction NW
Field Detail

longSides

public static final Map.Direction[] longSides
Method Detail

values

public static Map.Direction[] 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 (Map.Direction c : Map.Direction.values())
    System.out.println(c);

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

valueOf

public static Map.Direction 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

getOddDX

public int getOddDX()

getOddDY

public int getOddDY()

getEvenDX

public int getEvenDX()

getEvenDY

public int getEvenDY()

getNextDirection

public Map.Direction getNextDirection()

getPreviousDirection

public Map.Direction getPreviousDirection()

getReverseDirection

public Map.Direction getReverseDirection()
Returns the reverse direction of the given direction.

Returns:
The reverse direction of the given direction.

getRandomDirection

public static Map.Direction getRandomDirection(java.util.Random random)
Returns a random Direction.

Parameters:
random - A Random number source.
Returns:
a Direction value

getRandomDirectionArray

public static Map.Direction[] getRandomDirectionArray(java.util.Random random)
Creates an array of the eight directions in a random order.

Parameters:
random - A Random number source.
Returns:
The array.