Skip to content
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Serializable implementation for HLL #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hll.iml
4 changes: 3 additions & 1 deletion src/main/java/net/agkn/hll/HLL.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* limitations under the License.
*/

import java.io.Serializable;
import java.util.Arrays;

import it.unimi.dsi.fastutil.ints.Int2ByteOpenHashMap;
Expand Down Expand Up @@ -59,7 +60,7 @@
*
* @author timon
*/
public class HLL implements Cloneable {
public class HLL implements Cloneable, Serializable {
// minimum and maximum values for the log-base-2 of the number of registers
// in the HLL
public static final int MINIMUM_LOG2M_PARAM = 4;
Expand All @@ -75,6 +76,7 @@ public class HLL implements Cloneable {
public static final int MINIMUM_EXPTHRESH_PARAM = -1;
public static final int MAXIMUM_EXPTHRESH_PARAM = 18;
public static final int MAXIMUM_EXPLICIT_THRESHOLD = (1 << (MAXIMUM_EXPTHRESH_PARAM - 1)/*per storage spec*/);
private static final long serialVersionUID = -848939697379806659L;

// ************************************************************************
// Storage
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/agkn/hll/HLLType.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
* limitations under the License.
*/

import java.io.Serializable;

/**
* The types of algorithm/data structure that {@link HLL} can utilize. For more
* information, see the Javadoc for {@link HLL}.
*/
public enum HLLType {
public enum HLLType implements Serializable {
EMPTY,
EXPLICIT,
SPARSE,
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/agkn/hll/util/BitVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@

import net.agkn.hll.serialization.IWordSerializer;

import java.io.Serializable;

/**
* A vector (array) of bits that is accessed in units ("registers") of <code>width</code>
* bits which are stored as 64bit "words" (<code>long</code>s). In this context
* a register is at most 64bits.
*
* @author rgrzywinski
*/
public class BitVector implements Cloneable {
public class BitVector implements Cloneable, Serializable {
// NOTE: in this context, a word is 64bits

// rather than doing division to determine how a bit index fits into 64bit
Expand All @@ -40,6 +42,7 @@ public class BitVector implements Cloneable {

// ========================================================================
public static final int BYTES_PER_WORD = 8/*8 bytes in a long*/;
private static final long serialVersionUID = -2191980917150692709L;

// ************************************************************************
// 64bit words
Expand Down