Enum Direction
- All Implemented Interfaces:
Serializable
,Comparable<Direction>
public enum Direction extends Enum<Direction>
A direction from one SpiNNaker chip to another.
- Author:
- Christian-B
-
Enum Constant Summary
Enum Constants Enum Constant Description EAST
Direction 0 typically towards a location x + 1, y.NORTH
Direction 2 typically towards a location x, y +1.NORTHEAST
Direction 1 typically towards a location x + 1, y +1.SOUTH
Direction 5 typically towards a location x, y -1.SOUTHWEST
Direction 4 typically towards a location x -1, y -1.WEST
Direction 3 typically towards a location x - 1, y. -
Field Summary
Fields Modifier and Type Field Description int
id
The ID of this direction when it is expressed as anint
.String
label
The string representation, for example used in JSON.int
xChange
The typical change to X when moving in this direction.int
yChange
The typical change to Y when moving in this direction. -
Method Summary
Modifier and Type Method Description static Direction
byId(int id)
The Direction with this ID when expressed as anint
.static Direction
byLabel(String label)
The Direction with this labelstatic Direction
valueOf(String name)
Returns the enum constant of this type with the specified name.static Direction[]
values()
Returns an array containing the constants of this enum type, 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 type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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
-
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.
-