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

Class NodeSeq

src/jvm/clojure/lang/PersistentHashMap.java:1292–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1290}
1291
1292static final class NodeSeq extends ASeq {
1293 final Object[] array;
1294 final int i;
1295 final ISeq s;
1296
1297 NodeSeq(Object[] array, int i) {
1298 this(null, array, i, null);
1299 }
1300
1301 static ISeq create(Object[] array) {
1302 return create(array, 0, null);
1303 }
1304
1305 static public Object kvreduce(Object[] array, IFn f, Object init){
1306 for(int i=0;i<array.length;i+=2)
1307 {
1308 if(array[i] != null)
1309 init = f.invoke(init, array[i], array[i+1]);
1310 else
1311 {
1312 INode node = (INode) array[i+1];
1313 if(node != null)
1314 init = node.kvreduce(f,init);
1315 }
1316 if(RT.isReduced(init))
1317 return init;
1318 }
1319 return init;
1320 }
1321
1322 private static ISeq create(Object[] array, int i, ISeq s) {
1323 if(s != null)
1324 return new NodeSeq(null, array, i, s);
1325 for(int j = i; j < array.length; j+=2) {
1326 if(array[j] != null)
1327 return new NodeSeq(null, array, j, null);
1328 INode node = (INode) array[j+1];
1329 if (node != null) {
1330 ISeq nodeSeq = node.nodeSeq();
1331 if(nodeSeq != null)
1332 return new NodeSeq(null, array, j + 2, nodeSeq);
1333 }
1334 }
1335 return null;
1336 }
1337
1338 NodeSeq(IPersistentMap meta, Object[] array, int i, ISeq s) {
1339 super(meta);
1340 this.array = array;
1341 this.i = i;
1342 this.s = s;
1343 }
1344
1345 public Obj withMeta(IPersistentMap meta) {
1346 if(meta() == meta)
1347 return this;
1348 return new NodeSeq(meta, array, i, s);
1349 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…