public class LinearCounting extends Object implements ICardinality
| Modifier and Type | Class and Description |
|---|---|
static class |
LinearCounting.Builder |
protected static class |
LinearCounting.LinearCountingMergeException |
| Modifier and Type | Field and Description |
|---|---|
protected int |
count
Number of bits left unset in the map
|
protected int |
length
Size of the map in bits
|
protected byte[] |
map
Bitmap
Hashed stream elements are mapped to bits in this array
|
| Constructor and Description |
|---|
LinearCounting(byte[] map) |
LinearCounting(int size) |
| Modifier and Type | Method and Description |
|---|---|
long |
cardinality() |
protected int |
computeCount() |
byte[] |
getBytes() |
int |
getCount() |
double |
getUtilization() |
boolean |
isSaturated() |
protected String |
mapAsBitString()
For debug purposes
|
ICardinality |
merge(ICardinality... estimators)
Merges estimators to produce a new estimator for the combined streams
of this estimator and those passed as arguments.
|
static LinearCounting |
mergeEstimators(LinearCounting... estimators)
Merges estimators to produce an estimator for their combined streams
|
boolean |
offer(Object o) |
boolean |
offerHashed(int hashedInt)
Offer the value as a hashed long value
|
boolean |
offerHashed(long hashedLong)
Offer the value as a hashed long value
|
int |
sizeof() |
protected byte[] map
protected final int length
protected int count
public LinearCounting(int size)
size - of bit array in bytespublic LinearCounting(byte[] map)
public long cardinality()
cardinality in interface ICardinalitypublic byte[] getBytes()
getBytes in interface ICardinalitypublic boolean offerHashed(long hashedLong)
ICardinalityofferHashed in interface ICardinalityhashedLong - - the hash of the item to offer to the estimatorpublic boolean offerHashed(int hashedInt)
ICardinalityofferHashed in interface ICardinalityhashedInt - - the hash of the item to offer to the estimatorpublic boolean offer(Object o)
offer in interface ICardinalityo - stream elementpublic int sizeof()
sizeof in interface ICardinalityprotected int computeCount()
public double getUtilization()
public int getCount()
public boolean isSaturated()
protected String mapAsBitString()
public ICardinality merge(ICardinality... estimators) throws LinearCounting.LinearCountingMergeException
ICardinalitymerge in interface ICardinalityestimators - Zero or more compatible estimatorsLinearCounting.LinearCountingMergeException - if estimators are not mergeable (all estimators must be instances of LinearCounting of the same size)public static LinearCounting mergeEstimators(LinearCounting... estimators) throws LinearCounting.LinearCountingMergeException
estimators - LinearCounting.LinearCountingMergeException - if estimators are not mergeable (all estimators must be the same size)Copyright © 2014. All Rights Reserved.