Enum Class Direction
- All Implemented Interfaces:
Serializable
,Comparable<Direction>
,Constable
A direction from one SpiNNaker chip to another.
- Author:
- Christian-B
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDirection 0 typically towards a location x + 1, y.Direction 2 typically towards a location x, y +1.Direction 1 typically towards a location x + 1, y +1.Direction 5 typically towards a location x, y -1.Direction 4 typically towards a location x -1, y -1.Direction 3 typically towards a location x - 1, y. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int
The ID of this direction when it is expressed as anint
.final String
The string representation, for example used in JSON.final int
The typical change to X when moving in this direction.final int
The typical change to Y when moving in this direction. -
Method Summary
Modifier and TypeMethodDescriptionstatic Direction
byId
(int id) The Direction with this ID when expressed as anint
.static Direction
The Direction with this labelstatic Direction
Returns 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
-
EAST
Direction 0 typically towards a location x + 1, y. -
NORTHEAST
Direction 1 typically towards a location x + 1, y +1. -
NORTH
Direction 2 typically towards a location x, y +1. -
WEST
Direction 3 typically towards a location x - 1, y. -
SOUTHWEST
Direction 4 typically towards a location x -1, y -1. -
SOUTH
Direction 5 typically towards a location x, y -1.
-
-
Field Details
-
id
public final int idThe ID of this direction when it is expressed as anint
. -
xChange
public final int xChangeThe typical change to X when moving in this direction. -
yChange
public final int yChangeThe typical change to Y when moving in this direction. -
label
The string representation, for example used in JSON.
-
-
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
-
byId
The Direction with this ID when expressed as anint
.- Parameters:
id
- ID of this Direction- Returns:
- Direction with this ID
- Throws:
ArrayIndexOutOfBoundsException
- if the ID is not correct
-
byLabel
The Direction with this labelThe current implementation assumes the labels are lower-case and words are separated by underscore (e.g.,
north_east
).- Parameters:
label
- Label of a direction- Returns:
- A valid direction
- Throws:
IllegalArgumentException
- If no direction is found.
-