MCPcopy Index your code
hub / github.com/clojure/clojure / forceChunk

Method forceChunk

src/jvm/clojure/lang/Range.java:111–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109}
110
111public void forceChunk() {
112 if(_chunk != null) return;
113
114 Object[] arr = new Object[CHUNK_SIZE];
115 int n = 0;
116 Object val = start;
117 while(n < CHUNK_SIZE) {
118 arr[n++] = val;
119 val = Numbers.addP(val, step);
120 if(boundsCheck.exceededBounds(val)) {
121 //partial last chunk
122 _chunk = new ArrayChunk(arr, 0, n);
123 return;
124 }
125 }
126
127 // full last chunk
128 if(boundsCheck.exceededBounds(val)) {
129 _chunk = new ArrayChunk(arr, 0, CHUNK_SIZE);
130 return;
131 }
132
133 // full intermediate chunk
134 _chunk = new ArrayChunk(arr, 0, CHUNK_SIZE);
135 _chunkNext = new Range(val, end, step, boundsCheck);
136}
137
138public ISeq next() {
139 if(_next != null)

Callers 3

nextMethod · 0.95
chunkedFirstMethod · 0.95
chunkedMoreMethod · 0.95

Calls 2

addPMethod · 0.95
exceededBoundsMethod · 0.65

Tested by

no test coverage detected