Class TriadCoords

java.lang.Object
uk.ac.manchester.spinnaker.machine.board.TriadCoords
All Implemented Interfaces:
Comparable<TriadCoords>

public final class TriadCoords
extends Object
implements 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):

24-board layout

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

    Fields 
    Modifier and Type Field Description
    @uk.ac.manchester.spinnaker.machine.board.ValidTriadX int x
    X coordinate of triad.
    @uk.ac.manchester.spinnaker.machine.board.ValidTriadY int y
    Y coordinate of triad.
    @uk.ac.manchester.spinnaker.machine.board.ValidTriadZ int z
    Z coordinate of triad.
  • Constructor Summary

    Constructors 
    Constructor Description
    TriadCoords​(int x, int y, int z)
    Create an instance.
    TriadCoords​(String serialForm)
    Create an instance from its serial form.
  • Method Summary

    Modifier and Type Method Description
    ChipLocation asChipLocation()
    Convert these coordinates into a machine-global chip location.
    int compareTo​(TriadCoords other)  
    boolean equals​(Object obj)  
    int hashCode()  
    String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      @ValidTriadX public final @uk.ac.manchester.spinnaker.machine.board.ValidTriadX int x
      X coordinate of triad.
    • y

      @ValidTriadY public final @uk.ac.manchester.spinnaker.machine.board.ValidTriadY int y
      Y coordinate of triad.
    • z

      @ValidTriadZ public final @uk.ac.manchester.spinnaker.machine.board.ValidTriadZ int 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

      public TriadCoords​(String serialForm)
      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