use of org.roaringbitmap.RoaringBitmap in project Gaffer by gchq.
the class RoaringBitmapSerialiser method deserialise.
@Override
public Object deserialise(final byte[] bytes) throws SerialisationException {
RoaringBitmap value = new RoaringBitmap();
byte[] convertedBytes = RoaringBitmapUtils.upConvertSerialisedForm(bytes);
ByteArrayInputStream byteIn = new ByteArrayInputStream(convertedBytes);
DataInputStream in = new DataInputStream(byteIn);
try {
value.deserialize(in);
} catch (final IOException e) {
throw new SerialisationException(e.getMessage(), e);
}
return value;
}
use of org.roaringbitmap.RoaringBitmap in project Gaffer by gchq.
the class RoaringBitmapAggregatorTest method singleInputBitmapGeneratesIdenticalOutputBitmap.
@Test
public void singleInputBitmapGeneratesIdenticalOutputBitmap() {
RoaringBitmap inputBitmap = new RoaringBitmap();
int input1 = 123298333;
int input2 = 342903339;
inputBitmap.add(input1);
inputBitmap.add(input2);
RoaringBitmapAggregator roaringBitmapAggregator = new RoaringBitmapAggregator();
roaringBitmapAggregator.init();
roaringBitmapAggregator._aggregate(inputBitmap);
assertEquals(2, ((RoaringBitmap) roaringBitmapAggregator.state()[0]).getCardinality());
assertEquals(inputBitmap, roaringBitmapAggregator.state()[0]);
}
Aggregations