public class KNNQueryByLocatorOperation extends RankingQueryOperation
k
objects that are nearest to the specified query object
(according to the distance measure).QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
Modifier and Type | Field and Description |
---|---|
protected int |
k
Number of nearest objects to retrieve
|
protected java.lang.String |
queryLocator
Query object locator
|
suppData, uuidOperationComparator
Constructor and Description |
---|
KNNQueryByLocatorOperation(java.lang.String queryLocator,
int k)
Creates a new instance of kNNQueryOperation for a given query object and maximal number of objects to return.
|
KNNQueryByLocatorOperation(java.lang.String queryLocator,
int k,
AnswerType answerType)
Creates a new instance of kNNQueryOperation for a given query object and maximal number of objects to return.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
dataEqualsImpl(QueryOperation obj)
Indicates whether some other operation has the same data as this one.
|
int |
dataHashCode()
Returns a hash code value for the data of this operation.
|
int |
evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
Evaluate this query on a given set of objects.
|
java.lang.Object |
getArgument(int index)
Returns argument that was passed while constructing instance.
|
int |
getArgumentCount()
Returns number of arguments that were passed while constructing this instance.
|
int |
getK()
Returns the number of nearest objects to retrieve.
|
java.lang.String |
getQueryLocator()
Returns the query locator.
|
addToAnswer, clone, endOperation, getAnswer, getAnswer, getAnswerClass, getAnswerCollectionClass, getAnswerCollectionClone, getAnswerComparator, getAnswerCount, getAnswerDistance, getAnswerDistanceRestricted, getAnswerDistanceRestricted, getAnswerMaximalCapacity, getAnswerObjects, getAnswerThreshold, getLastAnswer, getSubAnswer, getSubAnswer, getSubAnswerCount, isAnswerFull, resetAnswer, setAnswerCollection, setAnswerIgnoringDuplicates, setAnswerThresholdComputation, setAnswerThresholdComputation, updateFrom, updateFrom
appendErrorCode, clone, dataEquals, endOperation, getAllSubAnswers, getAnswerType, getQueryAnswer, iterator, setAnswerType, wasSuccessful
appendArguments, clearSurplusData, containsParameter, createOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getArgumentString, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, getParameter, getParameter, getParameter, getParameterCount, getParameterMap, getParameterNames, getRequiredParameter, getRequiredParameter, hashCode, isErrorCode, isFinished, removeParameter, setParameter, toString
protected final java.lang.String queryLocator
protected final int k
public KNNQueryByLocatorOperation(java.lang.String queryLocator, int k, AnswerType answerType)
no-data objects
.queryLocator
- locator of the object to which the nearest neighbors are searchedk
- the number of nearest neighbors to retrieveanswerType
- the type of objects this operation stores in its answerpublic KNNQueryByLocatorOperation(java.lang.String queryLocator, int k)
no-data objects
.queryLocator
- locator of the object to which the nearest neighbors are searchedk
- the number of nearest neighbors to retrievepublic java.lang.String getQueryLocator()
public int getK()
public java.lang.Object getArgument(int index) throws java.lang.IndexOutOfBoundsException
getArgument
in class AbstractOperation
index
- index of an argument passed to constructorjava.lang.IndexOutOfBoundsException
- if index parameter is out of rangepublic int getArgumentCount()
getArgumentCount
in class AbstractOperation
public int evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
RankingQueryOperation.addToAnswer(messif.objects.AbstractObject, float, float[])
.evaluate
in class QueryOperation<RankedAbstractObject>
objects
- the collection of objects on which to evaluate this queryprotected boolean dataEqualsImpl(QueryOperation obj)
dataEqualsImpl
in class QueryOperation<RankedAbstractObject>
obj
- the reference object with which to compare.true
if this object has the same data as the obj
argument; false
otherwise.public int dataHashCode()
dataHashCode
in class QueryOperation<RankedAbstractObject>