Class DoubleSummary
- java.lang.Object
-
- org.apache.datasketches.tuple.adouble.DoubleSummary
-
- All Implemented Interfaces:
Summary
,UpdatableSummary<Double>
public final class DoubleSummary extends Object implements UpdatableSummary<Double>
Summary for generic tuple sketches of type Double. This summary keeps a double value. On update a predefined operation is performed depending on the mode. Supported modes: Sum, Min, Max, AlwaysOne, Increment. The default mode is Sum.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DoubleSummary.Mode
The aggregation modes for this Summary
-
Constructor Summary
Constructors Constructor Description DoubleSummary(DoubleSummary.Mode mode)
Creates an instance of DoubleSummary with a given mode.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleSummary
copy()
Deep copy.static DeserializeResult<DoubleSummary>
fromMemory(org.apache.datasketches.memory.Memory mem)
Creates an instance of the DoubleSummary given a serialized representationdouble
getValue()
byte[]
toByteArray()
This is to serialize a Summary instance to a byte array.DoubleSummary
update(Double value)
This is to provide a method of updating summaries.
-
-
-
Constructor Detail
-
DoubleSummary
public DoubleSummary(DoubleSummary.Mode mode)
Creates an instance of DoubleSummary with a given mode.- Parameters:
mode
- update mode
-
-
Method Detail
-
update
public DoubleSummary update(Double value)
Description copied from interface:UpdatableSummary
This is to provide a method of updating summaries. This is primarily used internally.- Specified by:
update
in interfaceUpdatableSummary<Double>
- Parameters:
value
- update value- Returns:
- this
-
copy
public DoubleSummary copy()
Description copied from interface:Summary
Deep copy.Caution: This must implement a deep copy.
-
getValue
public double getValue()
- Returns:
- current value of the DoubleSummary
-
toByteArray
public byte[] toByteArray()
Description copied from interface:Summary
This is to serialize a Summary instance to a byte array.The user should encode in the byte array its total size, which is used during deserialization, especially if the Summary has variable sized elements.
- Specified by:
toByteArray
in interfaceSummary
- Returns:
- serialized representation of the Summary
-
fromMemory
public static DeserializeResult<DoubleSummary> fromMemory(org.apache.datasketches.memory.Memory mem)
Creates an instance of the DoubleSummary given a serialized representation- Parameters:
mem
- Memory object with serialized DoubleSummary- Returns:
- DeserializedResult object, which contains a DoubleSummary object and number of bytes read from the Memory
-
-