public class GetRandomObjectsQueryOperation extends ListingQueryOperation
QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
suppData, uuidOperationComparator
Constructor and Description |
---|
GetRandomObjectsQueryOperation(int count)
Creates a new instance of GetRandomObjecstQueryOperation.
|
GetRandomObjectsQueryOperation(int count,
AnswerType answerType)
Creates a new instance of GetRandomObjectsQueryOperation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addToAnswer(AbstractObject object)
Add an object to the answer.
|
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.
|
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 |
getCount()
Returns the number of objects to be returned by this operation.
|
clone, getAnswer, getAnswer, getAnswerClass, getAnswerCount, getAnswerObjects, getSubAnswer, getSubAnswer, getSubAnswerCount, resetAnswer, updateFrom, updateFrom, updateFrom, updateFrom
appendErrorCode, clone, dataEquals, endOperation, getAllSubAnswers, getAnswerType, getQueryAnswer, iterator, setAnswerType, wasSuccessful
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
public GetRandomObjectsQueryOperation(int count)
AnswerType.NODATA_OBJECTS
will be returned in the result.count
- the number of random objects to retrievepublic GetRandomObjectsQueryOperation(int count, AnswerType answerType)
count
- the number of random objects to retrieveanswerType
- the type of objects this operation stores in its answerpublic java.lang.Object getArgument(int index) throws java.lang.IndexOutOfBoundsException
AbstractOperation
getArgument
in class AbstractOperation
index
- zero-based index of an argument passed to constructorjava.lang.IndexOutOfBoundsException
- if index parameter is out of rangepublic int getArgumentCount()
AbstractOperation
getArgumentCount
in class AbstractOperation
public int getCount()
ListingQueryOperation.getAnswerCount()
.public int evaluate(AbstractObjectIterator<? extends LocalAbstractObject> objects)
QueryOperation
evaluate
in class QueryOperation<AbstractObject>
objects
- the collection of objects on which to evaluate this querypublic boolean addToAnswer(AbstractObject object) throws java.lang.IllegalArgumentException
ListingQueryOperation
QueryOperation.answerType
.addToAnswer
in class ListingQueryOperation
object
- the object to addtrue
if the object
has been added to the answer. Otherwise false
.java.lang.IllegalArgumentException
- if the object cannot be added to the answer, e.g. because it cannot be clonedprotected boolean dataEqualsImpl(QueryOperation obj)
QueryOperation
dataEqualsImpl
in class QueryOperation<AbstractObject>
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<AbstractObject>