org.apache.jdo.impl.jdoql.tree
Class BinaryExpr

java.lang.Object
  extended byantlr.BaseAST
      extended byantlr.CommonAST
          extended byorg.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
              extended byorg.apache.jdo.impl.jdoql.tree.NodeImpl
                  extended byorg.apache.jdo.impl.jdoql.tree.Expr
                      extended byorg.apache.jdo.impl.jdoql.tree.BinaryExpr
All Implemented Interfaces:
antlr.collections.AST, BinaryExpression, java.lang.Cloneable, Expression, Node, java.io.Serializable
Direct Known Subclasses:
AndExpr, ConditionalAndExpr, ConditionalOrExpr, DivideExpr, EqualsExpr, GreaterThanEqualsExpr, GreaterThanExpr, LessThanEqualsExpr, LessThanExpr, MinusExpr, NotEqualsExpr, OrExpr, PlusExpr, TimesExpr

public abstract class BinaryExpr
extends Expr
implements BinaryExpression

This node represents a binary operator. All binary operators have exactly two children. Examples of binary operators are AndExpression and EqualsExpression.

Author:
Michael Watzek
See Also:
Serialized Form

Field Summary
(package private)  java.lang.Class commonOperandType
           
(package private)  java.lang.String commonOperandTypeName
           
 
Fields inherited from class org.apache.jdo.impl.jdoql.tree.NodeImpl
children, clazz, msg, object, parent
 
Fields inherited from class org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
column, line, typeInfo
 
Fields inherited from class antlr.CommonAST
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
  BinaryExpr()
          The noarg constructor is needed for ANTLR support and deserialization.
(package private) BinaryExpr(int tokenType, java.lang.String tokenName, java.lang.Class clazz, Expression left, Expression right)
          This constructor is called by specialized nodes.
 
Method Summary
(package private)  java.lang.Class computeJavaClass(java.lang.Class left, java.lang.Class right)
           
 java.lang.Class getCommonOperandType()
          Returns the class instance suiteable for implementing the result of this expression.
 Expression getLeftExpression()
          Returns the first child of this node.
 Expression getRightExpression()
          Returns the second child of this node.
 void setCommonOperandType(java.lang.Class clazz)
          Sets the common operand type for this binary expression.
 
Methods inherited from class org.apache.jdo.impl.jdoql.tree.NodeImpl
arrive, ASTToChildren, clone, getChildren, getJavaClass, getObject, getParent, getTokenType, leave, setChildren, setObject, setParent, toString, walkNextChild
 
Methods inherited from class org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
getColumn, getLine, getTypeInfo, initialize, initialize, initialize, setColumn, setLine, setTypeInfo, treeToString
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.jdoql.tree.Node
arrive, getChildren, getJavaClass, getObject, getParent, getTokenType, leave, setObject, setParent, walkNextChild
 

Field Detail

commonOperandType

transient java.lang.Class commonOperandType

commonOperandTypeName

java.lang.String commonOperandTypeName
Constructor Detail

BinaryExpr

public BinaryExpr()
The noarg constructor is needed for ANTLR support and deserialization. The caller must make sure to set the ANTLR tree structure himself or, call setChildren optionally.


BinaryExpr

BinaryExpr(int tokenType,
           java.lang.String tokenName,
           java.lang.Class clazz,
           Expression left,
           Expression right)
This constructor is called by specialized nodes. It calls setChildren in order to initialize the node's children left and right.

Parameters:
tokenType - the token type
tokenName - the name of this node
clazz - the Java type of this node
left - the first child
right - the second child
Method Detail

getLeftExpression

public Expression getLeftExpression()
Returns the first child of this node.

Specified by:
getLeftExpression in interface BinaryExpression
Returns:
the first child

getRightExpression

public Expression getRightExpression()
Returns the second child of this node.

Specified by:
getRightExpression in interface BinaryExpression
Returns:
the second child

getCommonOperandType

public java.lang.Class getCommonOperandType()
Returns the class instance suiteable for implementing the result of this expression. In case of integral binary expressions that class instance is also the result type of the operation retrieved by method getJavaClass. In case of relational binary expressions, that class instance differs from the type retrieved by getJavaClass, because relational binary expressions have a boolean result type which does not depend of the operand types.

Specified by:
getCommonOperandType in interface BinaryExpression
Returns:
the common operand type

setCommonOperandType

public void setCommonOperandType(java.lang.Class clazz)
Sets the common operand type for this binary expression.

Parameters:
clazz - the common operand type

computeJavaClass

java.lang.Class computeJavaClass(java.lang.Class left,
                                 java.lang.Class right)