java.lang.Object
uk.ac.manchester.spinnaker.messages.model.Blacklist
All Implemented Interfaces:
Serializable

public final class Blacklist
extends Object
implements Serializable
A blacklist read off a board. Note that all chip coordinates are board-relative and all processor IDs are physical; the boot process applies blacklists before inter-board links are brought up and before the virtual-to-physical core mapping is established.
Author:
Donal Fellows
See Also:
Serialized Form
  • Constructor Details

    • Blacklist

      public Blacklist​(ByteBuffer buffer)
      Create a blacklist from raw data.
      Parameters:
      buffer - The raw data to parse.
    • Blacklist

      public Blacklist​(Set<ChipLocation> deadChips, Map<ChipLocation,​? extends Set<Integer>> deadCores, Map<ChipLocation,​? extends Set<Direction>> deadLinks)
      Create a blacklist from parsed data.
      Parameters:
      deadChips - The set of chips that are dead.
      deadCores - The set of physical core IDs that are dead on live chips. Should not contain any empty sets of physical core IDs; caller should ensure.
      deadLinks - The set of link directions that are dead on live chips. Should not contain any empty sets of directions; caller should ensure.
    • Blacklist

      public Blacklist​(String blacklistText)
      Create a blacklist from a string.
      Parameters:
      blacklistText - The string to parse.
      Throws:
      IllegalArgumentException - If the string is badly formatted.
    • Blacklist

      public Blacklist​(File blacklistFile) throws IOException
      Create a blacklist from a text file.
      Parameters:
      blacklistFile - The file to parse.
      Throws:
      IOException - If the file can't be read from.
      IllegalArgumentException - If the string is badly formatted.
  • Method Details

    • render

      public String render()
      Convert the blacklist to a string in a human-readable format. This is the format understood by Blacklist(String).

      Note that the result may omit information in the original blacklist, but only if that would also be ignored by the string parser.

      Returns:
      The string form of the blacklist.
      Throws:
      RuntimeException - If something goes wrong. Not expected!
    • getChips

      public Set<ChipLocation> getChips()
      Returns:
      The chips on the board that are blacklisted. A chip being blacklisted means that its links will also be blacklisted.
    • getCores

      public Map<ChipLocation,​Set<Integer>> getCores()
      Returns:
      The cores on the board that are blacklisted where the whole chip is not blacklisted. Note that these are physical processor IDs, not logical ones.
    • getLinks

      public Map<ChipLocation,​Set<Direction>> getLinks()
      Returns:
      The links on the board that are blacklisted.
    • isChipMentioned

      public boolean isChipMentioned​(ChipLocation chip)
      Test if a chip is known about by the blacklist.
      Parameters:
      chip - The chip to look for. Coordinates must be board-local.
      Returns:
      Whether the chip is mentioned in the blacklist. That could be if it is blacklisted, if it has a blacklisted core, of if one of its links is blacklisted.
    • getRawData

      public ByteBuffer getRawData()
      Returns:
      The raw blacklist data in little-endian form. Read only.
    • hashCode

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

      public boolean equals​(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object