|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmessif.operations.AbstractOperation
messif.operations.QueryOperation<RankedAbstractObject>
messif.operations.RankingQueryOperation
messif.operations.query.IncrementalNNQueryOperation
public class IncrementalNNQueryOperation
Incremental Nearest Neighbor Search.
This operation returns only references to the original
object.
The behavior of an algorithm implementing this operation must hold the following contract:
1/ If there are some objects to pending, the operation must be ended with
HAS_NEXT error code by calling
endOperation method.
2/ If all objects have been returned in previous calls to the search or in this call, the operation
must be ended with RESPONSE_RETURNED error code.
This eror code is set automaticly if endOperation
is not called with a specific value.
This contract is similar to the behavior of iterators.
The call to wasSuccessful() returns true if the error code was set either to HAS_NEXT or RESPONSE_RETURNED.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class messif.operations.AbstractOperation |
|---|
AbstractOperation.DataEqualOperation, AbstractOperation.OperationConstructor, AbstractOperation.OperationName |
| Field Summary | |
|---|---|
protected int |
minNN
Minimum number of objects returned by this query. |
protected int |
nnAddedToAnswer
The number of nearest neighbors added to the answer since the last call to endOperation(). |
protected LocalAbstractObject |
queryObject
kNN query object |
| Fields inherited from class messif.operations.QueryOperation |
|---|
answerType |
| Fields inherited from class messif.operations.AbstractOperation |
|---|
errValue, operID, suppData |
| Constructor Summary | |
|---|---|
IncrementalNNQueryOperation(LocalAbstractObject queryObject)
Creates a new instance of IncrementalNNQueryOperation. |
|
IncrementalNNQueryOperation(LocalAbstractObject queryObject,
int minNN)
Creates a new instance of IncrementalNNQueryOperation. |
|
IncrementalNNQueryOperation(LocalAbstractObject queryObject,
int minNN,
AnswerType answerType)
Creates a new instance of IncrementalNNQueryOperation. |
|
| Method Summary | |
|---|---|
RankedAbstractObject |
addToAnswer(LocalAbstractObject queryObject,
LocalAbstractObject object,
float distThreshold)
Add an object to the answer. |
void |
clearSurplusData()
Clear non-messif data stored in operation. |
protected boolean |
dataEqualsImpl(AbstractOperation 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. |
void |
endOperation()
End operation successfully |
void |
endOperation(ErrorCode errValue)
End operation with a specific error code. |
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 |
getMinNN()
Returns the minimum number of objects returned by this query. |
LocalAbstractObject |
getQueryObject()
Returns the kNN query object. |
boolean |
isFilledEnough()
Returns true if the minimum number of objects has been inserted to the answer during one evaluation of this operation. |
| Methods inherited from class messif.operations.RankingQueryOperation |
|---|
addToAnswer, clone, getAnswer, getAnswer, getAnswerClass, getAnswerCount, getAnswerDistance, getAnswerObjects, getAnswerThreshold, getLastAnswer, isAnswerFull, isStoringMetaDistances, resetAnswer, setAnswerCollection, updateFrom, updateFrom |
| Methods inherited from class messif.operations.QueryOperation |
|---|
appendErrorCode, getAnswerType, wasSuccessful |
| Methods inherited from class messif.operations.AbstractOperation |
|---|
appendArguments, createOperation, dataEquals, equals, getAnnotatedConstructor, getAnnotatedConstructor, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, hashCode, isFinished, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final LocalAbstractObject queryObject
protected final int minNN
protected int nnAddedToAnswer
| Constructor Detail |
|---|
public IncrementalNNQueryOperation(LocalAbstractObject queryObject)
AnswerType.NODATA_OBJECTS will be returned in the result.
queryObject - the object to which the nearest neighbors are searched
public IncrementalNNQueryOperation(LocalAbstractObject queryObject,
int minNN)
AnswerType.NODATA_OBJECTS will be returned in the result.
queryObject - the object to which the nearest neighbors are searchedminNN - the minimal number of nearest neighbors to retrieve
public IncrementalNNQueryOperation(LocalAbstractObject queryObject,
int minNN,
AnswerType answerType)
queryObject - the object to which the nearest neighbors are searchedminNN - the minimal number of nearest neighbors to retrieveanswerType - the type of objects this operation stores in its answer| Method Detail |
|---|
public LocalAbstractObject getQueryObject()
public int getMinNN()
public java.lang.Object getArgument(int index)
throws java.lang.IndexOutOfBoundsException
getArgument in class AbstractOperationindex - index of an argument passed to constructor
java.lang.IndexOutOfBoundsException - if index parameter is out of rangepublic int getArgumentCount()
getArgumentCount in class AbstractOperationpublic void endOperation()
endOperation in class QueryOperation<RankedAbstractObject>
public void endOperation(ErrorCode errValue)
throws java.lang.IllegalArgumentException
endOperation in class AbstractOperationerrValue - the error code to set
java.lang.IllegalArgumentException - if the specified error value is null or ErrorCode.NOT_SETpublic int evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
addToAnswer(messif.objects.LocalAbstractObject, messif.objects.LocalAbstractObject, float).
Note that the incremental kNN search can't use filtering, because the maximal radius is unknown
evaluate in class QueryOperation<RankedAbstractObject>objects - the collection of objects on which to evaluate this query
public boolean isFilledEnough()
public RankedAbstractObject addToAnswer(LocalAbstractObject queryObject,
LocalAbstractObject object,
float distThreshold)
RankingQueryOperation
addToAnswer in class RankingQueryOperationqueryObject - the query object against which to compute the distance (rank)object - the object to adddistThreshold - the threshold on distance;
if the computed distance exceeds the threshold (sharply),
the object is not added to the answer
public void clearSurplusData()
clearSurplusData in interface ClearableclearSurplusData in class RankingQueryOperationprotected boolean dataEqualsImpl(AbstractOperation obj)
dataEqualsImpl in class AbstractOperationobj - 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 AbstractOperation
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||