public static historyPeriod BlendPeriods(this IEnumerable <historyPeriod> periods) { historyPeriod output = new historyPeriod(); DateTime minDate = DateTime.MaxValue; DateTime maxDate = DateTime.MinValue; foreach (historyPeriod p in periods) { if (p != null) { if (minDate > p.start) { minDate = p.start; } if (maxDate < p.end) { maxDate = p.end; } } } output.start = minDate; output.end = maxDate; output.periodName = output.GetPeriodName(); return(output); }
/// <summary> /// Determines whether [is ebraced by period] [the specified period]. /// </summary> /// <param name="period">The period.</param> /// <returns> /// <c>true</c> if [is ebraced by period] [the specified period]; otherwise, <c>false</c>. /// </returns> public Boolean IsEbracedByPeriod(historyPeriod period) { if ((start >= period.start) && (end <= period.end)) { return(true); } return(false); }
public void Add(T data, DateTime date) { historyPeriod period = periodCollection.GetPeriod(date); if (period != null) { if (period.periodName == historyTools.BINNAME_BEFORE) { beforeBin.Add(data); } else if (period.periodName == historyTools.BINNAME_AFTER) { afterBin.Add(data); } else { this[period.periodName].Add(data); } } }
public void Set(IEnumerable <T> data, DateTime _start, DateTime _end) { period = new historyPeriod(_start, _end); AddRange(data); }
public void Set(DateTime _start, DateTime _end) { period = new historyPeriod(_start, _end); }
public historyBin(historyPeriod _period) { period = _period; }