Skip to content

Commit 6fa14f7

Browse files
committed
Add new HLL constructor. Bump to 1.3.0. Fixes #3
- Add an HLL(log2m, regwidth) constructor that defaults to automatic EXPLICIT settings and using SPARSE.
1 parent 258785a commit 6fa14f7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<packaging>jar</packaging>
88
<description>HyperLogLog: approximate distinct value counting algoritm</description>
99
<url>https://github.com/aggregateknowledge/java-hll</url>
10-
<version>1.2.1</version>
10+
<version>1.3.0</version>
1111
<name>HyperLogLog in Java</name>
1212
<licenses>
1313
<license>

src/main/java/net/agkn/hll/HLL.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,23 @@ public HLL(final int log2m, final int regwidth, final int expthresh, final boole
233233
initializeStorage(type);
234234
}
235235

236+
/**
237+
* Construct an empty HLL with the given {@code log2m} and {@code regwidth}.<p/>
238+
*
239+
* This is equivalent to calling <code>HLL(log2m, regwidth, -1, true, HLLType.EMPTY)</code>.
240+
*
241+
* @param log2m log-base-2 of the number of registers used in the HyperLogLog
242+
* algorithm. Must be at least 4 and at most 30.
243+
* @param regwidth number of bits used per register in the HyperLogLog
244+
* algorithm. Must be at least 1 and at most 8.
245+
*
246+
* @see #HLL(int, int, int, boolean, HLLType)
247+
*/
248+
public HLL(final int log2m, final int regwidth) {
249+
this(log2m, regwidth, -1, true, HLLType.EMPTY);
250+
}
251+
252+
// -------------------------------------------------------------------------
236253
/**
237254
* Convenience constructor for testing. Assumes that both {@link HLLType#EXPLICIT}
238255
* and {@link HLLType#SPARSE} representations should be enabled.

0 commit comments

Comments
 (0)