public class GenericRStarTreeKNNQuery<O extends SpatialComparable,D extends Distance<D>> extends AbstractDistanceKNNQuery<O,D>
Modifier and Type | Field and Description |
---|---|
protected SpatialPrimitiveDistanceFunction<? super O,D> |
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 |
---|
GenericRStarTreeKNNQuery(AbstractRStarTree<?,?> tree,
SpatialDistanceQuery<O,D> distanceQuery)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
batchNN(AbstractRStarTreeNode<?,?> node,
Map<DBID,KNNHeap<D>> knnLists)
Performs a batch knn query.
|
protected void |
doKNNQuery(O object,
KNNHeap<D> knnList)
Performs a k-nearest neighbor query for the given NumberVector with the
given parameter k and the according distance function.
|
D |
getDistanceFactory()
Get the distance data type of the function.
|
List<List<DistanceResultPair<D>>> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
void |
getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
Bulk query method configured by a map.
|
List<DistanceResultPair<D>> |
getKNNForDBID(DBID id,
int k)
Get the k nearest neighbors for a particular id.
|
List<DistanceResultPair<D>> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
protected List<DistanceEntry<D,SpatialEntry>> |
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 SpatialPrimitiveDistanceFunction<? super O extends SpatialComparable,D extends Distance<D>> distanceFunction
public GenericRStarTreeKNNQuery(AbstractRStarTree<?,?> tree, SpatialDistanceQuery<O,D> distanceQuery)
tree
- Index to usedistanceQuery
- Distance query to useprotected void doKNNQuery(O object, KNNHeap<D> knnList)
object
- the query objectknnList
- the knn list containing the resultprotected void batchNN(AbstractRStarTreeNode<?,?> node, Map<DBID,KNNHeap<D>> knnLists)
node
- the node for which the query should be performedknnLists
- a map containing the knn lists for each query objectspublic void getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
KNNQuery
heaps
- Map of heaps to fill.protected List<DistanceEntry<D,SpatialEntry>> getSortedEntries(AbstractRStarTreeNode<?,?> node, DBIDs ids)
node
- the nodeids
- the id of the objectspublic List<DistanceResultPair<D>> getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O extends SpatialComparable,D extends Distance<D>>
getKNNForObject
in class AbstractDistanceKNNQuery<O extends SpatialComparable,D extends Distance<D>>
obj
- Query objectk
- Number of neighbors requestedpublic List<DistanceResultPair<D>> getKNNForDBID(DBID id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O extends SpatialComparable,D extends Distance<D>>
getKNNForDBID
in class AbstractDistanceKNNQuery<O extends SpatialComparable,D extends Distance<D>>
id
- query object IDk
- Number of neighbors requestedpublic List<List<DistanceResultPair<D>>> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
ids
- query object IDsk
- Number of neighbors requestedpublic D getDistanceFactory()
KNNQuery
getDistanceFactory
in interface KNNQuery<O extends SpatialComparable,D extends Distance<D>>
getDistanceFactory
in class AbstractDistanceKNNQuery<O extends SpatialComparable,D extends Distance<D>>