Class BoxIfElse

All Implemented Interfaces:
BoxVisitable

public class BoxIfElse extends BoxStatement
AST Node representing a if statement
  • Constructor Details

    • BoxIfElse

      public BoxIfElse(BoxExpression condition, BoxStatement thenBody, BoxStatement elseBody, Position position, String sourceText)
      Creates the AST node
      Parameters:
      condition - expression representing the condition to test
      thenBody - list of the statements to execute when the condition is true
      elseBody - list of the statements foe the else, empty if the else body is not present
      position - position of the statement in the source code
      sourceText - source code that originated the Node
  • Method Details

    • getCondition

      public BoxExpression getCondition()
    • getThenBody

      public BoxStatement getThenBody()
    • getElseBody

      public BoxStatement getElseBody()
    • setCondition

      public void setCondition(BoxExpression condition)
    • setThenBody

      public void setThenBody(BoxStatement thenBody)
    • setElseBody

      public void setElseBody(BoxStatement elseBody)
    • toMap

      public Map<String,Object> toMap()
      Overrides:
      toMap in class BoxNode
    • accept

      public void accept(VoidBoxVisitor v)
      Description copied from interface: BoxVisitable
      Accept method for visitor support.
      Parameters:
      v - the visitor implementation
    • accept

      public BoxNode accept(ReplacingBoxVisitor v)
      Description copied from interface: BoxVisitable
      Accept method for replacing visitor support. Each accept returns the node, or a replacement node.
      Parameters:
      v - the visitor implementation