Class HasNodeVisitor
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.HasNodeVisitor
-
- All Implemented Interfaces:
Visitor
- Direct Known Subclasses:
HasTableFunctionVisitor
class HasNodeVisitor extends java.lang.Object implements Visitor
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 Modifier and Type Field Description protected booleanhasNodeprivate java.lang.Class<?>nodeClassprivate java.lang.Class<?>skipOverClass
-
Constructor Summary
Constructors Constructor Description HasNodeVisitor(java.lang.Class<?> nodeClass)Construct a visitorHasNodeVisitor(java.lang.Class<?> nodeClass, java.lang.Class<?> skipOverClass)Construct a visitor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleanhasNode()Indicate whether we found the node in question(package private) voidreset()Reset the status so it can be run again.booleanskipChildren(Visitable node)Don't visit children under the skipOverClass node, if it isn't null.booleanstopTraversal()Stop traversal if we found the target nodeVisitablevisit(Visitable node)If we have found the target node, we are done.booleanvisitChildrenFirst(Visitable node)Visit parent before children.
-
-
-
Constructor Detail
-
HasNodeVisitor
HasNodeVisitor(java.lang.Class<?> nodeClass)
Construct a visitor- Parameters:
nodeClass- the class of the node that we are looking for.
-
HasNodeVisitor
HasNodeVisitor(java.lang.Class<?> nodeClass, java.lang.Class<?> skipOverClass)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 Detail
-
stopTraversal
public boolean stopTraversal()
Stop traversal if we found the target node- Specified by:
stopTraversalin interfaceVisitor- Returns:
- true/false
-
skipChildren
public boolean skipChildren(Visitable node)
Don't visit children under the skipOverClass node, if it isn't null.- Specified by:
skipChildrenin interfaceVisitor- Parameters:
node- the node to process- Returns:
- true/false
-
visitChildrenFirst
public boolean visitChildrenFirst(Visitable node)
Visit parent before children.- Specified by:
visitChildrenFirstin interfaceVisitor- Parameters:
node- the top node of a sub-tree about to be visited- Returns:
trueifnode's children should be visited beforenode,falseotherwise
-
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.
-
-