Class ArithExpr

All Implemented Interfaces:
Cloneable

public class ArithExpr extends Expr
ArithExpr represents a binary arithmetic expression. It consists of two operands and an operator.
  • Field Details

  • Constructor Details

    • ArithExpr

      public ArithExpr(char operation, Expr left, Expr right, Type type)
      Constructor.
      Parameters:
      operation - Arithmetic operation that this expression performs.
      left - Left-hand argument to operation.
      right - Right-hand argument to operation.
      type - The type of this expression.
  • Method Details

    • operation

      public int operation()
    • left

      public Expr left()
    • right

      public Expr right()
    • 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
    • exprHashCode

      public int exprHashCode()
      Description copied from class: Expr
      Returns the hash code for this expresion.
      Specified by:
      exprHashCode in class Expr
    • equalsExpr

      public boolean equalsExpr(Expr other)
      Compare this arithmetic expression to another Expression.
      Specified by:
      equalsExpr in class Expr
      Parameters:
      other - Expr to which to compare this.
      Returns:
      True, if both expressions have the same contents.
    • clone

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