public Enumerator(BlockIndexBase <T> index, int startOffset, int endOffset) { this.index = index; this.startOffset = startOffset; this.endOffset = endOffset; Reset(); }
protected BlockIndexBase(IIndex <T> index) : this() { if (index is BlockIndexBase <T> ) { // Optimization for when the input list is a BlockIntegerList BlockIndexBase <T> blockIndex = (BlockIndexBase <T>)index; List <IIndexBlock <T> > inBlocks = blockIndex.Blocks; int inBlocksCount = inBlocks.Count; // For each block in 'blockIndex' for (int i = 0; i < inBlocksCount; ++i) { // get the block. IIndexBlock <T> block = inBlocks[i]; // Insert a new block in this object. IIndexBlock <T> destBlock = InsertBlock(i, NewBlock()); // Copy the contents of the source block to the new destination block. block.CopyTo(destBlock); } // Set the size of the list Count = blockIndex.Count; //count; } else { // The case when IIntegerList type is not known IIndexEnumerator <T> i = index.GetEnumerator(); while (i.MoveNext()) { Add(i.Current); } } // If the given list is immutable then set this list to immutable if (index.IsReadOnly) { IsReadOnly = true; } }