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:
java.io.Serializable
,java.lang.Cloneable
public class AverageAggregationResult extends AggregationResult
This is an aggregated result holding the average of all results.- Author:
- baldersheim, Simon Thoresen Hult
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
classId
-
Constructor Summary
Constructors Constructor Description AverageAggregationResult()
Constructs an empty result node.AverageAggregationResult(NumericResultNode sum, long count)
Constructs an instance of this class with given sum and count values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AverageAggregationResult
clone()
protected boolean
equalsAggregation(AggregationResult obj)
NumericResultNode
getAverage()
Returns the average value of the results.long
getCount()
Returns the number of results in this.ResultNode
getRank()
Returns a value that can be used for ranking.NumericResultNode
getSum()
Returns the sum of all results in this.int
hashCode()
protected void
onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
protected int
onGetClassId()
protected void
onMerge(AggregationResult result)
Mmust be implemented by subclasses to support merge.protected void
onSerialize(com.yahoo.vespa.objects.Serializer buf)
AverageAggregationResult
setCount(long count)
Sets the number of results in this.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
-
-
-
-
Constructor Detail
-
AverageAggregationResult
public AverageAggregationResult()
Constructs an empty result node. NOTE: This instance is broken until non-optional member data is set.
-
AverageAggregationResult
public AverageAggregationResult(NumericResultNode sum, long count)
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 Detail
-
getSum
public final NumericResultNode getSum()
Returns the sum of all results in this.- Returns:
- The numeric sum.
-
setSum
public final AverageAggregationResult setSum(NumericResultNode sum)
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
public final AverageAggregationResult setCount(long count)
Sets the number of results in this.- Parameters:
count
- The number of results.- Returns:
- This, to allow chaining.
-
getAverage
public final NumericResultNode 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
public ResultNode 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
protected void onMerge(AggregationResult result)
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
public AverageAggregationResult clone()
- Overrides:
clone
in classAggregationResult
-
equalsAggregation
protected boolean equalsAggregation(AggregationResult obj)
- 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
-
-