|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jutil.java.collections.ExtendedComparator
A Comparator with more convenient methods than java.util.Comparator
.
Constructor Summary | |
ExtendedComparator()
|
Method Summary | |
static ExtendedComparator |
ensureExtended(java.util.Comparator comparator)
public behavior pre comparator != null; // The result must behave exactly the same as the given comparator. post (\forall Object o1; ; (\forall Object o2; ; \result.compare(o1, o2) == comparator.compare(o1, o2))); Ensure that the result is an ExtendedComparator. |
boolean |
greater(java.lang.Object first,
java.lang.Object second)
public behavior post \result == (compare(first, second) > 0); |
java.lang.Object |
max(java.lang.Object first,
java.lang.Object second)
public behavior post \result == first | \result == second; post compare(\result, first) >= 0; post compare(\result, second) >= 0; |
java.lang.Object |
min(java.lang.Object first,
java.lang.Object second)
public behavior post \result == first | \result == second; post compare(\result, first) <= 0; post compare(\result, second) <= 0; |
boolean |
notGreater(java.lang.Object first,
java.lang.Object second)
public behavior post \result == ! greater(first, second); |
boolean |
notSmaller(java.lang.Object first,
java.lang.Object second)
public behavior post \result == ! smaller(first, second); |
boolean |
smaller(java.lang.Object first,
java.lang.Object second)
public behavior post \result == (compare(first, second) < 0); |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
compare, equals |
Constructor Detail |
public ExtendedComparator()
Method Detail |
public java.lang.Object max(java.lang.Object first, java.lang.Object second)
Return the maximum of both objects. In case of a tie, any one of both can be returned.
first
- The first objectsecond
- The second objectpublic java.lang.Object min(java.lang.Object first, java.lang.Object second)
Return the minimum of both objects. In case of a tie, any one of both can be returned.
first
- The first objectsecond
- The second objectpublic boolean greater(java.lang.Object first, java.lang.Object second)
Check whether or not the first object is greater than the second one.
first
- The first objectsecond
- The second objectpublic boolean smaller(java.lang.Object first, java.lang.Object second)
Check whether or not the first object is smaller than the second one.
first
- The first objectsecond
- The second objectpublic boolean notSmaller(java.lang.Object first, java.lang.Object second)
Check whether or not the first object is greater than or equal to the second one.
first
- The first objectsecond
- The second objectpublic boolean notGreater(java.lang.Object first, java.lang.Object second)
Check whether or not the first object is smaller than or equal to the second one.
first
- The first objectsecond
- The second objectpublic static ExtendedComparator ensureExtended(java.util.Comparator comparator)
comparator
- The comparator of which one wants an ExtendedComparator
that behaves the same.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |