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

            _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);
        }