AggregateResponse

class AggregateResponse @JvmOverloads constructor(parent: ModelElement, name: String? = null) : Response(source)

Aggregate (per-observation) response that echoes every observation made on any chained source onto itself. The aggregate's within- and across-replication statistics are then a pooled view of every observation across every source: a source that fires twice as often contributes twice as many observations to the pool.

Parallel to AggregateTWResponse for non-time-weighted (per-event) responses. Use this when you want to compute a single mean (or any other Welford statistic) over the combined stream of observations from a set of Response sources — for example, an average fill-rate over a collection of inventories where each inventory pushes a 1.0/0.0 observation on every customer demand it sees.

Echo semantics. Each time a chained source's Response.value is assigned, this aggregate's value is assigned the same number. That assignment runs through the standard Response.assignValue path, so the aggregate's own within-replication Welford accumulator records the observation, and the aggregate's own observers (if any) fire downstream — exactly like AggregateTWResponse.

Weighting. Because every source observation produces exactly one aggregate observation, sources are weighted by their observation count. If two sources should be weighted equally regardless of how often they fire, the caller should aggregate source means externally rather than chain through this class.

Parameters

parent

the parent model element

name

an optional name for the aggregate

Constructors

Link copied to clipboard
constructor(parent: ModelElement, name: String? = null)

Functions

Link copied to clipboard
fun observe(response: Response)

Attach response as a source. The aggregate will echo every subsequent observation on response onto itself.

fun observe(response: ResponseCIfc)

Read-only-view variant of observe. Narrows to Response at runtime; if response is not the concrete type, this is a no-op.

Link copied to clipboard

Attach every entry of responses as a source. Accepts the read-only ResponseCIfc view because Collection<out E> is covariant — callers may pass Collection<Response> directly.

Link copied to clipboard
fun remove(response: Response)

Detach response as a source. Safe if never attached.

fun remove(response: ResponseCIfc)

Read-only-view variant of remove.

Link copied to clipboard

Detach every entry of responses as a source.