Class SwitchStmt


public class SwitchStmt extends JumpStmt
SwitchStmt represents a switch statement.
  • Constructor Details

    • SwitchStmt

      public SwitchStmt(Expr index, Block defaultTarget, Block[] targets, int[] values)
      Constructor.
      Parameters:
      index - The expression on which the switch is made.
      defaultTarget - The code to be executed if index is not contained in values.
      targets - The code to be executed for each value in values.
      values - The interesting values that index can have. That is, the values of index in which a non-default target is executed.
  • Method Details

    • index

      public Expr index()
    • setDefaultTarget

      public void setDefaultTarget(Block block)
    • defaultTarget

      public Block defaultTarget()
    • targets

      public Block[] targets()
    • values

      public int[] values()
    • visitForceChildren

      public void visitForceChildren(TreeVisitor visitor)
      Description copied from class: Node
      Visit the children of this node. Not all Nodes will have children to visit.
      Specified by:
      visitForceChildren in class Node
    • visit

      public void visit(TreeVisitor visitor)
      Specified by:
      visit in class Node
    • clone

      public Object clone()
      Specified by:
      clone in class Stmt