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
Direct Known Subclasses:
Adaptive, Atomic, Binary, EnumBranch, IntBranch, Search, Unary, Variable

@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

      public Pattern<A> 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 Variable must be shared. This implies that Variable.fork() must return this.
      • Fields that do not refer to subpatterns, but to matching state (changed by invocations of 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.
      • 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.
      Specified by:
      fork in interface Pattern<A>
      Returns:
      a copy of this pattern that has independent internal state, except for variables
    • clone

      public final Pattern<A> clone()
      Overrides:
      clone in class Object