T - type of data in the stream to be summarizedpublic class StreamSummary<T> extends Object implements ITopK<T>, Externalizable
| Modifier and Type | Class and Description |
|---|---|
protected class |
StreamSummary.Bucket |
| Modifier and Type | Field and Description |
|---|---|
protected DoublyLinkedList<StreamSummary.Bucket> |
bucketList |
protected int |
capacity |
| Constructor and Description |
|---|
StreamSummary()
For de-serialization
|
StreamSummary(byte[] bytes)
For de-serialization
|
StreamSummary(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
fromBytes(byte[] bytes) |
int |
getCapacity() |
protected void |
incrementCounter(ListNode2<Counter<T>> counterNode,
int incrementCount) |
boolean |
offer(T item)
Algorithm: Space-Saving
|
boolean |
offer(T item,
int incrementCount)
Algorithm: Space-Saving
|
Pair<Boolean,T> |
offerReturnAll(T item,
int incrementCount) |
T |
offerReturnDropped(T item,
int incrementCount) |
List<T> |
peek(int k) |
void |
readExternal(ObjectInput in) |
int |
size() |
byte[] |
toBytes() |
List<Counter<T>> |
topK(int k) |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected int capacity
protected DoublyLinkedList<StreamSummary.Bucket> bucketList
public StreamSummary(int capacity)
capacity - maximum size (larger capacities improve accuracy)public StreamSummary()
public StreamSummary(byte[] bytes)
throws IOException,
ClassNotFoundException
bytes - IOExceptionClassNotFoundExceptionpublic int getCapacity()
public boolean offer(T item)
public boolean offer(T item, int incrementCount)
public T offerReturnDropped(T item, int incrementCount)
item - stream element (e)public Pair<Boolean,T> offerReturnAll(T item, int incrementCount)
item - stream element (e)protected void incrementCounter(ListNode2<Counter<T>> counterNode, int incrementCount)
public int size()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void fromBytes(byte[] bytes)
throws IOException,
ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic byte[] toBytes()
throws IOException
IOExceptionCopyright © 2014. All Rights Reserved.