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
-
Method Summary
-
Field Details
-
cabinet
@ValidCabinetNumber public final @uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber int cabinetThe ID of the cabinet that contains the frame that contains the BMPs. -
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
Create an instance from its serial form. This is the form produced bytoString()
. 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
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<BMPCoords>
-