public class Predicates
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.function.Predicate |
__
wildcard predicate
|
| Constructor and Description |
|---|
Predicates() |
| Modifier and Type | Method and Description |
|---|---|
static <Y> java.util.function.Predicate<Y> |
ANY() |
static <Y> java.util.function.Predicate<Y> |
ANY(java.lang.Class c)
Match against any object that is an instance of supplied type
|
static <T> java.util.function.Predicate<T> |
p(java.util.function.Predicate<T> p) |
static <T> ADTPredicateBuilder<T> |
type(java.lang.Class<T> type)
Recursively decompose and match against case classes of specified type.
|
static <V> java.util.function.Predicate |
with(V... values)
Recursively compose an Object without specifying a type
|
public static <T> java.util.function.Predicate<T> p(java.util.function.Predicate<T> p)
public static final <Y> java.util.function.Predicate<Y> ANY()
__public static final <Y> java.util.function.Predicate<Y> ANY(java.lang.Class c)
c - Class type to match againstpublic static <T> ADTPredicateBuilder<T> type(java.lang.Class<T> type)
return Matching.<Expression>whenValues().isType( (Add<Const,Mult> a)-> new Const(1))
.with(__,type(Mult.class).with(__,new Const(0)))
.whenValues().isType( (Add<Mult,Const> a)-> new Const(0)).with(type(Mult.class).with(__,new Const(0)),__)
.whenValues().isType( (Add<Add,Const> a)-> new Const(-100)).with(with(__,new Const(2)),__)
.apply(e).orElse(new Const(-1));
type - Classs type to decomposepublic static <V> java.util.function.Predicate with(V... values)
return Matching.<Expression>whenValues().isType( (Add<Const,Mult> a)-> new Const(1))
.with(__,type(Mult.class).with(__,new Const(0)))
.whenValues().isType( (Add<Mult,Const> a)-> new Const(0)).with(type(Mult.class).with(__,new Const(0)),__)
.whenValues().isType( (Add<Add,Const> a)-> new Const(-100)).with(with(__,new Const(2)),__)
.apply(e).orElse(new Const(-1));
values - To match against