|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.molae.pipe.sorted.ComparatorWithInfinity<T>
public final class ComparatorWithInfinity<T>
Allows to define two constants for negative and positive infinity that are always less or greater than any other object, respecitively.
| Constructor Summary | |
|---|---|
ComparatorWithInfinity(Comparator<T> base,
Object negativeInfinity,
Object positiveInfinity)
Constructs a ComparatorWithInfinity object. |
|
| Method Summary | ||
|---|---|---|
int |
compare(T o1,
T o2)
If either argument is positive or negative infinity as specified in the constructor,
the corresponding result is returned,
otherwise the base comparator is used. |
|
boolean |
equals(Object obj)
Compares the specified object with this comparator for equality. |
|
static
|
newInstance(Comparator<T> base,
Object negativeInfinity,
Object positiveInfinity)
Constructs a ComparatorWithInfinity object. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ComparatorWithInfinity(Comparator<T> base,
Object negativeInfinity,
Object positiveInfinity)
base - the underlying comparator.negativeInfinity - an Object representing negative infinity.positiveInfinity - an Object representing positive infinity.| Method Detail |
|---|
public static <T> Comparator<T> newInstance(Comparator<T> base,
Object negativeInfinity,
Object positiveInfinity)
base - the underlying comparator.negativeInfinity - an Object representing negative infinity.positiveInfinity - an Object representing positive infinity.
public int compare(T o1,
T o2)
constructor,
the corresponding result is returned,
otherwise the base comparator is used.
compare in interface Comparator<T>ClassCastException - if o1 and o2
cannot be compared to one another using
the comparator (or, if it is null,
using natural ordering).
NullPointerException - if o1 or o2
is null and natural order is used,
or if the comparator does not tolerate null elements.public boolean equals(Object obj)
true, iff the parameter is a
ComparatorWithInfinity and all properties are equal.
equals in interface Comparator<T>equals in class Objectobj - the reference object with which to compare.
true if the specified Object is equal to this
comparator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||