lab7
Class ReflectiveVisitor
java.lang.Object
lab7.ReflectiveVisitor
- Direct Known Subclasses:
- NodeVisitor
public abstract class ReflectiveVisitor
- extends java.lang.Object
A reflective version of Visitor
Adapted from http://www.javaworld.com/javaworld/javatips/jw-javatip98.html
|
Field Summary |
static boolean |
debug
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
debug
public static boolean debug
ReflectiveVisitor
public ReflectiveVisitor()
defaultVisit
public abstract void defaultVisit(java.lang.Object o)
perform
public void perform(AbstractNode n)
- Method to kick things off. Override to do other stuff if
you wish
performVisit
public final ReflectiveVisitor performVisit(AbstractNode n)
- Better version of perform
dispatch
public final void dispatch(java.lang.Object o)
- Method to accomplish the double-dispatch.