public class Observable<A> extends Pattern<A>
Constructor and Description |
---|
Observable(Variable<A> variable) |
Modifier and Type | Method and Description |
---|---|
void |
clear(boolean recursively)
Disposes of all internal state related to results and
nondeterminism.
|
boolean |
isDeterministic()
Checks whether this pattern is deterministic.
|
boolean |
match(A target)
Attempts to match this pattern against a given object.
|
boolean |
matchAgain()
Attempts to re-match this pattern against a previously matched
object.
|
String |
toString() |
all, all, all, all, all, and, andThen, andThen, any, any, aside, binds, both, clear, clone, compareTo, compile, compileClear, compileClear, compileCut, compileCut, compileIsDeterministic, compileMatch, compileMatchAgain, compileSubPattern, compileThis, compileUpTo, cut, cut, DEBUG, either, enPassant, eq, eqNull, equal, filter, flatten, forInstancesOf, limit, main, 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
public boolean match(A target)
Pattern
match
in class Pattern<A>
target
- the object to match againsttrue
if the matching is successful, false
if it fails. Which Variable
s are bound by a
successful or failed match depends.Pattern.binds(Variable)
,
Pattern.preserves(Variable, boolean)
public boolean matchAgain()
Pattern
Patterns classes that do not override this method are
deterministic. Pattern classes that overwrite this method to
provide additional matches should also override Pattern.isDeterministic()
.
matchAgain
in class Pattern<A>
true
if the matching is successful, false
if it fails. Which Variable
s are bound by a
successful match depends. The default implementation
always returns false
.Pattern.binds(Variable)
,
Pattern.preserves(Variable, boolean)
public boolean isDeterministic()
Pattern
The default implementation returns true
.
isDeterministic
in class Pattern<A>
true
if this pattern is guaranteed to match any
object at most once, false
otherwise.Pattern.matchAgain()
public void clear(boolean recursively)
Pattern
The default implementation does nothing.
see also the complete user documentation .