messif.operations.query
Class GetObjectCountOperation

java.lang.Object
  extended by messif.operations.AbstractOperation
      extended by messif.operations.query.GetObjectCountOperation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Clearable

public class GetObjectCountOperation
extends AbstractOperation

Operation for retrieving the number of objects stored in indexing structure.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class messif.operations.AbstractOperation
AbstractOperation.DataEqualOperation, AbstractOperation.OperationConstructor, AbstractOperation.OperationName
 
Field Summary
protected  int objectCount
          The number of objects counted by this operation
 
Fields inherited from class messif.operations.AbstractOperation
errValue, operID, suppData
 
Constructor Summary
GetObjectCountOperation()
          Creates a new instance of GetAllObjectsQuery
 
Method Summary
 void addToAnswer(int objectCount)
          Add the specified count to the answer of this 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.
 int evaluate(BucketDispatcher dispatcher)
          Evaluate this query on a given bucket dispatcher.
 int evaluate(LocalBucket bucket)
          Evaluate this query on a given bucket.
 int getAnswerCount()
          Returns the number of objects counted by this operation.
 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.lang.String toString()
          Prints out the object count in a fancy way.
 boolean wasSuccessful()
          Returns true if this operation has finished successfuly.
 
Methods inherited from class messif.operations.AbstractOperation
appendArguments, appendErrorCode, clearSurplusData, clone, createOperation, dataEquals, endOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, hashCode, isFinished, updateFrom
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

objectCount

protected int objectCount
The number of objects counted by this operation

Constructor Detail

GetObjectCountOperation

public GetObjectCountOperation()
Creates a new instance of GetAllObjectsQuery

Method Detail

getArgument

public java.lang.Object getArgument(int index)
                             throws java.lang.IndexOutOfBoundsException
Returns argument that was passed while constructing instance. If the argument is not stored within operation, null is returned.

Overrides:
getArgument in class AbstractOperation
Parameters:
index - index of an argument passed to constructor
Returns:
argument that was passed while constructing instance
Throws:
java.lang.IndexOutOfBoundsException - if index parameter is out of range

getArgumentCount

public int getArgumentCount()
Returns number of arguments that were passed while constructing this instance.

Overrides:
getArgumentCount in class AbstractOperation
Returns:
number of arguments that were passed while constructing this instance

evaluate

public int evaluate(BucketDispatcher dispatcher)
Evaluate this query on a given bucket dispatcher. Object counts stored in all buckets maintained by the provided dispatcher is added to this operation's answer.

Parameters:
dispatcher - the bucket dispatcher to update answer from
Returns:
number of objects added to this operation, i.e. the actual dispatcher's object count

evaluate

public int evaluate(LocalBucket bucket)
Evaluate this query on a given bucket. Object count stored in this bucket is added to this operation's answer.

Parameters:
bucket - the bucket to update answer from
Returns:
number of objects added to this operation, i.e. the actual bucket's object count

getAnswerCount

public int getAnswerCount()
Returns the number of objects counted by this operation.

Returns:
the number of objects

addToAnswer

public void addToAnswer(int objectCount)
Add the specified count to the answer of this operation.

Parameters:
objectCount - the count to add

wasSuccessful

public boolean wasSuccessful()
Returns true if this operation has finished successfuly. Otherwise, false is returned - the operation was either unsuccessful or is has not finished yet.

Specified by:
wasSuccessful in class AbstractOperation
Returns:
true if this operation has finished successfuly

endOperation

public void endOperation()
End operation successfully.

Specified by:
endOperation in class AbstractOperation

toString

public java.lang.String toString()
Prints out the object count in a fancy way.

Overrides:
toString in class AbstractOperation
Returns:
object count in textual representation

dataEqualsImpl

protected boolean dataEqualsImpl(AbstractOperation obj)
Indicates whether some other operation has the same data as this one.

Specified by:
dataEqualsImpl in class AbstractOperation
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object has the same data as the obj argument; false otherwise.

dataHashCode

public int dataHashCode()
Returns a hash code value for the data of this operation.

Specified by:
dataHashCode in class AbstractOperation
Returns:
a hash code value for the data of this operation