public class DoubleDoublePair extends java.lang.Object implements java.lang.Comparable<DoubleDoublePair>
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<DoubleDoublePair> |
BYFIRST_COMPARATOR
Comparator to compare by second component only
|
static java.util.Comparator<DoubleDoublePair> |
BYSECOND_COMPARATOR
Comparator to compare by second component only
|
double |
first
first value
|
double |
second
second value
|
static java.util.Comparator<DoubleDoublePair> |
SWAPPED_COMPARATOR
Comparator to compare by swapped components
|
Constructor and Description |
---|
DoubleDoublePair(double first,
double second)
Constructor
|
DoubleDoublePair(DoubleDoublePair other)
Clone constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareSwappedTo(DoubleDoublePair other)
Implementation of comparableSwapped interface, sorting by second then
first.
|
int |
compareTo(DoubleDoublePair other)
Implementation of comparable interface, sorting by first then second.
|
boolean |
equals(java.lang.Object obj)
Trivial equals implementation
|
int |
hashCode()
Trivial hashCode implementation mixing the two integers.
|
void |
setFirst(double first)
Set first value
|
void |
setSecond(double second)
Set second value
|
java.lang.String |
toString() |
public double first
public double second
public static final java.util.Comparator<DoubleDoublePair> BYFIRST_COMPARATOR
public static final java.util.Comparator<DoubleDoublePair> BYSECOND_COMPARATOR
public static final java.util.Comparator<DoubleDoublePair> SWAPPED_COMPARATOR
public DoubleDoublePair(double first, double second)
first
- First valuesecond
- Second valuepublic DoubleDoublePair(DoubleDoublePair other)
other
- Existing pair.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object to compare topublic final int hashCode()
hashCode
in class java.lang.Object
public int compareTo(DoubleDoublePair other)
compareTo
in interface java.lang.Comparable<DoubleDoublePair>
other
- Object to compare topublic int compareSwappedTo(DoubleDoublePair other)
other
- Object to compare topublic final void setFirst(double first)
first
- new valuepublic final void setSecond(double second)
second
- new valuepublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.