edu.wpi.cs.dsrg.xmldb.xat.common.visitorpattern
Class InheritableVisitor

java.lang.Object
  |
  +--edu.wpi.cs.dsrg.xmldb.xat.common.visitorpattern.InheritableVisitor
Direct Known Subclasses:
BindingTableComputer, CompleteSchemaVisitor, ConsumedVisitor, CutVisitor, Debugger, ExecuteVisitor, MinSchemaVisitor, ModifiedVisitor, ObjectPrinter, OperatorEvaluator, ParserTraverse, PCMVisitor, ProducedVisitor, ProjectFillVisitor, QueryDecorrelation, RequiredVisitor, SchemaCleanupVisitor, SchemaVisitor, StatisticsGatheringVisitor, TreeCleanupVisitor, TwoParamVisitor, XATTreeDefaultVisitor

public abstract class InheritableVisitor
extends java.lang.Object
implements Visitor

It used to visit the lowest level class to be visited first, then go to the parent class if cannot find the visit function. It use the reflective functions. This will be the chosen visitor implementation for others.

Since:
1.0

Constructor Summary
InheritableVisitor()
           
 
Method Summary
abstract  java.lang.Object dispatch()
          To visit a null object.
abstract  java.lang.Object dispatch(java.lang.Object obj)
          To visit any object.
protected  java.util.Vector getAncestors(java.lang.Class c)
          Get the ancestor of a specific class.
protected  java.lang.reflect.Method getMethod(java.lang.Class c)
          The getMethod function will trying to get all the classes and also the interfaces from the lower level to the higher level to figure out which will be the proper method to invoke.
 java.lang.Object visit(java.lang.Object object)
          If there is an inheretance between the visited objects, it will only match the highest class.
 java.lang.Object visit(Visitable v)
          Well in some case, the visit() will call the visitable, which is the highest interface in the visitor pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InheritableVisitor

public InheritableVisitor()
Method Detail

dispatch

public abstract java.lang.Object dispatch()
To visit a null object.

dispatch

public abstract java.lang.Object dispatch(java.lang.Object obj)
To visit any object.

getAncestors

protected java.util.Vector getAncestors(java.lang.Class c)
Get the ancestor of a specific class. We get the interface before we get the superclass.
Parameters:
c - java.lang.Class
Returns:
java.util.Vector
Since:
1.0

getMethod

protected java.lang.reflect.Method getMethod(java.lang.Class c)
The getMethod function will trying to get all the classes and also the interfaces from the lower level to the higher level to figure out which will be the proper method to invoke. Due to the reason the default JAVA will always match the highest level of the abstract first. Algorithm: 1) First, we get all the classes and interfaces into a vector from the bottom to the up. 2) Second, we try to find the method from the beginning of that vector to the end.
Parameters:
c - The class to be visited.
Returns:
Method The found Method.
Since:
1.0

visit

public java.lang.Object visit(Visitable v)
Well in some case, the visit() will call the visitable, which is the highest interface in the visitor pattern. In that case, we just lead it to the visit(object) method to dynamically find out where you should go.

You should never ever visit(visitable) directly, but its subclasses.

Parameters:
v -  
Returns:
Object
Since:
1.0

visit

public java.lang.Object visit(java.lang.Object object)
If there is an inheretance between the visited objects, it will only match the highest class.
Specified by:
visit in interface Visitor
Parameters:
object -  
Returns:
Object
Since:
1.0