T
- the type of nodes to collectclass OffsetOrderVisitor<T extends QueryTreeNode> extends java.lang.Object implements Visitor
Modifier and Type | Field and Description |
---|---|
private static java.util.Comparator<QueryTreeNode> |
COMPARATOR
Comparator that orders nodes by ascending begin offset.
|
private int |
highOffset |
private int |
lowOffset |
private java.lang.Class<T> |
nodeClass |
private java.util.TreeSet<T> |
nodes |
Constructor and Description |
---|
OffsetOrderVisitor(java.lang.Class<T> nodeClass,
int low,
int high)
Create a new
OffsetOrderVisitor that collects nodes of the
specified type. |
Modifier and Type | Method and Description |
---|---|
(package private) java.util.SortedSet<T> |
getNodes() |
boolean |
skipChildren(Visitable node)
Method that is called to indicate whether
we should skip all nodes below this node
for traversal.
|
boolean |
stopTraversal()
Method that is called to see
if query tree traversal should be
stopped before visiting all nodes.
|
Visitable |
visit(Visitable node)
This is the default visit operation on a
QueryTreeNode.
|
boolean |
visitChildrenFirst(Visitable node)
Method that is called to see if
visit() should be called on
the children of node before it is called on node itself. |
private static final java.util.Comparator<QueryTreeNode> COMPARATOR
private final java.lang.Class<T extends QueryTreeNode> nodeClass
private final java.util.TreeSet<T extends QueryTreeNode> nodes
private final int lowOffset
private final int highOffset
OffsetOrderVisitor(java.lang.Class<T> nodeClass, int low, int high)
OffsetOrderVisitor
that collects nodes of the
specified type. The nodes must have begin offset and end offset in
the range given by the low
and high
parameters.nodeClass
- the type of nodes to collectlow
- the lowest begin offset to accept (inclusive)high
- the highest end offset to accept (exclusive)public Visitable visit(Visitable node) throws StandardException
Visitor
Visitors will overload this method by implementing a version with a signature that matches a specific type of node. For example, if I want to do something special with aggregate nodes, then that Visitor will implement a visit(AggregateNode node) method which does the aggregate specific processing.
visit
in interface Visitor
node
- the node to processStandardException
- may be throw an error
as needed by the visitor (i.e. may be a normal error
if a particular node is found, e.g. if checking
a group by, we don't expect to find any ColumnReferences
that aren't under an AggregateNode -- the easiest
thing to do is just throw an error when we find the
questionable node).public boolean visitChildrenFirst(Visitable node)
Visitor
visit()
should be called on
the children of node
before it is called on node
itself.
If this method always returns true
, the visitor will walk the
tree bottom-up. If it always returns false
, the tree is visited
top-down.visitChildrenFirst
in interface Visitor
node
- the top node of a sub-tree about to be visitedtrue
if node
's children should be visited
before node
, false
otherwisepublic boolean stopTraversal()
Visitor
stopTraversal
in interface Visitor
public boolean skipChildren(Visitable node) throws StandardException
Visitor
Differs from stopTraversal() in that it only affects subtrees, rather than the entire traversal.
skipChildren
in interface Visitor
node
- the node to processStandardException
java.util.SortedSet<T> getNodes()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.