Module roaringbitmap
Package org.roaringbitmap
Class RoaringBitmapWriter.Wizard<C extends WordStorage<C>,T extends BitmapDataProvider & AppendableStorage<C>>
java.lang.Object
org.roaringbitmap.RoaringBitmapWriter.Wizard<C,T>
- All Implemented Interfaces:
Supplier<RoaringBitmapWriter<T>>
- Direct Known Subclasses:
RoaringBitmapWriter.BufferWizard
,RoaringBitmapWriter.RoaringWizard
- Enclosing interface:
- RoaringBitmapWriter<T extends BitmapDataProvider>
public abstract static class RoaringBitmapWriter.Wizard<C extends WordStorage<C>,T extends BitmapDataProvider & AppendableStorage<C>>
extends Object
implements Supplier<RoaringBitmapWriter<T>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected int
protected int
protected boolean
protected boolean
-
Method Summary
Modifier and TypeMethodDescriptionAll writes are buffered into the same buffer of 8kB, before converting to the best container representation and appending to the bitmap.protected abstract T
createUnderlying(int initialCapacity)
Will partially sort values, which can allocate O(n) temporary memory but can significantly speed up adding unsorted values to a bitmap.expectedDensity(double density)
Influence default container choice by how dense the bitmap is expected to be.expectedRange(long min, long max)
Guesses the number of prefices required based on an estimate of the range the bitmap will contain, assumes that all prefices in the range will be required.expectedValuesPerContainer(int count)
fastRank()
get()
Builds a bitmap writer based on the supplied options.initialCapacity(int count)
Takes control of the size of the prefix array, in case it can be precalculated or estimated.Choose this option if it is known that most containers will be sparse.Choose this option if the bitmap is expected to be RLE compressible.runCompress(boolean runCompress)
By default the bitmap will be run-compressed on the fly, but it can be disabled (and run compressed at the end).
-
Field Details
-
initialCapacity
protected int initialCapacity -
constantMemory
protected boolean constantMemory -
partiallySortValues
protected boolean partiallySortValues -
runCompress
protected boolean runCompress -
containerSupplier
-
expectedContainerSize
protected int expectedContainerSize
-
-
Method Details
-
optimiseForArrays
Choose this option if it is known that most containers will be sparse.- Returns:
- this
-
optimiseForRuns
Choose this option if the bitmap is expected to be RLE compressible. Will buffer additions into a RunContainer.- Returns:
- this
-
runCompress
By default the bitmap will be run-compressed on the fly, but it can be disabled (and run compressed at the end).- Parameters:
runCompress
- whether to apply run compression on the fly.- Returns:
- this
-
expectedValuesPerContainer
- Parameters:
count
- how many values are expected to fall within any 65536 bit range.- Returns:
- this
-
fastRank
-
constantMemory
All writes are buffered into the same buffer of 8kB, before converting to the best container representation and appending to the bitmap. This option overrides any optimiseForArrays, optimiseForRuns and optimiseForBitmaps settings.- Returns:
- this
-
expectedDensity
Influence default container choice by how dense the bitmap is expected to be.- Parameters:
density
- value in [0.0, 1.0], density of the bitmap- Returns:
- this
-
expectedRange
Guesses the number of prefices required based on an estimate of the range the bitmap will contain, assumes that all prefices in the range will be required. This is a good heuristic for a contiguous bitmap, and, for instance, a very bad heuristic for a bitmap with just two values far apart.- Parameters:
min
- the inclusive min valuemax
- the exclusive max value- Returns:
- this
-
initialCapacity
Takes control of the size of the prefix array, in case it can be precalculated or estimated. This can potentially save many array allocations during building the bitmap.- Parameters:
count
- an estimate of the number of prefix keys required.- Returns:
- this
-
doPartialRadixSort
Will partially sort values, which can allocate O(n) temporary memory but can significantly speed up adding unsorted values to a bitmap.- Returns:
- this
-
arraySupplier
-
runSupplier
-
createUnderlying
-
get
Builds a bitmap writer based on the supplied options. A call to this method is repeatable, and will not fail because the wizard should already be in a valid state.- Specified by:
get
in interfaceSupplier<C extends WordStorage<C>>
- Returns:
- a new RoaringBitmapWriter
-