All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class openjava.ptree.BinaryExpression

java.lang.Object
   |
   +----openjava.ptree.PtreeObject
           |
           +----openjava.ptree.NonLeaf
                   |
                   +----openjava.ptree.BinaryExpression

public class BinaryExpression
extends NonLeaf
implements Expression
The BinaryExpression class represents an expression which consists of an operators and two operands.
This doesn't includes the expression whose operator is the instanceof operator nor the expression whose operator is one of the assignment operators.
If the operator in the expression of the left operand or the right operand has week unity, this automatically produces the code in which the left operand is enclosed by parenthesises.
In the case the left is a + b, the operator is * the right is c + d, this produces the code :
     (a + b) * (c + d)
 

See Also:
Expression, InstatnceofExpression, AssignmentExpression

Variable Index

 o BITAND
 o BITOR
 o DIVIDE
 o EQUAL
 o GREATER
 o GREATEREQUAL
 o INSTANCEOF
 o LESS
 o LESSEQUAL
 o LOGICAL_AND
 o LOGICAL_OR
 o MINUS
 o MOD
 o NOTEQUAL
 o PLUS
 o SHIFT_L
 o SHIFT_R
 o SHIFT_RR
 o TIMES
 o XOR

Constructor Index

 o BinaryExpression(Expression, int, Expression)
Allocates a new object.

Method Index

 o getKind()
 o getLeft()
Gets the expression of the left operand.
 o getOperator()
Gets the id number of the operator.
 o getRight()
Gets the expression of the right operand.
 o makeCopy()
Makes a new copy of this nonleaf-node as a ptree-node.
 o makeRecursiveCopy()
Makes a new copy (another object) of this nonleaf-node recursively.
 o setLeft(Expression)
Sets the expression of the left operand.
 o setOperator(int)
Sets the id number of the operator.
 o setRight(Expression)
Sets the expression of the right operand.
 o strength(int)
Returns the strength of the union of the operator.
 o writeCode()
Writes the code this parse-tree presents for.

Variables

 o TIMES
 public static final int TIMES
 o DIVIDE
 public static final int DIVIDE
 o MOD
 public static final int MOD
 o PLUS
 public static final int PLUS
 o MINUS
 public static final int MINUS
 o SHIFT_L
 public static final int SHIFT_L
 o SHIFT_R
 public static final int SHIFT_R
 o SHIFT_RR
 public static final int SHIFT_RR
 o LESS
 public static final int LESS
 o GREATER
 public static final int GREATER
 o LESSEQUAL
 public static final int LESSEQUAL
 o GREATEREQUAL
 public static final int GREATEREQUAL
 o INSTANCEOF
 public static final int INSTANCEOF
 o EQUAL
 public static final int EQUAL
 o NOTEQUAL
 public static final int NOTEQUAL
 o BITAND
 public static final int BITAND
 o XOR
 public static final int XOR
 o BITOR
 public static final int BITOR
 o LOGICAL_AND
 public static final int LOGICAL_AND
 o LOGICAL_OR
 public static final int LOGICAL_OR

Constructors

 o BinaryExpression
 public BinaryExpression(Expression lexp,
                         int opr,
                         Expression rexp)
Allocates a new object.

Parameters:
lexp - the expression of the left operand.
opr - the id number of operator.
rexp - the expression of the right operand.

Methods

 o makeRecursiveCopy
 public Ptree makeRecursiveCopy()
Makes a new copy (another object) of this nonleaf-node recursively.

Overrides:
makeRecursiveCopy in class NonLeaf
 o makeCopy
 public Ptree makeCopy()
Makes a new copy of this nonleaf-node as a ptree-node.

Overrides:
makeCopy in class NonLeaf
 o writeCode
 public void writeCode()
Writes the code this parse-tree presents for.

Overrides:
writeCode in class NonLeaf
 o strength
 protected static final int strength(int op)
Returns the strength of the union of the operator.

Parameters:
op - the id number of operator.
Returns:
the strength of the union.
 o getLeft
 public Expression getLeft()
Gets the expression of the left operand.

Returns:
the left expression.
 o setLeft
 public void setLeft(Expression lexpr)
Sets the expression of the left operand.

Parameters:
lexpr - the left expression.
 o getRight
 public Expression getRight()
Gets the expression of the right operand.

Returns:
the right expression.
 o setRight
 public void setRight(Expression rexpr)
Sets the expression of the right operand.

Parameters:
rexpr - the right expression.
 o getOperator
 public int getOperator()
Gets the id number of the operator.

Returns:
the id number of the operator.
See Also:
TIMES, DIVIDE, MOD, PLUS, MINUS, SHIFT_L, SHIFT_R, SHIFT_RR, LESS, GREATER, LESSEQUAL, GREATEREQUAL, INSTANCEOF, EQUAL, NOTEQUAL, BITAND, XOR, BITOR, LOGICAL_AND, LOGICAL_OR
 o getKind
 public int getKind()
 o setOperator
 public void setOperator(int opr)
Sets the id number of the operator.

Parameters:
opr - the id number of the operator.
See Also:
TIMES, DIVIDE, MOD, PLUS, MINUS, SHIFT_L, SHIFT_R, SHIFT_RR, LESS, GREATER, LESSEQUAL, GREATEREQUAL, INSTANCEOF, EQUAL, NOTEQUAL, BITAND, XOR, BITOR, LOGICAL_AND, LOGICAL_OR

All Packages  Class Hierarchy  This Package  Previous  Next  Index