NumberInputHandler

internal class NumberInputHandler<out Return>(val valueTypeIfEmpty: KType) : AggregatorInputHandler<Number, Return>

Input handler for aggregators that can handle any (mixed) primitive Number type of input.

When calculating the value type, it will try to find the common type in terms of number unification. Preprocessing will handle the conversion of the values in the input to this unified number type.

Constructors

Link copied to clipboard
constructor(valueTypeIfEmpty: KType)

Properties

Link copied to clipboard
open override var aggregator: Aggregator<Number, Return>?

Reference to the aggregator instance.

Link copied to clipboard
open override val valueTypeIfEmpty: KType

The type of the value if the input is empty.

Functions

Link copied to clipboard
open override fun calculateValueType(valueTypes: Set<KType>): ValueType

If the specific ValueType of the input is not known, but you still want to call aggregate, this function can be called to calculate it in terms of number unification

open override fun calculateValueType(values: Sequence<Number?>): ValueType

WARNING: HEAVY!

Link copied to clipboard
open fun init(aggregator: Aggregator<Number, Return>)
Link copied to clipboard
open override fun preprocessAggregation(values: Sequence<Number?>, valueType: ValueType): Pair<Sequence<Number?>, KType>

Preprocesses the input values before aggregation.