public class KNNMultiQueryOperation extends RankingMultiQueryOperation
k
objects that are nearest to the specified query objects
(according to the distance measure).QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
suppData, uuidOperationComparator
Constructor and Description |
---|
KNNMultiQueryOperation(LocalAbstractObject[] queryObjects,
int k)
Creates a new instance of KNNMultiQueryOperation for given query objects and maximal number of objects to return.
|
KNNMultiQueryOperation(LocalAbstractObject[] queryObjects,
int k,
AnswerType answerType,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
Creates a new instance of KNNMultiQueryOperation for given query objects and maximal number of objects to return.
|
KNNMultiQueryOperation(LocalAbstractObject[] queryObjects,
int k,
boolean storedIndividualDistances,
AnswerType answerType,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
Creates a new instance of KNNMultiQueryOperation for given query objects and maximal number of objects to return.
|
KNNMultiQueryOperation(LocalAbstractObject[] queryObjects,
int k,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
Creates a new instance of KNNMultiQueryOperation for given query objects 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.
|
addToAnswer, addToAnswer, addToAnswerInternal, clearSurplusData, clone, createOperation, getArgumentString, getDistanceFunction, getQueryObject, getQueryObjects, getQueryObjectsCount, isStoringIndividualDistances, loadObjects, toObjectArray
addToAnswer, 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, containsParameter, createOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, getParameter, getParameter, getParameter, getParameterCount, getParameterMap, getParameterNames, getRequiredParameter, getRequiredParameter, hashCode, isErrorCode, isFinished, removeParameter, setParameter, toString
public KNNMultiQueryOperation(LocalAbstractObject[] queryObjects, int k)
no-data objects
.
The distance function is sum aggregation
.queryObjects
- the objects to which the nearest neighbors are searchedk
- the number of nearest neighbors to retrievepublic KNNMultiQueryOperation(LocalAbstractObject[] queryObjects, int k, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
no-data objects
.queryObjects
- the objects to which the nearest neighbors are searchedk
- the number of nearest neighbors to retrievedistanceFunction
- the distance function for computing the distances between a data object and all query objectspublic KNNMultiQueryOperation(LocalAbstractObject[] queryObjects, int k, AnswerType answerType, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
queryObjects
- the objects to which the nearest neighbors are searchedk
- the number of nearest neighbors to retrieveanswerType
- the type of objects this operation stores in its answerdistanceFunction
- the distance function for computing the distances between a data object and all query objectspublic KNNMultiQueryOperation(LocalAbstractObject[] queryObjects, int k, boolean storedIndividualDistances, AnswerType answerType, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
queryObjects
- the objects to which the nearest neighbors are searchedk
- the number of nearest neighbors to retrievestoredIndividualDistances
- if true, all distances between the data object and all query objects are
stored in sub-distances
answerType
- the type of objects this operation stores in its answerdistanceFunction
- the distance function for computing the distances between a data object and all query objectspublic int getK()
public java.lang.Object getArgument(int index) throws java.lang.IndexOutOfBoundsException
AbstractOperation
getArgument
in class AbstractOperation
index
- zero-based index of an argument passed to constructorjava.lang.IndexOutOfBoundsException
- if index parameter is out of rangepublic int getArgumentCount()
AbstractOperation
getArgumentCount
in class AbstractOperation
public int evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
QueryOperation
evaluate
in class QueryOperation<RankedAbstractObject>
objects
- the collection of objects on which to evaluate this queryprotected boolean dataEqualsImpl(QueryOperation obj)
QueryOperation
dataEqualsImpl
in class RankingMultiQueryOperation
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()
QueryOperation
dataHashCode
in class RankingMultiQueryOperation