Package eu.bandm.tools.paisley
Class Atomic<A>
java.lang.Object
eu.bandm.tools.paisley.Pattern<A>
eu.bandm.tools.paisley.Atomic<A>
- Type Parameters:
A
- the target type
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
Constraint
Abstract base class for patterns that contain no subpatterns.
Subclasses of this class must represent deterministic patterns that
affect no variable.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.tools.paisley.Pattern
Pattern.Either<A>
-
Field Summary
Modifier and TypeFieldDescriptionA pattern that matches anything.Fields inherited from class eu.bandm.tools.paisley.Pattern
_left_matched, _target_save, none
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Checks whether a variable is bound by this pattern.clone()
Return a reference that behaves like a copy of this pattern.protected final void
compileClear
(CompilationContext context) protected final void
compileClear
(CompilationContext context, boolean recursively) protected final void
compileCut
(CompilationContext context) protected final void
compileCut
(CompilationContext context, boolean recursively) protected final void
compileMatchAgain
(CompilationContext context) final boolean
Checks whether this pattern is deterministic.final boolean
Attempts to re-match this pattern against a previously matched object.final boolean
Checks whether a variable is preserved by this pattern, unconditionally.final boolean
Checks whether a variable is preserved by this pattern, conditionally on success or failure.Methods inherited from class eu.bandm.tools.paisley.Pattern
all, all, all, all, all, and, andThen, andThen, any, aside, both, clear, clear, compile, compileIsDeterministic, compileMatch, compileSubPattern, compileThis, compileUpTo, cut, cut, DEBUG, either, enPassant, flatten, limit, main, match, matchOnce, matchVar, narrow, newAll, noMatch, none, of, or, orElse, orElse, repeat, some, some, some, some, someMatch, startCompile, uniquely, variable, variable
-
Field Details
-
anyObject
A pattern that matches anything. This pattern may be shared and reused concurrently.
-
-
Constructor Details
-
Atomic
protected Atomic()Creates a new atomic pattern.
-
-
Method Details
-
matchAgain
public final boolean matchAgain()Description copied from class:Pattern
Attempts to re-match this pattern against a previously matched object. If the class of this pattern imposes a specific order on matches, they are chosen in that order, beginning with the second one. The behaviour of this method is unspecified if the last matching attempt of this pattern has not been successful.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()
.- Overrides:
matchAgain
in classPattern<A>
- Returns:
true
if the matching is successful,false
if it fails. WhichVariable
s are bound by a successful match depends. The default implementation always returnsfalse
.- See Also:
-
binds
Description copied from class:Pattern
Checks whether a variable is bound by this pattern.The default implementation returns
false
. -
preserves
Description copied from class:Pattern
Checks whether a variable is preserved by this pattern, conditionally on success or failure.The default implementation returns
false
. -
preserves
Description copied from class:Pattern
Checks whether a variable is preserved by this pattern, unconditionally.The default implementation returns
false
. -
isDeterministic
public final boolean isDeterministic()Description copied from class:Pattern
Checks whether this pattern is deterministic.The default implementation returns
true
.- Overrides:
isDeterministic
in classPattern<A>
- Returns:
true
if this pattern is guaranteed to match any object at most once,false
otherwise.- See Also:
-
clone
Return a reference that behaves like a copy of this pattern. This implementation asserts that no duplication is required, and always returnsthis
. -
compileMatchAgain
- Overrides:
compileMatchAgain
in classPattern<A>
-
compileCut
- Overrides:
compileCut
in classPattern<A>
-
compileCut
- Overrides:
compileCut
in classPattern<A>
-
compileClear
- Overrides:
compileClear
in classPattern<A>
-
compileClear
- Overrides:
compileClear
in classPattern<A>
-
anyObject
-