de.lmu.ifi.dbs.elki.utilities.pairs
Class PairUtil.CompareSwapped<FIRST,SECOND>
java.lang.Object
de.lmu.ifi.dbs.elki.utilities.pairs.PairUtil.CompareSwapped<FIRST,SECOND>
- Type Parameters:
FIRST - first typeSECOND - second type
- All Implemented Interfaces:
- Comparator<Pair<FIRST,SECOND>>
- Enclosing class:
- PairUtil
public static class PairUtil.CompareSwapped<FIRST,SECOND>
- extends Object
- implements Comparator<Pair<FIRST,SECOND>>
Compare two SimplePairs based on two comparators, but by second component first.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fcomparator
private Comparator<? super FIRST> fcomparator
- A comparator for type FIRST.
scomparator
private Comparator<? super SECOND> scomparator
- A comparator for type FIRST.
PairUtil.CompareSwapped
public PairUtil.CompareSwapped(Comparator<? super FIRST> fcomparator,
Comparator<? super SECOND> scomparator)
- Provides a comparator for an
Pair based on the given
Comparator for type P.
- Parameters:
fcomparator - Comparator for the first componentscomparator - Comparator for the second component
compare
public int compare(Pair<FIRST,SECOND> o1,
Pair<FIRST,SECOND> o2)
- Two Objects of type
Pair are compared based on the
comparison of their property using the given comparators scomparator, then fcomparator.
- Specified by:
compare in interface Comparator<Pair<FIRST,SECOND>>
- Parameters:
o1 - First objecto2 - Second object
- Returns:
- comparison result
- See Also:
Comparator.compare(T, T)