Class NumberAggregationHelper

java.lang.Object
io.jmix.flowui.data.aggregation.NumberAggregationHelper

public class NumberAggregationHelper extends Object
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
    Modifier and Type
    Field
    Description
    protected final List<Double>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(Double newItem)
    Adds a new numerical item to the collection for aggregation operations.
    avg()
    Computes the average value of all numerical items in the collection.
    max()
    Determines the maximum value among the numerical items in the collection.
    min()
    Determines the minimum value from the collection of numerical items.
    sum()
    Calculates the total sum of all numerical values in the collection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • NumberAggregationHelper

      public NumberAggregationHelper()
  • Method Details

    • addItem

      public void addItem(Double newItem)
      Adds a new numerical item to the collection for aggregation operations.
      Parameters:
      newItem - the numerical value to be added to the collection
    • sum

      public Double 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

      @Nullable public Double avg()
      Computes the average value of all numerical items in the collection. If the collection is empty, returns null.
      Returns:
      the average value of the items in the collection, or null if the collection is empty
    • min

      @Nullable public Double min()
      Determines the minimum value from the collection of numerical items. If the collection is empty, returns null.
      Returns:
      the minimum value among the items in the collection, or null if the collection is empty
    • max

      @Nullable public Double max()
      Determines the maximum value among the numerical items in the collection. If the collection is empty, returns null.
      Returns:
      the maximum value among the numerical items, or null if the collection is empty