Package eu.bandm.tools.format
Class Variable
java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Variable
- All Implemented Interfaces:
Formattable,Serializable,Cloneable
- Direct Known Subclasses:
BoundVariable,FreeVariable
Common base class for
FreeVariable and BoundVariable- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default prefix for parsing and display of variables.Fields inherited from class eu.bandm.tools.format.Format
comma, DEFAULT_WIDTH, dot, empty, indent, INDENT_NOT_SET, LENGTH_PREFIX, space -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Formatbottom()Throws always an IllegalArgumentException.debugPrefix(int n) Deliver the concatenation of the text contents, limited by the given number of characters, approximately.protected voidOver-ridden by all sub-classes of Format, for performing the print operations.getName()Returns either the explicit name ofFreeVariable, or the position number of aBoundVariable.Return the prefix used for parsing and display.indent(int i) Returns a format structure which combines the behaviour of the given variable with the given indentation.Methods inherited from class eu.bandm.tools.format.Format
annotated, append, append, apply, apply, apply, apply, applyPartial, applyTo, applyTo, beneath, beneath, beside, beside, block, block, checkValidIndent, comment, comment, comment, comment, eval, format, getIndent, ground, indentIsSet, isAlwaysMultiline, isSpace, line, line, literal, markup, markupLeft, markupRight, maxOfMins, maxWidth, minWidth, of, printFormat, printFormat, printNonFormat, prior, prior, properties, server, showLn, space, subst, subst, subst, tabular, tabular, toObjString, toString, toString, variable, variable
-
Field Details
-
DEFAULT_PREFIX
The default prefix for parsing and display of variables.- See Also:
-
-
Constructor Details
-
Variable
Sets the name and the indentation value. Indentation must be equal toFormat.INDENT_NOT_SET.- Parameters:
prefix- used for parsing and display, must not be empty.s- the name of the variable, as printed for unresolved variables. Cannot be used for size calculations of the eventually rendered result, since variable is intended to be replaced.indent- must be equal toFormat.INDENT_NOT_SET.- Throws:
IllegalArgumentException- if indent in not equal toFormat.INDENT_NOT_SET.IllegalArgumentException- if prefix is empty.
-
-
Method Details
-
getName
Returns either the explicit name ofFreeVariable, or the position number of aBoundVariable.- Returns:
- the name (given or numeric)
-
getPrefix
Return the prefix used for parsing and display.- Returns:
- the prefix used for parsing and display.
-
indent
Returns a format structure which combines the behaviour of the given variable with the given indentation.(An indentation stored locally to the Variable instance would get lost when the variable is replaced. Therefore the result is
append(variable, empty).indent(i). The empty format is inserted to avoid a de-normal compound format.) -
doprint
Description copied from class:FormatOver-ridden by all sub-classes of Format, for performing the print operations. -
bottom
Throws always an IllegalArgumentException.- Returns:
- nothing, since an IllegalArgumentException is always thrown.
- Throws:
IllegalArgumentException- always
-
debugPrefix
Description copied from class:FormatDeliver the concatenation of the text contents, limited by the given number of characters, approximately. Useful for debugging purpose.- Specified by:
debugPrefixin classFormat- Parameters:
n- the maximal number of characters which can be generated per tree node.- Returns:
- the concatenated, unformatted text contents.
-