Beispiel #1
0
        public Interval GetInterval(IntervalKey intervalKey, Epoch epoch, int offset = 0)
        {
            var group = GetGroup(intervalKey.IntervalGroup);

            var cursor = group.GetInterval(intervalKey, epoch);

            if (offset == 0)
            {
                return(cursor);
            }

            if (offset > 0)
            {
                for (var i = 0; i < offset; i++)
                {
                    cursor = group.Next(cursor);
                }
            }
            else
            {
                for (var i = 0; i > offset; i--)
                {
                    cursor = group.Previous(cursor);
                }
            }

            return(cursor);
        }
Beispiel #2
0
        public ICollection <Interval> GenerateIntervals(IntervalKey intervalKey, Epoch from, int dataPoints)
        {
            var group = GetGroup(intervalKey.IntervalGroup);

            var intervals = new List <Interval>();

            var intervalCursor = group.GetInterval(intervalKey, from);

            for (var i = 0; i < dataPoints; i++)
            {
                intervals.Add(intervalCursor);

                intervalCursor = group.Next(intervalCursor);
            }

            return(intervals.OrderBy(i => i.From.TimestampMilliseconds).ToList());
        }
Beispiel #3
0
        public ICollection <Interval> GenerateIntervals(IntervalKey intervalKey, Epoch from, Epoch to)
        {
            var group = GetGroup(intervalKey.IntervalGroup);

            var intervals = new List <Interval>();

            var lastInterval = group.GetInterval(intervalKey, to);

            var intervalCursor = group.GetInterval(intervalKey, from);

            while (intervalCursor.From.DateTime < lastInterval.To.DateTime)
            {
                intervals.Add(intervalCursor);

                intervalCursor = group.Next(intervalCursor);
            }

            return(intervals);
        }