org.apache.derby.impl.sql.compile
Class IsNode

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.ValueNode
          extended by org.apache.derby.impl.sql.compile.BinaryOperatorNode
              extended by org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode
                  extended by org.apache.derby.impl.sql.compile.IsNode
All Implemented Interfaces:
Visitable

public class IsNode
extends BinaryLogicalOperatorNode


Field Summary
private  boolean notMe
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode
shortCircuitValue
 
Fields inherited from class org.apache.derby.impl.sql.compile.BinaryOperatorNode
AND, BinaryArgTypes, BinaryMethodNames, BinaryOperators, BinaryResultTypes, CONCATENATE, DIVIDE, EQ, GE, GT, LE, leftInterfaceType, leftOperand, LIKE, LT, methodName, MINUS, NE, operator, operatorType, OR, PLUS, receiver, resultInterfaceType, rightInterfaceType, rightOperand, TIMES, XMLEXISTS_OP, XMLQUERY_OP
 
Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode
transformed
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
 
Constructor Summary
IsNode()
           
 
Method Summary
 ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector)
          Bind this logical operator.
 ValueNode changeToCNF(boolean underTopAndNode)
          Finish putting an expression into conjunctive normal form.
(package private)  ValueNode eliminateNots(boolean underNotNode)
          Eliminate NotNodes in the current query block.
 void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
          Do code generation for this logical binary operator.
 void init(java.lang.Object leftOperand, java.lang.Object rightOperand, java.lang.Object notMe)
          Initializer for an IsNode
 ValueNode putAndsOnTop()
          Do the 1st step in putting child expressions into conjunctive normal form.
 boolean verifyChangeToCNF()
          Verify that changeToCNF() did its job correctly.
 boolean verifyPutAndsOnTop()
          Verify that putAndsOnTop() did its job correctly.
 
Methods inherited from class org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode
resolveLogicalBinaryOperator, verifyEliminateNots
 
Methods inherited from class org.apache.derby.impl.sql.compile.BinaryOperatorNode
acceptChildren, bindXMLQuery, categorize, constantExpression, genSQLJavaSQLTree, getLeftOperand, getOrderableVariantType, getReceiverInterfaceName, getRightOperand, init, init, initializeResultField, isConstantExpression, isEquivalent, preprocess, printSubNodes, remapColumnReferencesToExpressions, setLeftOperand, setLeftRightInterfaceType, setMethodName, setOperator, setRightOperand, toString
 
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, evaluateConstantExpressions, genEqualsFalseTree, generate, generateFilter, genIsNullTree, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isInListProbeNode, isParameterNode, isRelationalOperator, isSameNodeType, optimizableEqualityNode, requiresTypeFromContext, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, updatableByCursor
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

notMe

private boolean notMe
Constructor Detail

IsNode

public IsNode()
Method Detail

init

public void init(java.lang.Object leftOperand,
                 java.lang.Object rightOperand,
                 java.lang.Object notMe)
Initializer for an IsNode

Overrides:
init in class BinaryLogicalOperatorNode
Parameters:
leftOperand - The left operand of the IS
rightOperand - The right operand of the IS
notMe - Whether to reverse the sense of this node.

bindExpression

public ValueNode bindExpression(FromList fromList,
                                SubqueryList subqueryList,
                                java.util.Vector aggregateVector)
                         throws StandardException
Bind this logical operator. All that has to be done for binding a logical operator is to bind the operands, check that both operands are BooleanDataValue, and set the result type to BooleanDataValue.

Overrides:
bindExpression in class BinaryLogicalOperatorNode
Parameters:
fromList - The query's FROM list
subqueryList - The subquery list being built as we find SubqueryNodes
aggregateVector - The aggregate vector being built as we find AggregateNodes
Returns:
The new top of the expression tree.
Throws:
StandardException - Thrown on error

eliminateNots

ValueNode eliminateNots(boolean underNotNode)
                  throws StandardException
Eliminate NotNodes in the current query block. We just mark whether this IS node is under an eliminated NOT node.

Overrides:
eliminateNots in class ValueNode
Parameters:
underNotNode - Whether or not we are under a NotNode.
Returns:
The modified expression
Throws:
StandardException - Thrown on error

putAndsOnTop

public ValueNode putAndsOnTop()
                       throws StandardException
Do the 1st step in putting child expressions into conjunctive normal form. This step ensures that the top level of the child expression is a chain of AndNodes terminated by a true BooleanConstantNode.

Overrides:
putAndsOnTop in class ValueNode
Returns:
The modified expression
Throws:
StandardException - Thrown on error

verifyPutAndsOnTop

public boolean verifyPutAndsOnTop()
Verify that putAndsOnTop() did its job correctly. Verify that the top level of the expression is a chain of AndNodes terminated by a true BooleanConstantNode.

Overrides:
verifyPutAndsOnTop in class ValueNode
Returns:
Boolean which reflects validity of the tree.

changeToCNF

public ValueNode changeToCNF(boolean underTopAndNode)
                      throws StandardException
Finish putting an expression into conjunctive normal form. An expression tree in conjunctive normal form meets the following criteria: o If the expression tree is not null, the top level will be a chain of AndNodes terminating in a true BooleanConstantNode. o The left child of an AndNode will never be an AndNode. o Any right-linked chain that includes an AndNode will be entirely composed of AndNodes terminated by a true BooleanConstantNode. o The left child of an OrNode will never be an OrNode. o Any right-linked chain that includes an OrNode will be entirely composed of OrNodes terminated by a false BooleanConstantNode. o ValueNodes other than AndNodes and OrNodes are considered leaf nodes for purposes of expression normalization. In other words, we won't do any normalization under those nodes. In addition, we track whether or not we are under a top level AndNode. SubqueryNodes need to know this for subquery flattening.

Overrides:
changeToCNF in class ValueNode
Parameters:
underTopAndNode - Whether or not we are under a top level AndNode.
Returns:
The modified expression
Throws:
StandardException - Thrown on error

verifyChangeToCNF

public boolean verifyChangeToCNF()
Verify that changeToCNF() did its job correctly. Verify that: o AndNode - rightOperand is not instanceof OrNode leftOperand is not instanceof AndNode o OrNode - rightOperand is not instanceof AndNode leftOperand is not instanceof OrNode

Overrides:
verifyChangeToCNF in class ValueNode
Returns:
Boolean which reflects validity of the tree.

generateExpression

public void generateExpression(ExpressionClassBuilder acb,
                               MethodBuilder mb)
                        throws StandardException
Do code generation for this logical binary operator.

Overrides:
generateExpression in class BinaryLogicalOperatorNode
Parameters:
acb - The ExpressionClassBuilder for the class we're generating
mb - the method the expression will go into
Throws:
StandardException - Thrown on error

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.