Skip to main content

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

ParameterType
dartany

Returns

BitSet

Properties

PropertyModifierTypeDefined in
dartpublicanyjs-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

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

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

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

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

ParameterTypeDefault value
bBitSet | BitArrayundefined
notifybooleantrue

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

ParameterTypeDescription
inumberindex
xboolean-

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

ParameterTypeDescription
inumberIndex to start searching from.
xbooleanValue 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

ParameterType
inumber

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

ParameterTypeDefault value
rowIndexPredicateIndexPredicateundefined
mouseEventMouseEventundefined
modifiedSelectOnlybooleanfalse

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

ParameterTypeDefault valueDescription
fIndexPredicateundefinedfunction that accepts bit index and returns bit value
notifybooleantruewhether 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

ParameterTypeDefault value
notifybooleantrue

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

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

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

ParameterTypeDefault valueDescription
inumberundefined-
xbooleanundefined-
notifybooleantruewhether 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

ParameterTypeDefault valueDescription
xbooleanundefined-
notifybooleantruewhether 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

ParameterTypeDefault valueDescription
bBitSetundefinedsecond BitSet.
metric"tanimoto" | "dice" | "cosine" | "sokal" | "russel" | "rogot-goldberg" | "kulczynski" | "mc-connaughey" | "asymmetric" | "braun-blanquet"SIMILARITY_METRIC.TANIMOTOsimilarity 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

BitArray


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

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

Returns

BitSet


create()

static create(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

ParameterTypeDescription
lengthnumberNumber of bits.
f?IndexPredicate | nullwhen specified, Sets all bits by setting i-th bit to the results of f(i)

Returns

BitSet


fromBitArray()

static fromBitArray(a): BitSet

Defined in: js-api/src/dataframe/bit-set.ts:50

Creates a BitSet holding a copy of the BitArray's bits.

Parameters

ParameterType
aBitArray

Returns

BitSet


fromBytes()

static fromBytes(buffer, bitLength): BitSet

Defined in: js-api/src/dataframe/bit-set.ts:37

Creates a BitSet from the ArrayBuffer representing the bitset.

Parameters

ParameterTypeDescription
bufferArrayBufferPacked bits, least significant bit first.
bitLengthnumbercount of bits.

Returns

BitSet


fromString()

static fromString(zerosOnes): BitSet

Defined in: js-api/src/dataframe/bit-set.ts:30

Creates a BitSet from the string representing the bitset.

Parameters

ParameterTypeDescription
zerosOnesstringA string containing '1' and '0'.

Returns

BitSet