Interface ReadonlyRoaringBitmap32

interface ReadonlyRoaringBitmap32 {
    [toStringTag]: "Set";
    get isEmpty(): boolean;
    get isFrozen(): boolean;
    get size(): number;
    [iterator](): RoaringBitmap32Iterator;
    andCardinality(other): number;
    andNotCardinality(other): number;
    clone(): RoaringBitmap32;
    contentToString(maxLength?): string;
    entries(): IterableIterator<[number, number]>;
    every(callbackfn, thisArg?): boolean;
    filter(predicate, thisArg?, output?): number[];
    find(predicate, thisArg?): undefined | number;
    findIndex(predicate, thisArg?): number;
    forEach<This>(callbackfn, thisArg?): this;
    getSerializationSizeInBytes(format): number;
    has(value): boolean;
    hasRange(rangeStart, rangeEnd?): boolean;
    includes(value): boolean;
    indexOf(value, fromIndex?): number;
    intersects(other): boolean;
    intersectsWithRange(rangeStart, rangeEnd?): boolean;
    isEqual(other): boolean;
    isStrictSubset(other): boolean;
    isSubset(other): boolean;
    iterator(): RoaringBitmap32Iterator;
    jaccardIndex(other): number;
    join(separator?): string;
    keys(): RoaringBitmap32Iterator;
    lastIndexOf(value, fromIndex?): number;
    map<U, This>(callbackfn, thisArg?, output?): U[];
    maximum(): number;
    minimum(): number;
    orCardinality(other): number;
    rangeCardinality(rangeStart, rangeEnd?): number;
    rangeUint32Array(output, offset, limit?): Uint32Array;
    rangeUint32Array(minimumValue, maximumValue): Uint32Array;
    rangeUint32Array(minimumValue, maximumValue, output): Uint32Array;
    rangeUint32Array(minimumValue, output): Uint32Array;
    rangeUint32Array(output): Uint32Array;
    rank(maxValue): number;
    reduce(callbackfn): number;
    reduce(callbackfn, initialValue): number;
    reduce<U>(callbackfn, initialValue): U;
    reduceRight(callbackfn): number;
    reduceRight(callbackfn, initialValue): number;
    reduceRight<U>(callbackfn, initialValue): U;
    reverseIterator(): RoaringBitmap32Iterator;
    select(rank): undefined | number;
    serialize(format, _output?): Buffer;
    serialize(format, output): Buffer;
    serialize(output, format): Buffer;
    serializeAsync(format, _output?): Promise<Buffer>;
    serializeAsync(format, output): Promise<Buffer>;
    serializeAsync(output, format): Promise<Buffer>;
    serializeFileAsync(filePath, format): Promise<void>;
    some(callbackfn, thisArg?): boolean;
    statistics(): RoaringBitmap32Statistics;
    toArray(maxLength?): number[];
    toArray<TOutput>(output, maxLength?, offset?): TOutput;
    toJSON(): number[];
    toReversed(): number[];
    toSet(maxLength?): Set<number>;
    toSet(output, maxLength?): Set<number>;
    toSorted(cmp?): number[];
    toString(): string;
    toUint32Array(): Uint32Array;
    toUint32Array(maxSize): Uint32Array;
    toUint32Array(output): Uint32Array;
    toUint32ArrayAsync(): Promise<Uint32Array>;
    toUint32ArrayAsync(output): Promise<Uint32Array>;
    values(): RoaringBitmap32Iterator;
    xorCardinality(other): number;
}

Hierarchy (view full)

Properties

[toStringTag]: "Set"

Returns always "ReadonlyRoaringBitmap32".

To have a standard string representation of the content as a string, call contentToString() instead.

Returns

"Set"

Memberof

ReadonlyRoaringBitmap32

