Interface ReadonlyRoaringBitmap32

interface ReadonlyRoaringBitmap32 {
    [toStringTag]: "Set";
    get isEmpty(): boolean;
    get isFrozen(): boolean;
    get size(): number;
    [iterator](): RoaringBitmap32Iterator;
    andCardinality(other: ReadonlyRoaringBitmap32): number;
    andNotCardinality(other: ReadonlyRoaringBitmap32): number;
    clone(): RoaringBitmap32;
    contentToString(maxLength?: number): string;
    difference<U>(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<U>): Set<number>;
    entries(): SetIterator<[number, number]>;
    every(callbackfn: ((value: number, index: number, set: this) => boolean), thisArg?: unknown): boolean;
    filter(predicate: ((value: number, index: number, set: this) => boolean), thisArg?: unknown, output?: number[]): number[];
    find(predicate: ((value: number, index: number, set: this) => boolean), thisArg?: unknown): undefined | number;
    findIndex(predicate: ((value: number, index: number, set: this) => boolean), thisArg?: unknown): number;
    forEach<This>(callbackfn: ((this: This, value: number, index: number, set: this) => void), thisArg?: This): this;
    getSerializationSizeInBytes(format: SerializationFormatType): number;
    has(value: unknown): boolean;
    hasRange(rangeStart: undefined | number, rangeEnd?: number): boolean;
    includes(value: unknown): boolean;
    indexOf(value: unknown, fromIndex?: number): number;
    intersection<U>(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<U>): Set<number & U>;
    intersects(other: ReadonlyRoaringBitmap32): boolean;
    intersectsWithRange(rangeStart: undefined | number, rangeEnd?: number): boolean;
    isDisjointFrom(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<unknown>): boolean;
    isEqual(other: ReadonlyRoaringBitmap32): boolean;
    isStrictSubset(other: ReadonlyRoaringBitmap32): boolean;
    isStrictSuperset(other: ReadonlyRoaringBitmap32): boolean;
    isSubset(other: ReadonlyRoaringBitmap32): boolean;
    isSubsetOf(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<unknown>): boolean;
    isSuperset(other: ReadonlyRoaringBitmap32): boolean;
    isSupersetOf(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<unknown>): boolean;
    iterator(): RoaringBitmap32Iterator;
    jaccardIndex(other: ReadonlyRoaringBitmap32): number;
    join(separator?: string): string;
    keys(): RoaringBitmap32Iterator;
    lastIndexOf(value: unknown, fromIndex?: number): number;
    map<U, This>(callbackfn: ((this: This, value: number, index: number, set: this) => U), thisArg?: This, output?: U[]): U[];
    maximum(): number;
    minimum(): number;
    orCardinality(other: ReadonlyRoaringBitmap32): number;
    rangeCardinality(rangeStart: undefined | number, rangeEnd?: number): number;
    rangeUint32Array(output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int32Array
        | Uint32Array, offset: number, limit?: number): Uint32Array;
    rangeUint32Array(minimumValue: number, maximumValue: number): Uint32Array;
    rangeUint32Array(minimumValue: number, maximumValue: number, output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int32Array
        | Uint32Array): Uint32Array;
    rangeUint32Array(minimumValue: number, output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int32Array
        | Uint32Array): Uint32Array;
    rangeUint32Array(output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int32Array
        | Uint32Array): Uint32Array;
    rank(maxValue: number): number;
    reduce(callbackfn: ((previousValue: number, currentValue: number, currentIndex: number, set: this) => number)): number;
    reduce(callbackfn: ((previousValue: number, currentValue: number, currentIndex: number, set: this) => number), initialValue: undefined | number): number;
    reduce<U>(callbackfn: ((previousValue: U, currentValue: number, currentIndex: number, set: this) => U), initialValue: U): U;
    reduceRight(callbackfn: ((previousValue: number, currentValue: number, currentIndex: number, set: this) => number)): number;
    reduceRight(callbackfn: ((previousValue: number, currentValue: number, currentIndex: number, set: this) => number), initialValue: undefined | number): number;
    reduceRight<U>(callbackfn: ((previousValue: U, currentValue: number, currentIndex: number, set: this) => U), initialValue: U): U;
    reverseIterator(): RoaringBitmap32Iterator;
    select(rank: number): undefined | number;
    serialize(format: SerializationFormatType, _output?: undefined): Buffer;
    serialize(format: SerializationFormatType, output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int8Array
        | Uint8Array
        | Uint8ClampedArray): Buffer;
    serialize(output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int8Array
        | Uint8Array
        | Uint8ClampedArray, format: SerializationFormatType): Buffer;
    serializeAsync(format: SerializationFormatType, _output?: undefined): Promise<Buffer>;
    serializeAsync(format: SerializationFormatType, output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int8Array
        | Uint8Array
        | Uint8ClampedArray): Promise<Buffer>;
    serializeAsync(output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int8Array
        | Uint8Array
        | Uint8ClampedArray, format: SerializationFormatType): Promise<Buffer>;
    serializeFileAsync(filePath: string, format: FileSerializationFormatType): Promise<void>;
    some(callbackfn: ((value: number, index: number, set: this) => boolean), thisArg?: unknown): boolean;
    statistics(): RoaringBitmap32Statistics;
    symmetricDifference<U>(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<U>): Set<number | U>;
    toArray(maxLength?: number): number[];
    toArray<TOutput>(output: TOutput, maxLength?: number, offset?: number): TOutput;
    toJSON(): number[];
    toReversed(): number[];
    toSet(maxLength?: number): Set<number>;
    toSet(output: Set<number>, maxLength?: number): Set<number>;
    toSorted(cmp?: ((a: number, b: number) => number)): number[];
    toString(): string;
    toUint32Array(): Uint32Array;
    toUint32Array(maxSize: number): Uint32Array;
    toUint32Array(output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int32Array
        | Uint32Array): Uint32Array;
    toUint32ArrayAsync(): Promise<Uint32Array>;
    toUint32ArrayAsync(output:
        | ArrayBuffer
        | SharedArrayBuffer
        | Int32Array
        | Uint32Array): Promise<Uint32Array>;
    union<U>(other: ReadonlyRoaringBitmap32 | ReadonlySetLike<U>): Set<number | U>;
    values(): RoaringBitmap32Iterator;
    xorCardinality(other: ReadonlyRoaringBitmap32): number;
}

