|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections4.functors.AbstractQuantifierPredicate<T>
org.apache.commons.collections4.functors.OnePredicate<T>
public final class OnePredicate<T>
Predicate implementation that returns true if only one of the predicates return true. If the array of predicates is empty, then this predicate returns false.
NOTE: In versions prior to 3.2 an array size of zero or one threw an exception.
| Field Summary |
|---|
| Fields inherited from class org.apache.commons.collections4.functors.AbstractQuantifierPredicate |
|---|
iPredicates |
| Constructor Summary | |
|---|---|
OnePredicate(Predicate<? super T>... predicates)
Constructor that performs no validation. |
|
| Method Summary | ||
|---|---|---|
boolean |
evaluate(T object)
Evaluates the predicate returning true if only one decorated predicate returns true. |
|
static
|
onePredicate(Collection<? extends Predicate<T>> predicates)
Factory to create the predicate. |
|
static
|
onePredicate(Predicate<? super T>... predicates)
Factory to create the predicate. |
|
| Methods inherited from class org.apache.commons.collections4.functors.AbstractQuantifierPredicate |
|---|
getPredicates |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OnePredicate(Predicate<? super T>... predicates)
onePredicate if you want that.
predicates - the predicates to check, not cloned, not null| Method Detail |
|---|
public static <T> Predicate<T> onePredicate(Predicate<? super T>... predicates)
If the array is size zero, the predicate always returns false. If the array is size one, then that predicate is returned.
T - the type that the predicate queriespredicates - the predicates to check, cloned, not null
any predicate
IllegalArgumentException - if the predicates array is null
IllegalArgumentException - if any predicate in the array is nullpublic static <T> Predicate<T> onePredicate(Collection<? extends Predicate<T>> predicates)
T - the type that the predicate queriespredicates - the predicates to check, cloned, not null
one predicate
IllegalArgumentException - if the predicates array is null
IllegalArgumentException - if any predicate in the array is nullpublic boolean evaluate(T object)
evaluate in interface Predicate<T>object - the input object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||