Class FormatPrinter

java.lang.Object
eu.bandm.tools.format.FormatPrinter

public class FormatPrinter extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final char
    A constant holding one single space character u0020.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FormatPrinter(PrintWriter p, int width)
    Sets the print target and the page width.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    advance(int cnt)
    Output space characters and increment the column counter by the given number.
    int
    Public getter method for the current (=next-to-write) column.
    void
    Central service access point, prints the complete format to the output with construction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SPACE

      public static final char SPACE
      A constant holding one single space character u0020.
      See Also:
  • Constructor Details

    • FormatPrinter

      public FormatPrinter(PrintWriter p, int width)
      Sets the print target and the page width.
      Parameters:
      p - the target for printing
      width - 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

      public void startPrinting(Format f)
      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.