T
- the type of candidate elements being evaluatedpublic class CriteriaFilteringIterator<T> extends Object implements Iterator<T>
This implementation of Iterator
wraps another Iterator of a particular type, containing candidates
which are to be evaluated against a given set of EvaluableCriteria
. When the iterator is traversed,
criteria evaluation is performed on each candidate element of the underlying wrapped iterator
via EvaluableCriteria.evaluate(Object)
. Only those elements which satisfy the criteria indicated by
the criteria set are returned by the Iterator, as follows.
If the parameter meetAllCriteria
is true
, then all criteria in the criteria
set must be satisfied in order for the element to be returned. This in essence connects the criteria of the criteria
set with a logical AND
. If false
, then if an element satisfies any of the criteria of the
criteria set, it will be returned. This in essence connects the members of the criteria set with a logical
OR
.
If the parameter unevaluableSatisfies
is true
, then if a criteria's evaluation
of the candidate via EvaluableCriteria.evaluate(Object)
indicates that it is unable to evaluate
the candidate, the criteria will be considered satisfied as far as the determination of whether to return
the candidate. If false
, then the criteria will be considered unsatisfied for purposes
of this determination.
Care should be exercised in combining these two parameter values to achieve the desired result.
Constructor and Description |
---|
CriteriaFilteringIterator(Iterator<? extends T> candidatesIterator,
Set<EvaluableCriteria<T>> criteria,
boolean meetAllCriteria,
boolean unevaluableSatisfies)
Constructor.
|
public CriteriaFilteringIterator(Iterator<? extends T> candidatesIterator, Set<EvaluableCriteria<T>> criteria, boolean meetAllCriteria, boolean unevaluableSatisfies)
candidatesIterator
- the candidates to evaluatecriteria
- the set of criteria against which to evaluate the candidatesmeetAllCriteria
- whether a candidate must meet all criteria, or just oneunevaluableSatisfies
- whether a can-not-evaluate result of a particular criteria's evaluation
is treated as the candidate having satisfied or not satisfied the criteria, for purposes
of determinig whether to return the elementCopyright © 2018 JBoss by Red Hat. All rights reserved.