Class HasNodeVisitor
java.lang.Object
org.apache.derby.impl.sql.compile.HasNodeVisitor
- All Implemented Interfaces:
Visitor
- Direct Known Subclasses:
HasTableFunctionVisitor
Find out if we have a particular node anywhere in the
tree. Stop traversal as soon as we find one.
Can find any type of node -- the class or class name of the target node is passed in as a constructor parameter.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHasNodeVisitor
(Class<?> nodeClass) Construct a visitorHasNodeVisitor
(Class<?> nodeClass, Class<?> skipOverClass) Construct a visitor -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
hasNode()
Indicate whether we found the node in question(package private) void
reset()
Reset the status so it can be run again.boolean
skipChildren
(Visitable node) Don't visit children under the skipOverClass node, if it isn't null.boolean
Stop traversal if we found the target nodeIf we have found the target node, we are done.boolean
visitChildrenFirst
(Visitable node) Visit parent before children.
-
Field Details
-
hasNode
protected boolean hasNode -
nodeClass
-
skipOverClass
-
-
Constructor Details
-
HasNodeVisitor
HasNodeVisitor(Class<?> nodeClass) Construct a visitor- Parameters:
nodeClass
- the class of the node that we are looking for.
-
HasNodeVisitor
Construct a visitor- Parameters:
nodeClass
- the class of the node that we are looking for.skipOverClass
- do not go below this node when searching for nodeClass.
-
-
Method Details
-
visit
If we have found the target node, we are done. -
stopTraversal
public boolean stopTraversal()Stop traversal if we found the target node- Specified by:
stopTraversal
in interfaceVisitor
- Returns:
- true/false
-
skipChildren
Don't visit children under the skipOverClass node, if it isn't null.- Specified by:
skipChildren
in interfaceVisitor
- Parameters:
node
- the node to process- Returns:
- true/false
-
visitChildrenFirst
Visit parent before children.- Specified by:
visitChildrenFirst
in interfaceVisitor
- Parameters:
node
- the top node of a sub-tree about to be visited- Returns:
true
ifnode
's children should be visited beforenode
,false
otherwise
-
hasNode
boolean hasNode()Indicate whether we found the node in question- Returns:
- true/false
-
reset
void reset()Reset the status so it can be run again.
-