com.metamatrix.jdbc.api
Class PlanVisitor

java.lang.Object
  extended by com.metamatrix.jdbc.api.PlanVisitor
Direct Known Subclasses:
TextOutputVisitor

public abstract class PlanVisitor
extends java.lang.Object

A helper class to walk a query plan and execute some action at each node. Subclasses should override the appropriate visit() methods to get notification when a node of each type is visited.


Constructor Summary
PlanVisitor()
          Construct the visitor with a reference to the root node.
 
Method Summary
 void visit(PlanNode rootNode)
          This method controls how a tree is visited from the rootNode.
protected abstract  void visitContainerProperty(PlanNode node, java.lang.String propertyName, java.util.Collection propertyValue)
          Visit a container property - the container property will be visited, then each particular value of the container will be visited.
protected abstract  void visitNode(PlanNode node)
          Visit a node.
protected abstract  void visitPropertyValue(PlanNode node, java.lang.String propertyName, java.lang.Object propertyValue)
          Visit a property value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlanVisitor

public PlanVisitor()
Construct the visitor with a reference to the root node.

Method Detail

visit

public void visit(PlanNode rootNode)

This method controls how a tree is visited from the rootNode. This implementation will walk the tree in pre-order (a node is visited before it's children) and will visit a particular node in the following order: node itself, each property of the node, and finally the children of the node, in order.

Subclasses may override this method to manipulate the visitor order if desired.

Parameters:
rootNode - The rootNode of the tree

visitNode

protected abstract void visitNode(PlanNode node)
Visit a node.

Parameters:
node - The node being visited

visitPropertyValue

protected abstract void visitPropertyValue(PlanNode node,
                                           java.lang.String propertyName,
                                           java.lang.Object propertyValue)
Visit a property value.

Parameters:
node - The node being visited
propertyName - The property name being visited
propertyValue - The property value being visited

visitContainerProperty

protected abstract void visitContainerProperty(PlanNode node,
                                               java.lang.String propertyName,
                                               java.util.Collection propertyValue)
Visit a container property - the container property will be visited, then each particular value of the container will be visited.

Parameters:
node - The node being visited
propertyName - The property name being visited
propertyValue - The collection value being visited


Copyright © 2009. All Rights Reserved.