public static Bitmap newImmutableEwahBitmap(int[] data) throws Exception { ByteBuffer bb = toByteBuffer(newEwahBitmap(data)); EWAHCompressedBitmap ewah = new EWAHCompressedBitmap(bb); return new EwahBitmapWrapper(ewah); }
ComboBitset() { this(new EWAHCompressedBitmap()); }
private static EWAHCompressedBitmap readBitmap(DataInput dataInput) throws IOException { EWAHCompressedBitmap bitmap = new EWAHCompressedBitmap(); bitmap.deserialize(dataInput); return bitmap; } }
static final EWAHCompressedBitmap ones(int sizeInBits) { EWAHCompressedBitmap mask = new EWAHCompressedBitmap(); mask.addStreamOfEmptyWords( true, sizeInBits / EWAHCompressedBitmap.WORD_IN_BITS); int remaining = sizeInBits % EWAHCompressedBitmap.WORD_IN_BITS; if (remaining > 0) mask.addWord((1L << remaining) - 1, remaining); return mask; } }
final EWAHCompressedBitmap toEWAHCompressedBitmap() { EWAHCompressedBitmap compressed = new EWAHCompressedBitmap( words.length); int runningEmptyWords = 0; long lastNonEmptyWord = 0; for (long word : words) { if (word == 0) { runningEmptyWords++; continue; } if (lastNonEmptyWord != 0) compressed.addWord(lastNonEmptyWord); if (runningEmptyWords > 0) { compressed.addStreamOfEmptyWords(false, runningEmptyWords); runningEmptyWords = 0; } lastNonEmptyWord = word; } int bitsThatMatter = 64 - Long.numberOfLeadingZeros(lastNonEmptyWord); if (bitsThatMatter > 0) compressed.addWord(lastNonEmptyWord, bitsThatMatter); return compressed; }
commits = new EWAHCompressedBitmap(sizeInWords); trees = new EWAHCompressedBitmap(sizeInWords); blobs = new EWAHCompressedBitmap(sizeInWords); tags = new EWAHCompressedBitmap(sizeInWords); for (int i = 0; i < objects.size(); i++) { int type = objects.get(i).getType();
ComboBitset() { this(new EWAHCompressedBitmap()); }
ComboBitset() { this(new EWAHCompressedBitmap()); }
private static EWAHCompressedBitmap readBitmap(DataInput dataInput) throws IOException { EWAHCompressedBitmap bitmap = new EWAHCompressedBitmap(); bitmap.deserialize(dataInput); return bitmap; } }
private static EWAHCompressedBitmap readBitmap(DataInput dataInput) throws IOException { EWAHCompressedBitmap bitmap = new EWAHCompressedBitmap(); bitmap.deserialize(dataInput); return bitmap; } }
/** * Compute the xor aggregate using a temporary uncompressed bitmap. * * @param bitmaps the source bitmaps * @param bufSize buffer size used during the computation in 64-bit * words * @return the xor aggregate. */ public static EWAHCompressedBitmap bufferedxor(final int bufSize, final EWAHCompressedBitmap... bitmaps) { EWAHCompressedBitmap answer = new EWAHCompressedBitmap(); bufferedxorWithContainer(answer, bufSize, bitmaps); return answer; }
/** * Compute the or aggregate using a temporary uncompressed bitmap. * * @param bitmaps the source bitmaps * @param bufSize buffer size used during the computation in 64-bit * words * @return the or aggregate. */ public static EWAHCompressedBitmap bufferedor(final int bufSize, final EWAHCompressedBitmap... bitmaps) { EWAHCompressedBitmap answer = new EWAHCompressedBitmap(); bufferedorWithContainer(answer, bufSize, bitmaps); return answer; }
/** * Compute the xor aggregate using a temporary uncompressed bitmap. * * @param bitmaps the source bitmaps * @param bufSize buffer size used during the computation in 64-bit * words * @return the xor aggregate. */ public static EWAHCompressedBitmap bufferedxor(final int bufSize, final EWAHCompressedBitmap... bitmaps) { EWAHCompressedBitmap answer = new EWAHCompressedBitmap(); bufferedxorWithContainer(answer, bufSize, bitmaps); return answer; }
/** * Compute the or aggregate using a temporary uncompressed bitmap. * * @param bitmaps the source bitmaps * @param bufSize buffer size used during the computation in 64-bit * words * @return the or aggregate. */ public static EWAHCompressedBitmap bufferedor(final int bufSize, final EWAHCompressedBitmap... bitmaps) { EWAHCompressedBitmap answer = new EWAHCompressedBitmap(); bufferedorWithContainer(answer, bufSize, bitmaps); return answer; }
/** * Compute a Boolean threshold function: bits are true where at least t * bitmaps have a true bit. * * @param t the threshold * @param bitmaps input data * @return the aggregated bitmap * @since 0.8.1 */ public static EWAHCompressedBitmap threshold(final int t, final EWAHCompressedBitmap... bitmaps) { final EWAHCompressedBitmap container = new EWAHCompressedBitmap(); thresholdWithContainer(container, t, bitmaps); return container; }
/** * Compute a Boolean threshold function: bits are true where at least t * bitmaps have a true bit. * * @param t the threshold * @param bitmaps input data * @return the aggregated bitmap * @since 0.8.1 */ public static EWAHCompressedBitmap threshold(final int t, final EWAHCompressedBitmap... bitmaps) { final EWAHCompressedBitmap container = new EWAHCompressedBitmap(); thresholdWithContainer(container, t, bitmaps); return container; }
@Override public EWAHCompressedBitmap clone() throws CloneNotSupportedException { EWAHCompressedBitmap clone = new EWAHCompressedBitmap(this.buffer.clone()); clone.sizeInBits = this.sizeInBits; clone.rlw = new RunningLengthWord(clone.buffer, this.rlw.position); return clone; }
@Override public EWAHCompressedBitmap clone() throws CloneNotSupportedException { EWAHCompressedBitmap clone = new EWAHCompressedBitmap(this.buffer.clone()); clone.sizeInBits = this.sizeInBits; clone.rlw = new RunningLengthWord(clone.buffer, this.rlw.position); return clone; }
static final EWAHCompressedBitmap ones(int sizeInBits) { EWAHCompressedBitmap mask = new EWAHCompressedBitmap(); mask.addStreamOfEmptyWords( true, sizeInBits / EWAHCompressedBitmap.wordinbits); int remaining = sizeInBits % EWAHCompressedBitmap.wordinbits; if (remaining > 0) mask.add((1L << remaining) - 1, remaining); return mask; } }
static final EWAHCompressedBitmap ones(int sizeInBits) { EWAHCompressedBitmap mask = new EWAHCompressedBitmap(); mask.addStreamOfEmptyWords( true, sizeInBits / EWAHCompressedBitmap.WORD_IN_BITS); int remaining = sizeInBits % EWAHCompressedBitmap.WORD_IN_BITS; if (remaining > 0) mask.addWord((1L << remaining) - 1, remaining); return mask; } }