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 Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected int
protected IntArrayList
protected int
protected PlaModel
protected IntArrayList
protected int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(double firstKey, double slope, long intercept) Consumes a new segment.build()
Builds theIntPgmIndex
; orIntPgmIndex.EMPTY
if there are no keys in the list.long
Estimates the allocated memory.long
Estimates the bytes that are actually used.setEpsilon
(int epsilon) Sets the epsilon range to use when learning the segments for the list of keys.setEpsilonRecursive
(int epsilonRecursive) Sets the recursive epsilon range to use when learning the segments for the segment levels.setSortedKeys
(int[] keys, int length) Sets the sorted array of keys to build the index for; duplicate elements are allowed.setSortedKeys
(IntArrayList keys) Sets the sorted list of keys to build the index for; duplicate elements are allowed.
-
Field Details
-
keys
-
epsilon
protected int epsilon -
epsilonRecursive
protected int epsilonRecursive -
plam
-
size
protected int size -
segmentData
-
numSegments
protected int numSegments
-
-
Constructor Details
-
IntBuilder
public IntBuilder()
-
-
Method Details
-
setSortedKeys
Sets the sorted list of keys to build the index for; duplicate elements are allowed. -
setSortedKeys
Sets the sorted array of keys to build the index for; duplicate elements are allowed. -
setEpsilon
Sets the epsilon range to use when learning the segments for the list of keys. -
setEpsilonRecursive
Sets the recursive epsilon range to use when learning the segments for the segment levels. -
build
Builds theIntPgmIndex
; orIntPgmIndex.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 interfacePlaModel.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 interfaceAccountable
- 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 interfaceAccountable
- Returns:
- Ram used in bytes
-