net.sf.staccatocommons.defs.predicate
Interface Predicate<A>

All Superinterfaces:
Applicable<A,Boolean>, Evaluable<A>

@Applicative
public interface Predicate<A>
extends Evaluable<A>, Applicable<A,Boolean>

A rich Evaluable

Author:
flbulgarelli

Method Summary
 Predicate<A> and(Evaluable<? super A> other)
          Returns a predicate that performs a short-circuit logical-and between this Predicate's Evaluable.eval(Object) and other
 Predicate<A> andNotNull()
          Returns a null-safe predicate that, when evaluated, answers false if its argument is null, or evaluates this predicate, otherwise.
 Predicate<A> not()
          Negates this Predicate
<B> Predicate<B>
of(Applicable<? super B,? extends A> other)
          Composes this predicate with another Applicable, resulting in a new Predicate that when applied returns this.eval(other.apply(arg)
 Predicate<A> or(Evaluable<? super A> other)
          Returns a predicate that, performs a short-circuit logical-or between this Predicate's Evaluable.eval(Object) and other
 Predicate<A> orNull()
          Returns a null-safe predicate that, when evaluated, answers true if its argument is null, or evaluates this predicate, otherwise.
 Predicate<A> withEffectOnFalse(Executable<A> executable)
          Adds a a side effect to this predicate, that will be evaluated whenever the predicate evaluation is false
 Predicate<A> withEffectOnTrue(Executable<A> executable)
          Adds a side effect to this predicate, that will be evaluated whenever the predicate evaluation is true
 
Methods inherited from interface net.sf.staccatocommons.defs.Evaluable
eval
 
Methods inherited from interface net.sf.staccatocommons.defs.Applicable
apply
 

Method Detail

not

Predicate<A> not()
Negates this Predicate

Returns:
a Predicate that negates this Predicate's result.

or

Predicate<A> or(@NonNull
                Evaluable<? super A> other)
Returns a predicate that, performs a short-circuit logical-or between this Predicate's Evaluable.eval(Object) and other

Parameters:
other - another Evaluable. Non null.
Returns:
A new predicate that performs the short circuited or between this and other when evaluated.

and

Predicate<A> and(@NonNull
                 Evaluable<? super A> other)
Returns a predicate that performs a short-circuit logical-and between this Predicate's Evaluable.eval(Object) and other

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

@NullSafe
Predicate<A> andNotNull()
Returns a null-safe predicate that, when evaluated, answers false if its argument is null, or evaluates this predicate, otherwise.

Returns:
a predicate that returns arg != null && this.eval(arg)

orNull

@NullSafe
Predicate<A> orNull()
Returns a null-safe predicate that, when evaluated, answers true if its argument is null, or evaluates this predicate, otherwise.

Returns:
a predicate that returns arg == null || this.eval(arg)

withEffectOnTrue

Predicate<A> withEffectOnTrue(Executable<A> executable)
Adds a side effect to this predicate, that will be evaluated whenever the predicate evaluation is true

Parameters:
executable -
Returns:
a new Predicate that adds an Executable effect to this

withEffectOnFalse

Predicate<A> withEffectOnFalse(Executable<A> executable)
Adds a a side effect to this predicate, that will be evaluated whenever the predicate evaluation is false

Parameters:
executable -
Returns:
a new Predicate that adds an Executable effect to this

of

<B> Predicate<B> of(@NonNull
                    Applicable<? super B,? extends A> other)
Composes this predicate with another Applicable, resulting in a new Predicate that when applied returns this.eval(other.apply(arg)

Type Parameters:
B -
Parameters:
other -
Returns:
a new predicate, this composed with other


Get Staccatocommons at SourceForge.net. Fast, secure and Free Open Source software downloads