Class BoxUnaryOperation

All Implemented Interfaces:
BoxVisitable

public class BoxUnaryOperation extends BoxExpression
AST Node representing a unary operator
  • Constructor Details

    • BoxUnaryOperation

      public BoxUnaryOperation(BoxExpression expr, BoxUnaryOperator operator, Position position, String sourceText)
      Parameters:
      expr - expression
      operator - operator to apply
      position - position of the statement in the source code
      sourceText - source code that originated the Node
  • Method Details

    • getExpr

      public BoxExpression getExpr()
    • getOperator

      public BoxUnaryOperator getOperator()
    • setExpr

      public void setExpr(BoxExpression expr)
    • setOperator

      public void setOperator(BoxUnaryOperator operator)
    • 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
    • getDescription

      public String getDescription()
      Description copied from class: BoxNode
      Returns a human-readable description of the node, which it manufactures from the class name.

      While that is quite often good enough, override this method in subclasses to provide a better description when this default does not work quite right.

      Overrides:
      getDescription in class BoxNode
      Returns:
      human readable description of the expression, for use in error messages etc