public HeuristicsExtractionResult GetResult() { if (!resultTaken) { if (NoDataGathered) { throw new WurmApiException("Empty results, may indicate malformed file data. File name: " + logFileName); } resultTaken = true; } var heuristics = DayToHeuristicsMap.ToDictionary(pair => pair.Key, pair => pair.Value); return new HeuristicsExtractionResult() { LogDate = ProcessedLogDate, Heuristics = heuristics }; }
private void RollbackHeuristics(int actualCurrentDay) { // remove heuristics since this day (including this day) var overflows = DayToHeuristicsMap.Where(pair => pair.Key > actualCurrentDay).OrderBy(pair => pair.Key).ToList(); int overflowLineCount = LineCounter; if (overflows.Any()) { overflowLineCount += overflows.Sum(pair => pair.Value.LinesCount); } foreach (var keyValuePair in overflows) { dayToHeuristicsMap.Remove(keyValuePair.Key); } LineCounter = overflowLineCount; CurrentDay = actualCurrentDay; PreviousDay = CurrentDay - 1; }