org.prorefactor.core
Class JPNodeLister

java.lang.Object
  extended by org.prorefactor.core.JPNodeLister
Direct Known Subclasses:
TP01FramesTreeLister

public class JPNodeLister
extends java.lang.Object

Prints out the structure of a JPNode AST. Prints nodes one per line, using indentation to show the tree structure. Use TokenLister instead if you want to print using Proparse's API directly.


Field Summary
 java.lang.String lineSep
           
 boolean showColumn
           
 boolean showFilename
           
 boolean showLinenum
           
 boolean showStoretype
           
protected  java.lang.String spacer
           
protected  TokenTypesI tokenTypes
           
 
Constructor Summary
JPNodeLister(JPNode topNode, java.lang.String outfilename, TokenTypesI tokenTypes)
           
 
Method Summary
protected  java.lang.String generateLineText(JPNode node)
          This returns the line's text including the text indent, but not including the newline.
protected  java.lang.String indent()
          Get the current indent based on indentby
 void print()
          Call this method to write the output file.
 JPNodeLister setIndentby(int indentby)
          Number of spaces to indent by.
protected  JPNodeLister setSpacer(java.lang.String spacer)
          The String spacer is used to separate tokens or components of what is printed on one line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showColumn

public boolean showColumn

showFilename

public boolean showFilename

showLinenum

public boolean showLinenum

showStoretype

public boolean showStoretype

lineSep

public java.lang.String lineSep

spacer

protected java.lang.String spacer

tokenTypes

protected TokenTypesI tokenTypes
Constructor Detail

JPNodeLister

public JPNodeLister(JPNode topNode,
                    java.lang.String outfilename,
                    TokenTypesI tokenTypes)
Method Detail

generateLineText

protected java.lang.String generateLineText(JPNode node)
This returns the line's text including the text indent, but not including the newline. Override this method in order to generate your own line text. If you override this, you can use indent() to get the current indent string, or use getIndentby() and your own indent string generator.


indent

protected final java.lang.String indent()
Get the current indent based on indentby


print

public void print()
           throws java.io.IOException
Call this method to write the output file.

Throws:
java.io.IOException

setIndentby

public JPNodeLister setIndentby(int indentby)
Number of spaces to indent by. Default indentby is four spaces. You can change the number of indent spaces, or use your own indent generator when you override generateLineText.


setSpacer

protected JPNodeLister setSpacer(java.lang.String spacer)
The String spacer is used to separate tokens or components of what is printed on one line. Default is four spaces.



Copyright © 2008 Joanju Software. All Rights Reserved.