de.lmu.ifi.dbs.elki.utilities.pairs
Class PairUtil.CompareBySecond<FIRST,SECOND>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.pairs.PairUtil.CompareBySecond<FIRST,SECOND>
Type Parameters:
FIRST - first type
SECOND - second type
All Implemented Interfaces:
Comparator<Pair<? extends FIRST,? extends SECOND>>
Enclosing class:
PairUtil

public static class PairUtil.CompareBySecond<FIRST,SECOND>
extends Object
implements Comparator<Pair<? extends FIRST,? extends SECOND>>

Compare two SimplePairs based on a comparator for the second component.


Field Summary
private  Comparator<? super SECOND> comparator
          A comparator for type P.
 
Constructor Summary
PairUtil.CompareBySecond(Comparator<? super SECOND> comparator)
          Provides a comparator for an Pair based on the given Comparator for type P.
 
Method Summary
 int compare(Pair<? extends FIRST,? extends SECOND> o1, Pair<? extends FIRST,? extends SECOND> o2)
          To Objects of type Pair are compared based on the comparison of their property using the current PairUtil.comparator().
 
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
equals
 

Field Detail

comparator

private Comparator<? super SECOND> comparator
A comparator for type P.

Constructor Detail

PairUtil.CompareBySecond

public PairUtil.CompareBySecond(Comparator<? super SECOND> comparator)
Provides a comparator for an Pair based on the given Comparator for type P.

Parameters:
comparator - a Comparator for type P to base the comparison of an Pair on
Method Detail

compare

public int compare(Pair<? extends FIRST,? extends SECOND> o1,
                   Pair<? extends FIRST,? extends SECOND> o2)
To Objects of type Pair are compared based on the comparison of their property using the current PairUtil.comparator().

Specified by:
compare in interface Comparator<Pair<? extends FIRST,? extends SECOND>>
Parameters:
o1 - First object
o2 - Second object
Returns:
comparison result
See Also:
Comparator.compare(T, T)

Release 0.4.0 (2011-09-20_1324)