public class IntIntPair extends java.lang.Object implements java.lang.Comparable<IntIntPair>
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<IntIntPair> |
BYFIRST_COMPARATOR
Comparator to compare by second component only
|
static java.util.Comparator<IntIntPair> |
BYSECOND_COMPARATOR
Comparator to compare by second component only
|
int |
first
first value
|
int |
second
second value
|
static java.util.Comparator<IntIntPair> |
SWAPPED_COMPARATOR
Comparator to compare by swapped components
|
Constructor and Description |
---|
IntIntPair(int first,
int second)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareSwappedTo(IntIntPair other)
Implementation of comparableSwapped interface, sorting by second then
first.
|
int |
compareTo(IntIntPair 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(int first)
Set first value
|
void |
setSecond(int second)
Set second value
|
java.lang.String |
toString() |
public int first
public int second
public static final java.util.Comparator<IntIntPair> BYFIRST_COMPARATOR
public static final java.util.Comparator<IntIntPair> BYSECOND_COMPARATOR
public static final java.util.Comparator<IntIntPair> SWAPPED_COMPARATOR
public IntIntPair(int first, int second)
first
- First valuesecond
- Second valuepublic 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(IntIntPair other)
compareTo
in interface java.lang.Comparable<IntIntPair>
other
- Object to compare topublic int compareSwappedTo(IntIntPair other)
other
- Object to compare topublic final void setFirst(int first)
first
- new valuepublic final void setSecond(int second)
second
- new valuepublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.