public abstract class RankingMultiQueryOperation extends RankingQueryOperation
QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
suppData, uuidOperationComparator
Modifier | Constructor and Description |
---|---|
protected |
RankingMultiQueryOperation(LocalAbstractObject[] queryObjects,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction)
Creates a new instance of RankingMultiQueryOperation.
|
protected |
RankingMultiQueryOperation(LocalAbstractObject[] queryObjects,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction,
boolean storeIndividualDistances)
Creates a new instance of RankingMultiQueryOperation.
|
protected |
RankingMultiQueryOperation(LocalAbstractObject[] queryObjects,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction,
boolean storeIndividualDistances,
AnswerType answerType)
Creates a new instance of RankingMultiQueryOperation.
|
protected |
RankingMultiQueryOperation(LocalAbstractObject[] queryObjects,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction,
boolean storeIndividualDistances,
AnswerType answerType,
int maxAnswerSize)
Creates a new instance of RankingMultiQueryOperation.
|
protected |
RankingMultiQueryOperation(LocalAbstractObject[] queryObjects,
DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction,
boolean storeIndividualDistances,
AnswerType answerType,
RankedSortedCollection answerCollection)
Creates a new instance of RankingMultiQueryOperation.
|
Modifier and Type | Method and Description |
---|---|
RankedAbstractObject |
addToAnswer(LocalAbstractObject object)
Adds an object to the answer.
|
RankedAbstractObject |
addToAnswer(LocalAbstractObject object,
float distThreshold)
Adds an object to the answer.
|
protected RankedAbstractObject |
addToAnswerInternal(LocalAbstractObject object,
float[] individualDistances,
float distThreshold)
Adds an object to the answer.
|
void |
clearSurplusData()
Clear non-messif data stored in operation.
|
RankingMultiQueryOperation |
clone(boolean preserveAnswer)
Create a duplicate of this operation.
|
static <E extends RankingMultiQueryOperation> |
createOperation(java.lang.Class<E> operationClass,
LocalAbstractObject[] queryObjects,
java.lang.Object... arguments)
Creates a new ranking multi-query operation of the specified class.
|
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.
|
java.lang.String |
getArgumentString(int index)
Returns the string representation of an argument that was passed while constructing instance.
|
DistanceFunctionMultiObject<? super LocalAbstractObject> |
getDistanceFunction()
Returns the distance function for computing the distances between a data object and all query objects.
|
LocalAbstractObject |
getQueryObject(int index)
Returns the given query object of this operation.
|
java.util.Collection<? extends LocalAbstractObject> |
getQueryObjects()
Returns the query objects of this operation.
|
int |
getQueryObjectsCount()
Returns the number of query objects of this operation.
|
boolean |
isStoringIndividualDistances()
Returns true if individual-distances for the respective query objects are stored in the answer.
|
static LocalAbstractObject[] |
loadObjects(java.util.Iterator<? extends LocalAbstractObject> iterator,
int count)
Creates an array of
LocalAbstractObject s from the given iterator. |
static LocalAbstractObject[] |
toObjectArray(java.lang.Object objects)
Creates an array of
LocalAbstractObject s from a given instance. |
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, evaluate, getAllSubAnswers, getAnswerType, getQueryAnswer, iterator, setAnswerType, wasSuccessful
appendArguments, containsParameter, createOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getArgument, getArgumentCount, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, getParameter, getParameter, getParameter, getParameterCount, getParameterMap, getParameterNames, getRequiredParameter, getRequiredParameter, hashCode, isErrorCode, isFinished, removeParameter, setParameter, toString
protected RankingMultiQueryOperation(LocalAbstractObject[] queryObjects, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction, boolean storeIndividualDistances, AnswerType answerType, int maxAnswerSize) throws java.lang.NullPointerException
queryObjects
- the objects with which this operation worksdistanceFunction
- the distance function for computing the distances between a data object and all query objectsstoreIndividualDistances
- 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 answermaxAnswerSize
- sets the maximal answer sizejava.lang.NullPointerException
- if the queryObjects
or distanceAggregation
is nullprotected RankingMultiQueryOperation(LocalAbstractObject[] queryObjects, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction, boolean storeIndividualDistances, AnswerType answerType) throws java.lang.NullPointerException
queryObjects
- the objects with which this operation worksdistanceFunction
- the distance function for computing the distances between a data object and all query objectsstoreIndividualDistances
- 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 answerjava.lang.NullPointerException
- if the queryObjects
or distanceAggregation
is nullprotected RankingMultiQueryOperation(LocalAbstractObject[] queryObjects, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction, boolean storeIndividualDistances) throws java.lang.NullPointerException
changed to no-data objects
.
Unlimited number of objects can be added to the answer.queryObjects
- the objects with which this operation worksdistanceFunction
- the distance function for computing the distances between a data object and all query objectsstoreIndividualDistances
- if true, all distances between the data object and all query objects are
stored in sub-distances
java.lang.NullPointerException
- if the queryObjects
or distanceAggregation
is nullprotected RankingMultiQueryOperation(LocalAbstractObject[] queryObjects, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction) throws java.lang.NullPointerException
changed to no-data objects
.
Unlimited number of objects can be added to the answer.
The individual distances to the respective query objects are not stored.queryObjects
- the objects with which this operation worksdistanceFunction
- the distance function for computing the distances between a data object and all query objectsjava.lang.NullPointerException
- if the queryObjects
or distanceAggregation
is nullprotected RankingMultiQueryOperation(LocalAbstractObject[] queryObjects, DistanceFunctionMultiObject<? super LocalAbstractObject> distanceFunction, boolean storeIndividualDistances, AnswerType answerType, RankedSortedCollection answerCollection) throws java.lang.NullPointerException
queryObjects
- the objects with which this operation worksdistanceFunction
- the distance function for computing the distances between a data object and all query objectsstoreIndividualDistances
- 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 answeranswerCollection
- collection to be used as answer (it must be empty, otherwise it will be cleared)java.lang.NullPointerException
- if the queryObjects
or distanceAggregation
is nullpublic static LocalAbstractObject[] loadObjects(java.util.Iterator<? extends LocalAbstractObject> iterator, int count)
LocalAbstractObject
s from the given iterator.iterator
- the iterator that provides objectscount
- the number of objects to retrieve; negative number means unlimitedLocalAbstractObject
spublic java.util.Collection<? extends LocalAbstractObject> getQueryObjects()
public int getQueryObjectsCount()
public LocalAbstractObject getQueryObject(int index) throws java.lang.IndexOutOfBoundsException
index
- the zero-based index of the query object to retrievejava.lang.IndexOutOfBoundsException
- if the given index is not validpublic DistanceFunctionMultiObject<? super LocalAbstractObject> getDistanceFunction()
public boolean isStoringIndividualDistances()
public RankingMultiQueryOperation clone(boolean preserveAnswer) throws java.lang.CloneNotSupportedException
QueryOperation
preserveAnswer
is true the answer is
not cloned but both this and the cloned operation share the same answer collection.clone
in class RankingQueryOperation
preserveAnswer
- flag whether to clone the answer (false) or preserve
the same answer collection (true) in the cloned operationjava.lang.CloneNotSupportedException
- if the operation instance cannot be clonedpublic void clearSurplusData()
AbstractOperation
parameters
that are Clearable
are cleared
and the other non-primitive
parameters are removed from the parameters.clearSurplusData
in interface Clearable
clearSurplusData
in class AbstractOperation
protected boolean dataEqualsImpl(QueryOperation obj)
QueryOperation
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()
QueryOperation
dataHashCode
in class QueryOperation<RankedAbstractObject>
public java.lang.String getArgumentString(int index) throws java.lang.IndexOutOfBoundsException, java.lang.UnsupportedOperationException
AbstractOperation
getArgumentString
in class AbstractOperation
index
- zero-based index of an argument passed to constructorjava.lang.IndexOutOfBoundsException
- if index parameter is out of rangejava.lang.UnsupportedOperationException
- if this operation doesn't support construction argument retrievalprotected RankedAbstractObject addToAnswerInternal(LocalAbstractObject object, float[] individualDistances, float distThreshold) throws java.lang.IndexOutOfBoundsException
query objects
and the specified object
using the specified aggretate distance function
. The
passed array individualDistances
will be filled with the distances
of the individual query objects.object
- the object to addindividualDistances
- the array to fill with the distances to the respective query objects;
if not null, it must have the same number of allocated elements as the number of query objectsdistThreshold
- the threshold on distance;
if the computed distance exceeds the threshold (sharply),
the object is not added to the answerjava.lang.IndexOutOfBoundsException
- if the passed individualDistances
array is not big enoughpublic RankedAbstractObject addToAnswer(LocalAbstractObject object, float distThreshold)
query objects
and the specified object
using the specified aggretate distance function
.object
- the object to adddistThreshold
- the threshold on distance;
if the computed distance exceeds the threshold (sharply),
the object is not added to the answerpublic RankedAbstractObject addToAnswer(LocalAbstractObject object)
query objects
and the specified object
using the specified aggretate distance function
.object
- the object to addpublic static LocalAbstractObject[] toObjectArray(java.lang.Object objects)
LocalAbstractObject
s from a given instance.
The instance can be:
LocalAbstractObject
- an array with this single object is returnedIterator
- an array with all objects from the iterator is returnedCollection
- an array with all objects from the collection is returnedobjects
- the object, array, iterator, or collection to convertpublic static <E extends RankingMultiQueryOperation> E createOperation(java.lang.Class<E> operationClass, LocalAbstractObject[] queryObjects, java.lang.Object... arguments) throws java.lang.NoSuchMethodException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
E
- the class of the operation that should be createdoperationClass
- the class of the operation that should be createdqueryObjects
- the query objects for the operationarguments
- arguments supplied to the constructor; they should match the types of getConstructorArguments(operationClass)java.lang.NoSuchMethodException
- if either the operationClass
is null or the class is not annotated using AbstractOperation.OperationName
java.lang.IllegalArgumentException
- if the argument count or their types don't match the specified operation class constructorjava.lang.reflect.InvocationTargetException
- if there was an exception in the operation's constructor