net.sf.molae.pipe.sorted
Class SubSetFilter<T>

java.lang.Object
  extended by net.sf.molae.pipe.sorted.SubSetFilter<T>
All Implemented Interfaces:
TypedPredicate<T>

public final class SubSetFilter<T>
extends Object
implements TypedPredicate<T>

To pass this filter an object must be greater or equal to the lower bound and smaller than the upper bound using the specified comparator.


Constructor Summary
SubSetFilter(T lowerBound, T upperBound, Comparator<T> comparator)
          Constructs a SubSetFilter object.
 
Method Summary
 boolean evaluate(T input)
          Compares the specified object to the boundaries of this filter.
static
<T> TypedPredicate<T>
newInstance(T lowerBound, T upperBound, Comparator<T> comparator)
          Constructs a SubSetFilter object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubSetFilter

public SubSetFilter(T lowerBound,
                    T upperBound,
                    Comparator<T> comparator)
Constructs a SubSetFilter object.

Parameters:
lowerBound - lower bound of the intended sub set.
upperBound - upper bound of the intended sub set
comparator - comparator used for evaluation.
Throws:
NullPointerException - if the specified bounds are null.
Method Detail

newInstance

public static <T> TypedPredicate<T> newInstance(T lowerBound,
                                                T upperBound,
                                                Comparator<T> comparator)
Constructs a SubSetFilter object.

Parameters:
lowerBound - lower bound of the intended sub set.
upperBound - upper bound of the intended sub set
comparator - comparator used for evaluation.
Throws:
NullPointerException - if the specified bounds are null.

evaluate

public boolean evaluate(T input)
Compares the specified object to the boundaries of this filter.

Specified by:
evaluate in interface TypedPredicate<T>
Parameters:
input - object to evaluate.
Returns:
true, iff the specified object is greater or equal to the lower bound and smaller than the upper bound of this filter