|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjpaul.Misc.Predicate<T>
public abstract class Predicate<T>
Predicate wraps a boolean predicate. A predicate is
supposed to be pure, i.e., no side-effects. In those exceptional
cases that require side-effects, the programmer should either use
ActionPredicate, or, at the very least, explicitly document
the side-effects.
| Constructor Summary | |
|---|---|
Predicate()
|
|
| Method Summary | ||
|---|---|---|
static
|
AND(Predicate<T> a,
Predicate<T> b)
Short-circuited AND operation. |
|
abstract boolean |
check(T obj)
The boolean predicate. |
|
static
|
FALSE()
Returns an always-false predicate. |
|
static
|
FULL_AND(Predicate<T> a,
Predicate<T> b)
Complete AND operation. |
|
static
|
FULL_OR(Predicate<T> a,
Predicate<T> b)
Complete OR operation. |
|
static
|
NOT(Predicate<T> pred)
Predicate negation. |
|
static
|
OR(Predicate<T> a,
Predicate<T> b)
Short-circuited OR operation. |
|
static
|
TRUE()
Returns an always-true predicate. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Predicate()
| Method Detail |
|---|
public abstract boolean check(T obj)
public static <T> Predicate<T> TRUE()
public static <T> Predicate<T> FALSE()
public static <T> Predicate<T> NOT(Predicate<T> pred)
pred is
false.
public static <T> Predicate<T> AND(Predicate<T> a,
Predicate<T> b)
a and
b are true. Evaluation stops as soon as the
final result is known.
public static <T> Predicate<T> OR(Predicate<T> a,
Predicate<T> b)
a and
b are false. Evaluation stops as soon as the
final result is known.
public static <T> Predicate<T> FULL_AND(Predicate<T> a,
Predicate<T> b)
AND(jpaul.Misc.Predicate, jpaul.Misc.Predicate) but no
short-circuit: in all situations, a is evaluated
and next b is evaluated. Good for impure
predicates.
public static <T> Predicate<T> FULL_OR(Predicate<T> a,
Predicate<T> b)
OR(jpaul.Misc.Predicate, jpaul.Misc.Predicate) but no
short-circuit: in all situations, a is evaluated
and next b is evaluated. Good for impure
predicates.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||