public final class AndOrConcatRules extends Object implements LayoutRule
AND / OR so a long
WHERE/HAVING/ON condition lays out one conjunct per line:
WHERE a = 1 AND b = 2 OR c = 3
Only top-level boolean operators break: an AND/OR whose
block (paren) depth equals its clause run's base depth. Operators inside a
parenthesised sub-predicate ((a AND b)) or a function stay inline.
Limited to predicate clauses (WHERE/HAVING/JOIN).
Concatenation operators (||, +) are left to the spacing
rule (no break) — keeping concatenated expressions on one line.
This is a single linear pass over the token stream — there is no recursion
over the boolean expression tree — so a 2000-deep AND/OR chain
is handled in O(n) without StackOverflowError (plan §13/R3).
Priority LayoutPriorities.CASE_ANDOR. Needs S19 block + S20 sql +
S21 clause analyses. Read-only.
Plan reference: §7.3/S27, §7.4/S27.
| Constructor and Description |
|---|
AndOrConcatRules() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(LayoutContext context)
Apply the rule, requesting layout decisions on the context.
|
String |
name()
Short, stable identifier for logging/diagnostics.
|
int |
priority()
The rule's precedence.
|
public AndOrConcatRules()
public int priority()
LayoutRulepriority in interface LayoutRulepublic String name()
LayoutRulename in interface LayoutRulepublic void apply(LayoutContext context)
LayoutRuleapply in interface LayoutRule