@Test public void analyseSingleBitmap() { RoaringBitmap rb = new RoaringBitmap(); rb.add(1, 3, 6, 26, 110, 1024); rb.add(70000L, 80000L); for (int i = (5 << 16); i < (6 << 16); i++) { rb.add(i); } BitmapStatistics result = BitmapAnalyser.analyse(rb); BitmapStatistics expected = new BitmapStatistics(new BitmapStatistics.ArrayContainersStats(1, 6), 1, 1); assertEquals(expected, result); }
public static BitmapStatistics analyse(RoaringBitmap r) { int acCount = 0; int acCardinalitySum = 0; int bcCount = 0; int rcCount = 0; ContainerPointer cp = r.getContainerPointer(); while (cp.getContainer() != null) { if (cp.isBitmapContainer()) { bcCount += 1; } else if (cp.isRunContainer()) { rcCount += 1; } else { acCount += 1; acCardinalitySum += cp.getCardinality(); } cp.advance(); } BitmapStatistics.ArrayContainersStats acStats = new BitmapStatistics.ArrayContainersStats(acCount, acCardinalitySum); return new BitmapStatistics(acStats, bcCount, rcCount); }
BitmapAnalyser { public static BitmapStatistics analyse(RoaringBitmap r) { int acCount = 0; int acCardinalitySum = 0; int bcCount = 0; int rcCount = 0; ContainerPointer cp = r.getContainerPointer(); while (cp.getContainer() != null) { if (cp.isBitmapContainer()) { bcCount += 1; } else if (cp.isRunContainer()) { rcCount += 1; } else { acCount += 1; acCardinalitySum += cp.getCardinality(); } cp.advance(); } BitmapStatistics.ArrayContainersStats acStats = new BitmapStatistics.ArrayContainersStats(acCount, acCardinalitySum); return new BitmapStatistics(acStats, bcCount, rcCount); } }
BitmapAnalyser { public static BitmapStatistics analyse(RoaringBitmap r) { int acCount = 0; int acCardinalitySum = 0; int bcCount = 0; int rcCount = 0; ContainerPointer cp = r.getContainerPointer(); while (cp.getContainer() != null) { if (cp.isBitmapContainer()) { bcCount += 1; } else if (cp.isRunContainer()) { rcCount += 1; } else { acCount += 1; acCardinalitySum += cp.getCardinality(); } cp.advance(); } BitmapStatistics.ArrayContainersStats acStats = new BitmapStatistics.ArrayContainersStats(acCount, acCardinalitySum); return new BitmapStatistics(acStats, bcCount, rcCount); }  }
BitmapAnalyser { public static BitmapStatistics analyse(RoaringBitmap r) { int acCount = 0; int acCardinalitySum = 0; int bcCount = 0; int rcCount = 0; ContainerPointer cp = r.getContainerPointer(); while (cp.getContainer() != null) { if (cp.isBitmapContainer()) { bcCount += 1; } else if (cp.isRunContainer()) { rcCount += 1; } else { acCount += 1; acCardinalitySum += cp.getCardinality(); } cp.advance(); } BitmapStatistics.ArrayContainersStats acStats = new BitmapStatistics.ArrayContainersStats(acCount, acCardinalitySum); return new BitmapStatistics(acStats, bcCount, rcCount); }  static BitmapStatistics analyse(RoaringBitmap r); static BitmapStatistics analyse(Collection<? extends RoaringBitmap> bitmaps); }
BitmapAnalyser { public static BitmapStatistics analyse(RoaringBitmap r) { int acCount = 0; int acCardinalitySum = 0; int bcCount = 0; int rcCount = 0; ContainerPointer cp = r.getContainerPointer(); while (cp.getContainer() != null) { if (cp.isBitmapContainer()) { bcCount += 1; } else if (cp.isRunContainer()) { rcCount += 1; } else { acCount += 1; acCardinalitySum += cp.getCardinality(); } cp.advance(); } BitmapStatistics.ArrayContainersStats acStats = new BitmapStatistics.ArrayContainersStats(acCount, acCardinalitySum); return new BitmapStatistics(acStats, bcCount, rcCount); }  static BitmapStatistics analyse(RoaringBitmap r); static BitmapStatistics analyse(Collection<? extends RoaringBitmap> bitmaps);  }