@Test public void testSerializeImmutable() throws IOException { MutableRoaringBitmap mr = new MutableRoaringBitmap(); mr.add(5); ByteBuffer buffer = serializeRoaring(mr); buffer.rewind(); buffer = serializeRoaring(new ImmutableRoaringBitmap(buffer)); buffer.rewind(); ImmutableRoaringBitmap ir = new ImmutableRoaringBitmap(buffer); assertTrue(ir.contains(5)); }
@Override public boolean contains(final int x) { final char hb = highbits(x); int index = highLowContainer.getContainerIndex(hb); return index >= 0 && highLowContainer.containsForContainerAtIndex(index, lowbits(x)); }
ImmutableRoaringBitmap implements Iterable<Integer>, Cloneable, ImmutableBitmapDataProvider { @Override public boolean contains(final int x) { final char hb = highbits(x); int index = highLowContainer.getContainerIndex(hb); return index >= 0 && highLowContainer.containsForContainerAtIndex(index, lowbits(x)); } }
ImmutableRoaringBitmap implements Iterable<Integer>, Cloneable, ImmutableBitmapDataProvider { @Override public boolean contains(final int x) { final char hb = highbits(x); int index = highLowContainer.getContainerIndex(hb); return index >= 0 && highLowContainer.containsForContainerAtIndex(index, lowbits(x)); } protected  ImmutableRoaringBitmap();  ImmutableRoaringBitmap(final ByteBuffer b); }
ImmutableRoaringBitmap implements Iterable<Integer>, Cloneable, ImmutableBitmapDataProvider { @Override public boolean contains(final int x) { final char hb = highbits(x); int index = highLowContainer.getContainerIndex(hb); return index >= 0 && highLowContainer.containsForContainerAtIndex(index, lowbits(x)); } protected  ImmutableRoaringBitmap();  ImmutableRoaringBitmap(final ByteBuffer b); static MutableRoaringBitmap and(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final long rangeStart, final long rangeEnd); @Deprecated static MutableRoaringBitmap and(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final int rangeStart, final int rangeEnd); static MutableRoaringBitmap and(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static int andCardinality(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static int xorCardinality(final ImmutableRoaringBitmap x1,
                                   final ImmutableRoaringBitmap x2); static int andNotCardinality(final ImmutableRoaringBitmap x1,
                                      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2, long rangeStart, long rangeEnd); @Deprecated static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
                                              final ImmutableRoaringBitmap x2,
                                              final int rangeStart, final int rangeEnd); static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap orNot(
          final ImmutableRoaringBitmap x1, final ImmutableRoaringBitmap x2, long rangeEnd); static ImmutableRoaringBitmap bitmapOf(final int... data); static MutableRoaringBitmap flip(ImmutableRoaringBitmap bm, final long rangeStart,
      final long rangeEnd); @Deprecated static MutableRoaringBitmap flip(ImmutableRoaringBitmap bm,
                                            final int rangeStart, final int rangeEnd); static boolean intersects(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap or(ImmutableRoaringBitmap... bitmaps); static MutableRoaringBitmap or(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap or(Iterator<? extends ImmutableRoaringBitmap> bitmaps); static MutableRoaringBitmap or(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final long rangeStart, final long rangeEnd); @Deprecated static MutableRoaringBitmap or(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
          final int rangeStart, final int rangeEnd); static int orCardinality(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap xor(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final long rangeStart, final long rangeEnd); @Deprecated static MutableRoaringBitmap xor(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
          final int rangeStart, final int rangeEnd); static MutableRoaringBitmap xor(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); @Override ImmutableRoaringBitmap clone(); @Override boolean contains(final int x); boolean contains(long minimum, long supremum); boolean contains(ImmutableRoaringBitmap subset); @Override boolean equals(Object o); boolean isHammingSimilar(ImmutableRoaringBitmap other, int tolerance); boolean intersects(long minimum, long supremum); @Override long getLongCardinality(); @Override int getCardinality(); @Override void forEach(IntConsumer ic); MappeableContainerPointer getContainerPointer(); @Override PeekableIntIterator getIntIterator(); @Override IntIterator getReverseIntIterator(); @Override BatchIterator getBatchIterator(); @Override long getLongSizeInBytes(); @Override int getSizeInBytes(); @Override int hashCode(); boolean hasRunCompression(); @Override boolean isEmpty(); @Override Iterator<Integer> iterator(); @Override MutableRoaringBitmap limit(int maxcardinality); @Override long rankLong(int x); @Override long rangeCardinality(long start, long end); @Override int rank(int x); @Override int select(int j); @Override int first(); @Override int last(); @Override long nextValue(int fromValue); @Override long previousValue(int fromValue); @Override long nextAbsentValue(int fromValue); @Override long previousAbsentValue(int fromValue); @Override void serialize(DataOutput out); @Override void serialize(ByteBuffer buffer); @Override int serializedSizeInBytes(); @Override int[] toArray(); MutableRoaringBitmap toMutableRoaringBitmap(); RoaringBitmap toRoaringBitmap(); @Override String toString(); }
ImmutableRoaringBitmap implements Iterable<Integer>, Cloneable, ImmutableBitmapDataProvider { @Override public boolean contains(final int x) { final char hb = highbits(x); int index = highLowContainer.getContainerIndex(hb); return index >= 0 && highLowContainer.containsForContainerAtIndex(index, lowbits(x)); } protected  ImmutableRoaringBitmap();  ImmutableRoaringBitmap(final ByteBuffer b); static MutableRoaringBitmap and(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final long rangeStart, final long rangeEnd); @Deprecated static MutableRoaringBitmap and(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final int rangeStart, final int rangeEnd); static MutableRoaringBitmap and(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static int andCardinality(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static int xorCardinality(final ImmutableRoaringBitmap x1,
                                   final ImmutableRoaringBitmap x2); static int andNotCardinality(final ImmutableRoaringBitmap x1,
                                      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2, long rangeStart, long rangeEnd); @Deprecated static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
                                              final ImmutableRoaringBitmap x2,
                                              final int rangeStart, final int rangeEnd); static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap orNot(
          final ImmutableRoaringBitmap x1, final ImmutableRoaringBitmap x2, long rangeEnd); static ImmutableRoaringBitmap bitmapOf(final int... data); static MutableRoaringBitmap flip(ImmutableRoaringBitmap bm, final long rangeStart,
      final long rangeEnd); @Deprecated static MutableRoaringBitmap flip(ImmutableRoaringBitmap bm,
                                            final int rangeStart, final int rangeEnd); static boolean intersects(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap or(ImmutableRoaringBitmap... bitmaps); static MutableRoaringBitmap or(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap or(Iterator<? extends ImmutableRoaringBitmap> bitmaps); static MutableRoaringBitmap or(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final long rangeStart, final long rangeEnd); @Deprecated static MutableRoaringBitmap or(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
          final int rangeStart, final int rangeEnd); static int orCardinality(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); static MutableRoaringBitmap xor(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
      final long rangeStart, final long rangeEnd); @Deprecated static MutableRoaringBitmap xor(final Iterator<? extends ImmutableRoaringBitmap> bitmaps,
          final int rangeStart, final int rangeEnd); static MutableRoaringBitmap xor(final ImmutableRoaringBitmap x1,
      final ImmutableRoaringBitmap x2); @Override ImmutableRoaringBitmap clone(); @Override boolean contains(final int x); boolean contains(long minimum, long supremum); boolean contains(ImmutableRoaringBitmap subset); @Override boolean equals(Object o); boolean isHammingSimilar(ImmutableRoaringBitmap other, int tolerance); boolean intersects(long minimum, long supremum); @Override long getLongCardinality(); @Override int getCardinality(); @Override void forEach(IntConsumer ic); MappeableContainerPointer getContainerPointer(); @Override PeekableIntIterator getIntIterator(); @Override IntIterator getReverseIntIterator(); @Override BatchIterator getBatchIterator(); @Override long getLongSizeInBytes(); @Override int getSizeInBytes(); @Override int hashCode(); boolean hasRunCompression(); @Override boolean isEmpty(); @Override Iterator<Integer> iterator(); @Override MutableRoaringBitmap limit(int maxcardinality); @Override long rankLong(int x); @Override long rangeCardinality(long start, long end); @Override int rank(int x); @Override int select(int j); @Override int first(); @Override int last(); @Override long nextValue(int fromValue); @Override long previousValue(int fromValue); @Override long nextAbsentValue(int fromValue); @Override long previousAbsentValue(int fromValue); @Override void serialize(DataOutput out); @Override void serialize(ByteBuffer buffer); @Override int serializedSizeInBytes(); @Override int[] toArray(); MutableRoaringBitmap toMutableRoaringBitmap(); RoaringBitmap toRoaringBitmap(); @Override String toString();  }