Package io.jmix.flowui.data.aggregation
Class NumberAggregationHelper
java.lang.Object
io.jmix.flowui.data.aggregation.NumberAggregationHelper
Helper class for aggregating numerical values. This class provides methods
for adding numbers to a collection and performing basic aggregation
operations such as sum, average, minimum, and maximum.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new numerical item to the collection for aggregation operations.@Nullable Doubleavg()Computes the average value of all numerical items in the collection.@Nullable Doublemax()Determines the maximum value among the numerical items in the collection.@Nullable Doublemin()Determines the minimum value from the collection of numerical items.sum()Calculates the total sum of all numerical values in the collection.
-
Field Details
-
items
-
-
Constructor Details
-
NumberAggregationHelper
public NumberAggregationHelper()
-
-
Method Details
-
addItem
Adds a new numerical item to the collection for aggregation operations.- Parameters:
newItem- the numerical value to be added to the collection
-
sum
Calculates the total sum of all numerical values in the collection. Null values in the collection are ignored during the calculation.- Returns:
- the sum of all non-null numerical values in the collection
-
avg
Computes the average value of all numerical items in the collection. If the collection is empty, returnsnull.- Returns:
- the average value of the items in the collection, or
nullif the collection is empty
-
min
Determines the minimum value from the collection of numerical items. If the collection is empty, returnsnull.- Returns:
- the minimum value among the items in the collection, or
nullif the collection is empty
-
max
Determines the maximum value among the numerical items in the collection. If the collection is empty, returnsnull.- Returns:
- the maximum value among the numerical items, or
nullif the collection is empty
-