public EnumerableOfEnumerators(ChunkPartitioner <T> parentPartitioner, bool referenceCountForDisposal) { // Store the data, including creating an enumerator from the underlying data source _parentPartitioner = parentPartitioner ?? throw new ArgumentNullException(nameof(parentPartitioner)); _sharedEnumerator = parentPartitioner._source.GetEnumerator(); _nextSharedIndex = -1; _referenceCountForDisposal = referenceCountForDisposal; }
public ChunkPartitioner(IEnumerable <T> source, int minChunkSize, int maxChunkSize) : this(source, ChunkPartitioner <T> .CreateFuncFromMinAndMax(minChunkSize, maxChunkSize)) { if (minChunkSize <= 0 || minChunkSize > maxChunkSize) { throw new ArgumentOutOfRangeException(nameof(minChunkSize)); } }
public Enumerator(ChunkPartitioner <T> .EnumerableOfEnumerators parentEnumerable) { this._currentChunk = new List <KeyValuePair <long, T> >(); if (parentEnumerable == null) { throw new ArgumentNullException("parentEnumerable"); } this._parentEnumerable = parentEnumerable; }
public Enumerator( ChunkPartitioner <T> .EnumerableOfEnumerators parentEnumerable) { if (parentEnumerable == null) { throw new ArgumentNullException(nameof(parentEnumerable)); } this._parentEnumerable = parentEnumerable; }
private void DisposeEnumerator( ChunkPartitioner <T> .EnumerableOfEnumerators.Enumerator enumerator) { if (!this._referenceCountForDisposal || Interlocked.Decrement(ref this._activeEnumerators) != 0) { return; } this._sharedEnumerator.Dispose(); }
public EnumerableOfEnumerators(ChunkPartitioner <T> parentPartitioner, bool referenceCountForDisposal) { this._sharedLock = new object(); if (parentPartitioner == null) { throw new ArgumentNullException("parentPartitioner"); } this._parentPartitioner = parentPartitioner; this._sharedEnumerator = parentPartitioner._source.GetEnumerator(); this._nextSharedIndex = -1L; this._referenceCountForDisposal = referenceCountForDisposal; }