Struct TimeWindowSumIndicator<TInner, TSample, TValue, TTime>
Result of TimeWindowSum<TSelf, TSample, TValue, TTime>(IIndicator<TSelf, TSample, TValue>, Func<TSample, TTime>, Func<TTime, TTime, bool>). Maintains an O(1)-amortized running sum over a duration-bounded window.
public readonly struct TimeWindowSumIndicator<TInner, TSample, TValue, TTime> : IIndicator<TimeWindowSumIndicator<TInner, TSample, TValue, TTime>, TSample, (TValue Sum, int Count)>, ISignal<(TValue Sum, int Count)> where TInner : IIndicator<TInner, TSample, TValue> where TValue : IAdditionOperators<TValue, TValue, TValue>, ISubtractionOperators<TValue, TValue, TValue> where TTime : IComparable<TTime>
Type Parameters
TInnerThe wrapped indicator's concrete type.
TSampleThe sample type consumed on each observation.
TValueThe wrapped indicator's value type.
TTimeThe sample time type.
- Implements
-
IIndicator<TimeWindowSumIndicator<TInner, TSample, TValue, TTime>, TSample, (TValue Sum, int Count)>
- Inherited Members
- Extension Methods
Properties
Value
The current signal value.
public (TValue Sum, int Count) Value { get; }
Property Value
Remarks
Count is the live in-window count, which varies over time under
duration-based eviction — needed by any caller dividing the sum into an average
(e.g. SimpleMovingAverage).
Methods
Add(TSample)
Fold one more sample in, returning the updated indicator.
public TimeWindowSumIndicator<TInner, TSample, TValue, TTime> Add(TSample sample)
Parameters
sampleTSampleThe new observation.
Returns
- TimeWindowSumIndicator<TInner, TSample, TValue, TTime>
A new indicator instance reflecting
sample.