public abstract class QueryNodeProcessorImpl extends Object implements QueryNodeProcessor
This is a default implementation for the QueryNodeProcessor
interface, it's an abstract class, so it should be extended by classes that
want to process a QueryNode
tree.
This class process QueryNode
s from left to right in the tree. While
it's walking down the tree, for every node,
preProcessNode(QueryNode)
is invoked. After a node's children are
processed, postProcessNode(QueryNode)
is invoked for that node.
setChildrenOrder(List)
is invoked before
postProcessNode(QueryNode)
only if the node has at least one child,
in setChildrenOrder(List)
the implementor might redefine the
children order or remove any children from the children list.
Here is an example about how it process the nodes:
a / \ b e / \ c dHere is the order the methods would be invoked for the tree described above:
preProcessNode( a ); preProcessNode( b ); preProcessNode( c ); postProcessNode( c ); preProcessNode( d ); postProcessNode( d ); setChildrenOrder( bChildrenList ); postProcessNode( b ); preProcessNode( e ); postProcessNode( e ); setChildrenOrder( aChildrenList ); postProcessNode( a )
QueryNodeProcessor
Constructor and Description |
---|
QueryNodeProcessorImpl() |
QueryNodeProcessorImpl(QueryConfigHandler queryConfigHandler) |
Modifier and Type | Method and Description |
---|---|
QueryConfigHandler |
getQueryConfigHandler()
For reference about this method check:
QueryNodeProcessor.getQueryConfigHandler() . |
protected abstract QueryNode |
postProcessNode(QueryNode node)
This method is invoked for every node when walking up the tree.
|
protected abstract QueryNode |
preProcessNode(QueryNode node)
This method is invoked for every node when walking down the tree.
|
QueryNode |
process(QueryNode queryTree)
Processes a query node tree.
|
protected void |
processChildren(QueryNode queryTree)
This method is called every time a child is processed.
|
protected abstract List<QueryNode> |
setChildrenOrder(List<QueryNode> children)
This method is invoked for every node that has at least on child.
|
void |
setQueryConfigHandler(QueryConfigHandler queryConfigHandler)
For reference about this method check:
QueryNodeProcessor.setQueryConfigHandler(QueryConfigHandler) . |
public QueryNodeProcessorImpl()
public QueryNodeProcessorImpl(QueryConfigHandler queryConfigHandler)
public QueryNode process(QueryNode queryTree) throws QueryNodeException
QueryNodeProcessor
null
.process
in interface QueryNodeProcessor
queryTree
- tree root nodeQueryNodeException
protected void processChildren(QueryNode queryTree) throws QueryNodeException
queryTree
- the query node child to be processedQueryNodeException
- if something goes wrong during the query node processingpublic void setQueryConfigHandler(QueryConfigHandler queryConfigHandler)
QueryNodeProcessor.setQueryConfigHandler(QueryConfigHandler)
.setQueryConfigHandler
in interface QueryNodeProcessor
queryConfigHandler
- the query configuration handler to be set.QueryNodeProcessor.getQueryConfigHandler()
,
QueryConfigHandler
public QueryConfigHandler getQueryConfigHandler()
QueryNodeProcessor.getQueryConfigHandler()
.getQueryConfigHandler
in interface QueryNodeProcessor
QueryNodeProcessor.setQueryConfigHandler(QueryConfigHandler)
,
QueryConfigHandler
protected abstract QueryNode preProcessNode(QueryNode node) throws QueryNodeException
node
- the query node to be pre-processedQueryNodeException
- if something goes wrong during the query node processingprotected abstract QueryNode postProcessNode(QueryNode node) throws QueryNodeException
node
- node the query node to be post-processedQueryNodeException
- if something goes wrong during the query node processingprotected abstract List<QueryNode> setChildrenOrder(List<QueryNode> children) throws QueryNodeException
postProcessNode(QueryNode)
is invoked.children
- the list containing all current node's childrenQueryNodeException
- if something goes wrong during the query node processingCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.