BitSet
Defined in: js-api/src/dataframe/bit-set.ts:20
Efficient bit storage and manipulation. See samples: https://public.datagrok.ai/js/samples/data-frame/aggregation/aggregate
Constructors
Constructor
new BitSet(
dart):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:24
Creates a BitSet from the specified Dart object.
Parameters
| Parameter | Type |
|---|---|
dart | any |
Returns
BitSet
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
dart | public | any | js-api/src/dataframe/bit-set.ts:21 |
Accessors
anyFalse
Get Signature
get anyFalse():
boolean
Defined in: js-api/src/dataframe/bit-set.ts:101
Whether any bits are set to false.
Returns
boolean
anyTrue
Get Signature
get anyTrue():
boolean
Defined in: js-api/src/dataframe/bit-set.ts:98
Whether any bits are set to true.
Returns
boolean
falseCount
Get Signature
get falseCount():
number
Defined in: js-api/src/dataframe/bit-set.ts:93
Number of unset bits
Returns
number
length
Get Signature
get length():
number
Defined in: js-api/src/dataframe/bit-set.ts:83
Number of bits in a bitset
Returns
number
onChanged
Get Signature
get onChanged():
Observable<any>
Defined in: js-api/src/dataframe/bit-set.ts:221
Returns
Observable<any>
fires when the bitset gets changed.
trueCount
Get Signature
get trueCount():
number
Defined in: js-api/src/dataframe/bit-set.ts:88
Number of set bits
Returns
number
version
Get Signature
get version():
number
Defined in: js-api/src/dataframe/bit-set.ts:104
Version of the bitset
Returns
number
Methods
and()
and(
other,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:119
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
BitSet
andNot()
andNot(
other,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:140
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
BitSet
clone()
clone():
BitSet
Defined in: js-api/src/dataframe/bit-set.ts:107
Clones a bitset
Returns
BitSet
copyFrom()
copyFrom(
b,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:204
Copies the content from the other BitSet or BitArray of the same length.
Parameters
| Parameter | Type | Default value |
|---|---|---|
b | BitSet | BitArray | undefined |
notify | boolean | true |
Returns
BitSet
findNext()
findNext(
i,x):number
Defined in: js-api/src/dataframe/bit-set.ts:154
Finds the first index of value x, going forward from i-th position.
Parameters
| Parameter | Type | Description |
|---|---|---|
i | number | index |
x | boolean | - |
Returns
number
findPrev()
findPrev(
i,x):number
Defined in: js-api/src/dataframe/bit-set.ts:162
Finds the first index of value x, going backward 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
index of the first bit set to x, or -1 if not found
fireChanged()
fireChanged():
void
Defined in: js-api/src/dataframe/bit-set.ts:216
Fires onChanged after bits were set without notification.
Returns
void
get()
get(
i):boolean
Defined in: js-api/src/dataframe/bit-set.ts:167
Gets i-th bit
Parameters
| Parameter | Type |
|---|---|
i | number |
Returns
boolean
getBuffer()
getBuffer():
Int32Array
Defined in: js-api/src/dataframe/bit-set.ts:73
Returns the underlying storage. Be careful with the direct manipulations, as some statistics (set count, etc) are cached.
Returns
Int32Array
getSelectedIndexes()
getSelectedIndexes():
Int32Array
Defined in: js-api/src/dataframe/bit-set.ts:199
Indexes of all set bits. The result is cached.
Returns
Int32Array
handleClick()
handleClick(
rowIndexPredicate,mouseEvent,modifiedSelectOnly?):void
Defined in: js-api/src/dataframe/bit-set.ts:239
Applies the standard click semantics (Ctrl toggles, Shift extends) to the rows matching [rowIndexPredicate].
Parameters
| Parameter | Type | Default value |
|---|---|---|
rowIndexPredicate | IndexPredicate | undefined |
mouseEvent | MouseEvent | undefined |
modifiedSelectOnly | boolean | false |
Returns
void
init()
init(
f,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:181
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
BitSet
this
invert()
invert(
notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:112
Inverts a bitset.
Parameters
| Parameter | Type | Default value |
|---|---|---|
notify | boolean | true |
Returns
BitSet
or()
or(
other,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:126
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
BitSet
set()
set(
i,x,notify?):void
Defined in: js-api/src/dataframe/bit-set.ts:173
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
setAll()
setAll(
x,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:147
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
BitSet
similarityTo()
similarityTo(
b,metric?):number
Defined in: js-api/src/dataframe/bit-set.ts:229
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
similarity value
toBinaryString()
toBinaryString():
string
Defined in: js-api/src/dataframe/bit-set.ts:78
A string of 0 and 1 characters, one per bit.
Returns
string
toBitArray()
toBitArray():
BitArray
Defined in: js-api/src/dataframe/bit-set.ts:55
A BitArray holding a copy of this bitset's bits.
Returns
toString()
toString():
string
Defined in: js-api/src/dataframe/bit-set.ts:234
Returns
string
string representation of this bitset, like '0110'.
xor()
xor(
other,notify?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:133
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
BitSet
create()
staticcreate(length,f?):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:64
Creates a BitSet of the specified length with all bits set to false.
Parameters
| Parameter | Type | Description |
|---|---|---|
length | number | Number of bits. |
f? | IndexPredicate | null | when specified, Sets all bits by setting i-th bit to the results of f(i) |
Returns
BitSet
fromBitArray()
staticfromBitArray(a):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:50
Creates a BitSet holding a copy of the BitArray's bits.
Parameters
| Parameter | Type |
|---|---|
a | BitArray |
Returns
BitSet
fromBytes()
staticfromBytes(buffer,bitLength):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:37
Creates a BitSet from the ArrayBuffer representing the bitset.
Parameters
| Parameter | Type | Description |
|---|---|---|
buffer | ArrayBuffer | Packed bits, least significant bit first. |
bitLength | number | count of bits. |
Returns
BitSet
fromString()
staticfromString(zerosOnes):BitSet
Defined in: js-api/src/dataframe/bit-set.ts:30
Creates a BitSet from the string representing the bitset.
Parameters
| Parameter | Type | Description |
|---|---|---|
zerosOnes | string | A string containing '1' and '0'. |
Returns
BitSet