MCPcopy Index your code
hub / github.com/aggregateknowledge/java-hll / cardinality

Method cardinality

src/main/java/net/agkn/hll/HLL.java:511–524  ·  view source on GitHub ↗

Computes the cardinality of the HLL. @return the cardinality of HLL. This will never be negative.

()

Source from the content-addressed store, hash-verified

509 * @return the cardinality of HLL. This will never be negative.
510 */
511 public long cardinality() {
512 switch(type) {
513 case EMPTY:
514 return 0/*by definition*/;
515 case EXPLICIT:
516 return explicitStorage.size();
517 case SPARSE:
518 return (long)Math.ceil(sparseProbabilisticAlgorithmCardinality());
519 case FULL:
520 return (long)Math.ceil(fullProbabilisticAlgorithmCardinality());
521 default:
522 throw new RuntimeException("Unsupported HLL type " + type);
523 }
524 }
525
526 // ------------------------------------------------------------------------
527 // Cardinality helpers

Callers 14

smallRangeSmokeTestMethod · 0.95
normalRangeSmokeTestMethod · 0.95
largeRangeSmokeTestMethod · 0.95
unionTestMethod · 0.95
clearTestMethod · 0.95
smallRangeSmokeTestMethod · 0.95
normalRangeSmokeTestMethod · 0.95
largeRangeSmokeTestMethod · 0.95
addBasicTestMethod · 0.95
unionTestMethod · 0.95
clearTestMethod · 0.95
randomValuesTestMethod · 0.95

Tested by 14

smallRangeSmokeTestMethod · 0.76
normalRangeSmokeTestMethod · 0.76
largeRangeSmokeTestMethod · 0.76
unionTestMethod · 0.76
clearTestMethod · 0.76
smallRangeSmokeTestMethod · 0.76
normalRangeSmokeTestMethod · 0.76
largeRangeSmokeTestMethod · 0.76
addBasicTestMethod · 0.76
unionTestMethod · 0.76
clearTestMethod · 0.76
randomValuesTestMethod · 0.76