@Override public Bitmap aggregate(Iterable<Bitmap> bitmaps) { final Iterator<Bitmap> i = bitmaps.iterator(); EWAHCompressedBitmap bitmap = ((EwahBitmapWrapper) i.next()).bitmap; while (i.hasNext()) { bitmap = bitmap.or(((EwahBitmapWrapper) i.next()).bitmap); } return new EwahBitmapWrapper(bitmap); } };
EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.or(x2));
@Override public Bitmap or(Bitmap other) { return new EwahBitmapWrapper(bitmap.or(((EwahBitmapWrapper) other).bitmap)); }
EWAHCompressedBitmap x1 = pq.poll(); EWAHCompressedBitmap x2 = pq.poll(); pq.add(x1.or(x2));
@Benchmark public int horizontalOr_EWAH(BenchmarkState benchmarkState) { EWAHCompressedBitmap[] a = new EWAHCompressedBitmap[benchmarkState.ewah.size()]; EWAHCompressedBitmap bitmapor = EWAHCompressedBitmap.or(benchmarkState.ewah.toArray(a)); int answer = bitmapor.cardinality(); return answer; }
final InflatingBitSet or(EWAHCompressedBitmap other) { if (other.sizeInBits() == 0) return this; return new InflatingBitSet(bitmap.or(other), inflated); }
@Override public CompressedBitmap or(Bitmap other) { return new CompressedBitmap(bitmap.or(ewahBitmap(other)), bitmapIndex); }
@Override public AnalysisFormat merge(AnalysisFormat record) throws IOException { if (record instanceof UVBitmapFormat) { UVBitmapFormat that = (UVBitmapFormat) record; bitmap = bitmap.or(that.bitmap); } else { throw new IOException("need UVBitmapFormat but " + record.getClass().getSimpleName()); } return this; }
/** * Computes the logical <code>or</code> of the context bitmap * (<code>this</code>) and the given bitmap. * * @param rhs Bitmap to compute the logical <code>or</code> with. * @return Logical <code>or</code> of <code>this</code> bitmap * (context object) and the given bitmap. */ public SparseBitmap or(final SparseBitmap rhs) { return new SparseBitmap(this.bitmap.or(rhs.bitmap)); }
/** * Computes the logical <code>or</code> of the context bitmap * (<code>this</code>) and the given bitmap. * * @param rhs Bitmap to compute the logical <code>or</code> with. * @return Logical <code>or</code> of <code>this</code> bitmap * (context object) and the given bitmap. */ public SparseBitmap or(final SparseBitmap rhs) { return new SparseBitmap(this.bitmap.or(rhs.bitmap)); }
/** * Simple algorithm that computes the OR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap or(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.or(x2)); } return pq.poll(); }
/** * Simple algorithm that computes the OR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap or(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.or(x2)); } return pq.poll(); }
/** * Simple algorithm that computes the OR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap or(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.or(x2)); } return pq.poll(); }
/** * Simple algorithm that computes the OR aggregate. * * @param bitmaps input bitmaps * @return new bitmap containing the aggregate */ public static EWAHCompressedBitmap or(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.or(x2)); } return pq.poll(); }
final InflatingBitSet or(EWAHCompressedBitmap other) { if (other.sizeInBits() == 0) return this; return new InflatingBitSet(bitmap.or(other), inflated); }
final InflatingBitSet or(EWAHCompressedBitmap other) { if (other.sizeInBits() == 0) return this; return new InflatingBitSet(bitmap.or(other), inflated); }
@Override public CompressedBitmap or(Bitmap other) { return new CompressedBitmap(bitmap.or(ewahBitmap(other)), bitmapIndex); }
@Override public CompressedBitmap or(Bitmap other) { return new CompressedBitmap(bitmap.or(ewahBitmap(other)), bitmapIndex); }
/** * Creates a new SparseBitmap that is the logical <code>or</code> of all the given bitmaps. * * @param bitmaps Bitmaps to compute the logical <code>or</code> for * @return SparseBitmap that has the values set according to the <code>or</code> of the given bitmaps. */ public static SparseBitmap batchOr(final SparseBitmap... bitmaps) { if (bitmaps.length < 1) { return SparseBitmap.createFromUnsortedData(); } if (bitmaps.length < 2) { return bitmaps[0]; } EWAHCompressedBitmap firstMap = bitmaps[0].bitmap; for (int index = 1; index < bitmaps.length; ++index) { firstMap = firstMap.or(bitmaps[index].bitmap); } return new SparseBitmap(firstMap); }
/** * Creates a new SparseBitmap that is the logical <code>or</code> of all the given bitmaps. * * @param bitmaps Bitmaps to compute the logical <code>or</code> for * @return SparseBitmap that has the values set according to the <code>or</code> of the given bitmaps. */ public static SparseBitmap batchOr(final SparseBitmap... bitmaps) { if (bitmaps.length < 1) { return SparseBitmap.createFromUnsortedData(); } if (bitmaps.length < 2) { return bitmaps[0]; } EWAHCompressedBitmap firstMap = bitmaps[0].bitmap; for (int index = 1; index < bitmaps.length; ++index) { firstMap = firstMap.or(bitmaps[index].bitmap); } return new SparseBitmap(firstMap); }