public class DoubleDistanceRStarTreeKNNQuery<O extends SpatialComparable> extends AbstractDistanceKNNQuery<O,DoubleDistance>
Modifier and Type | Class and Description |
---|---|
(package private) class |
DoubleDistanceRStarTreeKNNQuery.DoubleDistanceEntry
Optimized double distance entry implementation.
|
Modifier and Type | Field and Description |
---|---|
protected SpatialPrimitiveDoubleDistanceFunction<? super O> |
distanceFunction
Spatial primitive distance function
|
protected AbstractRStarTree<?,?> |
tree
The index to use
|
distanceQuery
relation
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
DoubleDistanceRStarTreeKNNQuery(AbstractRStarTree<?,?> tree,
DistanceQuery<O,DoubleDistance> distanceQuery,
SpatialPrimitiveDoubleDistanceFunction<? super O> distanceFunction)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
batchNN(AbstractRStarTreeNode<?,?> node,
Map<DBID,KNNHeap<DoubleDistance>> knnLists)
Performs a batch knn query.
|
protected void |
doKNNQuery(O object,
KNNHeap<DoubleDistance> knnList)
Performs a k-nearest neighbor query for the given NumberVector with the
given parameter k and the according distance function.
|
DoubleDistance |
getDistanceFactory()
Get the distance data type of the function.
|
List<List<DistanceResultPair<DoubleDistance>>> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
void |
getKNNForBulkHeaps(Map<DBID,KNNHeap<DoubleDistance>> heaps)
Bulk query method configured by a map.
|
List<DistanceResultPair<DoubleDistance>> |
getKNNForDBID(DBID id,
int k)
Get the k nearest neighbors for a particular id.
|
List<DistanceResultPair<DoubleDistance>> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
protected List<DoubleDistanceRStarTreeKNNQuery.DoubleDistanceEntry> |
getSortedEntries(AbstractRStarTreeNode<?,?> node,
DBIDs ids)
Sorts the entries of the specified node according to their minimum distance
to the specified objects.
|
getDistanceQuery
getRelation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRelation
protected final AbstractRStarTree<?,?> tree
protected final SpatialPrimitiveDoubleDistanceFunction<? super O extends SpatialComparable> distanceFunction
public DoubleDistanceRStarTreeKNNQuery(AbstractRStarTree<?,?> tree, DistanceQuery<O,DoubleDistance> distanceQuery, SpatialPrimitiveDoubleDistanceFunction<? super O> distanceFunction)
tree
- Index to usedistanceQuery
- Distance query to usedistanceFunction
- Distance functionprotected void doKNNQuery(O object, KNNHeap<DoubleDistance> knnList)
object
- the query objectknnList
- the knn list containing the resultprotected void batchNN(AbstractRStarTreeNode<?,?> node, Map<DBID,KNNHeap<DoubleDistance>> knnLists)
node
- the node for which the query should be performedknnLists
- a map containing the knn lists for each query objectsprotected List<DoubleDistanceRStarTreeKNNQuery.DoubleDistanceEntry> getSortedEntries(AbstractRStarTreeNode<?,?> node, DBIDs ids)
node
- the nodeids
- the id of the objectspublic List<DistanceResultPair<DoubleDistance>> getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O extends SpatialComparable,DoubleDistance>
getKNNForObject
in class AbstractDistanceKNNQuery<O extends SpatialComparable,DoubleDistance>
obj
- Query objectk
- Number of neighbors requestedpublic List<DistanceResultPair<DoubleDistance>> getKNNForDBID(DBID id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O extends SpatialComparable,DoubleDistance>
getKNNForDBID
in class AbstractDistanceKNNQuery<O extends SpatialComparable,DoubleDistance>
id
- query object IDk
- Number of neighbors requestedpublic List<List<DistanceResultPair<DoubleDistance>>> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
ids
- query object IDsk
- Number of neighbors requestedpublic void getKNNForBulkHeaps(Map<DBID,KNNHeap<DoubleDistance>> heaps)
KNNQuery
heaps
- Map of heaps to fill.public DoubleDistance getDistanceFactory()
KNNQuery
getDistanceFactory
in interface KNNQuery<O extends SpatialComparable,DoubleDistance>
getDistanceFactory
in class AbstractDistanceKNNQuery<O extends SpatialComparable,DoubleDistance>