Package eu.bandm.tools.format
Class Compound
java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Compound
- All Implemented Interfaces:
Formattable,Serializable,Cloneable
The base class for all formats which combine subformats.
- See Also:
-
Field Summary
Fields inherited from class eu.bandm.tools.format.Format
comma, DEFAULT_WIDTH, dot, empty, indent, INDENT_NOT_SET, LENGTH_PREFIX, space -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThe constructor which sets all field values explicitly.protectedA constructor with some field values explicit, some calculated from the subformats.protectedA constructor with some field values explicit, some calculated from the subformats.protectedA constructor with some field values explicit, some calculated from the subformats. -
Method Summary
Modifier and TypeMethodDescriptionabstract CompoundConstructorReturns the reification of the constructor of this instance.debugPrefix(int n) Deliver the concatenation of the text contents, limited by the given number of characters, approximately.Return the result of replacing all variables with the bindings in the given context.getSubs()Return all subformats.indent(int i) Returns a clone ofthiswith the new value ofFormat.indent.Creates a new instance of the same class as this instance, or an optimized variant.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, doprint, 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
-
Constructor Details
-
Compound
A constructor with some field values explicit, some calculated from the subformats. In contrast to the factory methods, denormalized instances may be constructed.Minimal and maximal widths, whether always multiline and whether variables are contained, is all calculated from the subformats. Indentation is not set.
- Parameters:
f- list of sub-formats, should not be empty
-
Compound
A constructor with some field values explicit, some calculated from the subformats. In contrast to the factory methods, denormalized instances may be constructed.Whether always multiline and whether variables are contained, is calculated from the subformats. Indentation is not set.
- Parameters:
i- minwidtha- maxnwidthf- list of sub-formats, should not be empty
-
Compound
A constructor with some field values explicit, some calculated from the subformats. In contrast to the factory methods, denormalized instances may be constructed.Whether ariables are contained, is calculated from the subformats. Indentation is not set.
- Parameters:
i- minwidtha- maxnwidthm- isMultiLinef- list of sub-formats, should not be empty
-
Compound
The constructor which sets all field values explicitly. Consistency of the attributes must be realized by the caller. In contrast to the factory methods, denormalized instances may be constructed.- Parameters:
i- minimal widtha- maximal widthm- is always multiLineg- is groundindent- indentationf- list of sub-formats, should not be empty- Throws:
IllegalArgumentException- if ident value not valid, seeFormat.checkValidIndent(int)
-
-
Method Details
-
getSubs
Return all subformats. This list is unmodifiable.- Returns:
- all subformats. This list is unmodifiable.
-
constructor
Returns the reification of the constructor of this instance. That enum type has "apply()" methods which generate a corresponding instance.- Returns:
- the reification of the constructor of this instance.
-
indent
Description copied from class:FormatReturns a clone ofthiswith the new value ofFormat.indent. -
mutate
Creates a new instance of the same class as this instance, or an optimized variant. which contains as subformats all formats in a modified list. The list is modified arbitrarily in an "imperative" way, i.e. it can be altered or extended or totally cleared.The resulting list is fed into a factory method; therefore optimization applies and the returned type can be the singleton contents or an instance of Empty.
- Parameters:
mapSubs- the code to apply to the list of all subformats- Returns:
- a new format which contains the all formats in the modified list
-
eval
Description copied from class:FormatReturn the result of replacing all variables with the bindings in the given context.- Overrides:
evalin classFormat- Parameters:
c- defines the replacement for variables by name and number.partial- decides when a Variable not defined in the context is found: if true the Variable stays aunaltered; if false an IllegalArgumentException is thrown.- Returns:
- a format with all or some variables replaced
-
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.
-