Package com.epicbot.api.shared.model
Enum Class Direction
- All Implemented Interfaces:
Serializable,Comparable<Direction>,Constable
Represents the four main cardinal points.
Angles are represented as an int value ranging from 0-2047, where the following is true:
- 0 or 2048 is true South
- 256 is true South-West
- 512 is true West
- 768 is true North-West
- 1024 is true North
- 1280 is true North-East
- 1536 is true East
- 1792 is true South-East
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAngles ranging from 1408 - 1663.Angles ranging from 896 - 1151.Angles ranging from 1152 - 1407.Angles ranging from 640 - 895.Angles ranging from 0 - 127 and 1920 - 2047.Angles ranging from 1664 - 1919.Angles ranging from 128 - 383.Angles ranging from 384 - 639. -
Method Summary
Modifier and TypeMethodDescriptionstatic Directionget(int angle) Converts the angle value to the nearest cardinal direction.static intgetAngleTo(Locatable origin, Locatable locatable) static intgetAngleToDeg(Locatable origin, Locatable locatable) static DirectiongetDirectionTo(Locatable origin, Locatable locatable) static inttoDegrees(int angle) static inttoRS(int degrees) static 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
-
SOUTH
Angles ranging from 0 - 127 and 1920 - 2047. -
SOUTH_WEST
Angles ranging from 128 - 383. -
WEST
Angles ranging from 384 - 639. -
NORTH_WEST
Angles ranging from 640 - 895. -
NORTH
Angles ranging from 896 - 1151. -
NORTH_EAST
Angles ranging from 1152 - 1407. -
EAST
Angles ranging from 1408 - 1663. -
SOUTH_EAST
Angles ranging from 1664 - 1919.
-
-
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
-
get
Converts the angle value to the nearest cardinal direction.Each cardinal direction contains 256 angles, ranging between -128 and +128 of it's true value. Negative values and values above 2047 are wrapped accordingly
- Parameters:
angle- the RS angle- Returns:
- Nearest cardinal direction to the angle
-
toRS
public static int toRS(int degrees) -
toDegrees
public static int toDegrees(int angle)
-