private void doBulkReverseKNN ( RdKNNNode node , DBIDs ids , Map < DBID , ModifiableDoubleDBIDList > result ) { if ( node . isLeaf ( ) ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { RdKNNLeafEntry entry = ( RdKNNLeafEntry ) node . getEntry ( i ) ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { DBID id = DBIDUtil . deref ( iter ) ; double distance = distanceQuery . distance ( entry . getDBID ( ) , id ) ; if ( distance <= entry . getKnnDistance ( ) ) { result . get ( id ) . add ( distance , entry . getDBID ( ) ) ; } } } } // node is a inner node else { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { RdKNNDirectoryEntry entry = ( RdKNNDirectoryEntry ) node . getEntry ( i ) ; ModifiableDBIDs candidates = DBIDUtil . newArray ( ) ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { DBID id = DBIDUtil . deref ( iter ) ; double minDist = distanceQuery . minDist ( entry , id ) ; if ( minDist <= entry . getKnnDistance ( ) ) { candidates . add ( id ) ; } if ( ! candidates . isEmpty ( ) ) { doBulkReverseKNN ( getNode ( entry ) , candidates , result ) ; } } } } }
Performs a bulk reverse knn query in the specified subtree .