Package com.yahoo.searchlib.aggregation
Class AverageAggregationResult
java.lang.Object
com.yahoo.vespa.objects.Selectable
com.yahoo.vespa.objects.Identifiable
com.yahoo.searchlib.expression.ExpressionNode
com.yahoo.searchlib.aggregation.AggregationResult
com.yahoo.searchlib.aggregation.AverageAggregationResult
- All Implemented Interfaces:
Serializable
,Cloneable
This is an aggregated result holding the average of all results.
- Author:
- baldersheim, Simon Thoresen Hult
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs an empty result node.AverageAggregationResult
(NumericResultNode sum, long count) Constructs an instance of this class with given sum and count values. -
Method Summary
Modifier and TypeMethodDescriptionclone()
protected boolean
final NumericResultNode
Returns the average value of the results.final long
getCount()
Returns the number of results in this.getRank()
Returns a value that can be used for ranking.final NumericResultNode
getSum()
Returns the sum of all results in this.int
hashCode()
protected void
onDeserialize
(com.yahoo.vespa.objects.Deserializer buf) protected int
protected void
onMerge
(AggregationResult result) Mmust be implemented by subclasses to support merge.protected void
onSerialize
(com.yahoo.vespa.objects.Serializer buf) final AverageAggregationResult
setCount
(long count) Sets the number of results in this.final AverageAggregationResult
setSum
(NumericResultNode sum) Sets the sum of all results in this.void
visitMembers
(com.yahoo.vespa.objects.ObjectVisitor visitor) Methods inherited from class com.yahoo.searchlib.aggregation.AggregationResult
equalsExpression, getExpression, getResult, getTag, merge, onExecute, onPrepare, postMerge, setExpression, setTag
Methods inherited from class com.yahoo.searchlib.expression.ExpressionNode
equals, execute, executeIterative, onArgument, prepare
Methods inherited from class com.yahoo.vespa.objects.Identifiable
create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, putUtf8, registerClass, registerClass, serialize, serializeOptional, serializeWithId, toString
Methods inherited from class com.yahoo.vespa.objects.Selectable
select, select, selectMembers
-
Field Details
-
classId
public static final int classId
-
-
Constructor Details
-
AverageAggregationResult
public AverageAggregationResult()Constructs an empty result node. NOTE: This instance is broken until non-optional member data is set. -
AverageAggregationResult
Constructs an instance of this class with given sum and count values.- Parameters:
sum
- The initial sum to set.count
- The initial number of results.
-
-
Method Details
-
getSum
Returns the sum of all results in this.- Returns:
- The numeric sum.
-
setSum
Sets the sum of all results in this.- Parameters:
sum
- The sum to set.- Returns:
- This, to allow chaining.
-
getCount
public final long getCount()Returns the number of results in this.- Returns:
- The number of results.
-
setCount
Sets the number of results in this.- Parameters:
count
- The number of results.- Returns:
- This, to allow chaining.
-
getAverage
Returns the average value of the results. Because the result can be any numeric type, this method returns aNumericResultNode
object.- Returns:
- The average result value.
-
getRank
Description copied from class:AggregationResult
Returns a value that can be used for ranking.- Specified by:
getRank
in classAggregationResult
-
onGetClassId
protected int onGetClassId()- Overrides:
onGetClassId
in classAggregationResult
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf) - Overrides:
onSerialize
in classAggregationResult
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf) - Overrides:
onDeserialize
in classAggregationResult
-
onMerge
Description copied from class:AggregationResult
Mmust be implemented by subclasses to support merge. It is called as theAggregationResult.merge(AggregationResult)
method is invoked.- Specified by:
onMerge
in classAggregationResult
- Parameters:
result
- the result to merge with
-
clone
- Overrides:
clone
in classAggregationResult
-
equalsAggregation
- Specified by:
equalsAggregation
in classAggregationResult
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.yahoo.vespa.objects.Identifiable
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) - Overrides:
visitMembers
in classAggregationResult
-