private static void FillInternalGaps(IList<double> accumulatedTrianglValues, int baseIndex, int originYear, ref int priYear, BaseClaimRowMetaData baseClaimRowMetaData) { while (baseClaimRowMetaData.DevelopmentYear - priYear > 1) { priYear++; int offset = priYear - originYear; accumulatedTrianglValues[baseIndex + offset] = accumulatedTrianglValues[baseIndex + offset - 1]; } }
private Dictionary<string, Dictionary<int, List<BaseClaimRowMetaData>>> Process(IEnumerable<string> text) { var rows = new Dictionary<string, Dictionary<int, List<BaseClaimRowMetaData>>>(); // var lines = text.Select(a => a.Split(',')).Where(l => l.Count() == 4); foreach (var convertedLine in text.Select(Convert).Where(convertedLine => convertedLine != null)) { var claimMetaData = new BaseClaimRowMetaData { DevelopmentYear = convertedLine.DevelopmentYear, IncrementalValue = convertedLine.IncrementalValue }; if (!rows.ContainsKey(convertedLine.ProductName)) { rows.Add(convertedLine.ProductName, new Dictionary<int, List<BaseClaimRowMetaData>> { { convertedLine.OriginYear, new List<BaseClaimRowMetaData> { claimMetaData } } }); } else { var product = rows[convertedLine.ProductName]; if (!product.ContainsKey(convertedLine.OriginYear)) product.Add(convertedLine.OriginYear, new List<BaseClaimRowMetaData> { claimMetaData }); else product[convertedLine.OriginYear].Add(claimMetaData); } } return rows; }