Exemplo n.º 1
0
        private IEnumerable <TRange> AddRangeToRanges(IEnumerable <TRange> ranges, TRange incomingRange)
        {
            if (incomingRange == null)
            {
                return(ranges);
            }

            var subtractedRanges = _filterer.SubtractTimeRangeFromRanges(ranges, _accessor.GetTimeRange(incomingRange));

            return(_joiner.JoinDataRangeToDataRanges(subtractedRanges, incomingRange));
        }
Exemplo n.º 2
0
        private InsertPlacement PlaceDataRange(TRange itemToInsert, TRange existingItem)
        {
            var insertTimeRange   = _accessor.GetTimeRange(itemToInsert);
            var existingTimeRange = _accessor.GetTimeRange(existingItem);

            if (insertTimeRange.Touches(existingTimeRange))
            {
                return(InsertPlacement.Equal);
            }

            if (insertTimeRange.Min < existingTimeRange.Min)
            {
                return(InsertPlacement.Before);
            }

            if (insertTimeRange.Min > existingTimeRange.Min)
            {
                return(InsertPlacement.After);
            }

            throw new Exception("PlaceDataRange can't place data range");
        }
Exemplo n.º 3
0
 public IEnumerable <TRange> FilterRanges(IEnumerable <TRange> ranges, TimeRange timeRange)
 {
     return(ranges?.Where(dataRange => _intersector(_accessor.GetTimeRange(dataRange), timeRange)).Select(range => FilterRange(range, timeRange, _policy.FilterMode)));
 }