Skip to content

TAggregateAvg

Internally used class for average aggregate functions

Declaration

Source position: fpexprpars.pp line 685

type

  TAggregateAvg = class(TAggregateSum)
  public
    procedure InitAggregate;
    procedure UpdateAggregate;
    procedure GetNodeValue;
  end;

Description

The TAggregateAvg class implements the average (mean) aggregate function, which calculates the arithmetic mean of all processed numeric values. It extends TAggregateSum to leverage summation functionality while adding count tracking for average calculation.

The average function handles different numeric types and ensures appropriate precision in the final result. Division by zero is handled appropriately when no values have been processed.

This class is used internally by the TFPExpressionParser class to construct an AST (Abstract Syntax Tree). There is normally no need for you to use or instantiate this class directly.

Methods

Member Visibility Description
GetNodeValue public Calculate the average from aggregated values
InitAggregate public Initialize average aggregation
UpdateAggregate public Update average aggregate with new value
See all Methods

See also

Name Description
TFPExprNode Class for representing nodes in expression trees