|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.debug.Indenter
public class Indenter
Manages a string of varying size to be used for indenting. The "indent string" is some token string
repeated a variable number of times. By default, the token string is " " (two spaces), but
a different string may be provided if needed. Initially, the indentation level (the number of repeats)
is set to 0; push() and pop() are used to adjust this value.
If thread safety is required, alternative atomicPop() and atomicPush() methods are
provided as well. These use locking to prevent concurrent changes to the indentation level.
| Constructor Summary | |
|---|---|
Indenter()
Create an indenter with the default token string: " " (two spaces) |
|
Indenter(int spaces)
Create an indenter with the specified number of spaces as its token string |
|
Indenter(String token)
Create an indenter with the given string as its token string |
|
| Method Summary | |
|---|---|
void |
atomicPop()
Decrease the indentation level atomically. |
void |
atomicPush()
Increase the indentation level atomically. |
String |
indentString()
Produce a string based on the token string and current indentation level. |
void |
pop()
Decrease the indentation level |
void |
push()
Increase the indentation level |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Indenter()
" " (two spaces)
public Indenter(int spaces)
public Indenter(String token)
| Method Detail |
|---|
public void push()
public void pop()
public void atomicPush()
atomicPush() and
atomicPop() invocations from adjusting the level simultaneously.
public void atomicPop()
atomicPush() and
atomicPop() invocations from adjusting the level simultaneously.
public String indentString()
<= 0,
this is the empty string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||