Interface IPercentCalculator
- Namespace
- SunamoShared._public.SunamoInterfaces.Interfaces
- Assembly
- SunamoShared.dll
Provides methods for calculating percentages from cumulative values.
public interface IPercentCalculator
- Extension Methods
Properties
Last
Gets or sets the last computed value.
double Last { get; set; }
Property Value
OverallSum
Gets or sets the overall sum used as the 100% reference.
double OverallSum { get; set; }
Property Value
Methods
AddOnePercent()
Adds one percent to the computed sum.
void AddOnePercent()
Create(double)
Creates a new instance with the specified overall sum.
IPercentCalculator Create(double overallSum)
Parameters
overallSumdoubleThe total sum representing 100%.
Returns
PercentFor(double, bool)
Calculates the percentage for the given value.
int PercentFor(double value, bool isLast)
Parameters
valuedoubleThe value to calculate the percentage for.
isLastboolWhether this is the last value in the sequence.
Returns
ResetComputedSum()
Resets the computed sum to zero.
void ResetComputedSum()