Class MaxAggregator<TValue, TComparisonValue>
- Namespace
- AlgorithmsSW
- Assembly
- AlgorithmsSW.dll
The MaxAggregator class is used to aggregate values based on a comparison value and keep track of the maximum values and their set.
public class MaxAggregator<TValue, TComparisonValue>
Type Parameters
TValue
The type of the value to be aggregated.
TComparisonValue
The type of the comparison value used to compare the values.
- Inheritance
-
MaxAggregator<TValue, TComparisonValue>
- Inherited Members
- Extension Methods
Constructors
MaxAggregator(IComparer<TComparisonValue>)
The MaxAggregator class is used to aggregate values based on a comparison value and keep track of the maximum values and their set.
public MaxAggregator(IComparer<TComparisonValue> comparer)
Parameters
comparer
IComparer<TComparisonValue>
Properties
Comparer
Gets the Comparer used for comparing comparison values for this aggregator.
public IComparer<TComparisonValue> Comparer { get; }
Property Value
- IComparer<TComparisonValue>
HasMaxComparisonValue
Gets a value indicating whether the MaxAggregator has a maximum comparison value.
public bool HasMaxComparisonValue { get; }
Property Value
- bool
True if the MaxAggregator has a maximum comparison value; false otherwise.
Remarks
This property returns true if the MaxAggregator has at least one value and therefore has a maximum comparison value. If the MaxAggregator is empty, the property returns false.
MaxComparisonComparisonValue
Gets the maximum comparison value among the aggregated values.
public TComparisonValue MaxComparisonComparisonValue { get; }
Property Value
- TComparisonValue
The maximum comparison value.
Exceptions
- InvalidOperationException
Thrown when there are no values in MaxValues.
MaxValues
Gets the set of values that correspond to the maximum comparison value.
public IEnumerable<TValue> MaxValues { get; }
Property Value
- IEnumerable<TValue>
Methods
AddIfBigger(TValue, TComparisonValue)
Adds a value to the MaxAggregator if the provided comparison value is greater than the current maximum comparison value.
public void AddIfBigger(TValue value, TComparisonValue comparisonValue)
Parameters
value
TValueThe value to be added.
comparisonValue
TComparisonValueThe comparison value used to compare the values.