Class RoaringBitmapWriter.Wizard<C extends WordStorage<C>,​T extends BitmapDataProvider & AppendableStorage<C>>

    • Field Detail

      • initialCapacity

        protected int initialCapacity
      • constantMemory

        protected boolean constantMemory
      • partiallySortValues

        protected boolean partiallySortValues
      • expectedContainerSize

        protected int expectedContainerSize
    • Method Detail

      • optimiseForArrays

        public RoaringBitmapWriter.Wizard<C,​T> optimiseForArrays()
        Choose this option if it is known that most containers will be sparse.
        Returns:
        this
      • optimiseForRuns

        public RoaringBitmapWriter.Wizard<C,​T> optimiseForRuns()
        Choose this option if the bitmap is expected to be RLE compressible. Will buffer additions into a RunContainer.
        Returns:
        this
      • expectedValuesPerContainer

        public RoaringBitmapWriter.Wizard<C,​T> expectedValuesPerContainer​(int count)
        Parameters:
        count - how many values are expected to fall within any 65536 bit range.
        Returns:
        this
      • constantMemory

        public RoaringBitmapWriter.Wizard<C,​T> 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

        public RoaringBitmapWriter.Wizard<C,​T> expectedDensity​(double density)
        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

        public RoaringBitmapWriter.Wizard<C,​T> 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. 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 value
        max - the exclusive max value
        Returns:
        this
      • initialCapacity

        public RoaringBitmapWriter.Wizard<C,​T> initialCapacity​(int count)
        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

        public RoaringBitmapWriter.Wizard<C,​T> 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

        protected abstract Supplier<C> arraySupplier()
      • runSupplier

        protected abstract Supplier<C> runSupplier()
      • createUnderlying

        protected abstract T createUnderlying​(int initialCapacity)
      • get

        public RoaringBitmapWriter<T> 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 interface Supplier<C extends WordStorage<C>>
        Returns:
        a new RoaringBitmapWriter