Interface OperatorNode

All Superinterfaces:
ASTNode, ExpressionNode, ForLoopInitializerNode, InitializerNode, SizeableNode

public interface OperatorNode extends ExpressionNode

A node that represents an expression built using an operator.

The most common type of expression is an expression that involves an operator and some number of operands. The operands are the children of this AST node.

  • Method Details

    • getOperator

      OperatorNode.Operator getOperator()
      Returns the operator of this expression.
      Returns:
      the operator
    • setOperator

      void setOperator(OperatorNode.Operator operator)
      Sets the operator of this expression.
      Parameters:
      operator - the operator
    • getNumberOfArguments

      int getNumberOfArguments()
      Returns the number of arguments (operands) in this operator expression.
      Returns:
      the number of arguments
    • getArgument

      ExpressionNode getArgument(int index)
      Returns the index-th argument, indexed from 0.
      Returns:
      the index-th argument (operand) of this expression
    • setArgument

      void setArgument(int index, ExpressionNode value)
      Sets the index-th argument of this expression to be the given expression
      Parameters:
      index - nonnegative integer in appropriate range for the operator
      value - expression to be made the operand in that index
    • copy

      OperatorNode copy()
      Description copied from interface: ASTNode
      Returns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.
      Specified by:
      copy in interface ASTNode
      Specified by:
      copy in interface ExpressionNode
      Specified by:
      copy in interface ForLoopInitializerNode
      Specified by:
      copy in interface InitializerNode
      Specified by:
      copy in interface SizeableNode
      Returns:
      deep copy of this node