/** * Computes and returns the full bitmap. * * @return the full bitmap */ EWAHCompressedBitmap getBitmap() { // Fast path to immediately return the expanded result. Object r = bitmapContainer; if (r instanceof EWAHCompressedBitmap) return (EWAHCompressedBitmap) r; // Expand the bitmap and cache the result. XorCompressedBitmap xb = (XorCompressedBitmap) r; EWAHCompressedBitmap out = xb.bitmap; for (;;) { r = xb.xorBitmap.bitmapContainer; if (r instanceof EWAHCompressedBitmap) { out = out.xor((EWAHCompressedBitmap) r); out.trim(); bitmapContainer = out; return out; } xb = (XorCompressedBitmap) r; out = out.xor(xb.bitmap); } }
/** * Stores the bitmap for the objectId. * * @param objectId * the object id key for the bitmap. * @param bitmap * the bitmap * @param flags * the flags to be stored with the bitmap */ public void addBitmap( AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags) { bitmap.trim(); StoredBitmap result = new StoredBitmap(objectId, bitmap, null, flags); getBitmaps().add(result); byAddOrder.add(result); }
/** {@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; }
/** * Computes and returns the full bitmap. * * @return the full bitmap */ EWAHCompressedBitmap getBitmap() { // Fast path to immediately return the expanded result. Object r = bitmapContainer; if (r instanceof EWAHCompressedBitmap) return (EWAHCompressedBitmap) r; // Expand the bitmap and cache the result. XorCompressedBitmap xb = (XorCompressedBitmap) r; EWAHCompressedBitmap out = xb.bitmap; for (;;) { r = xb.xorBitmap.bitmapContainer; if (r instanceof EWAHCompressedBitmap) { out = out.xor((EWAHCompressedBitmap) r); out.trim(); bitmapContainer = out; return out; } xb = (XorCompressedBitmap) r; out = out.xor(xb.bitmap); } }
/** * Stores the bitmap for the objectId. * * @param objectId * the object id key for the bitmap. * @param bitmap * the bitmap * @param flags * the flags to be stored with the bitmap */ public void addBitmap( AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags) { bitmap.trim(); StoredBitmap result = new StoredBitmap(objectId, bitmap, null, flags); getBitmaps().add(result); byAddOrder.add(result); }
/** * Stores the bitmap for the objectId. * * @param objectId * the object id key for the bitmap. * @param bitmap * the bitmap * @param flags * the flags to be stored with the bitmap */ public void addBitmap( AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags) { bitmap.trim(); StoredBitmap result = new StoredBitmap(objectId, bitmap, null, flags); getBitmaps().add(result); byAddOrder.add(result); }
/** {@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; }