public final class LayoutDecision extends Object implements LayoutDecisionView
Each property defaults to UNSET (-1), meaning "no rule
decided this; the output writer should fall back to the token's original
precedingLinebreaks / precedingBlanks". This is what makes the
zero-rule pipeline an identity pass.
Properties are written only through LayoutContext's request methods,
which apply the LayoutConflictResolver precedence. The fields are
package-visible setters so the context (same package) can apply resolved
writes; rules never set them directly.
Consumers read decisions through the LayoutDecisionView interface
(what LayoutContext.decisionAt(int) returns); the mutating setters are
package-visible so only LayoutContext (same package) applies resolved
writes. The layout rules live in the sub-package pp2.layout.rules, so
they cannot reach these setters and must use the context's request*
methods — keeping all writes under LayoutConflictResolver precedence.
Plan reference: §7.3/S23, §7.4/S23.
| Modifier and Type | Field and Description |
|---|---|
static int |
UNSET
Sentinel: this property has not been decided by any rule.
|
| Constructor and Description |
|---|
LayoutDecision() |
| Modifier and Type | Method and Description |
|---|---|
int |
getBlanksBefore()
Number of blank columns to emit before the token, or
UNSET. |
int |
getIndentLevel()
Indent level for the token's line, or
UNSET. |
int |
getLinebreaksBefore()
Number of linebreaks to emit before the token, or
UNSET. |
String |
getTextOverride()
The text to emit for the token instead of its source text, or
null. |
boolean |
isBlanksDecided() |
boolean |
isIndentDecided() |
boolean |
isLinebreaksDecided() |
boolean |
isTextDecided() |
String |
toString() |
public static final int UNSET
public LayoutDecision()
public int getLinebreaksBefore()
UNSET.getLinebreaksBefore in interface LayoutDecisionViewpublic int getBlanksBefore()
UNSET.getBlanksBefore in interface LayoutDecisionViewpublic int getIndentLevel()
UNSET.getIndentLevel in interface LayoutDecisionViewpublic boolean isLinebreaksDecided()
isLinebreaksDecided in interface LayoutDecisionViewpublic boolean isBlanksDecided()
isBlanksDecided in interface LayoutDecisionViewpublic boolean isIndentDecided()
isIndentDecided in interface LayoutDecisionViewpublic String getTextOverride()
null.getTextOverride in interface LayoutDecisionViewpublic boolean isTextDecided()
isTextDecided in interface LayoutDecisionView