hw3
Class NodeVisitor

java.lang.Object
  extended by hw3.ReflectiveVisitor
      extended by hw3.NodeVisitor
Direct Known Subclasses:
ClassSemanticsVisitor, ClassSymtabVisitor, ClassTypeSetVisitor, DumpNodeVisitor, SymtabVisitor

public abstract class NodeVisitor
extends ReflectiveVisitor

Visitor idea adapted from http://www.javaworld.com/javaworld/javatips/jw-javatip98.html


Field Summary
protected  int level
           
protected  java.io.PrintStream ps
           
 
Fields inherited from class hw3.ReflectiveVisitor
debug
 
Constructor Summary
NodeVisitor()
           
 
Method Summary
 void defaultVisit(java.lang.Object o)
          Default visitation if nothing suitable is found
 void err(java.io.PrintStream ps, java.lang.String s)
           
 void err(java.lang.String s)
           
 void out(java.io.PrintStream ps, java.lang.String s)
           
 void out(java.lang.String s)
           
 void setPrintStream(java.io.PrintStream ps)
          Change the output stream.
protected  void visitChildren(AbstractNode n)
          Useful to be able to visit all children.
 
Methods inherited from class hw3.ReflectiveVisitor
dispatch, getBestMethodFor, perform, performVisit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level

protected int level

ps

protected java.io.PrintStream ps
Constructor Detail

NodeVisitor

public NodeVisitor()
Method Detail

setPrintStream

public void setPrintStream(java.io.PrintStream ps)
Change the output stream. Default is System.out


defaultVisit

public void defaultVisit(java.lang.Object o)
Default visitation if nothing suitable is found

Specified by:
defaultVisit in class ReflectiveVisitor

visitChildren

protected final void visitChildren(AbstractNode n)
Useful to be able to visit all children. The level instance variable is available to enhance your output (indent if you like)


err

public void err(java.lang.String s)

err

public void err(java.io.PrintStream ps,
                java.lang.String s)

out

public void out(java.lang.String s)

out

public void out(java.io.PrintStream ps,
                java.lang.String s)