org.apache.datasketches.tuple.aninteger

## Class IntegerSummary

- java.lang.Object
- - org.apache.datasketches.tuple.aninteger.IntegerSummary

All Implemented Interfaces:
  Summary, UpdatableSummary<Integer>

    public class IntegerSummary
    extends Object
    implements 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 Classes
`static class` `IntegerSummary.Mode` The aggregation modes for this Summary

### Constructor Summary

Constructors
Constructor and Description
`IntegerSummary(IntegerSummary.Mode mode)` Creates an instance of IntegerSummary with a given mode.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`IntegerSummary` `copy()` Deep copy.
`static DeserializeResult<IntegerSummary>` `fromMemory(org.apache.datasketches.memory.Memory mem)` Creates an instance of the IntegerSummary given a serialized representation
`int` `getValue()`
`byte[]` `toByteArray()` This is to serialize a Summary instance to a byte array.
`IntegerSummary` `update(Integer value)` This is to provide a method of updating summaries.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### IntegerSummary

    public IntegerSummary(IntegerSummary.Mode mode)

Creates an instance of IntegerSummary with a given mode.

Parameters:
  `mode` - update mode. This should not be called by a user.

### Method Detail

#### update

    public IntegerSummary update(Integer value)

Description copied from interface: `UpdatableSummary`
This is to provide a method of updating summaries. This is primarily used internally.

Specified by:
  `update` in interface `UpdatableSummary<Integer>`
Parameters:
  `value` - update value
Returns:
  this

#### copy

    public IntegerSummary copy()

Description copied from interface: `Summary`
Deep copy.

Caution: This must implement a deep copy.

Specified by:
  `copy` in interface `Summary`
Returns:
  deep copy of the Summary

#### getValue

    public int getValue()

Returns:
  current value of the IntegerSummary

#### 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 interface `Summary`
Returns:
  serialized representation of the Summary

#### fromMemory

    public static DeserializeResult<IntegerSummary> fromMemory(org.apache.datasketches.memory.Memory mem)

Creates an instance of the IntegerSummary given a serialized representation

Parameters:
  `mem` - Memory object with serialized IntegerSummary
Returns:
  DeserializedResult object, which contains a IntegerSummary object and number of bytes read from the Memory