de.lmu.ifi.dbs.elki.database.query.knn
Class AbstractDistanceKNNQuery<O,D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.database.query.AbstractDataBasedQuery<O>
      extended by de.lmu.ifi.dbs.elki.database.query.knn.AbstractDistanceKNNQuery<O,D>
All Implemented Interfaces:
DatabaseQuery, KNNQuery<O,D>
Direct Known Subclasses:
DoubleDistanceRStarTreeKNNQuery, GenericRStarTreeKNNQuery, LinearScanKNNQuery, MetricalIndexKNNQuery

public abstract class AbstractDistanceKNNQuery<O,D extends Distance<D>>
extends AbstractDataBasedQuery<O>
implements KNNQuery<O,D>

Instance for the query on a particular database.


Field Summary
protected  DistanceQuery<O,D> distanceQuery
          Hold the distance function to be used.
 
Fields inherited from class de.lmu.ifi.dbs.elki.database.query.AbstractDataBasedQuery
relation
 
Fields inherited from interface de.lmu.ifi.dbs.elki.database.query.DatabaseQuery
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
 
Constructor Summary
AbstractDistanceKNNQuery(DistanceQuery<O,D> distanceQuery)
          Constructor.
 
Method Summary
 D getDistanceFactory()
          Get the distance data type of the function.
 DistanceQuery<O,D> getDistanceQuery()
          Get the distance query for this function.
abstract  List<DistanceResultPair<D>> getKNNForDBID(DBID id, int k)
          Get the k nearest neighbors for a particular id.
abstract  List<DistanceResultPair<D>> getKNNForObject(O obj, int k)
          Get the k nearest neighbors for a particular id.
 
Methods inherited from class de.lmu.ifi.dbs.elki.database.query.AbstractDataBasedQuery
getRelation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.database.query.knn.KNNQuery
getKNNForBulkDBIDs, getKNNForBulkHeaps, getRelation
 

Field Detail

distanceQuery

protected DistanceQuery<O,D extends Distance<D>> distanceQuery
Hold the distance function to be used.

Constructor Detail

AbstractDistanceKNNQuery

public AbstractDistanceKNNQuery(DistanceQuery<O,D> distanceQuery)
Constructor.

Parameters:
distanceQuery - Distance query used
Method Detail

getKNNForDBID

public abstract List<DistanceResultPair<D>> getKNNForDBID(DBID id,
                                                          int k)
Description copied from interface: KNNQuery
Get the k nearest neighbors for a particular id.

Specified by:
getKNNForDBID in interface KNNQuery<O,D extends Distance<D>>
Parameters:
id - query object ID
k - Number of neighbors requested
Returns:
neighbors

getKNNForObject

public abstract List<DistanceResultPair<D>> getKNNForObject(O obj,
                                                            int k)
Description copied from interface: KNNQuery
Get the k nearest neighbors for a particular id.

Specified by:
getKNNForObject in interface KNNQuery<O,D extends Distance<D>>
Parameters:
obj - Query object
k - Number of neighbors requested
Returns:
neighbors

getDistanceQuery

public DistanceQuery<O,D> getDistanceQuery()
Description copied from interface: KNNQuery
Get the distance query for this function.

Specified by:
getDistanceQuery in interface KNNQuery<O,D extends Distance<D>>

getDistanceFactory

public D getDistanceFactory()
Description copied from interface: KNNQuery
Get the distance data type of the function.

Specified by:
getDistanceFactory in interface KNNQuery<O,D extends Distance<D>>

Release 0.4.0 (2011-09-20_1324)