예제 #1
0
        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);
        }
예제 #2
0
 /// <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);
                }
            }
        }
예제 #4
0
 public void Set(IEnumerable <T> data, DateTime _start, DateTime _end)
 {
     period = new historyPeriod(_start, _end);
     AddRange(data);
 }
예제 #5
0
 public void Set(DateTime _start, DateTime _end)
 {
     period = new historyPeriod(_start, _end);
 }
예제 #6
0
 public historyBin(historyPeriod _period)
 {
     period = _period;
 }