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="", timestamp="2025-12-18T16:24:39") 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)
    • lazyBindings

      public Iterable<A> lazyBindings(B target)