public boolean moveToNext() { while (!runningHasNext() && !literalHasNext()) { if (!this.ewahIter.hasNext()) { return false; } setRunningLengthWord(this.ewahIter.next()); } return true; }
@Override public int next() { final int answer; if (runningHasNext()) { answer = this.position++; } else { final long t = this.word & -this.word; answer = this.literalPosition + Long.bitCount(t - 1); this.word ^= t; } this.hasNext = this.moveToNext(); return answer; }
IntIteratorImpl(EWAHIterator ewahIter) { this.ewahIter = ewahIter; this.buffer = ewahIter.buffer(); this.hasNext = this.moveToNext(); }
/** * Iterator over the set bits (this is what most people will want to use * to browse the content if they want an iterator). The location of the * set bits is returned, in increasing order. * * The current bitmap is not modified. * * @return the int iterator */ public IntIterator intIterator() { return new IntIteratorImpl(this.getEWAHIterator()); }
IntIteratorImpl(EWAHIterator ewahIter) { this.ewahIter = ewahIter; this.buffer = ewahIter.buffer(); this.hasNext = this.moveToNext(); }
/** * Iterator over the set bits (this is what most people will want to use * to browse the content if they want an iterator). The location of the * set bits is returned, in increasing order. * * The current bitmap is not modified. * * @return the int iterator */ public IntIterator intIterator() { return new IntIteratorImpl(this.getEWAHIterator()); }
public boolean moveToNext() { while (!runningHasNext() && !literalHasNext()) { if (!this.ewahIter.hasNext()) { return false; } setRunningLengthWord(this.ewahIter.next()); } return true; }
@Override public int next() { final int answer; if (runningHasNext()) { answer = this.position++; } else { final long t = this.word & -this.word; answer = this.literalPosition + Long.bitCount(t - 1); this.word ^= t; } this.hasNext = this.moveToNext(); return answer; }