Example #1
0
        /// <summary>
        /// Creates the history bins.
        /// </summary>
        /// <param name="timeFrameStart">The time frame start.</param>
        /// <param name="timeFrameResolution">The time frame resolution.</param>
        /// <returns></returns>
        public historyBinCollection <T> CreateHistoryBins(historyPeriodCollection periods, Boolean includeBeforeAndAfter)
        {
            historyBinCollection <T> output = new historyBinCollection <T>(periods, includeBeforeAndAfter);

            foreach (var entry in events)
            {
                output.Add(entry.data, entry.dateTime);
            }
            return(output);
        }
        public List <historyPeriod> GetSecondHalfPeriods()
        {
            List <historyPeriod> output = new List <historyPeriod>();


            historyPeriodCollection list = this;

            for (int i1 = 0; i1 < list.Count; i1++)
            {
                if (i1 > (list.Count / 2))
                {
                    historyPeriod i = list[i1];
                    output.Add(i);
                }
            }


            return(output);
        }
        public historyBinCollection(historyPeriodCollection periods, Boolean includeBeforeAndAfter)
        {
            periodCollection = periods;

            beforeBin = new historyBin <T>(periodCollection.beforePeriod);
            afterBin  = new historyBin <T>(periodCollection.afterPeriod);

            foreach (var period in periods.GetAllPeriods(includeBeforeAndAfter))
            {
                if (period.periodName == historyTools.BINNAME_BEFORE)
                {
                    Add(period.periodName, beforeBin);
                }
                else if (period.periodName == historyTools.BINNAME_AFTER)
                {
                    Add(period.periodName, afterBin);
                }
                else
                {
                    Add(period.periodName, new historyBin <T>(period));
                }
            }
        }