public void Setup()
        {
            _consumer = new Consumer();

            var dummy = new TPayload();

            _data = new MappedInterval <TPayload> [Count];
            DataGeneration.LikeReal(Source, Filter, _ => dummy, _data);

            var offsetCount = _data.Length / ItemsPerOffset;

            var span = _data.Length / offsetCount;

            _ascendingOffsets  = new int[offsetCount];
            _descendingOffsets = new int[offsetCount];
            for (var i = 0; i < _ascendingOffsets.Length; ++i)
            {
                _ascendingOffsets[i] = i * span;
                _descendingOffsets[_ascendingOffsets.Length - i - 1] = i * span;
            }

            var r = new Random(0xF00D);

            _randomOffsets = new int[offsetCount];
            for (var i = 0; i < _randomOffsets.Length; ++i)
            {
                _randomOffsets[i] = r.Next(0, _data.Length);
            }
        }
示例#2
0
        public void Setup()
        {
            var dummy = new TPayload();

            _toBeDeleted = new MappedInterval <TPayload> [Count];
            DataGeneration.Fill(DeletionPattern, Overlapping.Yes, dummy, _toBeDeleted);
        }
示例#3
0
        public void Setup()
        {
            _input = new MappedInterval <TPayload> [Count];
            var mm = DataGeneration.Fill(InputSorting, InputOverlapping, new TPayload(), _input);

            _min = mm.Item1 - Nudge(mm.Item1);
            _max = mm.Item2 + Nudge(mm.Item2);
        }
示例#4
0
        public void Setup()
        {
            var dummy = new TPayload();

            _ascending = new MappedInterval <TPayload> [Count];
            DataGeneration.LikeReal(Source, Filter, _ => dummy, _ascending);

            _descending = new MappedInterval <TPayload> [_ascending.Length];
            Reverse(_ascending, _descending);

            _shuffled = new MappedInterval <TPayload> [_ascending.Length];
            Shuffle(_ascending, _shuffled);

            var ranges = GeneratePartitions(_ascending.Length).ToArray();

            _ranges = new Tuple <int, int> [ranges.Length];
            Shuffle(ranges, _ranges);
        }
示例#5
0
        protected override void AfterCollectionCreation()
        {
            var dummy = new TPayload();
            var box   = new MappedInterval <TPayload> [1];

            switch (InitialState)
            {
            case PreDeleteState.OneBigInterval:
                box[0] = new MappedInterval <TPayload>(0, long.MaxValue, dummy);
                Collection.Put(box);
                break;

            case PreDeleteState.LotsOfSmallIntervals:
            case PreDeleteState.Random:
                var inputs  = new MappedInterval <TPayload> [Count];
                var sorting = InitialState == PreDeleteState.Random ? Sorting.Random : Sorting.Ascending;
                DataGeneration.Fill(sorting, Overlapping.No, dummy, inputs);
                Collection.Put(inputs);
                break;
            }

            base.AfterCollectionCreation();
        }
示例#6
0
 public void Setup()
 {
     _input = new MappedInterval <TPayload> [Count];
     DataGeneration.Fill(InputSorting, InputOverlapping, new TPayload(), _input);
 }