Package eu.bandm.tools.paisley
Class TotalTransform<A,B>
java.lang.Object
eu.bandm.tools.paisley.AbstractPattern<A>
eu.bandm.tools.paisley.Unary<B,A>
eu.bandm.tools.paisley.Transform<A,B>
eu.bandm.tools.paisley.TotalTransform<A,B>
- Type Parameters:
A- the target type of the containing patternB- the target type of the contained subpattern
- All Implemented Interfaces:
Pattern<A>,Serializable,Cloneable
@Generated(generator="eu.bandm.tools.expander",
version="1.3.1",
timestamp="2026-02-18T13:05:44")
public abstract class TotalTransform<A,B>
extends Transform<A,B>
Abstract base class for patterns that delegate transformed targets to a
subpattern.
Subclasses must implement the Transform.apply(A) method.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTotalTransform(Pattern<? super B> body) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAttempts to match this pattern against a given object.static <A,B> TotalTransform <A, B> Returns a transforming pattern with the given transforming function and subpattern.static <A,B> Motif <B, A> Returns a motif that acts as a transforming pattern with the given transforming function and a hole in place of the subpattern.Methods inherited from class eu.bandm.tools.paisley.Unary
binds, clear, cut, fork, getBody, isDeterministic, matchAgain, preserves, preserves, setBodyMethods inherited from class eu.bandm.tools.paisley.AbstractPattern
clone
-
Constructor Details
-
TotalTransform
Creates a new instance.- Parameters:
body- the subpattern- Throws:
NullPointerException- ifbodyis null
-
-
Method Details
-
match
Attempts to match this pattern against a given object.If the class of this pattern imposes a specific order on matches, the first one is chosen.
The
nulltarget is generally allowed.This implementation matches the subpattern against the result of
apply(target).- Parameters:
target- the object to match against- Returns:
trueif the matching is successful,falseif it fails. WhichVariables are bound by a successful or failed match depends.- See Also:
-
of
public static <A,B> TotalTransform<A,B> of(Function<? super A, ? extends B> fun, Pattern<? super B> body) Returns a transforming pattern with the given transforming function and subpattern.- Type Parameters:
A- the target type of objects to match againstB- the type of transformed objects- Parameters:
fun- a transforming functionbody- a subpattern to match the transformed targets against- Returns:
- a pattern that matches
bodyagainst each target transformed byfun - Throws:
NullPointerException- iffunorbodyis null
-
with
Returns a motif that acts as a transforming pattern with the given transforming function and a hole in place of the subpattern.- Type Parameters:
A- the target type of objects to match againstB- the type of transformed objects- Parameters:
fun- a transforming function- Returns:
- a motif that matches the hole against each target transformed by
fun - Throws:
NullPointerException- iffunis null
-