mx.collections

# DefaultSummaryCalculator - AS3 Flex

Package | mx.collections
Class | public class DefaultSummaryCalculator
Inheritance | DefaultSummaryCalculator Object
Implements | ISummaryCalculator

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

The DefaultSummaryCalculator class provides summary calculation logic for `SUM`, `MIN`, `MAX`, `AVG`, and `COUNT` operations.

Related API Elements

mx.collections.SummaryField2

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | calculateSummary(data:Object, field:SummaryField2, rowData:Object):void Flex calls this method when a new value needs to be added to the summary value. | DefaultSummaryCalculator
|  | calculateSummaryOfSummary(oldValue:Object, newValue:Object, field:SummaryField2):void Flex calls this method when a new summary value needs to be added to the already computed summary. | DefaultSummaryCalculator
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | returnSummary(data:Object, field:SummaryField2):Number Flex calls this method to end the computation of the summary value. | DefaultSummaryCalculator
|  | returnSummaryOfSummary(oldValue:Object, field:SummaryField2):Number Flex calls this method to end the summary calculation. | DefaultSummaryCalculator
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | summaryCalculationBegin(field:SummaryField2):Object Flex calls this method to start the computation of a summary value. | DefaultSummaryCalculator
|  | summaryOfSummaryCalculationBegin(value:Object, field:SummaryField2):Object Flex calls this method to start calculation of summary out of summary values. | DefaultSummaryCalculator
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Method Detail

### calculateSummary

()
method

`public function calculateSummary(data:Object, field:SummaryField2, rowData:Object):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

Flex calls this method when a new value needs to be added to the summary value.

Parameters

| `data:Object` — The Object returned by the call to the `summaryCalculationBegin()` method, or calculated by a previous call to the `calculateSummary()` method. Use this Object to hold information necessary to perform the calculation. This method modifies this Object; it does not return a value.
| `field:SummaryField2` — The SummaryField2 for which the summary needs to calculated.
| `rowData:Object` — The object representing the rows data that is being analyzed.

### calculateSummaryOfSummary

()
method

`public function calculateSummaryOfSummary(oldValue:Object, newValue:Object, field:SummaryField2):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

Flex calls this method when a new summary value needs to be added to the already computed summary.

Parameters

| `oldValue:Object` — The Object returned by a call the `summaryOfSummaryCalculationBegin()` method, or calculated by a previous call to the `calculateSummaryOfSummary()` method. This method modifies this Object; it does not return a value.
| `newValue:Object` — The Object returned by the call to the `returnSummary()` method for a previous aggregation.
| `field:SummaryField2` — The SummaryField2 for which the summary needs to calculated.

### returnSummary

()
method

`public function returnSummary(data:Object, field:SummaryField2):Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

Flex calls this method to end the computation of the summary value.

Parameters

| `data:Object` — The Object returned by the call to the `calculateSummary()` method. Use this Object to hold information necessary to perform the calculation.
| `field:SummaryField2` — The SummaryField2 for which the summary needs to calculated.

Returns

| `Number` — The summary value.

### returnSummaryOfSummary

()
method

`public function returnSummaryOfSummary(oldValue:Object, field:SummaryField2):Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

Flex calls this method to end the summary calculation.

Parameters

| `oldValue:Object` — The Object returned by a call to the `calculateSummaryOfSummary()` method that is used to store the summary calculation results. This method modifies this Object; it does not return a value.
| `field:SummaryField2` — The SummaryField2 for which the summary needs to calculated.

Returns

| `Number` — The summary value.

### summaryCalculationBegin

()
method

`public function summaryCalculationBegin(field:SummaryField2):Object`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

Flex calls this method to start the computation of a summary value.

Parameters

| `field:SummaryField2` — The SummaryField2 for which the summary needs to calculated.

Returns

| `Object` — An Object initialized for the summary calculation. Use this Object to hold any information necessary to perform the calculation. You pass this Object to subsequent calls to the `calculateSummary()` and `returnSummary()` methods.

### summaryOfSummaryCalculationBegin

()
method

`public function summaryOfSummaryCalculationBegin(value:Object, field:SummaryField2):Object`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 9, AIR 1.1

Flex calls this method to start calculation of summary out of summary values. Calculating the average value of a group of averages is an example of an calculation of summary out of summary values.

Parameters

| `value:Object` — The Object returned by the call to the `calculateSummary()` method for a previous summary calculation. Use this Object to hold the information necessary to perform the calculation.
| `field:SummaryField2` — The SummaryField2 for which the summary needs to calculated.

Returns

| `Object` — An Object initialized for the summary calculation. Use this Object to hold any information necessary to perform the calculation. You pass this Object to subsequent calls to the `calculateSummaryOfSummary()` and `returnSummaryOfSummary()` methods.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00