ua.gradsoft.termware.printers
Class PrettyPrintWriter

java.lang.Object
  extended by ua.gradsoft.termware.printers.PrettyPrintWriter

public class PrettyPrintWriter
extends Object

Writer for pretty printing. In addition to print functions, user also can mark beginning and ending of language constructs, whitespaces and possible linebreaks. So, unlike PrintWriter, which understand only one type of token: strings, PrettyPrintWriter understand (inside implemented pretty printing algorithm from

 \@article{DBLP:journals/toplas/Oppen80,
 author    = {Derek C. Oppen},
 title     = {Prettyprinting},
 journal   = {ACM Trans. Program. Lang. Syst.},
 volume    = {2},
 number    = {4},
 year      = {1980},
 pages     = {465-483},
 ee        = {http://doi.acm.org/10.1145/357114.357115},
 bibsource = {DBLP, http://dblp.uni-trier.de}
}
 
) main changes from article are:

Author:
rssh

Field Summary
static int DEFAULT_LINE_WIDTH
           
 
Constructor Summary
PrettyPrintWriter(PrintWriter printWriter)
           
 
Method Summary
 void flush()
           
 int getLineWidth()
           
 void putBegin(PrettyPrintingBreakType breakType)
           
 void putBegin(PrettyPrintingBreakType breakType, int size, int offset)
           
 void putBreak(PrettyPrintingBreakType breakType, int size, int offset)
           
 void putConsistentBreak(int size)
           
 void putEnd(PrettyPrintingBreakType breakType)
           
 void putEnd(PrettyPrintingBreakType breakType, int size, int offset)
           
 void putEof()
           
 void putInconsistentBreak(int size)
           
 void putLineBreak()
           
 void putString(String value)
           
 void setLineWidth(int lineWidth)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LINE_WIDTH

public static final int DEFAULT_LINE_WIDTH
See Also:
Constant Field Values
Constructor Detail

PrettyPrintWriter

public PrettyPrintWriter(PrintWriter printWriter)
Method Detail

putString

public void putString(String value)

putBegin

public void putBegin(PrettyPrintingBreakType breakType)

putBegin

public void putBegin(PrettyPrintingBreakType breakType,
                     int size,
                     int offset)

putEnd

public void putEnd(PrettyPrintingBreakType breakType)

putEnd

public void putEnd(PrettyPrintingBreakType breakType,
                   int size,
                   int offset)

putConsistentBreak

public void putConsistentBreak(int size)

putInconsistentBreak

public void putInconsistentBreak(int size)

putLineBreak

public void putLineBreak()

putBreak

public void putBreak(PrettyPrintingBreakType breakType,
                     int size,
                     int offset)

putEof

public void putEof()

flush

public void flush()

getLineWidth

public int getLineWidth()

setLineWidth

public void setLineWidth(int lineWidth)