BitArray
Bit array
Based heavily on https://github.com/lemire/FastBitSet.js which is licensed under the Apache License, Version 2.0.
Constructor Summary
Public Constructor | ||
public |
constructor(length: Integer, setAll: Boolean) |
Method Summary
Public Methods | ||
public |
Set value at index to false |
|
public |
Clear all bits of the array |
|
public |
Clear bits at all given indices |
|
public |
clearRange(start: Integer, end: Integer): BitArray Clear bits of the given range |
|
public |
Clone this object |
|
public |
difference(otherBitarray: BitArray): BitArray Calculate difference betwen this and another bit array. |
|
public |
Flip value at index |
|
public |
Flip all the values in the array |
|
public |
Iterate over all set bits in the array |
|
public |
Get value at index |
|
public |
getIntersectionSize(otherBitarray: BitArray): Integer Calculate the number of bits in common betwen this and another bit array. |
|
public |
How many set bits? |
|
public |
intersection(otherBitarray: BitArray): BitArray Calculate intersection betwen this and another bit array. |
|
public |
intersects(otherBitarray: BitArray): Boolean Test if there is any intersection betwen this and another bit array. |
|
public |
Test if all bits in the array are clear |
|
public |
Test if all bits in the array are set |
|
public |
Test if bits at all given indices are clear |
|
public |
Test if two BitArrays are identical in all their values |
|
public |
isRangeClear(start: Integer, end: Integer): BitArray Test if bits in given range are clear |
|
public |
isRangeSet(start: Integer, end: Integer): BitArray Test if bits in given range are set |
|
public |
Test if bits at all given indices are set |
|
public |
makeIntersection(otherBitarray: BitArray): BitArray Calculate intersection betwen this and another bit array. |
|
public |
Set value at index to true |
|
public |
Set all bits of the array |
|
public |
Set bits at all given indices |
|
public |
Set bits of the given range |
|
public |
Get an array with the set bits |
|
public |
|
|
public |
toString() |
|
public |
Calculate union betwen this and another bit array. |
Private Methods | ||
private |
|
|
private |
|
Public Constructors
Public Methods
public clear(index: Integer): undefined source
Set value at index to false
Params:
Name | Type | Attribute | Description |
index | Integer | the index |
public clearBits(arguments: ...Integer): Boolean source
Clear bits at all given indices
Params:
Name | Type | Attribute | Description |
arguments | ...Integer | indices |
public difference(otherBitarray: BitArray): BitArray source
Calculate difference betwen this and another bit array. Store result in this object.
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other bit array |
public flip(index: Integer): undefined source
Flip value at index
Params:
Name | Type | Attribute | Description |
index | Integer | the index |
public forEach(callback: function(index: Integer, i: Integer)): undefined source
Iterate over all set bits in the array
public get(index: Integer): Boolean source
Get value at index
Params:
Name | Type | Attribute | Description |
index | Integer | the index |
public getIntersectionSize(otherBitarray: BitArray): Integer source
Calculate the number of bits in common betwen this and another bit array.
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other bit array |
public intersection(otherBitarray: BitArray): BitArray source
Calculate intersection betwen this and another bit array. Store result in this object.
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other bit array |
public intersects(otherBitarray: BitArray): Boolean source
Test if there is any intersection betwen this and another bit array.
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other bit array |
public isClear(arguments: ...Integer): Boolean source
Test if bits at all given indices are clear
Params:
Name | Type | Attribute | Description |
arguments | ...Integer | indices |
public isEqualTo(otherBitarray: BitArray): Boolean source
Test if two BitArrays are identical in all their values
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other BitArray |
public isRangeClear(start: Integer, end: Integer): BitArray source
Test if bits in given range are clear
public isRangeSet(start: Integer, end: Integer): BitArray source
Test if bits in given range are set
public isSet(arguments: ...Integer): Boolean source
Test if bits at all given indices are set
Params:
Name | Type | Attribute | Description |
arguments | ...Integer | indices |
public makeIntersection(otherBitarray: BitArray): BitArray source
Calculate intersection betwen this and another bit array. Store result in a new bit array.
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other bit array |
public set(index: Integer): undefined source
Set value at index to true
Params:
Name | Type | Attribute | Description |
index | Integer | the index |
public setBits(arguments: ...Integer): Boolean source
Set bits at all given indices
Params:
Name | Type | Attribute | Description |
arguments | ...Integer | indices |
public toSeleString() source
public toString() source
public union(otherBitarray: BitArray): BitArray source
Calculate union betwen this and another bit array. Store result in this object.
Params:
Name | Type | Attribute | Description |
otherBitarray | BitArray | the other bit array |