@Override public BitmapIterator iterator() { return new EwahIteratorWrapper(bitmap.intIterator()); }
private final IntIterator ofObjectType(int type) { return bitmapIndex.packIndex.ofObjectType(bitmap, type).intIterator(); }
@Override public boolean removeAllOrNone(PackBitmapIndex index) { if (!bitmapIndex.packIndex.equals(index)) return false; EWAHCompressedBitmap curr = bitset.combine() .xor(ones(bitmapIndex.indexObjectCount)); IntIterator ii = curr.intIterator(); if (ii.hasNext() && ii.next() < bitmapIndex.indexObjectCount) return false; bitset = new ComboBitset(curr); return true; }
iterator = bitmap.intIterator(); if (iterator.hasNext()) nextPosition = iterator.next();
@Override public Iterator<BitmapObject> iterator() { final IntIterator dynamic = bitmap.andNot(ones(bitmapIndex.indexObjectCount)) .intIterator(); final IntIterator commits = ofObjectType(Constants.OBJ_COMMIT); final IntIterator trees = ofObjectType(Constants.OBJ_TREE);
/** * Iterates over the positions of the true values. This is similar to * intIterator(), but it uses Java generics. * * The current bitmap is not modified. * * @return the iterator */ @Override public Iterator<Integer> iterator() { return new Iterator<Integer>() { @Override public boolean hasNext() { return this.under.hasNext(); } @Override public Integer next() { return this.under.next(); } @Override public void remove() { throw new UnsupportedOperationException( "bitsets do not support remove"); } private final IntIterator under = intIterator(); }; }
/** * Iterates over the positions of the true values. This is similar to * intIterator(), but it uses Java generics. * * The current bitmap is not modified. * * @return the iterator */ @Override public Iterator<Integer> iterator() { return new Iterator<Integer>() { @Override public boolean hasNext() { return this.under.hasNext(); } @Override public Integer next() { return this.under.next(); } @Override public void remove() { throw new UnsupportedOperationException( "bitsets do not support remove"); } private final IntIterator under = intIterator(); }; }
/** {@inheritDoc} */ @Override public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) { EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId); if (bitmap != null || oldPackIndex == null) return bitmap; StoredBitmap stored = convertedBitmaps.get(objectId); if (stored != null) return stored.getBitmap(); StoredBitmap oldBitmap = oldPackIndex.getBitmaps().get(objectId); if (oldBitmap == null) return null; if (newPackIndex.findPosition(objectId) == -1) return null; inflated.clear(); for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();) inflated.set(prevToNewMapping[i.next()]); bitmap = inflated.toEWAHCompressedBitmap(); bitmap.trim(); convertedBitmaps.add( new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags())); return bitmap; }
private final IntIterator ofObjectType(int type) { return bitmapIndex.packIndex.ofObjectType(bitmap, type).intIterator(); }
private final IntIterator ofObjectType(int type) { return bitmapIndex.packIndex.ofObjectType(bitmap, type).intIterator(); }
/** * A string describing the bitmap. * * @return the string */ @Override public String toString() { StringBuilder answer = new StringBuilder(); IntIterator i = this.intIterator(); answer.append("{"); if (i.hasNext()) answer.append(i.next()); while (i.hasNext()) { answer.append(","); answer.append(i.next()); } answer.append("}"); return answer.toString(); }
/** * A string describing the bitmap. * * @return the string */ @Override public String toString() { StringBuilder answer = new StringBuilder(); IntIterator i = this.intIterator(); answer.append("{"); if (i.hasNext()) answer.append(i.next()); while (i.hasNext()) { answer.append(","); answer.append(i.next()); } answer.append("}"); return answer.toString(); }
@Override public boolean removeAllOrNone(PackBitmapIndex index) { if (!bitmapIndex.packIndex.equals(index)) return false; EWAHCompressedBitmap curr = bitset.combine() .xor(ones(bitmapIndex.indexObjectCount)); IntIterator ii = curr.intIterator(); if (ii.hasNext() && ii.next() < bitmapIndex.indexObjectCount) return false; bitset = new ComboBitset(curr); return true; }
@Override public boolean removeAllOrNone(PackBitmapIndex index) { if (!bitmapIndex.packIndex.equals(index)) return false; EWAHCompressedBitmap curr = bitset.combine() .xor(ones(bitmapIndex.indexObjectCount)); IntIterator ii = curr.intIterator(); if (ii.hasNext() && ii.next() < bitmapIndex.indexObjectCount) return false; bitset = new ComboBitset(curr); return true; }
iterator = bitmap.intIterator(); if (iterator.hasNext()) nextPosition = iterator.next();
iterator = bitmap.intIterator(); if (iterator.hasNext()) nextPosition = iterator.next();
@Override public Iterator<BitmapObject> iterator() { final IntIterator dynamic = bitmap.andNot(ones(bitmapIndex.indexObjectCount)) .intIterator(); final IntIterator commits = ofObjectType(Constants.OBJ_COMMIT); final IntIterator trees = ofObjectType(Constants.OBJ_TREE);
@Override public Iterator<BitmapObject> iterator() { final IntIterator dynamic = bitmap.andNot(ones(bitmapIndex.indexObjectCount)) .intIterator(); final IntIterator commits = ofObjectType(Constants.OBJ_COMMIT); final IntIterator trees = ofObjectType(Constants.OBJ_TREE);
@Override public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) { EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId); if (bitmap != null || oldPackIndex == null) return bitmap; StoredBitmap stored = convertedBitmaps.get(objectId); if (stored != null) return stored.getBitmap(); StoredBitmap oldBitmap = oldPackIndex.getBitmaps().get(objectId); if (oldBitmap == null) return null; if (newPackIndex.findPosition(objectId) == -1) return null; inflated.clear(); for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();) inflated.set(prevToNewMapping[i.next()]); bitmap = inflated.toEWAHCompressedBitmap(); convertedBitmaps.add( new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags())); return bitmap; }
/** {@inheritDoc} */ @Override public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) { EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId); if (bitmap != null || oldPackIndex == null) return bitmap; StoredBitmap stored = convertedBitmaps.get(objectId); if (stored != null) return stored.getBitmap(); StoredBitmap oldBitmap = oldPackIndex.getBitmaps().get(objectId); if (oldBitmap == null) return null; if (newPackIndex.findPosition(objectId) == -1) return null; inflated.clear(); for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();) inflated.set(prevToNewMapping[i.next()]); bitmap = inflated.toEWAHCompressedBitmap(); bitmap.trim(); convertedBitmaps.add( new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags())); return bitmap; }