A
- the target type of the left subpatternB
- the target type of the right subpatternC
- the target type of the containing patternpublic abstract class Binary<A,B,C> extends Pattern<C>
Subclasses must implement the Pattern.match(A)
method.
Modifier | Constructor and Description |
---|---|
protected |
Binary(Pattern<? super A> left,
Pattern<? super B> right)
Creates a new pattern.
|
Modifier and Type | Method and Description |
---|---|
void |
clear(boolean recursively)
Disposes of all internal state related to results and
nondeterminism.
|
Pattern<C> |
clone()
Makes a matching-state copy if this pattern.
|
protected void |
compileClear(eu.bandm.tools.paisley.CompilationContext context,
boolean recursively) |
protected void |
compileCut(eu.bandm.tools.paisley.CompilationContext context,
boolean recursively) |
protected void |
compileMatch(eu.bandm.tools.paisley.CompilationContext context) |
protected void |
compileMatchAgain(eu.bandm.tools.paisley.CompilationContext context) |
void |
cut(boolean recursively)
Disposes of all internal state related to nondeterminism.
|
Pattern<A> |
getLeft() |
Pattern<B> |
getRight() |
String |
toString() |
protected String |
toStringOperator() |
all, all, all, all, all, and, andThen, andThen, any, any, aside, binds, both, clear, compareTo, compile, compileClear, compileCut, compileIsDeterministic, compileSubPattern, compileThis, compileUpTo, cut, DEBUG, either, enPassant, eq, eqNull, equal, filter, flatten, forInstancesOf, isDeterministic, limit, main, match, matchAgain, matchOnce, matchVar, narrow, neq, neqNull, newAll, noMatch, none, or, orElse, orElse, preserves, preserves, repeat, some, some, some, some, someMatch, startCompile, test, transform, uniquely, variable, variable
protected Binary(Pattern<? super A> left, Pattern<? super B> right)
IllegalArgumentException
- if left
or right
are null
.public void cut(boolean recursively)
Pattern
The default implementation does nothing. Subclasses that override
this method should also override Pattern.clear(boolean)
and
ensure that it implies the effect of cut(false)
.
public void clear(boolean recursively)
Pattern
The default implementation does nothing.
public Pattern<C> clone()
Pattern
Subclasses must override this method if necessary to honour the following rules for all transitively reachable patterns:
Variable
must
be shared. This implies that Variable.clone()
must
return this
.Pattern.match(A)
, Pattern.matchAgain()
, Pattern.cut()
or Pattern.clear()
) must be duplicated. If matching state changes are
effected by modification of other objects, these must be
duplicated. In summary, matching operations on this pattern and
its copy must not interfere, with the exception of variable
bindings.this
.protected String toStringOperator()
protected void compileMatch(eu.bandm.tools.paisley.CompilationContext context)
compileMatch
in class Pattern<C>
protected void compileMatchAgain(eu.bandm.tools.paisley.CompilationContext context)
compileMatchAgain
in class Pattern<C>
protected void compileCut(eu.bandm.tools.paisley.CompilationContext context, boolean recursively)
compileCut
in class Pattern<C>
protected void compileClear(eu.bandm.tools.paisley.CompilationContext context, boolean recursively)
compileClear
in class Pattern<C>
see also the complete user documentation .