Пример #1
0
        private void Initialize()
        {
            if (this.segmentLengthLog2 < 0)
            {
                ExceptionUtil.ThrowInternalErrorException("this.segmentLengthLog2 has not been set");
            }
            if (this.segments == null)
            {
                this.segments = new List <T[]>();
            }
            this.segmentAllocator = SegmentAllocator <T> .GetInstance(this.segmentLengthLog2);

            this.segmentSubIndexMask = (((int)1) << this.segmentLengthLog2) - 1;
            int requiredSegmentCount = this.GetRequiredSegmentCount(this.count);

            if (((this.segments == null) ? 0 : this.segments.Count) < requiredSegmentCount)
            {
                throw new FormatException("this.segments.Count is less than the number of segments required for this.Count");
            }
            this.isInitialized = true;
        }
Пример #2
0
        private void Initialize()
        {
            this.segmentSubIndexMask = (((int)1) << this.segmentLengthLog2) - 1;
            if (this.segments == null)
            {
                if (this.count != 0)
                {
                    throw new InternalErrorException("this.segments is null, but this.count != 0");
                }
                this.segments            = new SegmentedList <T[]>();
                this.segmentNonNullCount = new SegmentedList <int>();
            }
            if (this.segmentNonNullCount == null)
            {
                this.segmentNonNullCount = new SegmentedList <int>();
                this.segmentNonNullCount.Resize(this.segments.Count);
            }
            this.segmentAllocator = SegmentAllocator <T> .GetInstance(this.segmentLengthLog2);

            this.isInitialized = true;
        }