Class Theme<A,B>

Type Parameters:
A - the subtarget type of objects to match the argument variable against
B - the target type of objects to match the entire pattern against
All Implemented Interfaces:
Extractor<A>, Pattern<B>, Serializable, Cloneable

@Generated(generator="eu.bandm.tools.expander", version="1.3.1", timestamp="2026-02-18T13:05:48") public class Theme<A,B> extends Proxy<B> implements Extractor<A>
Pattern with a distinguished argument variable.

This class provides the simplest patterns that can be derived from a Motif, by filling the hole with a variable.

See Also:
  • Constructor Details

    • Theme

      public Theme(Pattern<? super B> body, Variable<A> arg)
      Creates a new instance.
      Parameters:
      body - the main pattern, which should bind the argument variable
      arg - the argument variable
      Throws:
      NullPointerException - if body or arg is null
  • Method Details

    • getArgument

      public Variable<A> getArgument()
      Returns the argument variable.
      Returns:
      the argument variable
    • getValue

      public A getValue()
      Returns the extracted data value.

      The result is unspecified if the pattern viewed by this extractor is not in the state after a successful match.

      Specified by:
      getValue in interface Extractor<A>
      Returns:
      the extracted data value
    • lambda

      public Motif<A,B> lambda()
      Converts this pattern into a motif.
      Returns:
      a motif that has the occurrences of the argument variable as the hole
      See Also:
    • eagerBindings

      public List<A> eagerBindings(B target)
      Finds all values bound by this pattern for a given target.

      In contrast to lazyBindings(B), the alternative successful matches are are exhausted before this method returns.

      Parameters:
      target - the object to match against
      Returns:
      the values bound by this extractor on all successive matching attempts of root against target, in order.
      See Also:
    • lazyBindings

      public Iterable<A> lazyBindings(B target)
      Finds all values bound by this pattern for a given target.

      In contrast to eagerBindings(B), the alternative successful matches are effected lazily on demand.

      Parameters:
      target - the object to match against
      Returns:
      the values bound by this extractor on all successive matching attempts of root against target, in order.
      See Also: