edu.uci.eecs.doc.cascade.tree
Class AbstractTreeWriter

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.tree.AbstractTreeWriter
All Implemented Interfaces:
TreeWriter
Direct Known Subclasses:
SVGTreeWriter, TextTreeWriter

public abstract class AbstractTreeWriter
extends Object
implements TreeWriter

An abstract base class for exporting a control flow tree to various output formats.

Author:
Trevor Harmon

Field Summary
protected  boolean showInstructions
           
protected  List<Tree> trees
           
 
Constructor Summary
AbstractTreeWriter(List<Tree> trees)
          Creates a new TreeWriter object for the given control flow trees.
 
Method Summary
 void setShowInstructions(boolean showInstructions)
          Tells whether the string representations of the nodes should include a list of the node's bytecode instructions.
 void write()
          Prints the control flow tree to standard output (System.out).
 void write(String filename)
          Exports the control flow tree to the specified file.
abstract  void write(Writer out)
          Exports the control flow tree to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trees

protected List<Tree> trees

showInstructions

protected boolean showInstructions
Constructor Detail

AbstractTreeWriter

public AbstractTreeWriter(List<Tree> trees)
Creates a new TreeWriter object for the given control flow trees.

Parameters:
trees - the list of control flow trees to be exported
Method Detail

setShowInstructions

public void setShowInstructions(boolean showInstructions)
Tells whether the string representations of the nodes should include a list of the node's bytecode instructions.

Specified by:
setShowInstructions in interface TreeWriter
Parameters:
showInstructions - true if instructions should be displayed; false otherwise

write

public void write()
Prints the control flow tree to standard output (System.out).

Specified by:
write in interface TreeWriter

write

public void write(String filename)
           throws IOException
Exports the control flow tree to the specified file.

Specified by:
write in interface TreeWriter
Parameters:
filename - the name of a file in which to save the tree
Throws:
IOException - if the tree cannot be written to disk

write

public abstract void write(Writer out)
                    throws IOException
Exports the control flow tree to the specified output stream.

Specified by:
write in interface TreeWriter
Parameters:
out - an output stream in which to save the tree
Throws:
IOException - if the tree cannot be written to the stream