Package eu.bandm.tools.paisley
A pattern can be matched against a given object, resulting in zero or more successful matches. As a side effect of a successful match, pattern variables may be bound. They retain their bound values until the next matching attempt. The value of variables is unspecified before a match has been attempted. Which variables are bound by a successful match is specific to the class and structure of the pattern.
The first successful match is retrieved using the Pattern.match(A)
method. All subsequent
matches on the same object are retrieved using the Pattern.matchAgain()
method. Any call to
these methods invalidates the variables bound by previous
calls. Patterns may be reused arbitrarily. Behaviour is unspecified
if usage times overlap, either concurrently or recursively.
A class of patterns that yield multiple successful matches for an object may either guarantee a certain order in which the matches are produced, or leave the order unspecified. A pattern class is ordered if such an order exists for all matched objects, otherwise unordered.
A class of patterns may also guarantee that there is at most one successful match for any object. A pattern class is deterministic if there is at most one match, otherwise nondeterministic. Nondeterministic patterns typically require internal memory to keep track of subsequent matches. That memory can be discarded explicitly, forfeiting remaining matches for the same object, and potentially allowing some heap space to be reclaimed.
-
ClassDescriptionAdaptive<A>Abstract base class for patterns that delegate to some other pattern, chosen dynamically per target.Atomic<A>Abstract base class for patterns that contain no subpatterns.Binary<A,
B, C> Abstract base class for patterns that contain two subpatterns.CachedTransform<A,B> Abstract base class for patterns that delegate expensively transformed targets to a subpattern.Indicates that a target can not be transformed.Static factory methods for creating patterns for collections.EnumBranch<A,E extends Enum<E>> Extractor<A>Filter<A>Abstract base class for patterns that match only a subset of the target type.FlatMultiTransform<A,B> IntBranch<A>Lazy<A>Wrapper class for a pattern that is to be created on demand.Motif<A,B> Motif.Star<A>MultiTransform<A,B> Abstract base class for patterns that delegate transformed targets to a subpattern.Observable<A>Pattern<A>Abstract base class of all patterns.Static factory methods for creating patterns for primitive types and basic objects.Proxy<A>Base class for patterns that contain one subpattern of the same target type.Static factory methods for creating patterns for runtime type information.RestrictedTransform<A,B> Rule<A,B> Search<A>Abstract base class for patterns that delegate matching dynamically to a number of alternative subpatterns.Static factory methods for creating patterns for strings and regular expressions.Theme<A,B> TotalTransform<A,B> Transform<A,B> Abstract base class for patterns that delegate transformed targets to a subpattern.Unary<A,B> Abstract base class for patterns that contain one subpattern.Variable<A>Class of pattern variables.