Package com.qfs.agg

Interface IGenericAggregationFunction

    • Field Detail

      • SUM_PRODUCT_FUNCTION_PLUGIN_KEY

        static final String SUM_PRODUCT_FUNCTION_PLUGIN_KEY
        Plugin value key for an aggregation function that produces the sum product of the sources it is given.

        This aggregation is only defined for numerical types, nullable or not. null values will simply be skipped.

        This aggregation also accepts a single numerical vector type, as long as it comes last in the list of sources to aggregate.

        Example with table Trade:

         ┌─────────────────┬──────────┬───────┐
         │    Underlying  │ Quantity │ Value  │
         ├────────────────┼──────────┼────────┤
         │   AAPL         │    10    │  7.4   │
         │   AAPL         │    15    │  2.0   │
         │   AAPL        │     1     │  5.33  │
         │   AAPL        │     12    │  6.0   │
         └───────────────┴────────────────────┘
         
        SumProduct(Quantity, Value) will output:
           Result = 10 * 7.4 + 15 * 2.0 + 1 * 5.33 + 12 * 6.0 = 181.33
         
        See Also:
        Constant Field Values
    • Method Detail

      • getAggregatedType

        int getAggregatedType​(int[] sourceTypes)
        Deduces the type of the result of the aggregation, based on the types of the sources of data.
        Parameters:
        sourceTypes - The data types of the elements to be aggregated
        Returns:
        the type of the result of this aggregation
      • createAggregation

        IGenericAggregation createAggregation​(List<String> sourceIdentifiers,
                                              int[] sourceTypes)
        Creates an IGenericAggregation that can bind a list of data structures to a single destination data structure.

        The created aggregation is specialized for the given source identifiers, which can then be used to retrieve the correct source data structures to bind with a destination.

        The two given collections must have the same size.

        Parameters:
        sourceIdentifiers - A way to identify the source data structures
        sourceTypes - The data types of the elements to be aggregated
        Returns:
        the newly created aggregation, tailored for the given identifiers and types
      • getFunction

        static <T extends IGenericAggregationFunction> T getFunction​(String pluginKey)
        Returns the IGenericAggregationFunction associated with this plugin using the input key.

        This method uses the current registry obtained through Registry.getRegistry().

        Parameters:
        pluginKey - The target function's plugin key
        Returns:
        The target function