de.lmu.ifi.dbs.elki.database.query
Class GenericDistanceResultPair<D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.pairs.Pair<D,DBID>
      extended by de.lmu.ifi.dbs.elki.database.query.GenericDistanceResultPair<D>
Type Parameters:
D - Distance type
All Implemented Interfaces:
DistanceResultPair<D>, PairInterface<D,DBID>, Comparable<DistanceResultPair<D>>

public class GenericDistanceResultPair<D extends Distance<D>>
extends Pair<D,DBID>
implements DistanceResultPair<D>

Trivial implementation using a generic pair.


Field Summary
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
first, second
 
Constructor Summary
GenericDistanceResultPair(D first, DBID second)
          Canonical constructor
 
Method Summary
 int compareByDistance(DistanceResultPair<D> o)
          Compare value, but by distance only.
 int compareTo(DistanceResultPair<D> o)
           
 boolean equals(Object obj)
          Simple equals statement.
 DBID getDBID()
          Getter for second element in pair
 D getDistance()
          Getter for first
 void setDistance(D first)
          Setter for first
 void setID(DBID second)
          Setter for second
 String toString()
          Canonical toString operator
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
getFirst, getSecond, hashCode, newPairArray, setFirst, setSecond
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.pairs.PairInterface
getFirst, getSecond
 

Constructor Detail

GenericDistanceResultPair

public GenericDistanceResultPair(D first,
                                 DBID second)
Canonical constructor

Parameters:
first - Distance
second - Object ID
Method Detail

getDistance

public final D getDistance()
Getter for first

Specified by:
getDistance in interface DistanceResultPair<D extends Distance<D>>
Returns:
first element in pair

setDistance

public final void setDistance(D first)
Setter for first

Specified by:
setDistance in interface DistanceResultPair<D extends Distance<D>>
Parameters:
first - new value for first element

getDBID

public final DBID getDBID()
Getter for second element in pair

Specified by:
getDBID in interface DistanceResultPair<D extends Distance<D>>
Returns:
second element in pair

setID

public final void setID(DBID second)
Setter for second

Specified by:
setID in interface DistanceResultPair<D extends Distance<D>>
Parameters:
second - new value for second element

compareByDistance

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

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

compareTo

public int compareTo(DistanceResultPair<D> o)
Specified by:
compareTo in interface Comparable<DistanceResultPair<D extends Distance<D>>>

equals

public boolean equals(Object obj)
Description copied from class: Pair
Simple equals statement. This Pair equals another Object if they are identical or if the other Object is also a Pair and the Pair.first and Pair.second element of this Pair equal the Pair.first and Pair.second element, respectively, of the other Pair.

Overrides:
equals in class Pair<D extends Distance<D>,DBID>
Parameters:
obj - Object to compare to

toString

public String toString()
Description copied from class: Pair
Canonical toString operator

Overrides:
toString in class Pair<D extends Distance<D>,DBID>

Release 0.4.0 (2011-09-20_1324)