public class BatchKNNQueryOperation extends QueryOperation
QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
suppData, uuidOperationComparator
Constructor and Description |
---|
BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects,
int k)
Creates a list of
KNNQueryOperation for all specified query objects. |
BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects,
int k,
AnswerType answerType)
Creates a list of
KNNQueryOperation for all specified query objects. |
BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects,
int maxNQueries,
int k,
AnswerType answerType)
Creates a list of
KNNQueryOperation for all specified query objects. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
dataEqualsImpl(QueryOperation operation)
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.
|
void |
endOperation()
End operation successfully
|
int |
evaluate(AbstractObjectIterator objects)
Evaluate this query on a given set of objects.
|
java.util.Iterator |
getAnswer()
Returns an iterator over all objects in the answer to this query.
|
java.util.Iterator |
getAnswer(int skip,
int count)
Returns an iterator over all objects in the answer skipping the first
skip items and returning only count elements. |
java.lang.Class |
getAnswerClass()
Returns the class of objects this operation stores in its answer.
|
int |
getAnswerCount()
Returns the number of objects in this query answer.
|
java.util.Iterator |
getAnswerObjects()
Returns an iterator over all
AbstractObject s in the answer to this query. |
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.
|
java.util.List<KNNQueryOperation> |
getKnnOperations() |
int |
getNOperations() |
KNNQueryOperation |
getOperation(int index) |
java.util.Iterator |
getSubAnswer(int index)
Returns an iterator over all objects in the answer sub-collection with the given index.
|
java.util.Iterator |
getSubAnswer(java.lang.Object key)
Returns an iterator over all objects in the answer sub-collection with the given key.
|
int |
getSubAnswerCount()
Returns the number of answer sub-collections.
|
void |
resetAnswer()
Reset the current query answer.
|
boolean |
wasSuccessful()
Returns true if this operation has finished successfuly.
|
appendErrorCode, clone, clone, dataEquals, getAllSubAnswers, getAnswerType, getQueryAnswer, iterator, setAnswerType
appendArguments, clearSurplusData, containsParameter, createOperation, endOperation, 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, updateFrom
public BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects, int k)
KNNQueryOperation
for all specified query objects.queryObjects
- iterator over the query objectsk
- the number of nearest neighbors to retrieve for each operationpublic BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects, int k, AnswerType answerType)
KNNQueryOperation
for all specified query objects.queryObjects
- iterator over the query objectsk
- the number of nearest neighbors to retrieve for each operationanswerType
- the type of objects this operation stores in its answerpublic BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects, int maxNQueries, int k, AnswerType answerType)
KNNQueryOperation
for all specified query objects.queryObjects
- iterator over the query objectsmaxNQueries
- maximal number of query objects read from the iterator (can be Integer.MAX_VALUE
k
- the number of nearest neighbors to retrieve for each operationanswerType
- the type of objects this operation stores in its answerpublic int getNOperations()
public KNNQueryOperation getOperation(int index)
public java.util.List<KNNQueryOperation> getKnnOperations()
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 boolean wasSuccessful()
AbstractOperation
wasSuccessful
in class QueryOperation
public void endOperation()
QueryOperation
endOperation
in class QueryOperation
public int evaluate(AbstractObjectIterator objects)
QueryOperation
evaluate
in class QueryOperation
objects
- the collection of objects on which to evaluate this querypublic java.lang.Class getAnswerClass()
QueryOperation
getAnswerClass
in class QueryOperation
public int getAnswerCount()
QueryOperation
getAnswerCount
in class QueryOperation
public java.util.Iterator getAnswer()
QueryOperation
getAnswer
in class QueryOperation
public java.util.Iterator getAnswer(int skip, int count)
QueryOperation
skip
items and returning only count
elements. If count
is less than or equal to zero, all objects from the answer (except for
skip
) are returned.getAnswer
in class QueryOperation
skip
- number of answer objects to skipcount
- number of answer objects to iterate (maximally, actual number of results can be smaller)public java.util.Iterator getAnswerObjects()
QueryOperation
AbstractObject
s in the answer to this query.
This method unwraps the objects from the results.getAnswerObjects
in class QueryOperation
AbstractObject
s in the answer to this querypublic void resetAnswer()
QueryOperation
QueryOperation.getAnswerCount()
will return zero.resetAnswer
in class QueryOperation
public int getSubAnswerCount()
QueryOperation
getSubAnswerCount
in class QueryOperation
public java.util.Iterator getSubAnswer(int index) throws java.lang.IndexOutOfBoundsException
QueryOperation
getSubAnswer
in class QueryOperation
index
- the index of the answer sub-collection to returnjava.lang.IndexOutOfBoundsException
- if the given index is negative or
greater or equal to QueryOperation.getSubAnswerCount()
public java.util.Iterator getSubAnswer(java.lang.Object key)
QueryOperation
getSubAnswer
in class QueryOperation
key
- the key of the answer sub-collection to returnprotected boolean dataEqualsImpl(QueryOperation operation)
QueryOperation
dataEqualsImpl
in class QueryOperation
operation
- 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