Package eu.bandm.tools.format
Class FreeVariable
java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Variable
eu.bandm.tools.format.FreeVariable
- All Implemented Interfaces:
Formattable,Serializable,Cloneable
Variable identified by a alphanumeric name which can be
bound explicitly.
- See Also:
-
Field Summary
Fields inherited from class eu.bandm.tools.format.Variable
DEFAULT_PREFIXFields inherited from class eu.bandm.tools.format.Format
comma, DEFAULT_WIDTH, dot, empty, indent, INDENT_NOT_SET, LENGTH_PREFIX, space -
Constructor Summary
ConstructorsConstructorDescriptionFreeVariable(String name) Constructor which sets the name of the variable.FreeVariable(String name, int indent) Sets the name and the indentation value.FreeVariable(String prefix, String name, int indent) Sets all properties of the new instance explicitly. -
Method Summary
Methods inherited from class eu.bandm.tools.format.Variable
bottom, debugPrefix, doprint, getName, getPrefix, indentMethods 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, 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
-
FreeVariable
Constructor which sets the name of the variable. The name must be an identifier accepted by#hasValidIdentifierStructure(String). The prefix for parsing and display deraults toVariable.DEFAULT_PREFIX.- Parameters:
name- of the variable- Throws:
IllegalArgumentException- if name is not a valid Java identifier.- See Also:
-
FreeVariable
Sets the name and the indentation value. The name must be an identifier accepted by#hasValidIdentifierStructure(String). Indentation must be equal toFormat.INDENT_NOT_SET. The prefix for parsing and display deraults toVariable.DEFAULT_PREFIX.- Parameters:
name- of the variableindent- must be equal toFormat.INDENT_NOT_SET.- Throws:
IllegalArgumentException- if indent in not equal toFormat.INDENT_NOT_SET.IllegalArgumentException- if name is not a valid Java identifier.- See Also:
-
FreeVariable
Sets all properties of the new instance explicitly. The prefix for parsing and display must be a non-empty string. The name must be an identifier accepted by#hasValidIdentifierStructure(String). Indentation must be equal toFormat.INDENT_NOT_SET.- Parameters:
prefix- used for parsing and display, must not be empty.name- of the variableindent- must be equal toFormat.INDENT_NOT_SET.- Throws:
IllegalArgumentException- if indent in not equal toFormat.INDENT_NOT_SET.IllegalArgumentException- if name is not a valid Java identifier.- See Also:
-
-
Method Details
-
eval
Replace this by the binding defined in the context. If no such binding exists leave this unaltered ifpartial==true, otherwise throw the exception defined byVariable.bottom().- 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
-