Enum Class Direction
- All Implemented Interfaces:
Serializable,Comparable<Direction>,Constable
Represents a cardinal direction, and provides methods for use when working with a 2D-array
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionall()Convenience method to retrieve a list of all Directions, to allow for easy iteration over themabstract Coordinatenext(Coordinate location) Returns the coordinate that is next from the given location in this directionabstract Directionturn()Returns the direction that is clockwise from the current oneReturns the direction counterclockwise from the current onestatic DirectionReturns the enum constant of this class with the specified name.static Direction[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UP
-
RIGHT
-
DOWN
-
LEFT
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
all
-
turn
Returns the direction that is clockwise from the current one- Returns:
- new direction
-
turnCounterClockwise
Returns the direction counterclockwise from the current one- Returns:
- new direction
-
next
Returns the coordinate that is next from the given location in this direction- Parameters:
location- the current location- Returns:
- the next location, given as a Coordinate
-