java.lang.Object
de.lmu.ifi.dbs.elki.utilities.pairs.DoubleDoublePair
- All Implemented Interfaces:
PairInterface<Double,,Double> Comparable<DoubleDoublePair>
- Direct Known Subclasses:
DoubleMinMax
public class DoubleDoublePair
extends Object
implements Comparable<DoubleDoublePair>, PairInterface<Double,Double>
Pair storing two doubles.
Since double is a native type, this can't be done via the
generic.
invalid reference
CPair
- Author:
- Erich Schubert
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<DoubleDoublePair> Comparator to compare by second component onlystatic final Comparator<DoubleDoublePair> Comparator to compare by second component onlydoublefirst valuedoublesecond valuestatic final Comparator<DoubleDoublePair> Comparator to compare by swapped components -
Constructor Summary
ConstructorsConstructorDescriptionDoubleDoublePair(double first, double second) ConstructorDoubleDoublePair(DoubleDoublePair other) Clone constructor. -
Method Summary
Modifier and TypeMethodDescriptionintcompareSwappedTo(DoubleDoublePair other) Implementation of comparableSwapped interface, sorting by second then first.intcompareTo(DoubleDoublePair other) Implementation of comparable interface, sorting by first then second.booleanTrivial equals implementationfinal DoublegetFirst()Deprecated.use pair.first to avoid boxing!final DoubleDeprecated.use pair.first to avoid boxing!final inthashCode()Trivial hashCode implementation mixing the two integers.final voidsetFirst(double first) Set first valuefinal voidsetSecond(double second) Set second valuetoString()
-
Field Details
-
first
public double firstfirst value -
second
public double secondsecond value -
BYFIRST_COMPARATOR
Comparator to compare by second component only -
BYSECOND_COMPARATOR
Comparator to compare by second component only -
SWAPPED_COMPARATOR
Comparator to compare by swapped components
-
-
Constructor Details
-
DoubleDoublePair
public DoubleDoublePair(double first, double second) Constructor- Parameters:
first- First valuesecond- Second value
-
DoubleDoublePair
Clone constructor.- Parameters:
other- Existing pair.
-
-
Method Details
-
equals
Trivial equals implementation -
hashCode
public final int hashCode()Trivial hashCode implementation mixing the two integers. -
compareTo
Implementation of comparable interface, sorting by first then second.- Specified by:
compareToin interfaceComparable<DoubleDoublePair>- Parameters:
other- Object to compare to- Returns:
- comparison result
-
compareSwappedTo
Implementation of comparableSwapped interface, sorting by second then first.- Parameters:
other- Object to compare to- Returns:
- comparison result
-
getFirst
Deprecated.use pair.first to avoid boxing!Description copied from interface:PairInterfaceGet the first object - note: this may cause autoboxing, use pair.first for native pairs!- Specified by:
getFirstin interfacePairInterface<Double,Double> - Returns:
- First object
-
setFirst
public final void setFirst(double first) Set first value- Parameters:
first- new value
-
getSecond
Deprecated.use pair.first to avoid boxing!Description copied from interface:PairInterfaceGet the second object - note: this may cause autoboxing, use pair.second for native pairs!- Specified by:
getSecondin interfacePairInterface<Double,Double> - Returns:
- Second object
-
setSecond
public final void setSecond(double second) Set second value- Parameters:
second- new value
-
toString
-