com.cafesoft.core.util
Class Indentation

java.lang.Object
  |
  +--com.cafesoft.core.util.Indentation

public class Indentation
extends Object

Indentation is a utility class that maintains textual identation state. It is useful for generating XML documents and other structured text like executable code whose readability benefits from indentation.


Constructor Summary
Indentation(int level, String indentPerLevel)
          Create a new Indentation.
 
Method Summary
 String getIndentation()
          Get the current indentation.
 int getLevel()
          Get the current indentation level.
 void indent()
          Indent a level.
 void outdent()
          Outdent a level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Indentation

public Indentation(int level,
                   String indentPerLevel)
Create a new Indentation.

Parameters:
level - the initial indentation level.
indentPerLevel - the per-level indentation String.
Method Detail

indent

public void indent()
Indent a level.


outdent

public void outdent()
Outdent a level.


getLevel

public int getLevel()
Get the current indentation level.

Returns:
the indentation level, which is greater than or equal to zero.

getIndentation

public String getIndentation()
Get the current indentation.

Returns:
a String representing the indentation for the current level.


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.