Hierarchy (view full)

  • Omit<ReadonlySet<number>,
        | "forEach"
        | "keys"
        | "values"
        | "entries"
        | typeof Symbol.iterator>

Properties

[toStringTag]

Returns always "ReadonlyRoaringBitmap32".

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

"Set"

ReadonlyRoaringBitmap32

Accessors

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

    Returns boolean

    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

    ReadonlyRoaringBitmap32

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

    Returns number

    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

    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.

    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.

    ReadonlyRoaringBitmap32

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

    Returns RoaringBitmap32

    A cloned RoaringBitmap32 instance

    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

    • OptionalmaxLength: 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...]"

    ReadonlyRoaringBitmap32

  • Warning: this method is just for compatibility with Set and returns a Set, so it can be very slow for big bitmaps. Yoo should use this.andNot(bitmap).

    Type Parameters

    • U

    Returns Set<number>

    a new Set containing all the elements in this Set which are not also in the argument.

  • 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 SetIterator<[number, number]>

    A new iterator

    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: number, index: number, set: this) => boolean)
        • (value, index, set): boolean
        • Parameters

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

          Returns boolean

    • OptionalthisArg: 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: number, index: number, set: this) => boolean)
        • (value, index, set): boolean
        • Parameters

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

          Returns boolean

    • OptionalthisArg: 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.

    • Optionaloutput: 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: number, index: number, set: this) => 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

    • OptionalthisArg: 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: number, index: number, set: this) => 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

    • OptionalthisArg: 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: This, value: number, index: number, set: this) => void)
        • (this, value, index, set): void
        • Parameters

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

          Returns void

    • OptionalthisArg: 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.

    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.

    ReadonlyRoaringBitmap32

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

    Parameters

    • rangeStart: undefined | number

      The start index (inclusive).

    • OptionalrangeEnd: 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.

    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.

    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.

    • OptionalfromIndex: 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.

    ReadonlyRoaringBitmap32

  • Warning: this method is just for compatibility with Set and returns a Set, so it can be very slow for big bitmaps. Yoo should use this.and(bitmap).

    Type Parameters

    • U

    Returns Set<number & U>

    a new Set containing all the elements which are both in this Set and in the argument.

  • 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.

    ReadonlyRoaringBitmap32

  • Check whether a bitmap and a closed range intersect.

    Parameters

    • rangeStart: undefined | number

      The start of the range.

    • OptionalrangeEnd: 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.

    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.

    ReadonlyRoaringBitmap32

  • Checks wether this set is a strict superset 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 superset of the given ReadonlyRoaringBitmap32. False if not.

    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.

    ReadonlyRoaringBitmap32

  • Checks wether this set is a superset 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 superset of the given ReadonlyRoaringBitmap32. False if not.

    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

    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.

    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

    • Optionalseparator: string

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

    Returns string

    A string in the format "123..."

    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

    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.

    • OptionalfromIndex: 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.

    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: This, value: number, index: number, set: this) => 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

    • OptionalthisArg: 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.

    • Optionaloutput: 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.

    ReadonlyRoaringBitmap32

  • Gets the minimum value in the set.

    Returns number

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

    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.

    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).

    • OptionalrangeEnd: 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
    • Optionallimit: number

    Returns Uint32Array

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

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • maximumValue: number

    Returns Uint32Array

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

    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.

    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.

    ReadonlyRoaringBitmap32

  • Same as toUint32Array

    Parameters

    • output:
          | ArrayBuffer
          | SharedArrayBuffer
          | Int32Array
          | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    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.

    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: number, currentValue: number, currentIndex: number, set: this) => 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: number, currentValue: number, currentIndex: number, set: this) => 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: U, currentValue: number, currentIndex: number, set: this) => 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: number, currentValue: number, currentIndex: number, set: this) => 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: number, currentValue: number, currentIndex: number, set: this) => 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: U, currentValue: number, currentIndex: number, set: this) => 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

    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.

    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.

    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.

    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.

    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.

    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.

    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.

    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>

    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: number, index: number, set: this) => boolean)
        • (value, index, set): boolean
        • Parameters

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

          Returns boolean

    • OptionalthisArg: unknown

    Returns boolean

  • Warning: this method is just for compatibility with Set and returns a Set, so it can be very slow for big bitmaps. Yoo should use this.xor(bitmap) instead.

    Type Parameters

    • U

    Returns Set<number | U>

    a new Set containing all the elements which are in either this Set or in the argument, but not in both.

  • 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

    • OptionalmaxLength: 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.

    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.

    • OptionalmaxLength: number

      The maximum number of elements to return.

    • Optionaloffset: number

    Returns TOutput

    The output array.

    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.

    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

    • OptionalmaxLength: 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.

    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.

    • OptionalmaxLength: number

      The maximum number of elements to return.

    Returns Set<number>

    The output set.

    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

    • Optionalcmp: ((a: number, b: number) => 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"

    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.

    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.

    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.

    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.

    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.

    ReadonlyRoaringBitmap32

  • Warning: this method is just for compatibility with Set and returns a Set, so it can be very slow for big bitmaps. Yoo should use this.or(bitmap).

    Type Parameters

    • U

    Returns Set<number | U>

    a new Set containing all the elements in this Set and also all the elements in the argument.

  • 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

    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.

    ReadonlyRoaringBitmap32