Mobios v0.91

mobios.index
Class KNNQuery

java.lang.Object
  extended by mobios.index.KNNQuery
All Implemented Interfaces:
Query

public class KNNQuery
extends Object
implements Query

This class contains implmentation for K nearest neighbor search (KNN) and approximate K nearest neighbor search (AKNN) queries. A KNN query is in the form of (q, k). Given (q, k), the search returns the k closest objects to query object q. An aproximate KNN query is in the form of (q, k, r, sp), where r is a limiting radius and sp is the approximation policy. The search proceed accroding to the value of r and sp. 1) When both r and sp is omit, the search proceeds as KNN search 2) When r is given and sp is omit or sp is the value of KNNQuery.RADIUSLIMIRED, the search returns upto k objects that are the closest ones to query q within radius r. 3) When a non-negative value is given for sp, an approximate set of k objects is returned. Only those objects within spsmallest distance to query q are gurantee to be returned in the result set. The results of search with larger sp value have better accuracy than those of search with lower sp value and take longer to compute. When a radius value is also given, the results are further limited to those within distance r to query q.

Version:
2006.07.09
Author:
Weijia Xu

Constructor Summary
KNNQuery(IndexObject center, int k)
          Initializes the strict KNN query object
KNNQuery(IndexObject center, int k, double radius)
           
KNNQuery(IndexObject center, int k, double radius, int sp)
           
KNNQuery(IndexObject center, int k, double radius, int sp, int listSize)
           
 
Method Summary
 int getK()
           
 int getMaxDistanceListSize()
           
 IndexObject getQueryObject()
          Return a reference to the query object
 double getRadius()
          Returns the search radius of the proximity query.
 int getSearchPolicy()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KNNQuery

public KNNQuery(IndexObject center,
                int k)
Initializes the strict KNN query object

Parameters:
center - the Object that serves as the query object
k - the number of nearest neighbors to return

KNNQuery

public KNNQuery(IndexObject center,
                int k,
                double radius)

KNNQuery

public KNNQuery(IndexObject center,
                int k,
                double radius,
                int sp)

KNNQuery

public KNNQuery(IndexObject center,
                int k,
                double radius,
                int sp,
                int listSize)
Method Detail

getQueryObject

public IndexObject getQueryObject()
Return a reference to the query object

Specified by:
getQueryObject in interface Query
Returns:
a reference to the query object

getRadius

public final double getRadius()
Returns the search radius of the proximity query.


getMaxDistanceListSize

public int getMaxDistanceListSize()

getK

public int getK()

getSearchPolicy

public int getSearchPolicy()

toString

public String toString()
Overrides:
toString in class Object

Mobios v0.91

(C) 2002 - 2006 The MoBIoS Group