net.sf.staccatocommons.lang.predicate
Class AbstractPredicate<A>
java.lang.Object
net.sf.staccatocommons.lang.predicate.AbstractPredicate<A>
- Type Parameters:
A - the type of argument to evaluate
- All Implemented Interfaces:
- Applicable<A,Boolean>, Evaluable<A>, Predicate<A>
- Direct Known Subclasses:
- AbstractPredicate.Soft
public abstract class AbstractPredicate<A>
- extends Object
- implements Predicate<A>
A AbstractPredicate is an abstract Evaluable.
Predicates in addition understand the basic boolean logic messages
not(), and(Evaluable) and or(Evaluable) that
perform those operations on evaluation result.
- Author:
- flbulgarelli
AbstractPredicate
public AbstractPredicate()
eval
public abstract boolean eval(@NonNull
A argument)
- Specified by:
eval in interface Evaluable<A>
apply
public Boolean apply(A arg)
- Specified by:
apply in interface Applicable<A,Boolean>
not
public Predicate<A> not()
- Specified by:
not in interface Predicate<A>
- Returns:
- a
AbstractPredicate that negates this
AbstractPredicate's result. Non Null.
or
public Predicate<A> or(@NonNull
Evaluable<? super A> other)
- Returns a predicate that, performs a short-circuit logical-or between this
AbstractPredicate's eval(Object) and other
- Specified by:
or in interface Predicate<A>
- Parameters:
other - another Evaluable. Non null.
- Returns:
- A new predicate that performs the short circuited or between this
and other when evaluated. Non Null
and
public Predicate<A> and(@NonNull
Evaluable<? super A> other)
- Returns a predicate that performs a short-circuit logical-and between this
AbstractPredicate's eval(Object) and other
- Specified by:
and in interface Predicate<A>
- Parameters:
other - another Evaluable. Non null.
- Returns:
- A new predicate that performs the short circuited logical-and
between this and other when evaluated. Non Null
andNotNull
public final Predicate<A> andNotNull()
- Specified by:
andNotNull in interface Predicate<A>
orNull
public final Predicate<A> orNull()
- Specified by:
orNull in interface Predicate<A>
of
public <B> Predicate<B> of(@NonNull
Applicable<? super B,? extends A> other)
- Specified by:
of in interface Predicate<A>
withEffectOnFalse
public Predicate<A> withEffectOnFalse(Executable<A> executable)
- Specified by:
withEffectOnFalse in interface Predicate<A>
withEffectOnTrue
public Predicate<A> withEffectOnTrue(Executable<A> executable)
- Specified by:
withEffectOnTrue in interface Predicate<A>
toString
public String toString()
- Overrides:
toString in class Object