Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,41 @@ private RectangleSpliterator(int[][] array, int startOuterInclusive, int endOute
this.startInnerInclusive = startInnerInclusive;
}

private boolean isSplitterable(){
return endOuterExclusive-startInnerInclusive>=2;
}

@Override
public OfInt trySplit() {
// TODO
throw new UnsupportedOperationException();
final int aboutMiddleIndex = startInnerInclusive + (endOuterExclusive-startInnerInclusive)/2;

RectangleSpliterator rectangleSpliterator = new RectangleSpliterator(array,
startOuterInclusive,
endOuterExclusive,
aboutMiddleIndex);
this.startInnerInclusive = aboutMiddleIndex; //how???? its final
return isSplitterable()?rectangleSpliterator:null;
}

@Override
public long estimateSize() {
return ((long) endOuterExclusive - startOuterInclusive)*innerLength - startInnerInclusive;
}

private int currentX;
private int currentY;
@Override
public boolean tryAdvance(IntConsumer action) {
// TODO
throw new UnsupportedOperationException();
if (currentY>array.length && currentX>array[currentY].length)

if (startInnerInclusive<endOuterExclusive){
action.accept(array[currentY][currentX]);
currentX++;
if(currentX>=array[currentY].length){
currentX=0;
currentY++;
}
}
return true;
}
}