org.extex.ocpware.compiler.arith
Class BinaryOp

java.lang.Object
  extended by org.extex.ocpware.compiler.arith.ArithExpr
      extended by org.extex.ocpware.compiler.arith.BinaryOp

public class BinaryOp
extends ArithExpr

This class represents the binary addition operation of two arithmetic expressions.

Version:
$Revision:6007 $
Author:
Gerd Neugebauer

Constructor Summary
BinaryOp(int opCode, java.lang.String op, ArithExpr left, ArithExpr right)
          Creates a new object.
BinaryOp(int opCode, java.lang.String op, ArithExpr left, ArithExpr right, boolean needsParen)
          Creates a new object.
 
Method Summary
 ArithExpr getLeft()
          Getter for left.
 java.lang.String getOp()
          Getter for op.
 ArithExpr getRight()
          Getter for right.
 boolean needsParen()
          Return the indicator that parentheses are needed when printed in a wider arithmetic context.
 java.lang.String toString()
          
 
Methods inherited from class org.extex.ocpware.compiler.arith.ArithExpr
parse, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryOp

public BinaryOp(int opCode,
                java.lang.String op,
                ArithExpr left,
                ArithExpr right)
Creates a new object.

Parameters:
opCode - the op code
op - the print presentation
left - the left argument
right - the right argument

BinaryOp

public BinaryOp(int opCode,
                java.lang.String op,
                ArithExpr left,
                ArithExpr right,
                boolean needsParen)
Creates a new object.

Parameters:
opCode - the op code
op - the print presentation
left - the left argument
right - the right argument
needsParen - the indicator for the precedence of the operator
Method Detail

getLeft

public ArithExpr getLeft()
Getter for left.

Returns:
the left

getOp

public java.lang.String getOp()
Getter for op.

Returns:
the op

getRight

public ArithExpr getRight()
Getter for right.

Returns:
the right

needsParen

public boolean needsParen()
Return the indicator that parentheses are needed when printed in a wider arithmetic context.

Overrides:
needsParen in class ArithExpr
Returns:
the indicator
See Also:
ArithExpr.needsParen()

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()