Class Indentation
java.lang.Object
nl.talsmasoftware.umldoclet.rendering.indent.Indentation
- All Implemented Interfaces:
Serializable,CharSequence
Type to capture the indentation as an immutable type containing a pre-filled buffer to quickly be written.
- Author:
- Sjoerd Talsma
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IndentationThe default indentation is four spaces, initially at level 0.static final IndentationA reusable constant for no indentation at all (even after calls toincrease()). -
Method Summary
Modifier and TypeMethodDescriptioncharcharAt(int index) decrease()booleanWhether the other object represents the exact same indentation object.inthashCode()increase()intlength()static Indentationspaces(int width, int level) Returns an indentation ofwidthspaces, initially indented atwidth * levelspaces.subSequence(int start, int end) static Indentationtabs(int level) Returns an indentation ofleveltabs, increasing or decreasing by one tab at a time.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints
-
Field Details
-
DEFAULT
The default indentation is four spaces, initially at level 0. -
NONE
A reusable constant for no indentation at all (even after calls toincrease()).
-
-
Method Details
-
tabs
Returns an indentation ofleveltabs, increasing or decreasing by one tab at a time.- Parameters:
level- The number of tabs for this indentation.- Returns:
- The indentation of
leveltabs.
-
spaces
Returns an indentation ofwidthspaces, initially indented atwidth * levelspaces. This indentation increases or decreases bywidthspaces at a time.- Parameters:
width- The number of spaces for a single indentation level (often 2 or 4).level- The current indentation level (multiply this with the width for the initial number of spaces).- Returns:
- The indentation level as
levelmultiples ofwidthspaces.
-
increase
- Returns:
- An indentation instance with the level increased by one.
-
decrease
- Returns:
- An indentation instance with the level decreased by one (if there was indentation left to decrease).
-
hashCode
public int hashCode() -
equals
Whether the other object represents the exact same indentation object. -
length
public int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAtin interfaceCharSequence
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
toString
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject- Returns:
- The indentation as a string.
-