| 448 | } |
| 449 | |
| 450 | static public final class ChunkedSeq extends ASeq implements IChunkedSeq,Counted,IReduce,IDrop{ |
| 451 | |
| 452 | public final PersistentVector vec; |
| 453 | final Object[] node; |
| 454 | final int i; |
| 455 | public final int offset; |
| 456 | |
| 457 | public ChunkedSeq(PersistentVector vec, int i, int offset){ |
| 458 | this.vec = vec; |
| 459 | this.i = i; |
| 460 | this.offset = offset; |
| 461 | this.node = vec.arrayFor(i); |
| 462 | } |
| 463 | |
| 464 | ChunkedSeq(IPersistentMap meta, PersistentVector vec, Object[] node, int i, int offset){ |
| 465 | super(meta); |
| 466 | this.vec = vec; |
| 467 | this.node = node; |
| 468 | this.i = i; |
| 469 | this.offset = offset; |
| 470 | } |
| 471 | |
| 472 | ChunkedSeq(PersistentVector vec, Object[] node, int i, int offset){ |
| 473 | this.vec = vec; |
| 474 | this.node = node; |
| 475 | this.i = i; |
| 476 | this.offset = offset; |
| 477 | } |
| 478 | |
| 479 | public IChunk chunkedFirst() { |
| 480 | return new ArrayChunk(node, offset); |
| 481 | } |
| 482 | |
| 483 | public ISeq chunkedNext(){ |
| 484 | if(i + node.length < vec.cnt) |
| 485 | return new ChunkedSeq(vec,i+ node.length,0); |
| 486 | return null; |
| 487 | } |
| 488 | |
| 489 | public ISeq chunkedMore(){ |
| 490 | ISeq s = chunkedNext(); |
| 491 | if(s == null) |
| 492 | return PersistentList.EMPTY; |
| 493 | return s; |
| 494 | } |
| 495 | |
| 496 | public Obj withMeta(IPersistentMap meta){ |
| 497 | if(meta == this._meta) |
| 498 | return this; |
| 499 | return new ChunkedSeq(meta, vec, node, i, offset); |
| 500 | } |
| 501 | |
| 502 | public Object first(){ |
| 503 | return node[offset]; |
| 504 | } |
| 505 | |
| 506 | public ISeq next(){ |
| 507 | if(offset + 1 < node.length) |
nothing calls this directly
no outgoing calls
no test coverage detected