@Override public void orWith(BitmapCounter another) { if (another instanceof RoaringBitmapCounter) { RoaringBitmapCounter input = (RoaringBitmapCounter) another; getMutableBitmap().or(input.bitmap); return; } throw new IllegalArgumentException("Unsupported type: " + another.getClass().getCanonicalName()); }
@Override public void add(int value) { getMutableBitmap().add(value); }
@Override public void andWith(BitmapCounter another) { if (another instanceof RoaringBitmapCounter) { RoaringBitmapCounter input = (RoaringBitmapCounter) another; getMutableBitmap().and(input.bitmap); return; } throw new IllegalArgumentException("Unsupported type: " + another.getClass().getCanonicalName()); }
@Override public void write(ByteBuffer out) throws IOException { if (bitmap instanceof MutableRoaringBitmap) { getMutableBitmap().runOptimize(); } if (out.remaining() < bitmap.serializedSizeInBytes()) { throw new BufferOverflowException(); } try (DataOutputStream dos = new DataOutputStream(new ByteBufferOutputStream(out))) { bitmap.serialize(dos); } }
@Override public void orWith(BitmapCounter another) { if (another instanceof RoaringBitmapCounter) { RoaringBitmapCounter input = (RoaringBitmapCounter) another; getMutableBitmap().or(input.bitmap); return; } throw new IllegalArgumentException("Unsupported type: " + another.getClass().getCanonicalName()); }
@Override public void andWith(BitmapCounter another) { if (another instanceof RoaringBitmapCounter) { RoaringBitmapCounter input = (RoaringBitmapCounter) another; getMutableBitmap().and(input.bitmap); return; } throw new IllegalArgumentException("Unsupported type: " + another.getClass().getCanonicalName()); }
@Override public void add(int value) { getMutableBitmap().add(value); }
@Override public void write(ByteBuffer out) throws IOException { if (bitmap instanceof MutableRoaringBitmap) { getMutableBitmap().runOptimize(); } if (out.remaining() < bitmap.serializedSizeInBytes()) { throw new BufferOverflowException(); } try (DataOutputStream dos = new DataOutputStream(new ByteBufferOutputStream(out))) { bitmap.serialize(dos); } }