org.jjoost.util
Interface FilterPartialOrder<P>

All Known Subinterfaces:
BothFilter<E>
All Known Implementing Classes:
AcceptAll, AcceptBetween, AcceptEqual, AcceptGreater, AcceptGreaterEqual, AcceptLess, AcceptLessEqual, AcceptNone, AcceptUniqueAscendingSequence, AcceptUniqueDescendingSequence, BothFilterAnd, BothFilterMultiAnd, BothFilterMultiOr, BothFilterNot, BothFilterOr, PartialOrderAcceptBetween, PartialOrderAcceptGreater, PartialOrderAcceptGreaterEqual, PartialOrderAcceptLess, PartialOrderAcceptLessEqual, PartialOrderAnd, PartialOrderMultiAnd, PartialOrderMultiOr, PartialOrderNot, PartialOrderOr, PartialOrderOverride

public interface FilterPartialOrder<P>

This interface is used to define an abstract filter over a data set whose type is known but whose ordering may not be. With a provided Comparator instances of this interface should be able to indicate whether or not a range bounds a value that the filter accepts. Null values cannot be part of the ordering, as they indicate +/- infinite to the mayAcceptBetween() method

Author:
b.elliottsmith

Method Summary
 boolean accept(P v, java.util.Comparator<? super P> cmp)
          Return true iff this filter and comparator combination accept the provided value
 boolean mayAcceptBetween(P lb, boolean lbInclusive, P ub, boolean ubInclusive, java.util.Comparator<? super P> cmp)
          Returns true if there exists (in the total order defined by the comparator, not necessarily in any concrete data set this is being applied to) a value between lb and ub that this filter may accept.
 boolean mayRejectBetween(P lb, boolean lbInclusive, P ub, boolean ubInclusive, java.util.Comparator<? super P> cmp)
          Returns true if there exists (in the total order defined by the comparator, not necessarily in any concrete data set this is being applied to) a value between lb and ub that this filter may reject.
 

Method Detail

accept

boolean accept(P v,
               java.util.Comparator<? super P> cmp)
Return true iff this filter and comparator combination accept the provided value

Parameters:
v - the value to check
cmp - the partial order
Returns:
true, if accepts

mayAcceptBetween

boolean mayAcceptBetween(P lb,
                         boolean lbInclusive,
                         P ub,
                         boolean ubInclusive,
                         java.util.Comparator<? super P> cmp)
Returns true if there exists (in the total order defined by the comparator, not necessarily in any concrete data set this is being applied to) a value between lb and ub that this filter may accept. This method may return true if there is no such value, at the cost of more expensive execution but valid behaviour, however it cannot return false if there is such a value without breaking functionality. null values should be seen as both +/- infinity, i.e. containsBetween(null, o) should return containsBefore(o) and containsBetween(o, null) should return containsAfter(o) containsBetween should take arguments IN ORDER, i.e. o1 <= o2; behaviour where o2 < o1 is undefined.

Parameters:
lb - the lower bound of the range to check
lbInclusive - if the lower bound should be taken as inclusive
ub - the upper bound of the range to check
ubInclusive - if the upper bound should be taken as inclusive
cmp - the partial order
Returns:
true, if there may exists a value V such that lb <(/<=) V <(/<=) ub and accept(V, cmp) == true

mayRejectBetween

boolean mayRejectBetween(P lb,
                         boolean lbInclusive,
                         P ub,
                         boolean ubInclusive,
                         java.util.Comparator<? super P> cmp)
Returns true if there exists (in the total order defined by the comparator, not necessarily in any concrete data set this is being applied to) a value between lb and ub that this filter may reject. This method may return true if there is no such value at the cost of more expensive execution but valid behaviour, however it cannot return false if there is such a value without breaking functionality. null values should be seen as both +/- infinity, i.e. containsBetween(null, o) should return containsBefore(o) and containsBetween(o, null) should return containsAfter(o) containsBetween should take arguments IN ORDER, i.e. o1 <= o2; behaviour where o2 < o1 is undefined.

Parameters:
lb - the lower bound of the range to check
lbInclusive - if the lower bound should be taken as inclusive
ub - the upper bound of the range to check
ubInclusive - if the upper bound should be taken as inclusive
cmp - the partial order
Returns:
true, if there may exists a value V such that lb <(/<=) V <(/<=) ub and accept(V, cmp) == false