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
    @uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber int cabinet
    The ID of the cabinet that contains the frame that contains the BMPs.
    @uk.ac.manchester.spinnaker.machine.board.ValidFrameNumber int frame
    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 compareTo​(BMPCoords other)  
    boolean equals​(Object obj)  
    int getCabinet()  
    int getFrame()  
    int hashCode()  
    String toString()  

    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