org.apache.derby.impl.sql.compile
Class HasNodeVisitor

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.HasNodeVisitor
All Implemented Interfaces:
Visitor

public 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.

Author:
jamie

Field Summary
private  boolean hasNode
           
private  java.lang.Class nodeClass
           
private  java.lang.Class skipOverClass
           
 
Constructor Summary
HasNodeVisitor(java.lang.Class nodeClass)
          Construct a visitor
HasNodeVisitor(java.lang.Class nodeClass, java.lang.Class skipOverClass)
          Construct a visitor
 
Method Summary
 boolean hasNode()
          Indicate whether we found the node in question
 void reset()
          Reset the status so it can be run again.
 boolean skipChildren(Visitable node)
          Don't visit childen under the skipOverClass node, if it isn't null.
 boolean stopTraversal()
          Stop traversal if we found the target node
 Visitable visit(Visitable node)
          If we have found the target node, we are done.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hasNode

private boolean hasNode

nodeClass

private java.lang.Class nodeClass

skipOverClass

private java.lang.Class skipOverClass
Constructor Detail

HasNodeVisitor

public HasNodeVisitor(java.lang.Class nodeClass)
Construct a visitor

Parameters:
nodeClass - the class of the node that we are looking for.

HasNodeVisitor

public 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

visit

public Visitable visit(Visitable node)
If we have found the target node, we are done.

Specified by:
visit in interface Visitor
Parameters:
node - the node to process
Returns:
me

stopTraversal

public boolean stopTraversal()
Stop traversal if we found the target node

Specified by:
stopTraversal in interface Visitor
Returns:
true/false

skipChildren

public boolean skipChildren(Visitable node)
Don't visit childen under the skipOverClass node, if it isn't null.

Specified by:
skipChildren in interface Visitor
Parameters:
node - the node to process
Returns:
true/false

hasNode

public boolean hasNode()
Indicate whether we found the node in question

Returns:
true/false

reset

public void reset()
Reset the status so it can be run again.



Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.