org.jjoost.util.filters
Class AcceptBetween<E extends java.lang.Comparable<? super E>>

java.lang.Object
  extended by org.jjoost.util.filters.PartialOrderAcceptBetween<E>
      extended by org.jjoost.util.filters.AcceptBetween<E>
All Implemented Interfaces:
java.io.Serializable, Filter<E>, FilterPartialOrder<E>, BothFilter<E>

public class AcceptBetween<E extends java.lang.Comparable<? super E>>
extends PartialOrderAcceptBetween<E>
implements BothFilter<E>

A filter that accepts everything between the provided lower and upper bounds, as determined by the Comparator provided to its methods. Each bound can be specified as inclusive or exclusive

See Also:
Serialized Form

Constructor Summary
AcceptBetween(E lb, boolean lbIsInclusive, E ub, boolean ubIsInclusive)
          Constructs a new filter that accepts everything between the provided lower and upper bounds, as determined by the Comparator provided to its methods.
 
Method Summary
 boolean accept(E test)
          Returns true if the Filter accepts the parameter and false otherwise
static
<E extends java.lang.Comparable<? super E>>
AcceptBetween<E>
get(E lb, boolean lbIsInclusive, E ub, boolean ubIsInclusive)
          Returns a filter that accepts everything between the provided lower and upper bounds, as determined by the Comparator provided to its methods.
static
<E extends java.lang.Comparable<? super E>>
AcceptBetween<E>
get(E lb, E ub)
          Returns a partial order filter that accepts everything greater than or equal to the provided lower bound (first argument) and everything strictly less than the provided upper bound (second argument), as determined by the Comparator provided to its methods by utilising classes.
 java.lang.String toString()
           
 
Methods inherited from class org.jjoost.util.filters.PartialOrderAcceptBetween
accept, mayAcceptBetween, mayRejectBetween
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jjoost.util.FilterPartialOrder
accept, mayAcceptBetween, mayRejectBetween
 

Constructor Detail

AcceptBetween

public AcceptBetween(E lb,
                     boolean lbIsInclusive,
                     E ub,
                     boolean ubIsInclusive)
Constructs a new filter that accepts everything between the provided lower and upper bounds, as determined by the Comparator provided to its methods. Each bound can be specified as inclusive or exclusive

Parameters:
lb - lower limit of acceptable values
lbIsInclusive - true if lb should be inclusive, false if exclusive
ub - exclusive upper limit of acceptable values
ubIsInclusive - true if ub should be inclusive, false if exclusive
Method Detail

accept

public boolean accept(E test)
Description copied from interface: Filter
Returns true if the Filter accepts the parameter and false otherwise

Specified by:
accept in interface Filter<E extends java.lang.Comparable<? super E>>
Parameters:
test - value to test
Returns:
true if the filter accepts test; false otherwise

get

public static <E extends java.lang.Comparable<? super E>> AcceptBetween<E> get(E lb,
                                                                               E ub)
Returns a partial order filter that accepts everything greater than or equal to the provided lower bound (first argument) and everything strictly less than the provided upper bound (second argument), as determined by the Comparator provided to its methods by utilising classes.

Parameters:
lb - inclusive lower limit of acceptable values
ub - exclusive upper limit of acceptable values
Returns:
a filter that accepts everything in the range [lb...ub)

get

public static <E extends java.lang.Comparable<? super E>> AcceptBetween<E> get(E lb,
                                                                               boolean lbIsInclusive,
                                                                               E ub,
                                                                               boolean ubIsInclusive)
Returns a filter that accepts everything between the provided lower and upper bounds, as determined by the Comparator provided to its methods. Each bound can be specified as inclusive or exclusive

Parameters:
lb - lower limit of acceptable values
lbIsInclusive - true if lb should be inclusive, false if exclusive
ub - exclusive upper limit of acceptable values
ubIsInclusive - true if ub should be inclusive, false if exclusive
Returns:
a filter that accepts everything in the range [lb...ub)

toString

public java.lang.String toString()
Overrides:
toString in class PartialOrderAcceptBetween<E extends java.lang.Comparable<? super E>>