Visitorpublic class CollectNodesVisitor<T extends Visitable> extends java.lang.Object implements Visitor
Can find any type of node -- the class or class name of the target node is passed in as a constructor parameter.
| Modifier and Type | Field | Description |
|---|---|---|
private java.lang.Class<T> |
nodeClass |
|
private java.util.List<T> |
nodeList |
|
private java.lang.Class<? extends Visitable> |
skipOverClass |
| Constructor | Description |
|---|---|
CollectNodesVisitor(java.lang.Class<T> nodeClass) |
Construct a visitor
|
CollectNodesVisitor(java.lang.Class<T> nodeClass,
java.lang.Class<? extends Visitable> skipOverClass) |
Construct a visitor
|
| Modifier and Type | Method | Description |
|---|---|---|
java.util.List<T> |
getList() |
Return the list of matching nodes.
|
boolean |
skipChildren(Visitable node) |
Don't visit children under the skipOverClass
node, if it isn't null.
|
boolean |
stopTraversal() |
Method that is called to see
if query tree traversal should be
stopped before visiting all nodes.
|
Visitable |
visit(Visitable node) |
If we have found the target node, we are done.
|
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 final java.lang.Class<? extends Visitable> skipOverClass
public CollectNodesVisitor(java.lang.Class<T> nodeClass)
nodeClass - the class of the node that
we are looking for.public boolean visitChildrenFirst(Visitable node)
Visitorvisit() 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 Visitornode - the top node of a sub-tree about to be visitedtrue if node's children should be visited
before node, false otherwisepublic boolean stopTraversal()
VisitorstopTraversal in interface Visitorpublic boolean skipChildren(Visitable node)
skipChildren in interface Visitornode - the node to processpublic java.util.List<T> getList()
null.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.