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

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

public class CollectNodesVisitor
extends java.lang.Object
implements Visitor

Collect all nodes of the designated type to be returned in a vector.

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  java.lang.Class nodeClass
           
private  java.util.Vector nodeList
           
private  java.lang.Class skipOverClass
           
 
Constructor Summary
CollectNodesVisitor(java.lang.Class nodeClass)
          Construct a visitor
CollectNodesVisitor(java.lang.Class nodeClass, java.lang.Class skipOverClass)
          Construct a visitor
 
Method Summary
 java.util.Vector getList()
          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()
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeList

private java.util.Vector nodeList

nodeClass

private java.lang.Class nodeClass

skipOverClass

private java.lang.Class skipOverClass
Constructor Detail

CollectNodesVisitor

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

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

CollectNodesVisitor

public CollectNodesVisitor(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()
Description copied from interface: Visitor
Method that is called to see if query tree traversal should be stopped before visiting all nodes. Useful for short circuiting traversal if we already know we are done.

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

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

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

getList

public java.util.Vector getList()
Reset the status so it can be run again.


Built on Mon 2007-06-04 09:58:47+0400, from revision ???

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