Class BMPCoords

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

@Immutable public final class BMPCoords extends Object implements Comparable<BMPCoords>
A simple description of a BMP to talk to. Supports equality and being used as a hash key.

Although every board technically has a BMP, they are managed at the level of a frame (when a sufficient quantity of boards is used, typically but not necessarily 24). Cabinets contain frames.

Serialisation Formats

Defaults to being serialised as a JSON object:
{"cabinet": 3, "frame": 2}
and can be deserialized from that, or:
{"c": 3, "f": 2}
It can also accept being deserialised from a JSON array, for a more compact notation:
[3, 2]
Finally, it can also be deserialised from the string form created by the toString() method:
[c:3,f:2]
Author:
Donal Fellows
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final @uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber int
    The ID of the cabinet that contains the frame that contains the BMPs.
    final @uk.ac.manchester.spinnaker.machine.board.ValidFrameNumber int
    The ID of the frame that contains the master BMP.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BMPCoords(int cabinet, int frame)
    Create an instance.
    BMPCoords(String serialForm)
    Create an instance from its serial form.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     
    int
     
    int
     
    int
     
     

    Methods inherited from class java.lang.Object

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

    • cabinet

      @ValidCabinetNumber public final @uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber int cabinet
      The ID of the cabinet that contains the frame that contains the BMPs.
    • frame

      @ValidFrameNumber public final @uk.ac.manchester.spinnaker.machine.board.ValidFrameNumber int frame
      The ID of the frame that contains the master BMP. Frames are contained within a cabinet.
  • Constructor Details

    • BMPCoords

      public BMPCoords(int cabinet, int frame)
      Create an instance.
      Parameters:
      cabinet - Cabinet number.
      frame - Frame number.
    • BMPCoords

      public BMPCoords(String serialForm)
      Create an instance from its serial form. This is the form produced by toString(). The serial form (where the numbers may vary) is:
       [c:34,f:12]
       
      Parameters:
      serialForm - The form to deserialise.
      Throws:
      IllegalArgumentException - If the string is not in the right form.
  • Method Details

    • getCabinet

      public int getCabinet()
      Returns:
      The ID of the cabinet that contains the frame that contains the BMPs.
    • getFrame

      public int getFrame()
      Returns:
      The ID of the frame that contains the master BMP. Frames are contained within a cabinet.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(BMPCoords other)
      Specified by:
      compareTo in interface Comparable<BMPCoords>