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.

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

Due to limitations in object subclassing,

invalid reference
CPair
cannot be a subclass of
invalid reference
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:

  • IntIntPair storing two int values
  • DoubleIntPair storing one double and one int value.
  • invalid reference
    IntDoublePair
    storing one int and one double value.
  • DoubleDoublePair storing two double values

Triples can be used via:

  • invalid reference
    Triple
    is the generic non-comparable triple.
  • invalid reference
    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.