|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.operations.AbstractOperation
messif.operations.QueryOperation<TAnswer>
TAnswer
- the class of objects returned in the query answerpublic abstract class QueryOperation<TAnswer>
The base class for all query operations. Query operations retrive data from indexing structures according to their specification, but they do not modify the indexed data. Once a query operation is executed on an index structure, its answer is updated.
There are three cathegories of query operations that return different types of answers:
SingletonQueryOperation
- returns a single AbstractObject
ListingQueryOperation
- returns a collection of AbstractObject
RankingQueryOperation
- returns a distance-ranked collection of AbstractObject
Nested Class Summary |
---|
Nested classes/interfaces inherited from class messif.operations.AbstractOperation |
---|
AbstractOperation.DataEqualOperation, AbstractOperation.OperationConstructor, AbstractOperation.OperationName |
Field Summary | |
---|---|
protected AnswerType |
answerType
Types of objects this query operation will return |
Fields inherited from class messif.operations.AbstractOperation |
---|
errValue, operID, suppData |
Constructor Summary | |
---|---|
protected |
QueryOperation(AnswerType answerType)
Creates a new instance of QueryOperation. |
Method Summary | |
---|---|
protected void |
appendErrorCode(java.lang.StringBuilder str)
Appends the error code of this query to the specified string along with the information about the number of objects in the current answer. |
void |
endOperation()
End operation successfully |
abstract int |
evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
Evaluate this query on a given set of objects. |
abstract java.util.Iterator<TAnswer> |
getAnswer()
Returns an iterator over all objects in the answer to this query. |
abstract java.util.Iterator<TAnswer> |
getAnswer(int skip,
int count)
Returns an iterator over all objects in the answer skipping the first skip items and returning only count elements. |
abstract java.lang.Class<? extends TAnswer> |
getAnswerClass()
Returns the class of objects this operation stores in its answer. |
abstract int |
getAnswerCount()
Returns the number of objects in this query answer. |
abstract java.util.Iterator<AbstractObject> |
getAnswerObjects()
Returns an iterator over all AbstractObject s in the answer to this query. |
AnswerType |
getAnswerType()
Returns the type of objects this operation stores in its answer. |
abstract void |
resetAnswer()
Reset the current query answer. |
boolean |
wasSuccessful()
Returns true if this operation has finished successfuly. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final AnswerType answerType
Constructor Detail |
---|
protected QueryOperation(AnswerType answerType)
answerType
- the type of objects this operation stores in its answerMethod Detail |
---|
public boolean wasSuccessful()
wasSuccessful
in class AbstractOperation
public void endOperation()
endOperation
in class AbstractOperation
public abstract int evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
objects
- the collection of objects on which to evaluate this query
public AnswerType getAnswerType()
public abstract java.lang.Class<? extends TAnswer> getAnswerClass()
public abstract int getAnswerCount()
public abstract java.util.Iterator<TAnswer> getAnswer()
public abstract java.util.Iterator<TAnswer> getAnswer(int skip, int count)
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.
skip
- number of answer objects to skipcount
- number of answer objects to iterate (maximally, actual number of results can be smaller)
public abstract java.util.Iterator<AbstractObject> getAnswerObjects()
AbstractObject
s in the answer to this query.
This method unwraps the objects from the results.
AbstractObject
s in the answer to this querypublic abstract void resetAnswer()
getAnswerCount()
will return zero.
protected void appendErrorCode(java.lang.StringBuilder str)
appendErrorCode
in class AbstractOperation
str
- the string to add the error code to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |