Class ExceptionBlockImpl

All Implemented Interfaces:
Block, ExceptionBlock, SingleSuccessorBlock, org.plumelib.util.UniqueId

public class ExceptionBlockImpl extends SingleSuccessorBlockImpl implements ExceptionBlock
Implementation of ExceptionBlock.
  • Field Details

    • node

      protected @Nullable Node node
      The node of this block.
    • exceptionalSuccessors

      protected final Map<TypeMirror,Set<Block>> exceptionalSuccessors
      Set of exceptional successors.
  • Constructor Details

    • ExceptionBlockImpl

      public ExceptionBlockImpl()
      Create an empty exceptional block.
  • Method Details

    • setNode

      public void setNode(Node c)
      Set the node.
    • getNode

      public Node getNode()
      Description copied from interface: ExceptionBlock
      Returns the node of this block.
      Specified by:
      getNode in interface ExceptionBlock
      Returns:
      the node of this block
    • getNodes

      public List<Node> getNodes()
      Returns the nodes contained within this basic block. The list may be empty.

      The following invariant holds.

       forall n in getNodes() :: n.getBlock() == this
       

      This implementation returns a singleton list.

      Specified by:
      getNodes in interface Block
      Returns:
      the nodes contained within this basic block
    • getLastNode

      public @Nullable Node getLastNode()
      Description copied from interface: Block
      Returns the last node of this block, or null if none.
      Specified by:
      getLastNode in interface Block
      Returns:
      the last node of this block or null
    • addExceptionalSuccessor

      public void addExceptionalSuccessor(BlockImpl b, TypeMirror cause)
      Add an exceptional successor.
      Parameters:
      b - the successor
      cause - the exception type that leads to the given block
    • getExceptionalSuccessors

      public Map<TypeMirror,Set<Block>> getExceptionalSuccessors()
      Description copied from interface: ExceptionBlock
      Returns the list of exceptional successor blocks as an unmodifiable map.
      Specified by:
      getExceptionalSuccessors in interface ExceptionBlock
      Returns:
      the list of exceptional successor blocks as an unmodifiable map
    • getSuccessors

      public Set<Block> getSuccessors()
      Description copied from interface: Block
      Returns the successors of this basic block.
      Specified by:
      getSuccessors in interface Block
      Overrides:
      getSuccessors in class SingleSuccessorBlockImpl
      Returns:
      the successors of this basic block
    • toString

      public String toString()
      Overrides:
      toString in class Object