Package eu.bandm.tools.paisley
Class Filter<A>
java.lang.Object
eu.bandm.tools.paisley.AbstractPattern<A>
eu.bandm.tools.paisley.Unary<A,A>
eu.bandm.tools.paisley.Transform<A,A>
eu.bandm.tools.paisley.RestrictedTransform<A,A>
eu.bandm.tools.paisley.Filter<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-18T13:05:43")
public abstract class Filter<A>
extends RestrictedTransform<A,A>
Abstract base class for patterns that match only a subset of the target
type.
Subclasses should override the RestrictedTransform.isDomain(A)
method. The default always returns true, performing no filtering.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ATransforms a target to be matched into a target for the subpattern.static <A> Filter<A> Returns a filter pattern with the given domain predicate and subpattern.static <A> Motif<A, A> Returns a motif that acts as a filter pattern with the given domain predicate and a hole in place of the subpattern.Methods inherited from class eu.bandm.tools.paisley.RestrictedTransform
cut, isDomain, isRange, match, matchAgain, ofUnlessNull, withUnlessNullMethods inherited from class eu.bandm.tools.paisley.Unary
binds, clear, fork, getBody, isDeterministic, preserves, preserves, setBodyMethods inherited from class eu.bandm.tools.paisley.AbstractPattern
clone
-
Constructor Details
-
Filter
Creates a new pattern.- Parameters:
body- the pattern to match under the restriction implemented by this filter- Throws:
NullPointerException- ifbodyis null
-
-
Method Details
-
of
Returns a filter pattern with the given domain predicate and subpattern.- Type Parameters:
A- the target type of objects to match against- Parameters:
pred- a predicate that determines whether a given target is supported by this filterbody- a subpattern to match supported targets against- Returns:
- a pattern that matches
bodyagainst a target ifisDomainreturnstrue, or fails otherwise - Throws:
NullPointerException- ifpredorbodyis null- See Also:
-
with
Returns a motif that acts as a filter pattern with the given domain predicate and a hole in place of the subpattern.- Type Parameters:
A- the target type of objects to match against- Parameters:
pred- a predicate that determines whether a given target is supported by this filter- Returns:
- a motif that matches the hole against a target if
isDomainreturnstrue, or fails otherwise - Throws:
NullPointerException- ifpredis null- See Also:
-
apply
Transforms a target to be matched into a target for the subpattern.This implementations returns
target.
-