public void Append(DateTime _Timestamp, string COL, List <double> _GULossVector, double _Factor = 1.0) { if (_Timestamp < Timestamp) { Timestamp = _Timestamp; } if (!AmountByCOL.ContainsKey(COL)) { AmountByCOL.Add(COL, _GULossVector.Clone()); } else { AmountByCOL[COL].AddRange(_GULossVector); if (AmountByCOL[COL].Count > _FactorArray.Count) { _FactorArray.AddRange(Enumerable.Repeat(_Factor, _GULossVector.Count)); IsArrayified = false; //FactorArray = FactorArray.Concat(Enumerable.Repeat(_Factor, GULossVector.Count)).ToArray(); NumBuildings += _GULossVector.Count; } } SamplesForCOL.Remove(COL); TotalGUForCOL.Remove(COL); //if (!GUByCOLByTime.ContainsKey(COL)) // GUByCOLByTime.Add(COL, new Dictionary<DateTime, double>()); //if (!GUByCOLByTime[COL].ContainsKey(_Timestamp)) // GUByCOLByTime[COL].Add(_Timestamp, GULossVector.Sum() * _Factor); //else // GUByCOLByTime[COL][_Timestamp] += (GULossVector.Sum() * _Factor); Factor = _Factor; }
public void AddOrReplaceAmountByCOL(Loss loss) { foreach (var kv in loss.AmountByCOL) { if (!AmountByCOL.ContainsKey(kv.Key)) { AmountByCOL.Add(kv.Key, kv.Value); } else { AmountByCOL[kv.Key] = AmountByCOL[kv.Key].Zip(kv.Value, (a, b) => a + b).ToList <double>(); } } }