Object CMatterPredicates
-
- All Implemented Interfaces:
public class CMatterPredicatesCombinator functions for composing CMatterPredicate instances.
Every combinator derives the composed predicate's CMatterPredicate.name from the names of its operands, so a composed predicate reports its own structure in diagnostic logs.
-
-
Field Summary
Fields Modifier and Type Field Description public final static CMatterPredicatesINSTANCE
-
Method Summary
Modifier and Type Method Description final static CMatterPredicatenamed(String name, CMatterPredicate predicate)Returns predicate carrying name as its CMatterPredicate.name. final static CMatterPredicateand(CMatterPredicate $self, CMatterPredicate other)Combines this predicate with other using logical AND. final static CMatterPredicateor(CMatterPredicate $self, CMatterPredicate other)Combines this predicate with other using logical OR. final static CMatterPredicateallOf(CMatterPredicate $self, CMatterPredicate predicates)Combines this predicate with predicates using logical AND. final static CMatterPredicatenOf(CMatterPredicate $self, Integer n, CMatterPredicate predicates)Combines this predicate with predicates and passes when at least n of them pass. -
-
Method Detail
-
named
final static CMatterPredicate named(String name, CMatterPredicate predicate)
Returns predicate carrying name as its CMatterPredicate.name.
A lambda has no identity of its own, so wrapping it here is what makes an io.github.sakaki_aruka.customcrafter.debug.Explainer able to report this predicate by name instead of by index.
- Parameters:
name- Label to report this predicate underpredicate- The predicate to label- Returns:
CMatterPredicate A predicate behaving as predicate and named name
- Since:
5.3.0
-
and
final static CMatterPredicate and(CMatterPredicate $self, CMatterPredicate other)
Combines this predicate with other using logical AND.
- Parameters:
other- The other predicate to combine with- Returns:
CMatterPredicate A predicate that passes when both this predicate and other pass
- Since:
5.3.0
-
or
final static CMatterPredicate or(CMatterPredicate $self, CMatterPredicate other)
Combines this predicate with other using logical OR.
- Parameters:
other- The other predicate to combine with- Returns:
CMatterPredicate A predicate that passes when either this predicate or other passes
- Since:
5.3.0
-
allOf
final static CMatterPredicate allOf(CMatterPredicate $self, CMatterPredicate predicates)
Combines this predicate with predicates using logical AND.
- Parameters:
predicates- Additional predicates to combine with- Returns:
CMatterPredicate A predicate that passes when this predicate and every predicate in predicates pass
- Since:
5.3.0
-
nOf
final static CMatterPredicate nOf(CMatterPredicate $self, Integer n, CMatterPredicate predicates)
Combines this predicate with predicates and passes when at least n of them pass.
- Parameters:
n- Minimum number of predicates (out of this predicate and predicates) that must passpredicates- Additional predicates to combine with- Returns:
CMatterPredicate A predicate that passes when at least n of (this predicate and predicates) pass
- Since:
5.3.0
-
-
-
-