Package eu.bandm.tools.format
Class FormatPrinter
java.lang.Object
eu.bandm.tools.format.FormatPrinter
Central Visitor for formatted printing. Is constructed with a
PrintWriter and a maximal page width. Then
startPrinting(Format)
is called to execute formatted printing.
Due to the heurstic nature of the algorithm, this
is not a hard limit in every situation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charA constant holding one single space characteru0020. -
Constructor Summary
ConstructorsConstructorDescriptionFormatPrinter(PrintWriter p, int width) Sets the print target and the page width. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadvance(int cnt) Output space characters and increment the column counter by the given number.intgetPos()Public getter method for the current (=next-to-write) column.voidCentral service access point, prints the complete format to the output with construction.
-
Field Details
-
SPACE
public static final char SPACEA constant holding one single space characteru0020.- See Also:
-
-
Constructor Details
-
FormatPrinter
Sets the print target and the page width.- Parameters:
p- the target for printingwidth- the line width to respect by inserting line feeds
-
-
Method Details
-
getPos
public int getPos()Public getter method for the current (=next-to-write) column.- Returns:
- the current (=next-to-write) column.
-
startPrinting
Central service access point, prints the complete format to the output with construction. DOC FIXME exceptions ?- Parameters:
f- the format to print
-
advance
protected void advance(int cnt) Output space characters and increment the column counter by the given number.- Parameters:
cnt- the number of spaces to print.
-