Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.pairs
Class Pair.Compare<FIRST,SECOND>

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

public static class Pair.Compare<FIRST,SECOND>
extends Object
implements Comparator<Pair<FIRST,SECOND>>

Compare two SimplePairs based on two comparators


Field Summary
private  Comparator<FIRST> fcomparator
          A comparator for type FIRST.
private  Comparator<SECOND> scomparator
          A comparator for type FIRST.
 
Constructor Summary
Pair.Compare(Comparator<FIRST> fcomparator, Comparator<SECOND> scomparator)
          Provides a comparator for an Pair based on the given Comparator for type P.
 
Method Summary
 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 comparators fcomparator, then scomparator.
 
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

fcomparator

private Comparator<FIRST> fcomparator
A comparator for type FIRST.


scomparator

private Comparator<SECOND> scomparator
A comparator for type FIRST.

Constructor Detail

Pair.Compare

public Pair.Compare(Comparator<FIRST> fcomparator,
                    Comparator<SECOND> scomparator)
Provides a comparator for an Pair based on the given Comparator for type P.

Parameters:
fcomparator - Comparator for the first component
scomparator - Comparator for the second component
Method Detail

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 comparators fcomparator, then scomparator.

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

Release 0.2.1 (2009-07-13_1605)