DirectArrayOfDoublesCompactSketch(final long[] keys, final double[] values, final long theta, final boolean isEmpty, final int numValues, final short seedHash, final WritableMemory dstMem) { super(numValues); checkIfEnoughMemory(dstMem, values.length, numValues); mem_ = dstMem; dstMem.putByte(PREAMBLE_LONGS_BYTE, (byte) 1); dstMem.putByte(SERIAL_VERSION_BYTE, serialVersionUID); dstMem.putByte(FAMILY_ID_BYTE, (byte) Family.TUPLE.getID()); dstMem.putByte(SKETCH_TYPE_BYTE, (byte) SerializerDeserializer.SketchType.ArrayOfDoublesCompactSketch.ordinal()); final boolean isBigEndian = ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN); isEmpty_ = isEmpty; final int count = keys.length; dstMem.putByte(FLAGS_BYTE, (byte) ( (isBigEndian ? 1 << Flags.IS_BIG_ENDIAN.ordinal() : 0) | (isEmpty_ ? 1 << Flags.IS_EMPTY.ordinal() : 0) | (count > 0 ? 1 << Flags.HAS_ENTRIES.ordinal() : 0) )); dstMem.putByte(NUM_VALUES_BYTE, (byte) numValues_); dstMem.putShort(SEED_HASH_SHORT, seedHash); theta_ = theta; dstMem.putLong(THETA_LONG, theta_); if (count > 0) { dstMem.putInt(RETAINED_ENTRIES_INT, count); dstMem.putLongArray(ENTRIES_START, keys, 0, count); dstMem.putDoubleArray( ENTRIES_START + ((long) SIZE_OF_KEY_BYTES * count), values, 0, values.length); } }
final long theta, final WritableMemory dstMem) { super(sketch.getNumValues()); checkIfEnoughMemory(dstMem, sketch.getRetainedEntries(), sketch.getNumValues()); mem_ = dstMem; dstMem.putByte(PREAMBLE_LONGS_BYTE, (byte) 1);
DirectArrayOfDoublesCompactSketch(final long[] keys, final double[] values, final long theta, final boolean isEmpty, final int numValues, final short seedHash, final WritableMemory dstMem) { super(numValues); checkIfEnoughMemory(dstMem, values.length, numValues); mem_ = dstMem; dstMem.putByte(PREAMBLE_LONGS_BYTE, (byte) 1); dstMem.putByte(SERIAL_VERSION_BYTE, serialVersionUID); dstMem.putByte(FAMILY_ID_BYTE, (byte) Family.TUPLE.getID()); dstMem.putByte(SKETCH_TYPE_BYTE, (byte) SerializerDeserializer.SketchType.ArrayOfDoublesCompactSketch.ordinal()); final boolean isBigEndian = ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN); isEmpty_ = isEmpty; final int count = keys.length; dstMem.putByte(FLAGS_BYTE, (byte) ( (isBigEndian ? 1 << Flags.IS_BIG_ENDIAN.ordinal() : 0) | (isEmpty_ ? 1 << Flags.IS_EMPTY.ordinal() : 0) | (count > 0 ? 1 << Flags.HAS_ENTRIES.ordinal() : 0) )); dstMem.putByte(NUM_VALUES_BYTE, (byte) numValues_); dstMem.putShort(SEED_HASH_SHORT, seedHash); theta_ = theta; dstMem.putLong(THETA_LONG, theta_); if (count > 0) { dstMem.putInt(RETAINED_ENTRIES_INT, count); dstMem.putLongArray(ENTRIES_START, keys, 0, count); dstMem.putDoubleArray(ENTRIES_START + SIZE_OF_KEY_BYTES * count, values, 0, values.length); } }
final long theta, final WritableMemory dstMem) { super(sketch.getNumValues()); checkIfEnoughMemory(dstMem, sketch.getRetainedEntries(), sketch.getNumValues()); mem_ = dstMem; dstMem.putByte(PREAMBLE_LONGS_BYTE, (byte) 1);