| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
|
| 4 |
namespace Mono.Documentation.Updater.Statistics |
| 5 |
{ |
| 6 |
/// <summary> |
| 7 |
/// The class stores statistics: int value for each StatisticsItem-StatisticsMetrics pair |
| 8 |
/// </summary> |
| 9 |
public class StatisticsStorage |
| 10 |
{ |
| 11 |
public Dictionary<StatisticsItem, Dictionary<StatisticsMetrics, int>> Values { get; } = new Dictionary<StatisticsItem, Dictionary<StatisticsMetrics, int>>(); |
| 12 |
|
| 13 |
public StatisticsStorage() |
| 14 |
{ |
| 15 |
foreach (var statisticsItem in Enum.GetValues(typeof(StatisticsItem))) |
| 16 |
{ |
| 17 |
var metrics = Values[(StatisticsItem)statisticsItem] = new Dictionary<StatisticsMetrics, int>(); |
| 18 |
foreach (var statisticsMetrics in Enum.GetValues(typeof(StatisticsMetrics))) |
| 19 |
{ |
| 20 |
metrics[(StatisticsMetrics) statisticsMetrics] = 0; |
| 21 |
} |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
public void AddMetric(StatisticsItem item, StatisticsMetrics metrics, int delta = 1) |
| 26 |
{ |
| 27 |
Values[item][metrics] += delta; |
| 28 |
} |
| 29 |
} |
| 30 |
} |