// Path: src/main/java/org/rakam/cache/hazelcast/hyperloglog/HyperLogLogBackupAwareOperation.java
// public abstract class HyperLogLogBackupAwareOperation extends HyperLogLogBaseOperation implements BackupAwareOperation, BackupOperation {
// 
//     protected boolean shouldBackup = true;
// 
//     public HyperLogLogBackupAwareOperation() {
//     }
// 
//     public HyperLogLogBackupAwareOperation(String name) {
//         super(name);
//     }
// 
//     @Override
//     public boolean shouldBackup() {
//         return shouldBackup;
//     }
// 
//     @Override
//     public int getSyncBackupCount() {
//         return 1;
//     }
// 
//     @Override
//     public int getAsyncBackupCount() {
//         return 0;
//     }
// }
// 
// Path: src/main/java/org/rakam/util/HLLWrapper.java
// public class HLLWrapper {
//     final private static int SEED = 123456;
//     private HLL hll;
// 
//     public HLLWrapper() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// 
//     public HLLWrapper(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public long cardinality() {
//         return hll.cardinality();
//     }
// 
//     public void union(HLLWrapper hll) {
//         this.hll.union(hll.hll);
//     }
// 
//     public void addAll(Collection<String> coll) {
//         for (String a : coll) {
//             byte[] s = a.getBytes();
//             hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//         }
//     }
// 
//     public void add(String obj) {
//         if (obj == null)
//             throw new IllegalArgumentException();
//         byte[] s = obj.getBytes();
// 
//         hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//     }
// 
//     public void set(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public byte[] bytes() {
//         return hll.toBytes();
//     }
// 
//     public void reset() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// }


import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.spi.Operation;
import org.rakam.cache.hazelcast.hyperloglog.HyperLogLogBackupAwareOperation;
import org.rakam.util.HLLWrapper;
import java.io.IOException;
package org.rakam.cache.hazelcast.hyperloglog.operations;

/**
 * Created by buremba on 10/07/14.
 */



public class UnionOperation extends HyperLogLogBackupAwareOperation {

    private HLLWrapper hll;

    public UnionOperation() {
    }

    public UnionOperation(String name, HLLWrapper hll) {
        super(name);
        this.hll = hll;
    }

    @Override
// Path: src/main/java/org/rakam/cache/hazelcast/hyperloglog/HyperLogLogBackupAwareOperation.java
// public abstract class HyperLogLogBackupAwareOperation extends HyperLogLogBaseOperation implements BackupAwareOperation, BackupOperation {
// 
//     protected boolean shouldBackup = true;
// 
//     public HyperLogLogBackupAwareOperation() {
//     }
// 
//     public HyperLogLogBackupAwareOperation(String name) {
//         super(name);
//     }
// 
//     @Override
//     public boolean shouldBackup() {
//         return shouldBackup;
//     }
// 
//     @Override
//     public int getSyncBackupCount() {
//         return 1;
//     }
// 
//     @Override
//     public int getAsyncBackupCount() {
//         return 0;
//     }
// }
// 
// Path: src/main/java/org/rakam/util/HLLWrapper.java
// public class HLLWrapper {
//     final private static int SEED = 123456;
//     private HLL hll;
// 
//     public HLLWrapper() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// 
//     public HLLWrapper(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public long cardinality() {
//         return hll.cardinality();
//     }
// 
//     public void union(HLLWrapper hll) {
//         this.hll.union(hll.hll);
//     }
// 
//     public void addAll(Collection<String> coll) {
//         for (String a : coll) {
//             byte[] s = a.getBytes();
//             hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//         }
//     }
// 
//     public void add(String obj) {
//         if (obj == null)
//             throw new IllegalArgumentException();
//         byte[] s = obj.getBytes();
// 
//         hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//     }
// 
//     public void set(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public byte[] bytes() {
//         return hll.toBytes();
//     }
// 
//     public void reset() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// }


// Path: src/main/java/org/rakam/cache/hazelcast/hyperloglog/operations/UnionOperation.java
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.spi.Operation;
import org.rakam.cache.hazelcast.hyperloglog.HyperLogLogBackupAwareOperation;
import org.rakam.util.HLLWrapper;
import java.io.IOException;

package org.rakam.cache.hazelcast.hyperloglog.operations;

/**
 * Created by buremba on 10/07/14.
 */



public class UnionOperation extends HyperLogLogBackupAwareOperation {

    private HLLWrapper hll;

    public UnionOperation() {
    }

    public UnionOperation(String name, HLLWrapper hll) {
        super(name);
        this.hll = hll;
    }

    @Override
    public void run() throws Exception {