Class 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-01T13:13:54") 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:
  • Constructor Details

    • Filter

      protected Filter(Pattern<? super A> body)
      Creates a new pattern.
      Parameters:
      body - the pattern to match under the restriction implemented by this filter
      Throws:
      NullPointerException - if body is null
  • Method Details

    • of

      public static <A> Filter<A> of(Predicate<? super A> pred, Pattern<? super A> body)
    • with

      public static <A> Motif<A,A> with(Predicate<? super A> pred)
    • apply

      public final A apply(A target)
      Transforms a target to be matched into a target for the subpattern.

      This implementations returns target.

      Specified by:
      apply in class Transform<A,A>
      Parameters:
      target - the target for this pattern to be matched against.
      Returns:
      a target for Unary.body to be matched against.