@Override public int cardinality() { return bitmap.cardinality(); }
@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; }
@Override public int cardinality() { return bitset.combine().cardinality(); }
/** * The number of bits that are set. * * @return The number of bits that are set. */ public int cardinality() { return this.bitmap.cardinality(); }
@Override public Object toDbValue() { return bitmap.cardinality(); }
/** * The number of bits that are set. * * @return The number of bits that are set. */ public int cardinality() { return this.bitmap.cardinality(); }
@Override public String toString() { return Integer.toString(bitmap.cardinality()); }
@Override public String format() throws IOException { return Integer.toString(bitmap.cardinality()); }
/** * Gets the highest bit that is set in the bitmap. * * @return The highest bit. */ public int getHighestBit() { return this.bitmap.cardinality() > 0 ? this.bitmap.toArray()[this.bitmap.cardinality() - 1] : 0; }
/** * Gets the highest bit that is set in the bitmap. * * @return The highest bit. */ public int getHighestBit() { return this.bitmap.cardinality() > 0 ? this.bitmap.toArray()[this.bitmap.cardinality() - 1] : 0; }
/** * Set the bit at the given index. Throws an exception if bits are not set in strictly ascending order. * For performance reasons, bits must be set in ascending order. * * @param bitToSet The index of the bit to set. */ public void set(final int bitToSet) { // Check that we are setting bits in ascending order (equality with the last value is OK). if (this.bitmap.cardinality() > 0 && bitToSet < this.bitmap.toArray()[this.bitmap.cardinality() - 1]) { throw new IllegalArgumentException("Must set bits in strictly ascending order."); } this.bitmap.set(bitToSet); }
@Override public int cardinality() { return bitset.combine().cardinality(); }
@Override public int cardinality() { return bitset.combine().cardinality(); }
/** * Set the bit at the given index. Throws an exception if bits are not set in strictly ascending order. * For performance reasons, bits must be set in ascending order. * * @param bitToSet The index of the bit to set. */ public void set(final int bitToSet) { // Check that we are setting bits in ascending order (equality with the last value is OK). if (this.bitmap.cardinality() > 0 && bitToSet < this.bitmap.toArray()[this.bitmap.cardinality() - 1]) { throw new IllegalArgumentException("Must set bits in strictly ascending order."); } this.bitmap.set(bitToSet); }
/** * Returns the cardinality of the result of a bitwise AND of the values * of the provided bitmaps. Avoids allocating an intermediate * bitmap to hold the result of the AND. * * @param bitmaps bitmaps to AND * @return the cardinality * @since 0.4.3 */ public static int andCardinality(final EWAHCompressedBitmap... bitmaps) { if (bitmaps.length == 1) return bitmaps[0].cardinality(); final BitCounter counter = new BitCounter(); andWithContainer(counter, bitmaps); return counter.getCount(); }
/** * Returns the cardinality of the result of a bitwise OR of the values * of the provided bitmaps. Avoids allocating an intermediate * bitmap to hold the result of the OR. * * @param bitmaps bitmaps to OR * @return the cardinality * @since 0.4.0 */ public static int orCardinality(final EWAHCompressedBitmap... bitmaps) { if (bitmaps.length == 1) return bitmaps[0].cardinality(); final BitCounter counter = new BitCounter(); orWithContainer(counter, bitmaps); return counter.getCount(); }
/** * Returns the cardinality of the result of a bitwise AND of the values * of the provided bitmaps. Avoids allocating an intermediate * bitmap to hold the result of the AND. * * @param bitmaps bitmaps to AND * @return the cardinality * @since 0.4.3 */ public static int andCardinality(final EWAHCompressedBitmap... bitmaps) { if (bitmaps.length == 1) return bitmaps[0].cardinality(); final BitCounter counter = new BitCounter(); andWithContainer(counter, bitmaps); return counter.getCount(); }
/** * Returns the cardinality of the result of a bitwise OR of the values * of the provided bitmaps. Avoids allocating an intermediate * bitmap to hold the result of the OR. * * @param bitmaps bitmaps to OR * @return the cardinality * @since 0.4.0 */ public static int orCardinality(final EWAHCompressedBitmap... bitmaps) { if (bitmaps.length == 1) return bitmaps[0].cardinality(); final BitCounter counter = new BitCounter(); orWithContainer(counter, bitmaps); return counter.getCount(); }
int[] ans = new int[this.cardinality()]; int inAnsPos = 0; int pos = 0;
int[] ans = new int[this.cardinality()]; int inAnsPos = 0; int pos = 0;