Class TriadCoords
java.lang.Object
uk.ac.manchester.spinnaker.machine.board.TriadCoords
- All Implemented Interfaces:
Comparable<TriadCoords>
Triad coordinates.
Boards are in groups of three (triads) that group together in a rectangular
grid. The
x and y coordinates say which group of three in the
grid, and the z coordinate says which board within the group. The
group is not itself rectangular, but tesselates on a rectangular grid.
To understand how the triad coordinate system works, consider this board layout (a classic 24 board machine, with wrap-arounds not shown):
Serialisation Formats
Defaults to being serialised as a JSON object:{"x": 3, "y": 2, "z": 1}
and can also be deserialized from that, but can also accept being
deserialised from a JSON array:
[3, 2, 1]and can also be deserialized from its string form:
[x:3,y:2,z:1]
- Author:
- Donal Fellows
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal @uk.ac.manchester.spinnaker.machine.board.ValidTriadX intX coordinate of triad.final @uk.ac.manchester.spinnaker.machine.board.ValidTriadY intY coordinate of triad.final @uk.ac.manchester.spinnaker.machine.board.ValidTriadZ intZ coordinate of triad. -
Constructor Summary
ConstructorsConstructorDescriptionTriadCoords(int x, int y, int z) Create an instance.TriadCoords(String serialForm) Create an instance from its serial form. -
Method Summary
Modifier and TypeMethodDescriptionConvert these coordinates into a machine-global chip location.intcompareTo(TriadCoords other) booleaninthashCode()toString()
-
Field Details
-
x
X coordinate of triad. -
y
Y coordinate of triad. -
z
Z coordinate of triad.
-
-
Constructor Details
-
TriadCoords
public TriadCoords(int x, int y, int z) Create an instance.- Parameters:
x- X coordinate.y- Y coordinate.z- Z coordinate.
-
TriadCoords
Create an instance from its serial form. The serial form (where the numbers may vary) is:[x:3,y:5,z:2]
- Parameters:
serialForm- The form to deserialise.- Throws:
IllegalArgumentException- If the string is not in the right form.
-
-
Method Details
-
asChipLocation
Convert these coordinates into a machine-global chip location.- Returns:
- The chip location relative to the root of the machine.
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<TriadCoords>
-