Package-level declarations

Types

Link copied to clipboard

This class is the main entry-point for creating an aggregator.

Link copied to clipboard

The base functionality of the aggregator, which defines how the aggregation of a single Sequence or column is done. It also provides information on which return type will be given, as KType, given a value type. It can also provide the index of the result in the input values if it is a selecting aggregator.

Link copied to clipboard
interface AggregatorHandler<in Value : Any, out Return>

Common interface for Aggregator handlers or "injector" objects that can build up an Aggregator instance.

Link copied to clipboard

The input handler of the aggregator, which handles type checks, conversions, and preprocessing of a single sequence of input values. It can also calculate a specific value type from the input values or input types if the (specific) type is not known.

Link copied to clipboard

The multiple columns handler, which specifies how to aggregate multiple columns into a single value by using the supplied AggregatorAggregationHandler. It can also calculate the return type of the aggregation given all input column types.

Link copied to clipboard
class AggregatorOptionSwitch1<in Param1, in Value : Any, out Return>(val name: String, val getAggregator: (param1: Param1) -> AggregatorProvider<Value, Return>)

Wrapper around an aggregator factory for aggregators that require a single parameter.

Link copied to clipboard
class AggregatorOptionSwitch2<in Param1, in Param2, in Value : Any, out Return>(val name: String, val getAggregator: (param1: Param1, param2: Param2) -> AggregatorProvider<Value, Return>)

Wrapper around an aggregator factory for aggregators that require two parameters.

Link copied to clipboard

Common interface for providers of Aggregators or "factory" objects that create aggregators.

Link copied to clipboard
Link copied to clipboard
internal typealias CalculateReturnType = (type: KType, emptyInput: Boolean) -> KType

Type alias for a function that gives the return type of a Reducer or Selector given some input type and whether the input is empty.

Link copied to clipboard
internal typealias IndexOfResult<Value> = Sequence<Value?>.(type: KType) -> Int

Type alias for a function that returns the index of the result of Selector in this sequence. If the result is not in the sequence, it returns -1. The type of the values is provided as KType and the sequence can contain nulls.

Link copied to clipboard
fun interface Provider<out T>

Common interface for providers or "factory" objects that create anything of type T.

Link copied to clipboard
internal typealias Reducer<Value, Return> = Sequence<Value & Any>.(valueType: KType) -> Return

Type alias for a reducer function where the type of the values is provided as KType. Nulls have already been filtered out when this function is called.

Link copied to clipboard
internal typealias Selector<Value, Return> = Sequence<Value & Any>.(type: KType) -> Return

Type alias for a selector function where the type of the values is provided as KType.

Link copied to clipboard
data class ValueType(val kType: KType, val needsFullConversion: Boolean = false)

Represents the type of values in a column as the input of an aggregator.

Properties

Link copied to clipboard

Common case for CalculateReturnType, preserves return type, but makes it nullable for empty inputs.

Functions

Link copied to clipboard

Aggregates the data in the given columns and computes a single resulting value.

Aggregates the data in the given column and computes a single resulting value.

internal fun <Value : Any, Return> Aggregator<Value, Return>.aggregate(values: Sequence<Value?>, valueType: KType): Return

Performs aggregation on the given values, taking valueType into account. If valueType is unknown, see calculateValueType or aggregateCalculatingValueType.

Link copied to clipboard
internal fun <Value : Any, Return> Aggregator<Value, Return>.aggregateCalculatingValueType(values: Sequence<Value?>, valueTypes: Set<KType>? = null): Return

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 by combining the set of known valueTypes or by gathering the types from values and then aggregating them.

Link copied to clipboard
internal fun <Value : Any, Return> Aggregator<Value, Return>.calculateValueType(values: Sequence<Value?>, valueTypes: Set<KType>? = null): 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 by combining the set of known valueTypes or by gathering the types from values.

Link copied to clipboard
internal fun <Type> Aggregator<*, *>.cast(): Aggregator<Type & Any, Type>
Link copied to clipboard
Link copied to clipboard
internal operator fun <T> Provider<T>.getValue(obj: Any?, property: KProperty<*>): T
Link copied to clipboard

Gives the index of the aggregation result in the input values, if it applies. This is used for aggregators with an AggregatorAggregationHandler where Value== Return, and where the result exists in the input.

Link copied to clipboard
internal fun KType.toValueType(needsFullConversion: Boolean = false): ValueType