BitSet
Efficient bit storage and manipulation. See samples: https://public.datagrok.ai/js/samples/data-frame/aggregation
Constructors
new BitSet()
new BitSet(
dart
):BitSet
Creates a BitSet from the specified Dart object.
Parameters
Parameter | Type |
---|---|
dart | any |
Returns
Source
Properties
Property | Modifier | Type |
---|---|---|
dart | public | any |
Accessors
anyFalse
get
anyFalse():boolean
Whether any bits are set to false.
Returns
boolean
Source
anyTrue
get
anyTrue():boolean
Whether any bits are set to true.
Returns
boolean
Source
falseCount
get
falseCount():number
Number of unset bits
Returns
number
Source
length
get
length():number
Number of bits in a bitset
Returns
number
Source
onChanged
get
onChanged():Observable
<any
>
Returns
Observable
<any
>
- fires when the bitset gets changed.
Source
trueCount
get
trueCount():number
Number of set bits
Returns
number
Source
version
get
version():number
Version of the bitset
Returns
number
Source
Methods
and()
and(
other
,notify
):BitSet
Modifies this bitset by performing the bitwise AND operation against the specified bitset. Returns this.
Parameters
Parameter | Type | Default value |
---|---|---|
other | BitSet | undefined |
notify | boolean | true |
Returns
Source
andNot()
andNot(
other
,notify
):BitSet
Modifies this bitset by performing the bitwise AND_NOT operation against the specified bitset. Returns this.
Parameters
Parameter | Type | Default value |
---|---|---|
other | BitSet | undefined |
notify | boolean | true |
Returns
Source
clone()
clone():
BitSet
Clones a bitset
Returns
Source
copyFrom()
copyFrom(
b
,notify
):BitSet
Copies the content from the other BitSet.
Parameters
Parameter | Type | Default value |
---|---|---|
b | BitSet | undefined |
notify | boolean | true |
Returns
Source
findNext()
findNext(
i
,x
):number
Finds the first index of value x, going forward from i-th position.
Parameters
Parameter | Type | Description |
---|---|---|
i | number | index |
x | boolean |
Returns
number
Source
findPrev()
findPrev(
i
,x
):number
Finds the first index of value x, going forward from i-th position, or -1 if not found.
Parameters
Parameter | Type | Description |
---|---|---|
i | number | Index to start searching from. |
x | boolean | Value to search for. |
Returns
number
Source
fireChanged()
fireChanged():
void
Returns
void
Source
get()
get(
i
):boolean
Gets i-th bit
Parameters
Parameter | Type | Description |
---|---|---|
i | number |
Returns
boolean
Source
getBuffer()
getBuffer():
Int32Array
Returns the underlying storage. Be careful with the direct manipulations, as some statistics (set count, etc) are cached.
Returns
Int32Array
Source
getSelectedIndexes()
getSelectedIndexes():
Int32Array
Indexes of all set bits. The result is cached.
Returns
Int32Array
Source
handleClick()
handleClick(
rowIndexPredicate
,mouseEvent
,modifiedSelectOnly
):void
Parameters
Parameter | Type | Default value |
---|---|---|
rowIndexPredicate | IndexPredicate | undefined |
mouseEvent | MouseEvent | undefined |
modifiedSelectOnly | boolean | false |
Returns
void
Source
init()
init(
f
,notify
):BitSet
Sets all bits by setting i-th bit to the results of f(i)
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
f | IndexPredicate | undefined | function that accepts bit index and returns bit value |
notify | boolean | true | whether BitSet's changed event should be fired |
Returns
- this
Source
invert()
invert(
notify
):BitSet
Inverts a bitset.
Parameters
Parameter | Type | Default value |
---|---|---|
notify | boolean | true |
Returns
Source
or()
or(
other
,notify
):BitSet
Modifies this bitset by performing the bitwise OR operation against the specified bitset. Returns this.
Parameters
Parameter | Type | Default value |
---|---|---|
other | BitSet | undefined |
notify | boolean | true |
Returns
Source
set()
set(
i
,x
,notify
):void
Sets i-th bit to x
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
i | number | undefined | |
x | boolean | undefined | |
notify | boolean | true | whether BitSet's changed event should be fired |
Returns
void
Source
setAll()
setAll(
x
,notify
):BitSet
Sets all bits to x
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
x | boolean | undefined | |
notify | boolean | true | whether BitSet's changed event should be fired |
Returns
Source
similarityTo()
similarityTo(
b
,metric
):number
Finds the value of similarity between two BitSets.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
b | BitSet | undefined | second BitSet. |
metric | "tanimoto" | "dice" | "cosine" | "sokal" | "russel" | "rogot-goldberg" | "kulczynski" | "mc-connaughey" | "asymmetric" | "braun-blanquet" | SIMILARITY_METRIC.TANIMOTO | similarity metric to use. |
Returns
number
Source
toBinaryString()
toBinaryString():
string
Returns
string
Source
toString()
toString():
string
Returns
string
Source
xor()
xor(
other
,notify
):BitSet
Modifies this bitset by performing the bitwise XOR operation against the specified bitset. Returns this.
Parameters
Parameter | Type | Default value |
---|---|---|
other | BitSet | undefined |
notify | boolean | true |
Returns
Source
create()
static
create(length
,f
?):BitSet
Creates a BitSet of the specified length with all bits set to false.
Parameters
Parameter | Type | Description |
---|---|---|
length | number | Number of bits. |
f ? | null | IndexPredicate | when specified, Sets all bits by setting i-th bit to the results of f(i) |
Returns
Source
fromBytes()
static
fromBytes(buffer
,bitLength
):BitSet
Creates a BitSet from the ArrayBuffer representing the bitset.
Parameters
Parameter | Type | Description |
---|---|---|
buffer | ArrayBuffer | An array containing 1 and 0. |
bitLength | number | count of bits. |
Returns
Source
fromString()
static
fromString(zerosOnes
):BitSet
Creates a BitSet from the string representing the bitset.
Parameters
Parameter | Type | Description |
---|---|---|
zerosOnes | string | A string containing '1' and '0'. |