de.hunsicker.jalopy.printer
Class EnumPrinter

java.lang.Object
  |
  +--de.hunsicker.jalopy.printer.AbstractPrinter
        |
        +--de.hunsicker.jalopy.printer.BasicDeclarationPrinter
              |
              +--de.hunsicker.jalopy.printer.EnumPrinter
All Implemented Interfaces:
Printer

public class EnumPrinter
extends de.hunsicker.jalopy.printer.BasicDeclarationPrinter

The enum printer


Field Summary
protected static Convention settings
          The code convention settings.
 
Constructor Summary
protected EnumPrinter()
          Creates a new EnumPrinter object.
 
Method Summary
protected  void addClassComment(JavaNode node, NodeWriter out)
          Adds a Javadoc comment to the given CLASS_DEF node.
protected  void addComment(JavaNode node, NodeWriter out)
          Adds a Javadoc comment to the given node.
protected  void addInterfaceComment(JavaNode node, NodeWriter out)
          Adds a Javadoc comment to the given INTERFACE_DEF node.
protected  void addMethodComment(JavaNode node, NodeWriter out)
          Adds a Javadoc comment to the given METHOD_DEF node.
protected  int countChildrenLines(JavaNode n, int current)
          Counts the number of blank lines following a node
static Printer getInstance()
          Returns the sole instance of this class.
protected  void prepareComment(JavaNode lcurly, JavaNode rcurly, NodeWriter out)
           
 void print(antlr.collections.AST node, NodeWriter out)
          Prints the enumeration
 void printChildren(antlr.collections.AST node, NodeWriter out)
          Prints all the children of the passed node
protected  void printIndentation(int diff, NodeWriter out)
          Outputs indentation whitespace according to the current marker offset.
protected  void printIndentation(de.hunsicker.jalopy.printer.Marker marker, NodeWriter out)
          Outputs indentation whitespace.
protected  void printIndentation(NodeWriter out)
          Outputs indentation whitespace according to the current marker offset or indentation level (depends on the used indentation policy).
 void trackPosition(JavaNode node, int line, int column, NodeWriter out)
          Tracks the position of the given node by updating the position information.
 void trackPosition(JavaNode node, NodeWriter out)
          Tracks the position of the given node by updating the position information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

protected static final Convention settings
The code convention settings.

Constructor Detail

EnumPrinter

protected EnumPrinter()
Creates a new EnumPrinter object.

Method Detail

getInstance

public static final Printer getInstance()
Returns the sole instance of this class.

Returns:
the sole instance of this class.

print

public void print(antlr.collections.AST node,
                  NodeWriter out)
           throws java.io.IOException
Prints the enumeration

Specified by:
print in interface Printer
Overrides:
print in class de.hunsicker.jalopy.printer.BasicDeclarationPrinter
Parameters:
node -
out -
Throws:
java.io.IOException

addClassComment

protected void addClassComment(JavaNode node,
                               NodeWriter out)
Adds a Javadoc comment to the given CLASS_DEF node.

Parameters:
node - a CLASS_DEF node.
out - stream to write to.
Since:
1.0b8

addComment

protected void addComment(JavaNode node,
                          NodeWriter out)
Adds a Javadoc comment to the given node.

Parameters:
node - node to add a Javadoc comment.
out - stream to write to.

addInterfaceComment

protected void addInterfaceComment(JavaNode node,
                                   NodeWriter out)
Adds a Javadoc comment to the given INTERFACE_DEF node.

Parameters:
node - a INTERFACE_DEF node.
Since:
1.0b8

addMethodComment

protected void addMethodComment(JavaNode node,
                                NodeWriter out)
Adds a Javadoc comment to the given METHOD_DEF node.

Parameters:
node - a METHOD_DEF node.
out - stream to write to.

printChildren

public final void printChildren(antlr.collections.AST node,
                                NodeWriter out)
                         throws java.io.IOException
Prints all the children of the passed node

java.io.IOException

trackPosition

public void trackPosition(JavaNode node,
                          NodeWriter out)
Tracks the position of the given node by updating the position information

Parameters:
node - the node that needs its position tracked.
out - stream to write to.
Since:
1.0b9

trackPosition

public void trackPosition(JavaNode node,
                          int line,
                          int column,
                          NodeWriter out)
Tracks the position of the given node by updating the position information.

Parameters:
node - the node that needs its position tracked.
line - the new line position.
column - the new column position.
out - stream to write to.
Since:
1.0b9

printIndentation

protected void printIndentation(NodeWriter out)
                         throws java.io.IOException
Outputs indentation whitespace according to the current marker offset or indentation level (depends on the used indentation policy).

Parameters:
out - stream to write to.
Throws:
java.io.IOException - if an I/O error occured.
Since:
1.0b8

printIndentation

protected void printIndentation(de.hunsicker.jalopy.printer.Marker marker,
                                NodeWriter out)
                         throws java.io.IOException
Outputs indentation whitespace.

Parameters:
marker - if not null this marker will be used to calculate the right amount of indentation whitespace. Otherwise indentation depends on the general indentation policy.
out - stream to write to.
Throws:
java.io.IOException - if an I/O error occured.
Since:
1.0b9

printIndentation

protected void printIndentation(int diff,
                                NodeWriter out)
                         throws java.io.IOException
Outputs indentation whitespace according to the current marker offset. If no marker is set, this method does nothing.

Parameters:
diff - The amount
out - stream to write to.
Throws:
java.io.IOException - if an I/O error occured.
Since:
1.0b8

prepareComment

protected void prepareComment(JavaNode lcurly,
                              JavaNode rcurly,
                              NodeWriter out)

countChildrenLines

protected int countChildrenLines(JavaNode n,
                                 int current)
Counts the number of blank lines following a node

Parameters:
n - The node
Returns:
The number of lines


Copyright © 1997-2005 Jalopy. All Rights Reserved.