コード例 #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);
 }
コード例 #3
0
        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;
 }