de.lmu.ifi.dbs.elki.utilities.pairs
Class IntDoublePair

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.pairs.IntDoublePair
All Implemented Interfaces:
PairInterface<Integer,Double>, Comparable<IntDoublePair>

public class IntDoublePair
extends Object
implements Comparable<IntDoublePair>, PairInterface<Integer,Double>

Pair storing an integer and a double. Since double and int are native types, this can't be done via the CPair generic.


Field Summary
static Comparator<IntDoublePair> BYFIRST_COMPARATOR
          Comparator to compare by second component only
static Comparator<IntDoublePair> BYSECOND_COMPARATOR
          Comparator to compare by second component only
 int first
          first value
 double second
          second value
static Comparator<IntDoublePair> SWAPPED_COMPARATOR
          Comparator to compare by swapped components
 
Constructor Summary
IntDoublePair(int first, double second)
          Constructor
 
Method Summary
 int compareSwappedTo(IntDoublePair other)
          Implementation of comparableSwapped interface, sorting by second then first.
 int compareTo(IntDoublePair other)
          Implementation of comparable interface, sorting by first then second.
 boolean equals(Object obj)
          Trivial equals implementation
 Integer getFirst()
          Deprecated. use pair.first to avoid boxing!
 Double getSecond()
          Deprecated. use pair.first to avoid boxing!
 int hashCode()
          Trivial hashCode implementation mixing the two integers.
 void setFirst(int first)
          Set first value
 void setSecond(double second)
          Set second value
 String toString()
          Returns first and second value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public int first
first value


second

public double second
second value


BYFIRST_COMPARATOR

public static final Comparator<IntDoublePair> BYFIRST_COMPARATOR
Comparator to compare by second component only


BYSECOND_COMPARATOR

public static final Comparator<IntDoublePair> BYSECOND_COMPARATOR
Comparator to compare by second component only


SWAPPED_COMPARATOR

public static final Comparator<IntDoublePair> SWAPPED_COMPARATOR
Comparator to compare by swapped components

Constructor Detail

IntDoublePair

public IntDoublePair(int first,
                     double second)
Constructor

Parameters:
first - First value
second - Second value
Method Detail

equals

public boolean equals(Object obj)
Trivial equals implementation

Overrides:
equals in class Object
Parameters:
obj - Object to compare to

hashCode

public final int hashCode()
Trivial hashCode implementation mixing the two integers.

Overrides:
hashCode in class Object

compareTo

public int compareTo(IntDoublePair other)
Implementation of comparable interface, sorting by first then second.

Specified by:
compareTo in interface Comparable<IntDoublePair>
Parameters:
other - Object to compare to
Returns:
comparison result

compareSwappedTo

public int compareSwappedTo(IntDoublePair other)
Implementation of comparableSwapped interface, sorting by second then first.

Parameters:
other - Object to compare to
Returns:
comparison result

getFirst

@Deprecated
public final Integer getFirst()
Deprecated. use pair.first to avoid boxing!

Description copied from interface: PairInterface
Get the first object - note: this may cause autoboxing, use pair.first for native pairs!

Specified by:
getFirst in interface PairInterface<Integer,Double>
Returns:
First object

setFirst

public final void setFirst(int first)
Set first value

Parameters:
first - new value

getSecond

@Deprecated
public final Double getSecond()
Deprecated. use pair.first to avoid boxing!

Description copied from interface: PairInterface
Get the second object - note: this may cause autoboxing, use pair.second for native pairs!

Specified by:
getSecond in interface PairInterface<Integer,Double>
Returns:
Second object

setSecond

public final void setSecond(double second)
Set second value

Parameters:
second - new value

toString

public String toString()
Returns first and second value.

Overrides:
toString in class Object

Release 0.4.0 (2011-09-20_1324)