de.lmu.ifi.dbs.elki.database.query
Class DoubleDistanceResultPair

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.database.query.DoubleDistanceResultPair
All Implemented Interfaces:
DistanceResultPair<DoubleDistance>, PairInterface<DoubleDistance,DBID>, Comparable<DistanceResultPair<DoubleDistance>>

public class DoubleDistanceResultPair
extends Object
implements DistanceResultPair<DoubleDistance>

Optimized DistanceResultPair that avoids/postpones an extra layer of boxing for double values.


Field Summary
(package private)  double distance
          Distance value
(package private)  DBID id
          Object ID
 
Constructor Summary
DoubleDistanceResultPair(double distance, DBID id)
          Constructor.
 
Method Summary
 int compareByDistance(DistanceResultPair<DoubleDistance> o)
          Compare value, but by distance only.
 int compareTo(DistanceResultPair<DoubleDistance> o)
           
 boolean equals(Object obj)
           
 DBID getDBID()
          Getter for second element in pair
 DoubleDistance getDistance()
          Getter for first
 double getDoubleDistance()
          Get the distance as double value.
 DoubleDistance getFirst()
          Deprecated. Use getDoubleDistance() or getDistance() for clearness.
 DBID getSecond()
          Deprecated. Use getDBID() for clearness.
 void setDistance(DoubleDistance distance)
          Setter for first
 void setID(DBID id)
          Setter for second
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

distance

double distance
Distance value


id

DBID id
Object ID

Constructor Detail

DoubleDistanceResultPair

public DoubleDistanceResultPair(double distance,
                                DBID id)
Constructor.

Parameters:
distance - Distance value
id - Object ID
Method Detail

getDistance

public DoubleDistance getDistance()
Description copied from interface: DistanceResultPair
Getter for first

Specified by:
getDistance in interface DistanceResultPair<DoubleDistance>
Returns:
first element in pair

setDistance

public void setDistance(DoubleDistance distance)
Description copied from interface: DistanceResultPair
Setter for first

Specified by:
setDistance in interface DistanceResultPair<DoubleDistance>
Parameters:
distance - new value for first element

getDBID

public DBID getDBID()
Description copied from interface: DistanceResultPair
Getter for second element in pair

Specified by:
getDBID in interface DistanceResultPair<DoubleDistance>
Returns:
second element in pair

setID

public void setID(DBID id)
Description copied from interface: DistanceResultPair
Setter for second

Specified by:
setID in interface DistanceResultPair<DoubleDistance>
Parameters:
id - new value for second element

getFirst

@Deprecated
public DoubleDistance getFirst()
Deprecated. Use getDoubleDistance() or getDistance() for clearness.

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<DoubleDistance,DBID>
Returns:
First object

getSecond

@Deprecated
public DBID getSecond()
Deprecated. Use getDBID() for clearness.

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<DoubleDistance,DBID>
Returns:
Second object

compareByDistance

public int compareByDistance(DistanceResultPair<DoubleDistance> o)
Description copied from interface: DistanceResultPair
Compare value, but by distance only.

Specified by:
compareByDistance in interface DistanceResultPair<DoubleDistance>
Parameters:
o - Other object
Returns:
comparison result, as by Double.compare(this, other)

compareTo

public int compareTo(DistanceResultPair<DoubleDistance> o)
Specified by:
compareTo in interface Comparable<DistanceResultPair<DoubleDistance>>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getDoubleDistance

public double getDoubleDistance()
Get the distance as double value.

Returns:
distance value

toString

public String toString()
Overrides:
toString in class Object

Release 0.4.0 (2011-09-20_1324)