wt.tools.xref
Class OutputHelper

java.lang.Object
  extended bywt.tools.xref.OutputHelper

public class OutputHelper
extends Object

This class is a helper class that provides the ability to output information either to the console (the default) or to an output text file, in a hierarchical manner.


Field Summary
(package private)  int d_indentLevel
           
(package private)  String d_indentString
           
(package private)  int d_outputLevel
           
(package private)  PrintWriter d_pw
           
(package private)  boolean d_specifiedFileName
           
(package private)  PrintWriter d_stdout
           
 
Constructor Summary
OutputHelper()
          When this constructor is used, all output is sent to the console.
OutputHelper(PrintWriter pw)
           
OutputHelper(String classInterfaceSpec)
          When this constructor is used, all output is sent to an output file based on the specified classInterfaceSpec (i.e.
 
Method Summary
 void close()
          When the user instantiates with class with the constructor that accepts an outputFileName then this method can be used to close that outputFileName.
 void decreaseIndent()
          This method decrements the indent level which results in all output via the Log() method to be indented 4 spaces less.
 void increaseIndent()
          This method increments the indent level which results in all output via the Log() method to be indented another 4 spaces.
private  void init()
          This convenience method provides a single initialization method for all constructors to call.
 void open(String classInterfaceSpec)
          This method is used to instantiate a PrintWriter associated with an output file.
 void println(String msg)
          This method is the output method for this class.
 void setOutputLevel(int level)
          This method controls how much of the hierarchical information to display.
 void updateIndentString()
          This method initializes the indent string field based on the contents of the field d_indentLevel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d_pw

PrintWriter d_pw

d_stdout

PrintWriter d_stdout

d_outputLevel

int d_outputLevel

d_indentLevel

int d_indentLevel

d_indentString

String d_indentString

d_specifiedFileName

boolean d_specifiedFileName
Constructor Detail

OutputHelper

public OutputHelper()
When this constructor is used, all output is sent to the console.


OutputHelper

public OutputHelper(PrintWriter pw)

OutputHelper

public OutputHelper(String classInterfaceSpec)
             throws IOException
When this constructor is used, all output is sent to an output file based on the specified classInterfaceSpec (i.e. wt.query.specification.DefaultQueryWriter)

Method Detail

open

public void open(String classInterfaceSpec)
          throws IOException
This method is used to instantiate a PrintWriter associated with an output file.

Throws:
IOException

close

public void close()
When the user instantiates with class with the constructor that accepts an outputFileName then this method can be used to close that outputFileName. And then the above open() method can be used to open another output file.


init

private void init()
This convenience method provides a single initialization method for all constructors to call.


updateIndentString

public void updateIndentString()
This method initializes the indent string field based on the contents of the field d_indentLevel.


increaseIndent

public void increaseIndent()
This method increments the indent level which results in all output via the Log() method to be indented another 4 spaces.


decreaseIndent

public void decreaseIndent()
This method decrements the indent level which results in all output via the Log() method to be indented 4 spaces less.


setOutputLevel

public void setOutputLevel(int level)
This method controls how much of the hierarchical information to display. The following is an example of six levels of information, displayed hierarchically.

 First Level of information
     Second Level of information
         Third level of information
             Fourth level of information
                 Fifth level of information
                     Sixth level of information


If with above set of information to display, you call this method with the value 3, then nothing beyond the 3rd level will be output, in other words you would see the following:

 First Level of information
     Second Level of information
         Third level of information

If you you want to display everything, then you can just call this method with a large value like 99 or 9999.


println

public void println(String msg)
This method is the output method for this class.