public class PP
extends java.lang.Object
render
can be used
to render this object to a single string formatted in a certain
way.
Logically the strings to be pretty printed are grouped hierarchically into groups that have to be printed side by side, and groups that have to be printed above the other.
Internally, PP is structured recursively. It has right and under pointers that again point to PP objects. The PP at 'right' is to be printed right to the current PP, and the PP at 'under' is to be printed below the current PP. There is also a field line which contains a single string (which should not contain a newline). It represents the single line of text belonging to the currect PP.
The field indent specifies an indentation offset for the PP (and all PP's below it).
In addition to the redering method, this library also provides some methods for constructing PPs.
Example: see source code.
Constructor and Description |
---|
PP()
Creating an empty PP.
|
Modifier and Type | Method and Description |
---|---|
PP |
aside__spec(PP pp2)
A specification.
|
PP |
aside_(PP pp2)
As
aside , but insert a space between. |
PP |
aside_spec(PP pp2)
A specification.
|
PP |
aside(PP pp2)
Set two pp2 aside this PP.
|
PP |
indent(int i)
Increase the indentation of this PP with i.
|
static void |
main(java.lang.String[] args)
Just for testing.
|
PP |
ontop_spec(PP pp2)
A specification.
|
PP |
ontop(PP pp2)
Set this PP above pp2.
|
java.lang.String |
render(int horOffset)
To render this PP to a formatted string.
|
static PP |
text(java.lang.String s)
To make a PP containing a single line of string as its only content.
|
public java.lang.String render(int horOffset)
public static PP text(java.lang.String s)
public PP indent(int i)
public static void main(java.lang.String[] args)