Accessors

  • get isEmpty(): boolean
  • Property. True if the bitmap is empty.

    Returns boolean

    Memberof

    ReadonlyRoaringBitmap32

  • get isFrozen(): boolean
  • Property. True if the bitmap is read-only. A read-only bitmap cannot be modified, every operation will throw an error. You can freeze a bitmap using the freeze() method. A bitmap cannot be unfrozen.

    Returns boolean

    Memberof

    ReadonlyRoaringBitmap32

  • get size(): number
  • Property. Gets the number of items in the set (cardinality).

    Returns number

    Memberof

    ReadonlyRoaringBitmap32

Methods

  • Symbol.iterator Gets a new iterator able to iterate all values in the set in ascending order.

    WARNING: Is not allowed to change the bitmap while iterating. The iterator may throw exception if the bitmap is changed during the iteration.

    Returns RoaringBitmap32Iterator

    A new iterator

    Memberof

    ReadonlyRoaringBitmap32

  • Computes the size of the intersection between two bitmaps (the number of values in common).

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Computes the size of the difference (andnot) between two bitmaps.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns a new bitmap that is a copy of this bitmap, same as new RoaringBitmap32(copy)

    Returns RoaringBitmap32

    A cloned RoaringBitmap32 instance

    Memberof

    ReadonlyRoaringBitmap32

  • Returns a standard string representation of the content of this ReadonlyRoaringBitmap32 instance. It may return a very long string.

    Default max length is 32000 characters, everything after maxLength is truncated (ellipsis added).

    Parameters

    • Optional maxLength: number

      Approximate maximum length of the string. Default is 32000. Ellipsis will be added if the string is longer.

    Returns string

    A string in the format "[1,2,3...]"

    Memberof

    ReadonlyRoaringBitmap32

  • Gets a new iterator able to iterate all value pairs [value, value] in the set in ascending order. This is just for compatibility with the Set interface.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour. The iterator may throw exception if the bitmap is changed during the iteration.

    Same as Symbol.iterator

    Returns IterableIterator<[number, number]>

    A new iterator

    Memberof

    ReadonlyRoaringBitmap32

  • Behaves like array.every. The every() method tests whether all elements in the set pass the test implemented by the provided function. It returns a Boolean value.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((value, index, set) => boolean)
        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

    Returns boolean

  • It behaves like array.filter. WARNING: The returned array may be very big, up to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • predicate: ((value, index, set) => boolean)
        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Optional output: number[]

    Returns number[]

    A new array containing all elements of the array that satisfy the given predicate.

  • Behaves like array.find. The find() method returns the value of the first element in the set that satisfies the provided testing function. Otherwise undefined is returned. WARNING: this can potentially iterate a large set of to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • predicate: ((value, index, set) => boolean)

      find calls predicate once for each element of the set, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns undefined | number

    The value of the first element in the set that satisfies the provided testing function. Otherwise undefined is returned.

  • Behaves like array.findIndex. The findIndex() method returns the index of the first element in the set that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test. WARNING: this can potentially iterate a large set of to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • predicate: ((value, index, set) => boolean)

      find calls predicate once for each element of the set, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns number

    The index of the first element in the set that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test.

  • Executes a function for each value in the set, in ascending order. The callback has 3 arguments, the value, the value and this (this set). This is to match the Set interface.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    WARNING: the second parameter of the callback is not the index, but the value itself, the same as the first argument. This is required to match the Set interface.

    Type Parameters

    • This = unknown

    Parameters

    • callbackfn: ((this, value, index, set) => void)
        • (this, value, index, set): void
        • Parameters

          • this: This
          • value: number
          • index: number
          • set: this

          Returns void

    • Optional thisArg: This

    Returns this

  • How many bytes are required to serialize this bitmap.

    Setting the format flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    Returns number

    How many bytes are required to serialize this bitmap.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether the given value exists in the set. Is the same as this.includes(value).

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    Returns boolean

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Check whether a range of values from rangeStart (included) to rangeEnd (excluded) is present

    Parameters

    • rangeStart: undefined | number

      The start index (inclusive).

    • Optional rangeEnd: number

      The end index (exclusive).

    Returns boolean

    True if the bitmap contains the whole range of values from rangeStart (included) to rangeEnd (excluded), false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether the given value exists in the set. Is the same as this.has(value).

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    Returns boolean

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns the index of value in the set, index start from 0. If the set doesn't contain value, this function will return -1. The difference with rank function is that this function will return -1 when value isn't in the set, but the rank function will return a non-negative number.

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    • Optional fromIndex: number

      The index to start the search at, defaults to 0. It does not have performance difference, is just for compatibility with array.indexOf.

    Returns number

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Check whether the two bitmaps intersect.

    Returns true if there is at least one item in common, false if not.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if the two set intersects, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Check whether a bitmap and a closed range intersect.

    Parameters

    • rangeStart: undefined | number

      The start of the range.

    • Optional rangeEnd: number

      The end of the range.

    Returns boolean

    True if the bitmap and the range intersects, false if not.

  • Checks wether this set is equal to another set.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if the two sets contains the same elements, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether this set is a strict subset of the given set.

    Returns false if the sets are the same.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if this set is a strict subset of the given ReadonlyRoaringBitmap32. False if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether this set is a subset or the same as the given set.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if this set is a subset of the given ReadonlyRoaringBitmap32. False if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Gets a new iterator able to iterate all values in the set in ascending order.

    WARNING: Is not allowed to change the bitmap while iterating. The iterator may throw exception if the bitmap is changed during the iteration.

    Same as Symbol.iterator

    Returns RoaringBitmap32Iterator

    A new iterator

    Memberof

    ReadonlyRoaringBitmap32

  • Computes the Jaccard index between two bitmaps. (Also known as the Tanimoto distance or the Jaccard similarity coefficient).

    See https://en.wikipedia.org/wiki/Jaccard_index

    The Jaccard index is undefined if both bitmaps are empty.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The Jaccard index.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns a standard string representation of the content of this ReadonlyRoaringBitmap32 instance.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    Parameters

    • Optional separator: string

      The separator to use between elements. Default is ",".

    Returns string

    A string in the format "123..."

    Memberof

    ReadonlyRoaringBitmap32

  • Gets a new iterator able to iterate all values in the set in ascending order. This is just for compatibility with the Set interface.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour. The iterator may throw exception if the bitmap is changed during the iteration.

    Same as Symbol.iterator

    Returns RoaringBitmap32Iterator

    A new iterator

    Memberof

    ReadonlyRoaringBitmap32

  • Returns the index of value in the set, index start from 0. If the set doesn't contain value, this function will return -1. The difference with rank function is that this function will return -1 when value isn't in the set, but the rank function will return a non-negative number. If fromIndex is not specified, is the same as this.indexOf(value). It behaves like array.lastIndexOf, but it doesn't have performance difference, is just for compatibility with array.lastIndexOf.

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    • Optional fromIndex: number

      The index to start the search at, defaults to 0. It does not have performance difference, is just for compatibility with array.indexOf.

    Returns number

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • It behaves like array.map. WARNING: The returned array may be very big, up to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Type Parameters

    • U
    • This = unknown

    Parameters

    • callbackfn: ((this, value, index, set) => U)

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this, value, index, set): U
        • Parameters

          • this: This
          • value: number
          • index: number
          • set: this

          Returns U

    • Optional thisArg: This

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Optional output: U[]

    Returns U[]

    An array containing the results of calling the callbackfn function on each element in the set.

  • Gets the maximum value in the set.

    Returns number

    The minimum value in the set or 0 if empty.

    Memberof

    ReadonlyRoaringBitmap32

  • Gets the minimum value in the set.

    Returns number

    The minimum value in the set or 0xFFFFFFFF if empty.

    Memberof

    ReadonlyRoaringBitmap32

  • Computes the size of the union between two bitmaps.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Gets the cardinality (number of elements) between rangeStart (included) to rangeEnd (excluded) of the bitmap. Returns 0 if range is invalid or if no element was found in the given range.

    Parameters

    • rangeStart: undefined | number

      The start index (inclusive).

    • Optional rangeEnd: number

      The end index (exclusive).

    Returns number

    The number of elements between rangeStart (included) to rangeEnd (excluded).

  • toUint32Array array with pagination

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array
    • offset: number
    • Optional limit: number

    Returns Uint32Array

    A new Uint32Array instance containing paginated items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • maximumValue: number

    Returns Uint32Array

    A new Uint32Array instance containing paginated items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • maximumValue: number
    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Same as toUint32Array

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns the number of values in the set that are smaller or equal to the given value.

    Parameters

    • maxValue: number

      The maximum value

    Returns number

    Returns the number of values in the set that are smaller or equal to the given value.

    Memberof

    ReadonlyRoaringBitmap32

  • Behaves like array.reduce. The reduce() method applies a function against an accumulator and each value of the set (from left-to-right) to reduce it to a single value.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the set.

        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    Returns number

    The value that results from the reduction.

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)
        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    • initialValue: undefined | number

    Returns number

  • Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => U)
        • (previousValue, currentValue, currentIndex, set): U
        • Parameters

          • previousValue: U
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns U

    • initialValue: U

    Returns U

  • Behaves like array.reduceRight. The reduceRight() method applies a function against an accumulator and each value of the set (from right-to-left) to reduce it to a single value. WARNING: this can potentially iterate a large set of to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the set.

        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    Returns number

    The value that results from the reduction.

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)
        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    • initialValue: undefined | number

    Returns number

  • Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => U)
        • (previousValue, currentValue, currentIndex, set): U
        • Parameters

          • previousValue: U
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns U

    • initialValue: U

    Returns U

  • Gets a new iterator able to iterate all values in the set in descending order.

    WARNING: Is not allowed to change the bitmap while iterating. The iterator may throw exception if the bitmap is changed during the iteration.

    Returns RoaringBitmap32Iterator

    A new reverse iterator

    Memberof

    ReadonlyRoaringBitmap32

  • If the size of the roaring bitmap is strictly greater than rank, then this function returns the element of given rank.

    Otherwise, it returns undefined.

    Parameters

    • rank: number

      The rank, an unsigned 32 bit integer.

    Returns undefined | number

    The element of the given rank or undefined if not found.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into a new Buffer.

    Setting the formatg to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • Optional _output: undefined

    Returns Buffer

    A new node Buffer that contains the serialized bitmap.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at the given outputStartIndex position. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the format to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      If false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    Returns Buffer

    The output Buffer. If the input buffer was exactly of the same size. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at position 0. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    • format: SerializationFormatType

    Returns Buffer

    The output Buffer. If the input buffer was exactly of the same size. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into a new Buffer. The bitmap will be temporarily frozen until the operation completes.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • Optional _output: undefined

    Returns Promise<Buffer>

    A new node Buffer that contains the serialized bitmap.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at the given outputStartIndex position. The bitmap will be temporarily frozen until the operation completes. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      If false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    Returns Promise<Buffer>

    The output Buffer. If the input buffer was exactly of the same size, the same buffer is returned. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at position 0. The bitmap will be temporarily frozen until the operation completes. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    • format: SerializationFormatType

    Returns Promise<Buffer>

    The output Buffer. If the input buffer was exactly of the same size, the same buffer is returned. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into a file, asynchronously. The bitmap will be temporarily frozen until the operation completes.

    This is faster, everything runs in its own thread and it consumes less memory than serializing to a Buffer and then to write to a file, internally it uses memory mapped files and skip all the JS overhead.

    Parameters

    • filePath: string
    • format: FileSerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    Returns Promise<void>

    Memberof

    ReadonlyRoaringBitmap32

  • Behaves like array.some. The some() method tests whether at least one element in the set passes the test implemented by the provided function. It returns true if, in the set, it finds an element for which the provided function returns true; otherwise it returns false.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((value, index, set) => boolean)
        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

    Returns boolean

  • Creates a new plain JS array and fills it with all the values in the bitmap.

    The returned array may be very big, use this function only when you know what you are doing.

    Parameters

    • Optional maxLength: number

      The maximum number of elements to return.

    Returns number[]

    A new plain JS array that contains all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Append all the values in this bitmap to the given plain JS array.

    The resulting array may be very big, use this function only when you know what you are doing.

    Type Parameters

    • TOutput extends number[]

      The type of the output array.

    Parameters

    • output: TOutput

      The output array.

    • Optional maxLength: number

      The maximum number of elements to return.

    • Optional offset: number

    Returns TOutput

    The output array.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns a plain JS array with all the values in the bitmap.

    Used by JSON.stringify to serialize this bitmap as an array.

    Returns number[]

    A new plain JS array that contains all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • It behaves like array.toReversed. Returns a new array that is this set sorted in reverse order. WARNING: The returned array may be very big, up to 4 billion elements.

    Returns number[]

    An array containing the elements of this set in reverse order (descending).

  • Creates a new plain JS Set and fills it with all the values in the bitmap.

    The returned set may be very big, use this function only when you know what you are doing.

    Parameters

    • Optional maxLength: number

      The maximum number of elements to return.

    Returns Set<number>

    A new plain JS array that contains all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Adds all the values in this bitmap to the given plain JS Set.

    The resulting set may be very big, use this function only when you know what you are doing.

    Parameters

    • output: Set<number>

      The output set.

    • Optional maxLength: number

      The maximum number of elements to return.

    Returns Set<number>

    The output set.

    Memberof

    ReadonlyRoaringBitmap32

  • It behaves like array.toSorted. Returns a new array that is this set sorted according to the compare function. If no sorting function is provided, the array is sorted according to the numeric order of the values (the same as calling this.toArray()).

    WARNING: The returned array may be very big, up to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • Optional cmp: ((a, b) => number)

      A function that defines an alternative sort order. The sort method calls the compareFunction function once for each element in the array.

        • (a, b): number
        • Parameters

          • a: number
          • b: number

          Returns number

    Returns number[]

    A new sorted array that contains all the elements of this set.

  • Returns always "ReadonlyRoaringBitmap32".

    To have a standard string representation of the content as a string, call contentToString() instead.

    Returns string

    "ReadonlyRoaringBitmap32"

    Memberof

    ReadonlyRoaringBitmap32

  • Creates a new Uint32Array and fills it with all the values in the bitmap.

    The returned array may be very big, up to 4 billion elements.

    Use this function only when you know what you are doing.

    This function is faster than calling new Uint32Array(bitmap);

    See rangeUint32Array to paginate.

    Returns Uint32Array

    A new Uint32Array instance containing all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Creates a new Uint32Array and fills it with all the values in the bitmap up to the given length.

    See rangeUint32Array to paginate.

    Parameters

    • maxSize: number

    Returns Uint32Array

    A new Uint32Array instance containing all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Copies all the values in the roaring bitmap to an Uint32Array.

    This function is faster than calling new Uint32Array(bitmap); Throws if the given array is not a valid Uint32Array or Int32Array or is not big enough.

    See rangeUint32Array to paginate.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Creates a new Uint32Array and fills it with all the values in the bitmap, asynchronously. The bitmap will be temporarily frozen until the operation completes.

    The returned array may be very big, up to 4 billion elements.

    Use this function only when you know what you are doing.

    This function is faster than calling new Uint32Array(bitmap);

    See rangeUint32Array to paginate.

    Returns Promise<Uint32Array>

    A new Uint32Array instance containing all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Copies all the values in the roaring bitmap to an Uint32Array, asynchronously. The bitmap will be temporarily frozen until the operation completes.

    This function is faster than calling new Uint32Array(bitmap); Throws if the given array is not a valid Uint32Array or Int32Array or is not big enough.

    See rangeUint32Array to paginate.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Promise<Uint32Array>

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Gets a new iterator able to iterate all values in the set in ascending order. This is just for compatibility with the Set interface.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour. The iterator may throw exception if the bitmap is changed during the iteration.

    Same as Symbol.iterator

    Returns RoaringBitmap32Iterator

    A new iterator

    Memberof

    ReadonlyRoaringBitmap32

  • Computes the size of the symmetric difference (xor) between two bitmaps.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

Generated using TypeDoc