Package com.mckoi.database
Class InternalFunctionFactory.AvgFunction
- java.lang.Object
-
- com.mckoi.database.AbstractFunction
-
- com.mckoi.database.AbstractAggregateFunction
-
- com.mckoi.database.InternalFunctionFactory.AvgFunction
-
- All Implemented Interfaces:
Function
- Enclosing class:
- InternalFunctionFactory
private static class InternalFunctionFactory.AvgFunction extends AbstractAggregateFunction
-
-
Constructor Summary
Constructors Constructor Description AvgFunction(Expression[] params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TObject
evalAggregate(GroupResolver group, QueryContext context, TObject ob1, TObject ob2)
Evaluates the aggregate function for the given values and returns the result.TObject
postEvalAggregate(GroupResolver group, QueryContext context, TObject result)
Called just before the value is returned to the parent.-
Methods inherited from class com.mckoi.database.AbstractAggregateFunction
evaluate
-
Methods inherited from class com.mckoi.database.AbstractFunction
allElements, allVariables, getName, getParameter, init, isAggregate, isGlob, parameterCount, prepareParameters, returnTType, returnTType, setAggregate, toString
-
-
-
-
Constructor Detail
-
AvgFunction
public AvgFunction(Expression[] params)
-
-
Method Detail
-
evalAggregate
public TObject evalAggregate(GroupResolver group, QueryContext context, TObject ob1, TObject ob2)
Description copied from class:AbstractAggregateFunction
Evaluates the aggregate function for the given values and returns the result. If this aggregate was 'sum' then this method would sum the two values. If this aggregate was 'avg' then this method would also sum the two values and the 'postEvalAggregate' would divide by the number processed.NOTE: This first time this method is called on a set, 'val1' is 'null' and 'val2' contains the first value in the set.
- Specified by:
evalAggregate
in classAbstractAggregateFunction
-
postEvalAggregate
public TObject postEvalAggregate(GroupResolver group, QueryContext context, TObject result)
Description copied from class:AbstractAggregateFunction
Called just before the value is returned to the parent. This does any final processing on the result before it is returned. If this aggregate was 'avg' then we'd divide by the size of the group.- Overrides:
postEvalAggregate
in classAbstractAggregateFunction
-
-