Package geo
Enum CardinalDirection
- java.lang.Object
-
- java.lang.Enum<CardinalDirection>
-
- geo.CardinalDirection
-
- All Implemented Interfaces:
Serializable
,Comparable<CardinalDirection>
public enum CardinalDirection extends Enum<CardinalDirection>
Immutable enumeration of cardinal directions.PS1 instructions: do NOT change this enumeration.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CardinalDirection
fromChar(char letter)
char
toChar()
static CardinalDirection
valueOf(String name)
Returns the enum constant of this type with the specified name.static CardinalDirection[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NORTH
public static final CardinalDirection NORTH
-
EAST
public static final CardinalDirection EAST
-
SOUTH
public static final CardinalDirection SOUTH
-
WEST
public static final CardinalDirection WEST
-
-
Method Detail
-
values
public static CardinalDirection[] 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 (CardinalDirection c : CardinalDirection.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CardinalDirection valueOf(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
toChar
public char toChar()
- Returns:
- upper-case first letter of this cardinal direction
-
fromChar
public static CardinalDirection fromChar(char letter)
- Parameters:
letter
- the upper-case first letter of a cardinal direction- Returns:
- the cardinal direction whose first letter is letter
-
-