Object CRecipePredicates
-
- All Implemented Interfaces:
public class CRecipePredicatesCombinator functions for composing CRecipePredicate instances.
Every combinator derives the composed predicate's CRecipePredicate.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 CRecipePredicatesINSTANCE
-
Method Summary
Modifier and Type Method Description final static CRecipePredicatenamed(String name, CRecipePredicate predicate)Returns predicate carrying name as its CRecipePredicate.name. final static CRecipePredicateand(CRecipePredicate $self, CRecipePredicate other)Combines this predicate with other using logical AND. final static CRecipePredicateor(CRecipePredicate $self, CRecipePredicate other)Combines this predicate with other using logical OR. final static CRecipePredicateallOf(CRecipePredicate $self, CRecipePredicate predicates)Combines this predicate with predicates using logical AND. final static CRecipePredicatenOf(CRecipePredicate $self, Integer n, CRecipePredicate predicates)Combines this predicate with predicates and passes when at least n of them pass. -
-
Method Detail
-
named
final static CRecipePredicate named(String name, CRecipePredicate predicate)
Returns predicate carrying name as its CRecipePredicate.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:
CRecipePredicate A predicate behaving as predicate and named name
- Since:
5.3.0
-
and
final static CRecipePredicate and(CRecipePredicate $self, CRecipePredicate other)
Combines this predicate with other using logical AND.
- Parameters:
other- The other predicate to combine with- Returns:
CRecipePredicate A predicate that passes when both this predicate and other pass
- Since:
5.3.0
-
or
final static CRecipePredicate or(CRecipePredicate $self, CRecipePredicate other)
Combines this predicate with other using logical OR.
- Parameters:
other- The other predicate to combine with- Returns:
CRecipePredicate A predicate that passes when either this predicate or other passes
- Since:
5.3.0
-
allOf
final static CRecipePredicate allOf(CRecipePredicate $self, CRecipePredicate predicates)
Combines this predicate with predicates using logical AND.
- Parameters:
predicates- Additional predicates to combine with- Returns:
CRecipePredicate A predicate that passes when this predicate and every predicate in predicates pass
- Since:
5.3.0
-
nOf
final static CRecipePredicate nOf(CRecipePredicate $self, Integer n, CRecipePredicate 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:
CRecipePredicate A predicate that passes when at least n of (this predicate and predicates) pass
- Since:
5.3.0
-
-
-
-