Class All<A>
- Type Parameters:
A- the target type of objects to match against
- All Implemented Interfaces:
Pattern<A>,Serializable,Cloneable
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear(boolean recursively) Disposes of all temporary internal state related to results and nondeterminism.voidcut(boolean recursively) Disposes of all temporary internal state related to nondeterminism.Returns a reference to the array of clauses of this formula, for internal use only.booleanChecks whether this pattern is deterministic.booleanAttempts to match this pattern against a given object.booleanAttempts to re-match this pattern against a previously matched object.Methods inherited from class eu.bandm.tools.paisley.AbstractPattern
clone, doclone, fork
-
Constructor Details
-
All
Creates a new instance.- Parameters:
clauses- the clauses of the new formula
-
-
Method Details
-
getClauses
Returns a reference to the array of clauses of this formula, for internal use only.- Returns:
- a reference to the array of clauses of this formula; do not modify!
-
match
Attempts to match this pattern against a given object.If the class of this pattern imposes a specific order on matches, the first one is chosen.
The
nulltarget is generally allowed.- Parameters:
target- the object to match against- Returns:
trueif the matching is successful,falseif it fails. WhichVariables are bound by a successful or failed match depends.- See Also:
-
matchAgain
public boolean matchAgain()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().- Returns:
trueif the matching is successful,falseif it fails. WhichVariables are bound by a successful match depends. The default implementation always returnsfalse.- See Also:
-
cut
public void cut(boolean recursively) Disposes of all temporary internal state related to nondeterminism.The default implementation does nothing. Subclasses that override this method should also override
Pattern.clear(boolean)and ensure that it implies the effect ofcut(false).- Parameters:
recursively-trueif all subpatterns should traversed,falseotherwise.
-
clear
public void clear(boolean recursively) Disposes of all temporary internal state related to results and nondeterminism.The default implementation just invokes
cut(false). Subclasses that override this method should either invoke this overridden implementation, or ensure by other means that the effect ofcut(false)is implied.- Parameters:
recursively-trueif all subpatterns should be traversed,falseotherwise.
-
isDeterministic
public boolean isDeterministic()Checks whether this pattern is deterministic.The default implementation returns
false.- Returns:
trueif this pattern is guaranteed to match any object at most once,falseotherwise.- See Also:
-