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 intprotected intprotected IntArrayListprotected intprotected PlaModelprotected IntArrayListprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(double firstKey, double slope, long intercept) Consumes a new segment.build()Builds theIntPgmIndex; orIntPgmIndex.EMPTYif there are no keys in the list.longEstimates the allocated memory.longEstimates 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.EMPTYif there are no keys in the list. -
accept
public void accept(double firstKey, double slope, long intercept) Description copied from interface:PlaModel.SegmentConsumerConsumes a new segment. The segment is defined by the epsilon-approximation function fs(k) = k × slope + intercept.- Specified by:
acceptin 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:
ramBytesAllocatedin 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:
ramBytesUsedin interfaceAccountable- Returns:
- Ram used in bytes
-