Class CatchHandlerList

All Implemented Interfaces:
ToHuman, Comparable<CatchHandlerList>

public final class CatchHandlerList extends FixedSizeList implements Comparable<CatchHandlerList>
Ordered list of (exception type, handler address) entries.
  • Field Details

  • Constructor Details

    • CatchHandlerList

      public CatchHandlerList(int size)
      Constructs an instance. All indices initially contain null.
      Parameters:
      size - >= 0; the size of the list
  • Method Details

    • get

      public CatchHandlerList.Entry get(int n)
      Gets the element at the given index. It is an error to call this with the index for an element which was never set; if you do that, this will throw NullPointerException.
      Parameters:
      n - >= 0, < size(); which index
      Returns:
      non-null; element at that index
    • toHuman

      public String toHuman()
      Return the "human" string form of this instance. This is generally less "debuggy" than toString(). This method will only work if every element of the list implements ToHuman.
      Specified by:
      toHuman in interface ToHuman
      Overrides:
      toHuman in class FixedSizeList
      Returns:
      non-null; the human string form
    • toHuman

      public String toHuman(String prefix, String header)
      Get the human form of this instance, prefixed on each line with the string.
      Parameters:
      prefix - non-null; the prefix for every line
      header - non-null; the header for the first line (after the first prefix)
      Returns:
      non-null; the human form
    • catchesAll

      public boolean catchesAll()
      Returns whether or not this instance ends with a "catch-all" handler.
      Returns:
      true if this instance ends with a "catch-all" handler or false if not
    • set

      public void set(int n, CstType exceptionType, int handler)
      Sets the entry at the given index.
      Parameters:
      n - >= 0, < size(); which index
      exceptionType - non-null; type of exception handled
      handler - >= 0; exception handler address
    • set

      public void set(int n, CatchHandlerList.Entry entry)
      Sets the entry at the given index.
      Parameters:
      n - >= 0, < size(); which index
      entry - non-null; the entry to set at n
    • compareTo

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