Package eu.bandm.tools.paisley
Class AbstractPattern<A>
java.lang.Object
eu.bandm.tools.paisley.AbstractPattern<A>
- Type Parameters:
A- the target type of objects to match against
- All Implemented Interfaces:
Pattern<A>,Serializable,Cloneable
@Generated(generator="eu.bandm.tools.expander",
version="1.3.1",
timestamp="2026-02-01T13:13:51")
public abstract class AbstractPattern<A>
extends Object
implements Pattern<A>, Cloneable
Base class for common patterns.
This class implements Cloneable, and realizes fork() in
terms of clone().
- See Also:
-
Constructor Details
-
AbstractPattern
protected AbstractPattern()Creates a new instance.
-
-
Method Details
-
fork
Makes a copy of this pattern with independent internal state.Subclasses must override this method if necessary to honour the following rules for all transitively reachable patterns:
- Subpatterns that are instances of
Variablemust be shared. This implies thatVariable.fork()must returnthis. - Fields that do not refer to subpatterns, but to matching
state (changed by invocations of
Pattern.match(A),Pattern.matchAgain(),Pattern.cut()orPattern.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. - Fields neither referring to subpatterns nor to matching state may be either shared or duplicated. The usage of such fields in a modifiable way (such that the distinction is relevant) is strongly deprecated.
- Patterns
whose fields need not be duplicated need not be duplicated themselves, but
may return
this.
- Subpatterns that are instances of
-
clone
-