public class PartitionedKNNQueryOperation extends KNNQueryOperation
setCurrentPartition
method.
For example:
PartitionedKNNQueryOperationquery; for (LocalBucket bucket : (LocalBucket[])null) { query.setCurrentObject(bucket.getBucketID()); bucket.processQuery(query); }
QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
Modifier and Type | Field and Description |
---|---|
protected RankedSortedCollection |
currentPartition
Current partition list
|
protected boolean |
isPartitionLocked
The locking flag for
setCurrentPartition |
protected java.util.Map<java.lang.Object,RankedSortedCollection> |
partitionedAnswer
The answer holder
|
k
suppData, uuidOperationComparator
Constructor and Description |
---|
PartitionedKNNQueryOperation(LocalAbstractObject queryObject,
int k)
Creates a new instance of KNNQueryOperation given the query object and radius.
|
PartitionedKNNQueryOperation(LocalAbstractObject queryObject,
int k,
AnswerType answerType)
Creates a new instance of KNNQueryOperation given the query object, radius and specifying the answer type.
|
Modifier and Type | Method and Description |
---|---|
RankedAbstractObject |
addToAnswer(LocalAbstractObject object,
float distThreshold)
Adds an object to the answer.
|
void |
consolidatePartitionsWithAnswer()
This method goes over objects in the partitioned answer and leaves there only those which
are also stored in the answer itself.
|
java.util.Map<java.lang.Object,RankedSortedCollection> |
getAllPartitionsAnswer()
Returns the whole answer divided by partitions.
|
java.util.Iterator<RankedAbstractObject> |
getPartitionAnswer(java.lang.Object partitionIdentifier)
Returns the partial answer for the specified partition.
|
boolean |
isIsPartitionLocked()
Returns true if the partition is currently locked using
setCurrentPartitionLock(boolean) . |
void |
removeEmptyPartitions()
Remove empty partitions
|
void |
setCurrentPartition(java.lang.Object partitionObject)
Sets the current partition differentiation object.
|
void |
setCurrentPartitionLock(boolean isPartitionLocked)
Set lock for
setCurrentPartition . |
java.lang.String |
toSimpleString()
Returns a simple string representation of this operation.
|
java.lang.String |
toString()
Returns a string representation of this operation.
|
protected void |
updateFrom(RankingQueryOperation operation)
Update all answer data of this operation from the another operation.
|
dataEqualsImpl, dataHashCode, evaluate, getArgument, getArgumentCount, getK
addToAnswer, clearSurplusData, clone, createOperation, getQueryObject, isStoringMetaDistances
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
appendErrorCode, clone, dataEquals, endOperation, getAllSubAnswers, getAnswerType, getQueryAnswer, iterator, setAnswerType, wasSuccessful
appendArguments, 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
protected final java.util.Map<java.lang.Object,RankedSortedCollection> partitionedAnswer
protected RankedSortedCollection currentPartition
protected boolean isPartitionLocked
setCurrentPartition
public PartitionedKNNQueryOperation(LocalAbstractObject queryObject, int k)
queryObject
- the query objectk
- the query radiuspublic PartitionedKNNQueryOperation(LocalAbstractObject queryObject, int k, AnswerType answerType)
queryObject
- the query objectk
- the query radiusanswerType
- the type of objects this operation stores in its answerpublic void setCurrentPartition(java.lang.Object partitionObject)
partitionObject
- the object to differentiate the answer partitionpublic void setCurrentPartitionLock(boolean isPartitionLocked)
setCurrentPartition
.
If set to true, all calls to setCurrentPartition
will be ignored until it is unlocked again.isPartitionLocked
- pass true for enabling the lock or false to disable itpublic boolean isIsPartitionLocked()
setCurrentPartitionLock(boolean)
.public RankedAbstractObject addToAnswer(LocalAbstractObject object, float distThreshold)
RankingSingleQueryOperation
query object
and the specified object.addToAnswer
in class RankingSingleQueryOperation
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 java.util.Iterator<RankedAbstractObject> getPartitionAnswer(java.lang.Object partitionIdentifier)
partitionIdentifier
- the idetifier to select a particular partitionpublic java.util.Map<java.lang.Object,RankedSortedCollection> getAllPartitionsAnswer()
protected void updateFrom(RankingQueryOperation operation)
updateFrom
in class RankingQueryOperation
operation
- the operation to update answer frompublic void consolidatePartitionsWithAnswer()
public void removeEmptyPartitions()
public java.lang.String toSimpleString()
public java.lang.String toString()
toString
in class AbstractOperation