LinearCounting implements IRichCardinality { @Override public int sizeof() { return map.length; } LinearCounting(int size);  LinearCounting(byte[] map); @Override long cardinality(); @Override byte[] getBytes(); @Override boolean offerHashed(long hashedLong); @Override boolean offerHashed(int hashedInt); @Override boolean offer(Object o); @Override int sizeof(); int computeCount(); double getUtilization(); int getCount(); boolean isSaturated(); @Override IRichCardinality merge(IRichCardinality... estimators); static LinearCounting mergeEstimators(LinearCounting... estimators);  }
@Test public void testBuilder() { assertEquals(630, Builder.onePercentError(1).sizeof()); assertEquals(630, Builder.onePercentError(99).sizeof()); assertEquals(630, Builder.onePercentError(100).sizeof()); assertEquals(630, Builder.onePercentError(101).sizeof()); assertEquals(759, Builder.onePercentError(3375).sizeof()); assertEquals(995, Builder.onePercentError(9999).sizeof()); assertEquals(995, Builder.onePercentError(10000).sizeof()); assertEquals(996, Builder.onePercentError(10001).sizeof()); assertEquals(7501, Builder.onePercentError(305028).sizeof()); assertEquals(19272, Builder.onePercentError(1000000).sizeof()); assertEquals(23027, Builder.onePercentError(1250000).sizeof()); assertEquals(74962, Builder.onePercentError(5000000).sizeof()); assertEquals(81372, Builder.onePercentError(5500000).sizeof()); assertEquals(131030, Builder.onePercentError(9500000).sizeof()); assertEquals(137073, Builder.onePercentError(10000000).sizeof()); assertEquals(137073, Builder.onePercentError(10000001).sizeof()); assertEquals(355055, Builder.onePercentError(30000000).sizeof()); assertEquals(573038, Builder.onePercentError(50000000).sizeof()); assertEquals(822207, Builder.onePercentError(75000000).sizeof()); assertEquals(1071377, Builder.onePercentError(100000000).sizeof()); assertEquals(1167722, Builder.onePercentError(110000000).sizeof()); assertEquals(1264067, Builder.onePercentError(120000000).sizeof()); assertEquals(2500000, Builder.onePercentError(240000000).sizeof()); }
@Test public void testArbitraryStdErrorSize() { assertEquals(630, Builder.withError(0.01, 100).sizeof()); assertEquals(759, Builder.withError(0.01, 3375).sizeof()); assertEquals(10, Builder.withError(0.1, 100).sizeof()); assertEquals(34, Builder.withError(0.1, 1000).sizeof()); assertEquals(214, Builder.withError(0.1, 10000).sizeof()); assertEquals(1593, Builder.withError(0.1, 100000).sizeof()); assertEquals(12610, Builder.withError(0.1, 1000000).sizeof()); assertEquals(103977, Builder.withError(0.1, 10000000).sizeof()); assertEquals(882720, Builder.withError(0.1, 100000000).sizeof()); }