Class IntegerTupleSketch


public class IntegerTupleSketch extends UpdatableTupleSketch<Integer, IntegerSummary>
Extends UpdatableTupleSketch<Integer, IntegerSummary>
Author:
Lee Rhodes
  • Constructor Details

    • IntegerTupleSketch

      public IntegerTupleSketch(int lgK, IntegerSummary.Mode mode)
      Constructs this sketch with given lgK.
      Parameters:
      lgK - Log_base2 of Nominal Entries. See Nominal Entries
      mode - The IntegerSummary mode to be used
    • IntegerTupleSketch

      public IntegerTupleSketch(int lgK, int lgResizeFactor, float samplingProbability, IntegerSummary.Mode mode)
      Creates this sketch with the following parameters:
      Parameters:
      lgK - Log_base2 of Nominal Entries.
      lgResizeFactor - log2(resizeFactor) - value from 0 to 3:
      0 - no resizing (max size allocated),
      1 - double internal hash table each time it reaches a threshold
      2 - grow four times
      3 - grow eight times (default)
      
      samplingProbability - See Sampling Probability
      mode - The IntegerSummary mode to be used
    • IntegerTupleSketch

      @Deprecated public IntegerTupleSketch(MemorySegment seg, IntegerSummary.Mode mode)
      Deprecated.
      As of 3.0.0, heapifying an UpdatableTupleSketch is deprecated. This capability will be removed in a future release. Heapifying a CompactTupleSketch is not deprecated.
      Constructs this sketch from a MemorySegment image, which must be from an IntegerTupleSketch, and usually with data.
      Parameters:
      seg - the given MemorySegment
      mode - The IntegerSummary mode to be used
  • Method Details

    • update

      public void update(String key, Integer value)
      Description copied from class: UpdatableTupleSketch
      Updates this sketch with a String key and U value. The value is passed to update() method of the Summary object associated with the key
      Overrides:
      update in class UpdatableTupleSketch<Integer, IntegerSummary>
      Parameters:
      key - The given String key
      value - The given U value
    • update

      public void update(long key, Integer value)
      Description copied from class: UpdatableTupleSketch
      Updates this sketch with a long key and U value. The value is passed to update() method of the Summary object associated with the key
      Overrides:
      update in class UpdatableTupleSketch<Integer, IntegerSummary>
      Parameters:
      key - The given long key
      value - The given U value
    • getRetainedEntries

      public int getRetainedEntries()
      Description copied from class: TupleSketch
      Returns number of retained entries
      Specified by:
      getRetainedEntries in class TupleSketch<S extends Summary>
      Returns:
      number of retained entries
    • getCountLessThanThetaLong

      public int getCountLessThanThetaLong(long thetaLong)
      Description copied from class: TupleSketch
      Gets the number of hash values less than the given theta expressed as a long.
      Specified by:
      getCountLessThanThetaLong in class TupleSketch<S extends Summary>
      Parameters:
      thetaLong - the given theta as a long in the range (zero, Long.MAX_VALUE].
      Returns:
      the number of hash values less than the given thetaLong.
    • getNominalEntries

      public int getNominalEntries()
      Get configured nominal number of entries
      Returns:
      nominal number of entries
    • getLgK

      public int getLgK()
      Get log_base2 of Nominal Entries
      Returns:
      log_base2 of Nominal Entries
    • getSamplingProbability

      public float getSamplingProbability()
      Get configured sampling probability
      Returns:
      sampling probability
    • getCurrentCapacity

      public int getCurrentCapacity()
      Get current capacity
      Returns:
      current capacity
    • getResizeFactor

      public ResizeFactor getResizeFactor()
      Get configured resize factor
      Returns:
      resize factor
    • trim

      public void trim()
      Rebuilds reducing the actual number of entries to the nominal number of entries if needed
    • reset

      public void reset()
      Resets this sketch an empty state.
    • compact

      Converts the current state of the sketch into a compact sketch
      Specified by:
      compact in class TupleSketch<S extends Summary>
      Returns:
      compact sketch
    • toByteArray

      @Deprecated public byte[] toByteArray()
      Deprecated.
      As of 3.0.0, serializing an UpdatableTupleSketch is deprecated. This capability will be removed in a future release. Serializing a CompactTupleSketch is not deprecated.
      This serializes an UpdatableTupleSketch (QuickSelectSketch).
      Specified by:
      toByteArray in class TupleSketch<S extends Summary>
      Returns:
      serialized representation of an UpdatableTupleSketch (QuickSelectSketch).
    • iterator

      public TupleSketchIterator<IntegerSummary> iterator()
      Description copied from class: TupleSketch
      Returns a SketchIterator
      Specified by:
      iterator in class TupleSketch<S extends Summary>
      Returns:
      a SketchIterator