com.infomancers.collections.util
Class PredicateCollection<T>
java.lang.Object
com.infomancers.collections.util.PredicateCollection<T>
- All Implemented Interfaces:
- Predicate<T>
public final class PredicateCollection<T>
- extends java.lang.Object
- implements Predicate<T>
Used to evaluate an item against a collection of predicates.
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PredicateCollection
public PredicateCollection(PredicateCollection.Type type)
add
public void add(Predicate<T> pred)
evaluate
public boolean evaluate(T item)
- Evaluates the item against all predicates in the collection.
If needsAll is set to true, the collection will behave like an
"AND" chain. Otherwise, the collection will behave like an "OR" chain.
- Specified by:
evaluate in interface Predicate<T>
- Parameters:
item - The item to evaluate.
- Returns:
- Whether the item fits all the collection's predicates.
remove
public void remove(Predicate<T> pred)