kumulant

AbstractStatGroup

sealed class AbstractStatGroup<S : Stat<*>> : GroupedStat(source)

Internal base shared by StatGroup, PairedStatGroup, and VectorStatGroup. Holds the spec list and provides the modality-agnostic read / merge / reset implementations.

Inheritors

Properties

concurrency

The weakest child guarantee; the requested mode applies when constructing fresh children.

Functions

merge

override fun merge(values: GroupResult, timestampNanos: Long = currentTimeNanos())(source)

Fold a compatible snapshot values into this accumulator at timestampNanos. Implementations document whether the combine is exact or approximate and which state the snapshot omits. The source accumulator is unaffected.

Time-dependent statistics, such as windows, place the snapshot at timestampNanos, which must share the clock the caller uses for updates and reads. Time-independent statistics ignore it.

read

override fun read(timestampNanos: Long = currentTimeNanos()): GroupResult(source)

Return the current result evaluated at timestampNanos. Time-independent statistics ignore the timestamp. Reading does not add an observation.

Snapshot consistency depends on the implementation's synchronisation. Locks protect coupled state under Concurrency.Strict and Concurrency.HighWrite; independently updated cells and JVM striped adders can still yield a best-effort snapshot. Concurrency.Relaxed permits drift across coupled cells.

reset

override fun reset()(source)

Restore the configured baseline, including any prior seed. Preserves the configuration and concurrency.

validateMerge

override fun validateMerge(values: GroupResult)(source)

Validate values for merge without changing accumulator state. Containers validate every child before merging any of them. Successful validation checks compatibility; it does not make a concurrent merge transactional.

Link copied to clipboard
abstract fun create(concurrency: Concurrency? = null): Stat<GroupResult>

Create an independent accumulator at the configured baseline. A null concurrency preserves this accumulator's mode; a non-null value overrides it. Modality subtypes narrow the return type to preserve the input shape.