ValueAccumulator<T>


Declaration

public abstract class ValueAccumulator<T>

Description

Accumulates a set of stored values into a single total value.

Type Parameters

TThe type of value to accumulate.

Properties

valuesThe stored values with their given identifiers (Read only).
countThe number of unique values being accumulated (Read only).
totalValueThe total accumulated value (Read only).
defaultValueThe default value of T.

Constructors

ValueAccumulatorCreates a new instance of the value accumulator.

Methods

GetValueReturns the value stored with the specified identifier.
SetValueStores a given value with the specified identifier. The total accumulated value is updated based on the difference between the new and old value.
RemoveValueRemoves the value stored with the given identifier and updates the total accumulated value.
ClearRemoves all stored values and resets the total accumulated value.
AddIncreases the accumulated total by a given value.
SubtractDecreases the accumulated total by a given value.