Class IntegerSummary
java.lang.Object
org.apache.datasketches.tuple.aninteger.IntegerSummary
- All Implemented Interfaces:
Summary, UpdatableSummary<Integer>
Summary for generic tuple sketches of type Integer.
This summary keeps an Integer 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 ClassesModifier and TypeClassDescriptionstatic enumThe aggregation modes for this Summary -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of IntegerSummary with a given mode. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Deep copy.static DeserializeResult<IntegerSummary> Creates an instance of the IntegerSummary given a serialized representationintgetValue()Returns the current value of the IntegerSummarybyte[]This is to serialize a Summary instance to a byte array.This is to provide a method of updating summaries.
-
Constructor Details
-
IntegerSummary
Creates an instance of IntegerSummary with a given mode.- Parameters:
mode- update mode. This should not be called by a user.
-
-
Method Details
-
update
Description copied from interface:UpdatableSummaryThis is to provide a method of updating summaries. This is primarily used internally.- Specified by:
updatein interfaceUpdatableSummary<Integer>- Parameters:
value- update value- Returns:
- this
-
copy
Description copied from interface:SummaryDeep copy.Caution: This must implement a deep copy.
-
getValue
public int getValue()Returns the current value of the IntegerSummary- Returns:
- current value of the IntegerSummary
-
toByteArray
public byte[] toByteArray()Description copied from interface:SummaryThis 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:
toByteArrayin interfaceSummary- Returns:
- serialized representation of the Summary
-
fromMemorySegment
Creates an instance of the IntegerSummary given a serialized representation- Parameters:
seg- MemorySegment object with serialized IntegerSummary- Returns:
- DeserializedResult object, which contains a IntegerSummary object and number of bytes read from the MemorySegment
-