Package eu.bandm.tools.format
Class Format.BoundVariable
java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Format.Variable
eu.bandm.tools.format.Format.BoundVariable
- All Implemented Interfaces:
Formattable
,Serializable
,Cloneable
- Enclosing class:
- Format
Variable identified by an index number, resolved by un-named arguments
by counting their positions.
This mechanism is ubiquituously used in meta-tools, eg.
with
metajava.FormatClosure
,
and well tested (in contrast to Format.FreeVariable
!-)- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.tools.format.Format
Format.Annotated<A>, Format.Append, Format.Beneath, Format.Beside, Format.Block, Format.BoundVariable, Format.Comment, Format.Compound, Format.Context, Format.Empty, Format.FormatPrinter, Format.FreeVariable, Format.Line, Format.Literal, Format.Markup, Format.Matcher, Format.NonFormatPrinter, Format.Prior, Format.Rewriter, Format.Space, Format.Subst, Format.Tabular, Format.Variable, Format.Visitor
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int
The position of the argument to be replaced by this variable.Fields inherited from class eu.bandm.tools.format.Format.Variable
name
Fields inherited from class eu.bandm.tools.format.Format
comma, DEFAULT_WIDTH, dot, empty, ground, indent, INDENT_NOT_SET, isAlwaysMultiline, LENGTH_PREFIX, maxWidth, minWidth, pattern_illegal_literal, space
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioneval
(Format.Context c, boolean partial) Return the Format value bound to positionindex
of this variable in the given context.indent
(int i) Unsupported Operation.Methods inherited from class eu.bandm.tools.format.Format.Variable
bottom, debugPrefix, doprint
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, comment, comment, comment, comment, format, indentIsSet, isSpace, isValidContentForLiteral, line, line, literal, makeAppend, makeBeneath, makeBeside, makeBlock, makeLine, makeTabular, markup, markupLeft, markupRight, maxOfMins, of, printFormat, printFormat, printNonFormat, prior, prior, server, showLn, space, subst, subst, subst, tabular, tabular, toObjString, toString, toString, variable, variable
-
Field Details
-
index
public final int indexThe position of the argument to be replaced by this variable.
-
-
Constructor Details
-
BoundVariable
public BoundVariable(int index) -
BoundVariable
public BoundVariable(int index, int indent)
-
-
Method Details
-
indent
Unsupported Operation. Variables will be replaced completely> by some other format before the containing format will be laid out and printed. This includes the indentation value. For a constant indentation behaviour for any such replacement use an expression likeappend(empty.ident(i), new BoundVariable(index))
-
eval
Return the Format value bound to positionindex
of this variable in the given context. If the index is higher than the defined range of arguemnts: ifpartial==true
the index is adjusted by subtracting the number of arguments in the context. Otherwise an exception is thrown by returningFormat.Variable.bottom()
.
-