@Override public Bitmap xor(Bitmap other) { return new EwahBitmapWrapper(bitmap.xor(((EwahBitmapWrapper) other).bitmap)); }
EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.xor(x2));
/** * 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); } }
EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.xor(x2));
@Override public CompressedBitmap xor(Bitmap other) { return new CompressedBitmap(bitmap.xor(ewahBitmap(other)), bitmapIndex); }
final InflatingBitSet xor(EWAHCompressedBitmap other) { if (isEmpty()) { if (other.sizeInBits() == 0) return this; return new InflatingBitSet(other); } return new InflatingBitSet(bitmap.xor(other)); }
@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; }
/** * 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); bitmapContainer = out; return out; } xb = (XorCompressedBitmap) r; out = out.xor(xb.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); } }
/** * Simple algorithm that computes the XOR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap xor(final EWAHCompressedBitmap... bitmaps) { PriorityQueue<EWAHCompressedBitmap> pq = new PriorityQueue<EWAHCompressedBitmap>(bitmaps.length, new Comparator<EWAHCompressedBitmap>() { @Override public int compare(EWAHCompressedBitmap a, EWAHCompressedBitmap b) { return a.sizeInBytes() - b.sizeInBytes(); } } ); Collections.addAll(pq, bitmaps); if(pq.isEmpty()) return new EWAHCompressedBitmap(); while (pq.size() > 1) { EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.xor(x2)); } return pq.poll(); }
/** * Simple algorithm that computes the XOR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap xor(final Iterator<EWAHCompressedBitmap> bitmaps) { PriorityQueue<EWAHCompressedBitmap> pq = new PriorityQueue<EWAHCompressedBitmap>(32, new Comparator<EWAHCompressedBitmap>() { @Override public int compare(EWAHCompressedBitmap a, EWAHCompressedBitmap b) { return a.sizeInBytes() - b.sizeInBytes(); } } ); while(bitmaps.hasNext()) pq.add(bitmaps.next()); if(pq.isEmpty()) return new EWAHCompressedBitmap(); while (pq.size() > 1) { EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.xor(x2)); } return pq.poll(); }
/** * Simple algorithm that computes the XOR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap xor(final Iterator<EWAHCompressedBitmap> bitmaps) { PriorityQueue<EWAHCompressedBitmap> pq = new PriorityQueue<EWAHCompressedBitmap>(32, new Comparator<EWAHCompressedBitmap>() { @Override public int compare(EWAHCompressedBitmap a, EWAHCompressedBitmap b) { return a.sizeInBytes() - b.sizeInBytes(); } } ); while(bitmaps.hasNext()) pq.add(bitmaps.next()); if(pq.isEmpty()) return new EWAHCompressedBitmap(); while (pq.size() > 1) { EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.xor(x2)); } return pq.poll(); }
/** * Simple algorithm that computes the XOR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap xor(final EWAHCompressedBitmap... bitmaps) { PriorityQueue<EWAHCompressedBitmap> pq = new PriorityQueue<EWAHCompressedBitmap>(bitmaps.length, new Comparator<EWAHCompressedBitmap>() { @Override public int compare(EWAHCompressedBitmap a, EWAHCompressedBitmap b) { return a.sizeInBytes() - b.sizeInBytes(); } } ); Collections.addAll(pq, bitmaps); if(pq.isEmpty()) return new EWAHCompressedBitmap(); while (pq.size() > 1) { EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.xor(x2)); } return pq.poll(); }
@Override public CompressedBitmap xor(Bitmap other) { return new CompressedBitmap(bitmap.xor(ewahBitmap(other)), bitmapIndex); }
@Override public CompressedBitmap xor(Bitmap other) { return new CompressedBitmap(bitmap.xor(ewahBitmap(other)), bitmapIndex); }
final InflatingBitSet xor(EWAHCompressedBitmap other) { if (isEmpty()) { if (other.sizeInBits() == 0) return this; return new InflatingBitSet(other); } return new InflatingBitSet(bitmap.xor(other)); }
final InflatingBitSet xor(EWAHCompressedBitmap other) { if (isEmpty()) { if (other.sizeInBits() == 0) return this; return new InflatingBitSet(other); } return new InflatingBitSet(bitmap.xor(other)); }
@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; }