Module math

Package de.lmu.ifi.dbs.elki.utilities.pairs


package de.lmu.ifi.dbs.elki.utilities.pairs

Pairs and triples utility classes.

Pairs and triples are frequently used classes and reimplemented too often.

  • Pair is the generic non-comparable pair (you can use external comparators!).
  • FCPair is the generic pair comparable in the first component only.
  • CPair is the pair comparable in both components.
  • SCPair is the generic pair comparable in the second component only.

Due to limitations in object subclassing, CPair cannot be a subclass of FCPair, since a class cannot implement the Comparable interface twice.

Also primitive types cannot be used in Generics, resulting in the following classes for primitive types:

Triples can be used via:

  • Triple is the generic non-comparable triple.
  • CTriple is the triple comparable in all components.

If you need a triple comparable in just particular components, either define a comparator for sorting or subclass Triple appropriately.