void ForceChunk() { if (this._chunk != null) { return; } var arr = new object[Constants.CHUNK_SIZE]; int n = 0; var val = this._start; while (n < Constants.CHUNK_SIZE) { arr[n++] = val; val = Numbers.Add(val, this._step); if (this._boundsCheck.ExceededBounds(val)) { this._chunk = new ArrayChunked(arr, 0, n); // funclib.Core.Partial( last chunk return; } } // full last chunk if (this._boundsCheck.ExceededBounds(val)) { this._chunk = new ArrayChunked(arr, 0, Constants.CHUNK_SIZE); return; } // full intermediate chunk this._chunk = new ArrayChunked(arr, 0, Constants.CHUNK_SIZE); this._chunkNext = new Range(val, this._end, this._step, this._boundsCheck); }
void ForceChunk() { if (this._chunk != null) { return; } long count; try { count = RangeCount(this._start, this._end, this._step); } catch (ArithmeticException) { count = SteppingCount(this._start, this._end, this._step); } if (count > Constants.CHUNK_SIZE) { var nextStart = this._start + (this._step * Constants.CHUNK_SIZE); this._chunkNext = new LongRange(nextStart, this._end, this._step, this._boundsCheck); this._chunk = new LongChunked(this._start, this._step, Constants.CHUNK_SIZE); } else { this._chunk = new LongChunked(this._start, this._step, (int)count); } }
Range(object start, object end, object step, IBoundsCheck boundsCheck, IChunked chunk, ISeq chunkNext) { this._start = start; this._end = end; this._step = step; this._boundsCheck = boundsCheck; this._chunk = chunk; this._chunkNext = chunkNext; }
LongRange(long start, long end, long step, IBoundsCheck boundsCheck, IChunked chunk, ISeq chunkNext) { this._start = start; this._end = end; this._step = step; this._boundsCheck = boundsCheck; this._chunk = chunk; this._chunkNext = chunkNext; }
public ChunkedCons(IChunked chunk, ISeq more) { this._chunk = chunk; this._more = more; }