Package com.j_spaces.jdbc.parser
Class ExpNode
java.lang.Object
com.j_spaces.jdbc.parser.ExpNode
- All Implemented Interfaces:
SmartExternalizable,Externalizable,Serializable,Cloneable
- Direct Known Subclasses:
AbstractInNode,AndNode,ContainsNode,EqualNode,GTENode,GTNode,IsNullNode,LikeNode,LTENode,LTNode,NotEqualNode,NotLikeNode,OrNode,RelationNode,RLikeNode,ValueNode
This is the main expression node. it holds to children, left and right, and has a few abstract
method that all subclasses must implement.
- Author:
- Michael Mitrani, 2Train4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExpNodeprotected ExpNodeprotected QueryTemplatePacket -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaccept(QueryTemplateBuilder builder) Accept the query builder Default implementation returns null - no QueryTemplatePacket is definedvoidaccept(IQueryExecutor executor, ISpaceProxy space, Transaction txn, int readModifier, int max) Accept the query executorclone()Override the clone method.createIndex(QueryTableData queryTableData, IQueryResultSet<IEntryPacket> tableEntries) booleancreateJoinIndex(QueryTableData tableData) voidforEachChild(java.util.function.Consumer<ExpNode> consumer) Applies the consumer on each non-null child.booleanbooleanbooleanGets whether this node has a child which is an inner query nodebooleanisJoined()is there somewhere in the tree a join condition.abstract booleanisValidCompare(Object ob1, Object ob2) Operator nodes implement this method to return whether two objects satisfy the given condition.abstract ExpNodePrototype method - Create new instance of the classprepareTemplateValues(TreeMap values, String colName) PreparedNodes will set their values through this methods.voidprepareValues(Object[] values) PreparedNodes will set their values through this methods.voidreverse()Generates a reverse tree/stack ensuring each node's children are popped before the node.voidsetLeftChild(ExpNode leftChild) Set the left child.voidsetRightChild(ExpNode rightChild) Set the right child.voidsetTemplate(QueryTemplatePacket template) voidApplies the consumer on this node and its children recursivelyvoidtraverseReverse(java.util.function.Consumer<ExpNode> consumer) Applies the consumer on this node and its children recursively in reverse (children before parent)voidValidates inner query result size (this method is only called after executing the inner query) Default validation only permits a single result from inner query.voidMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.gigaspaces.serialization.SmartExternalizable
enabledSmartExternalizableWithReference
-
Field Details
-
leftChild
-
rightChild
-
template
-
-
Constructor Details
-
ExpNode
public ExpNode()Empty constructor. -
ExpNode
- Parameters:
leftChild- The left childrightChild- The right child
-
-
Method Details
-
setLeftChild
Set the left child. -
setRightChild
Set the right child. -
getLeftChild
- Returns:
- The left child
-
getRightChild
- Returns:
- The right child
-
forEachChild
Applies the consumer on each non-null child. -
traverse
Applies the consumer on this node and its children recursively -
traverseReverse
Applies the consumer on this node and its children recursively in reverse (children before parent) -
reverse
Generates a reverse tree/stack ensuring each node's children are popped before the node. -
prepareValues
PreparedNodes will set their values through this methods. this one just calls the prepareValues on the children- Throws:
SQLException
-
prepareTemplateValues
PreparedNodes will set their values through this methods. this one just calls the prepareValues on the children. This method will be used only for SQLTemplate.- Throws:
SQLException
-
isValidCompare
Operator nodes implement this method to return whether two objects satisfy the given condition.- Returns:
- true if the two given objects satisfy the condition
-
isJoined
public boolean isJoined()is there somewhere in the tree a join condition. -
newInstance
Prototype method - Create new instance of the class -
clone
Override the clone method. -
accept
Accept the query builder Default implementation returns null - no QueryTemplatePacket is defined- Throws:
SQLException
-
accept
public void accept(IQueryExecutor executor, ISpaceProxy space, Transaction txn, int readModifier, int max) throws SQLException Accept the query executor- Throws:
SQLException
-
getTemplate
-
setTemplate
-
toString
- Returns:
- op string
-
createIndex
public EntriesCursor createIndex(QueryTableData queryTableData, IQueryResultSet<IEntryPacket> tableEntries) -
createJoinIndex
- Returns:
- true if created join index
-
isInnerQuery
public boolean isInnerQuery()Gets whether this node has a child which is an inner query node -
isContainsItemNode
public boolean isContainsItemNode() -
isContainsItemsRootNode
public boolean isContainsItemsRootNode() -
validateInnerQueryResult
Validates inner query result size (this method is only called after executing the inner query) Default validation only permits a single result from inner query.- Throws:
SQLException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-