Creates a new roaring bitmap adding the specified values.
The roaring bitmap allocates in WASM memory, remember to dispose the RoaringBitmap32 when not needed anymore to release WASM memory.
Optional
valuesOrCapacity: null | number | ReadonlyRoaringBitmap32 | BasicTypedArray | Iterable<undefined | null | string | number | false> | readonly (undefined | null | string | number | false)[]Optional
arenaAllocator: null | RoaringArenaAllocatorPrivate
#privateInternal
Internal property, do not use.
Returns true if this instance was disposed. A disposed bitmap cannot be used anymore.
Returns true if the bitmap has no elements.
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.
The number of values in the set. Alias to this.size
Get the cardinality of the bitmap (number of elements).
A number that changes every time the bitmap might have changed. Do not make assumptions about the value of this property, it is not guaranteed to be sequential. The value might change after some operations also if the content of the bitmap does not change, because it would be too expensive to check if the content changed. This property is useful to check if the bitmap changed since the last time you checked it.
Adds a 32 bit unsigned integer value. Values are unique, this function does nothing if the value already exists.
32 bit unsigned integer to add in the set.
This RoaringBitmap32 instance.
If the bitmap is frozen.
Adds multiple values. Using this is faster than calling add() multiple times. Inserting ordered or partially ordered arrays is faster.
The values to add.
Adds all the values in the interval: [rangeStart, rangeEnd).
First element is included, last element is excluded. The number of added values is rangeEnd - rangeStart.
Areas outside the range are passed through unchanged.
Optional
rangeStart: numberThe start index. Trimmed to 0.
Optional
rangeEnd: numberThe end index. Trimmed to 4294967296.
This RoaringBitmap32 instance.
Compute the difference between this and the provided bitmap, writing the result in the current bitmap. The provided bitmap is not modified.
The other bitmap.
The at() method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the set.
Zero-based index of the array element to be returned, converted to an integer. Negative index counts back from the end of the array — if index < 0, index + array.length is accessed.
The element in the set matching the given index. Always returns undefined if index < -array.length or index >= array.length without attempting to access the corresponding property.
Returns a new bitmap that is a copy of this bitmap, same as new RoaringBitmap32(copy)
A cloned RoaringBitmap32 instance
Removes a value from the set checking if the bitmap changes. Use remove() if you don't need to know if something changed. If the value does not exists, this function does nothing and returns false.
32 bit unsigned integer to remove from the set.
True if the bitmap changed, false if not.
If the bitmap is frozen.
Creates a new roaring bitmap deserializing it from a buffer
The roaring bitmap allocates in WASM memory, remember to dispose the RoaringBitmap32 when not needed anymore to release WASM memory.
The buffer to deserialize
The reulting bitmap. Remember to dispose the instance when finished using it.
Creates a new roaring bitmap deserializing it from a buffer
The roaring bitmap allocates in WASM memory, remember to dispose the RoaringBitmap32 when not needed anymore to release WASM memory.
The buffer to deserialize
The reulting bitmap. Remember to dispose the instance when finished using it.
Negates (in place) the roaring bitmap within a specified interval: [rangeStart, rangeEnd).
First element is included, last element is excluded. The number of negated values is rangeEnd - rangeStart.
Areas outside the range are passed through unchanged.
Optional
rangeStart: numberThe start index. Trimmed to 0.
Optional
rangeEnd: numberThe end index. Trimmed to 4294967296.
This RoaringBitmap32 instance.
RoaringBitmap32
Makes this roaring bitmap readonly. Sets isFrozen to true. This is a no-op if isFrozen is already true. Every attempt to modify the bitmap will throw an exception. A frozen bitmap cannot be unfrozen, but it can be disposed.
How many bytes are required to serialize this bitmap.
The serialization format.
Check whether a range of values from rangeStart (included) to rangeEnd (excluded) is present
Optional
rangeStart: numberThe start value (inclusive).
Optional
rangeEnd: numberThe end value (exclusive).
True if the bitmap contains the whole range of values from rangeStart (included) to rangeEnd (excluded), false if not.
ReadonlyRoaringBitmap32
Protected
invalidateComputes 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.
The Jaccard index
Converts the bitmap to a string in the format "1,2,3,4,5". The resulting string may be very big, use this function with caution.
Optional
sepatator: stringThe optional separator to use between values, defaults to ",".
Optional
maxStringLength: numberThe optional approximate maximum number of characters the output string can contain.
Adds the element of the other bitmap into this bitmap. Stores the result in this bitmap. The provided bitmap is not modified.
The other bitmap.
Overwrite the content of this bitmap with the content of another bitmap.
The other bitmap to copy.
This RoaringBitmap32 instance.
Converts a range of the bitmap to an JS Array. The resulting array may be very big, use this function with caution.
Optional
minimumValue: numberThe range start value (inclusive).
Optional
maximumValue: numberThe range end value (exclusive).
Optional
output: number[]The output array. If not specified, a new array is created.
The array containing all values within the given range in the bitmap.
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.
Optional
rangeStart: numberThe start value (inclusive).
Optional
rangeEnd: numberThe end value (exclusive).
The number of elements between rangeStart (included) to rangeEnd (excluded).
Converts a range of the bitmap to a string in the form "1,2,3,4,5". The resulting string may be very big, use this function with caution.
Optional
minimumValue: numberThe range start value (inclusive).
Optional
maximumValue: numberThe range end value (exclusive).
Optional
separator: stringThe separator to use between values. Defaults to ",".
The string containing all values within the given range in the bitmap.
Converts a range of the bitmap to a Set. The resulting set may be very big, use this function with caution.
Optional
minimumValue: numberThe range start value (inclusive).
Optional
maximumValue: numberThe range end value (exclusive).
Optional
output: Set<number>The output set. If not specified, a new set is created.
The set containing all values within the given range in the bitmap.
Converts a range of the bitmap to a Uint32Array. The resulting array may be very big, use this function with caution.
Optional
minimumValue: numberThe range start value (inclusive).
Optional
maximumValue: numberThe range end value (exclusive).
Optional
output: Uint32ArrayThe output array. If not specified, a new array is created.
The array containing all values within the given range in the bitmap.
Removes a value from the set checking if the bitmap changes. Use remove() if you don't need to know if something changed. If the value does not exists, this function does nothing and returns false.
Alias to delete.
32 bit unsigned integer to remove from the set.
True if the bitmap changed, false if not.
If the bitmap is frozen.
Removes all the values in the interval: [rangeStart, rangeEnd).
First element is included, last element is excluded. The number of renived values is rangeEnd - rangeStart.
Areas outside the range are passed through unchanged.
Optional
rangeStart: numberThe start index. Trimmed to 0.
Optional
rangeEnd: numberThe end index. Trimmed to 4294967296.
This RoaringBitmap32 instance.
RoaringBitmap32
Convert array and bitmap containers to run containers when it is more efficient; also convert from run containers when more space efficient.
Returns true if the bitmap has at least one run container.
Additional savings might be possible by calling shrinkToFit().
True if the bitmap has at least one run container.
Serializes a bitmap to a typed Uint8Array. The returned array is automatically garbage collected and there is no need to be disposed manually.
The serialization format.
The Uint8Array that contains the serialized bitmap
Serializes a bitmap to a typed Uint8Array. The returned array is automatically garbage collected and there is no need to be disposed manually.
The serialization format.
The output that will contain the serialized bitmap. If not provided, a new array is created.
The Uint8Array that contains the serialized bitmap
Serializes a bitmap to a typed Uint8Array. The returned array is automatically garbage collected and there is no need to be disposed manually.
The Uint8Array that will contain the serialized bitmap.
The serialization format.
The Uint8Array that contains the serialized bitmap
Serializes a bitmap to a byte buffer allocated in WASM memory.
The returned RoaringUint8Array is allocated in WASM memory and not garbage collected, it should to be freed manually calling dispose() as soon as possible.
The serialization format.
Optional
output: RoaringUint8ArrayThe RoaringUint8Array, a buffer allocated in WASM memory.
Converts a slice, define by start index (included) and end index (excluded) of the bitmap to a number array. The resulting array may be very big, use this function with caution.
Optional
start: numberThe slice start index (inclusive).
Optional
end: numberThe slice end index (exclusive).
Optional
output: number[]The output array. If not specified, a new array is created.
The array containing all values within the given slice in the bitmap.
Converts a slice, define by start index (included) and end index (excluded) of the bitmap to a string in the form "1,2,3,4,5". The resulting string may be very big, use this function with caution.
Optional
start: numberThe slice start index (inclusive).
Optional
end: numberThe slice end index (exclusive).
Optional
separator: stringThe separator to use between values. Defaults to ",".
The string containing all values within the given slice in the bitmap.
Converts a slice, define by start index (included) and end index (excluded) of the bitmap to a Set. The resulting set may be very big, use this function with caution.
Optional
start: numberThe slice start index (inclusive).
Optional
end: numberThe slice end index (exclusive).
Optional
output: Set<number>The output set. If not specified, a new set is created.
The set containing all values within the given slice in the bitmap.
Converts a slice, define by start index (included) and end index (excluded) of the bitmap to a Uint32Array. The resulting array may be very big, use this function with caution.
Optional
start: numberThe slice start index (inclusive).
Optional
end: numberThe slice end index (exclusive).
Optional
output: Uint32ArrayThe output array. If not specified, a new array is created.
The array containing all values within the given slice in the bitmap.
Converts the bitmap to a JS array. The resulting array may be very big, use this function with caution.
The array containing all values in the bitmap.
Converts the bitmap to a JS array. The resulting array may be very big, use this function with caution.
The maximum length of the output array.
The array containing all values in the bitmap.
Append all items in the bitmap to a JS array. The resulting array may be very big, use this function with caution.
The output array. If not specified, a new array is created.
Optional
maxLength: numberThe optional maximum number of values to read from the bitmap and push in the array.
The array containing all values in the bitmap.
Converts the bitmap to a JS Set
Optional
output: Set<number>The output Set. If not specified, a new Set is created.
Optional
maxLength: numberThe optional maximum number of values to read from the bitmap and add in the set.
The set containing all values in the bitmap.
Converts the bitmap to a JS Uint32Array. The resulting array may be very big, use this function with caution.
Optional
output: number | Uint32ArrayThe output Uint32Array. If not specified, a new array is created. If the output array is too small, only the first values that fit are written. If the output array is too big, the remaining values are left untouched and a new subarray is returned. If is a number, a new array of the specified size is created.
The Uint32Array containing all values in the bitmap.
Adds a 32 bit unsigned integer value checking if the bitmap changes. Use add() if you don't need to know if something changed. Values are unique, this function does nothing and returns false if the value already exists.
32 bit unsigned integer to add in the set.
True if the bitmap changed, false if not.
If the bitmap is frozen.
Computes the difference between two bitmaps. Stores the result in this bitmap. The provided bitmap is not modified.
The other bitmap.
Static
addaddOffset adds the value 'offset' to each and every value in a bitmap, generating a new bitmap in the process. If offset + element is outside of the range [0,2^32), that the element will be dropped.
The input bitmap.
The offset to add to each element. Can be positive or negative.
A new bitmap with the offset added to each element.
Static
andReturns a new RoaringBitmap32 with the intersection (and) between the given two bitmaps.
The provided bitmaps are not modified.
The first RoaringBitmap32 instance to and.
The second RoaringBitmap32 instance to and.
A new RoaringBitmap32 that contains the intersection a AND b
Static
andReturns a new RoaringBitmap32 with the difference (and not) between the two given bitmaps.
The provided bitmaps are not modified.
The first RoaringBitmap32 instance.
The second RoaringBitmap32 instance.
Static
deserializeCreates a new roaring bitmap deserializing it from a buffer
The roaring bitmap allocates in WASM memory, remember to dispose the RoaringBitmap32 when not needed anymore to release WASM memory.
The buffer to deserialize
The reulting bitmap. Remember to dispose the instance when finished using it.
Creates a new roaring bitmap deserializing it from a buffer
The roaring bitmap allocates in WASM memory, remember to dispose the RoaringBitmap32 when not needed anymore to release WASM memory.
The buffer to deserialize
The reulting bitmap. Remember to dispose the instance when finished using it.
Static
flipCreates a new bitmap with the content of the input bitmap but with given range of values flipped.
The input bitmap, it will not be modified
The start index (inclusive).
The end index (exclusive).
A new copied bitmap with the range flipped.
Static
fromStatic
fromCreates a new bitmap that contains all the values in the interval: [rangeStart, rangeEnd). Is possible to specify the step parameter to have a non contiguous range.
Optional
rangeStart: numberThe start value. Trimmed to 0.
Optional
rangeEnd: numberThe end value, excluded. Trimmed to 4294967296.
Optional
step: numberThe increment step, defaults to 1.
A new RoaringBitmap32 instance.
Static
ofThe RoaringBitmap32.of() static method creates a new Array instance from a variable number of arguments, regardless of number or type of the arguments. Note that is faster to pass a Uint32Array instance instead of an array or an iterable.
Rest
...values: (undefined | null | string | number | false)[]A set of values to add to the new RoaringBitmap32 instance.
A new RoaringBitmap32 instance.
Static
orReturns a new RoaringBitmap32 with the union (or) of the two given bitmaps.
The provided bitmaps are not modified.
The first RoaringBitmap32 instance to or.
The second RoaringBitmap32 instance to or.
Static
orPerforms a union between all the given array of RoaringBitmap32 instances.
This function is faster than calling or multiple times. In some circumstances orManyHeap is faster than orMany.
An array of RoaringBitmap32 instances to or together.
A new RoaringBitmap32 that contains the union of all the given bitmaps.
Static
orPerforms a union between all the given array of RoaringBitmap32 instances.
This function is faster than calling or multiple times. In some circumstances orManyHeap is faster than orMany.
An array of RoaringBitmap32 instances to or together.
A new RoaringBitmap32 that contains the union of all the given bitmaps.
Static
swapSwaps the content of two RoaringBitmap32 instances.
First RoaringBitmap32 instance to swap
Second RoaringBitmap32 instance to swap
RoaringBitmap32
Static
xorReturns a new RoaringBitmap32 with the symmetric union (xor) between the two given bitmaps.
The provided bitmaps are not modified.
The first RoaringBitmap32 instance to xor.
The second RoaringBitmap32 instance to xor.
Static
xorPerforms a xor between all the given array of RoaringBitmap32 instances.
This function is faster than calling xor multiple times.
An array of RoaringBitmap32 instances to or together.
A new RoaringBitmap32 that contains the xor of all the given bitmaps.
Generated using TypeDoc
A Roaring Bitmap that supports 32 bit unsigned integers.
The roaring bitmap allocates in WASM memory, remember to dispose the RoaringBitmap32 when not needed anymore to release WASM memory.