org.opensaml.xml.security
Class CriteriaFilteringIterator<T>

java.lang.Object
  extended by org.opensaml.xml.security.CriteriaFilteringIterator<T>
Type Parameters:
T - the type of candidate elements being evaluated
All Implemented Interfaces:
Iterator<T>

public 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 Summary
CriteriaFilteringIterator(Iterator<? extends T> candidatesIterator, Set<EvaluableCriteria<T>> criteria, boolean meetAllCriteria, boolean unevaluableSatisfies)
          Constructor.
 
Method Summary
 boolean hasNext()
          
 T next()
          
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CriteriaFilteringIterator

public CriteriaFilteringIterator(Iterator<? extends T> candidatesIterator,
                                 Set<EvaluableCriteria<T>> criteria,
                                 boolean meetAllCriteria,
                                 boolean unevaluableSatisfies)
Constructor.

Parameters:
candidatesIterator - the candidates to evaluate
criteria - the set of criteria against which to evaluate the candidates
meetAllCriteria - whether a candidate must meet all criteria, or just one
unevaluableSatisfies - 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 element
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator<T>

next

public T next()

Specified by:
next in interface Iterator<T>

remove

public void remove()

Specified by:
remove in interface Iterator<T>


Copyright © 2006-2011 Internet2. All Rights Reserved.