Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities
Class QueryResult<D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.QueryResult<D>
All Implemented Interfaces:
Comparable<QueryResult<D>>

public class QueryResult<D extends Distance<D>>
extends Object
implements Comparable<QueryResult<D>>

QueryResult holds the id of a database object and its distance to a special query object.

Author:
Elke Achtert

Field Summary
private  D distance
          The distance of the underlying database object to the query object.
private  int id
          The id of the underlying database object.
 
Constructor Summary
QueryResult(int id, D distance)
          Creates a new QueryResult object.
 
Method Summary
 int compareTo(QueryResult<D> o)
          Compares this QueryResult with the given QueryResult with respect to the distances.
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 D getDistance()
          Returns the distance of the underlying database object to the query object.
 int getID()
          Returns the id of the underlying database object.
 int hashCode()
          Returns a hash code value for this object.
 String toString()
          Returns a string representation of this QueryResult object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private final int id
The id of the underlying database object.


distance

private final D extends Distance<D> distance
The distance of the underlying database object to the query object.

Constructor Detail

QueryResult

public QueryResult(int id,
                   D distance)
Creates a new QueryResult object.

Parameters:
id - the id of the underlying database object
distance - the distance of the underlying database object to the query object
Method Detail

getID

public int getID()
Returns the id of the underlying database object.

Returns:
the id of the underlying database object

getDistance

public D getDistance()
Returns the distance of the underlying database object to the query object.

Returns:
the distance of the underlying database object to the query object

compareTo

public int compareTo(QueryResult<D> o)
Compares this QueryResult with the given QueryResult with respect to the distances.

Specified by:
compareTo in interface Comparable<QueryResult<D extends Distance<D>>>
See Also:
Comparable.compareTo(Object)

toString

public String toString()
Returns a string representation of this QueryResult object.

Overrides:
toString in class Object
Returns:
a string representation of this QueryResult object.

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the o argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this object.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object

Release 0.1 (2008-07-10_1838)