Class IntPgmIndex.IntBuilder

java.lang.Object
com.carrotsearch.hppc.IntPgmIndex.IntBuilder
All Implemented Interfaces:
Accountable, PlaModel.SegmentConsumer
Enclosing class:
IntPgmIndex

public static class IntPgmIndex.IntBuilder extends Object implements PlaModel.SegmentConsumer, Accountable
Builds a IntPgmIndex on a provided sorted list of keys.
  • Field Details

    • keys

      protected IntArrayList keys
    • epsilon

      protected int epsilon
    • epsilonRecursive

      protected int epsilonRecursive
    • plam

      protected PlaModel plam
    • size

      protected int size
    • segmentData

      protected IntArrayList segmentData
    • numSegments

      protected int numSegments
  • Constructor Details

    • IntBuilder

      public IntBuilder()
  • Method Details

    • setSortedKeys

      public IntPgmIndex.IntBuilder setSortedKeys(IntArrayList keys)
      Sets the sorted list of keys to build the index for; duplicate elements are allowed.
    • setSortedKeys

      public IntPgmIndex.IntBuilder setSortedKeys(int[] keys, int length)
      Sets the sorted array of keys to build the index for; duplicate elements are allowed.
    • setEpsilon

      public IntPgmIndex.IntBuilder setEpsilon(int epsilon)
      Sets the epsilon range to use when learning the segments for the list of keys.
    • setEpsilonRecursive

      public IntPgmIndex.IntBuilder setEpsilonRecursive(int epsilonRecursive)
      Sets the recursive epsilon range to use when learning the segments for the segment levels.
    • build

      public IntPgmIndex build()
      Builds the IntPgmIndex; or IntPgmIndex.EMPTY if there are no keys in the list.
    • accept

      public void accept(double firstKey, double slope, long intercept)
      Description copied from interface: PlaModel.SegmentConsumer
      Consumes a new segment. The segment is defined by the epsilon-approximation function fs(k) = k × slope + intercept.
      Specified by:
      accept in interface PlaModel.SegmentConsumer
      Parameters:
      firstKey - The first key of the segment.
      slope - The segment slope.
      intercept - The segment intercept.
    • ramBytesAllocated

      public long ramBytesAllocated()
      Estimates the allocated memory. It does not count the memory for the list of keys, only for the builder itself.
      Specified by:
      ramBytesAllocated in interface Accountable
      Returns:
      Ram allocated in bytes
    • ramBytesUsed

      public long ramBytesUsed()
      Estimates the bytes that are actually used. It does not count the memory for the list of keys, only for the builder itself.
      Specified by:
      ramBytesUsed in interface Accountable
      Returns:
      Ram used in bytes