E - is the type of objects in the set.public class HyperLogLog<E> extends Object implements Serializable
| Constructor and Description |
|---|
HyperLogLog(double relativeError,
double confidence,
boolean pastCountsEnabled)
Create a new HyperLogLog by specifying the relative error and confidence of answers
being within the error margin.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(E item)
Adds a new item to the array by hashing and increasing the count of relevant buckets
|
void |
clear()
Clears all the counts stored in the data structure.
|
long |
getCardinality() |
long[] |
getConfidenceInterval()
Calculate the confidence interval for the current distinctCount.
|
int |
getHashValue(Object value)
Compute an integer hash value for a given value
|
void |
removeItem(E item)
Removes the given item from the array and restore the distinctCount value by using the previous count.
|
public HyperLogLog(double relativeError,
double confidence,
boolean pastCountsEnabled)
relativeError - is a number in the range (0, 1)confidence - is a value out of 0.65, 0.95, 0.99pastCountsEnabled - is a boolean value to mention whether to keep track of past counts or not.public long getCardinality()
public long[] getConfidenceInterval()
public void addItem(E item)
item - is the item to be insertedpublic void removeItem(E item)
item - is the item to be removedpublic int getHashValue(Object value)
value - to be hashedpublic void clear()
Copyright © 2019 WSO2. All rights reserved.