Skip to main content

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

ParameterType
dartany

Returns

BitSet

Source

src/dataframe.ts:1705

Properties

PropertyModifierType
dartpublicany

Accessors

anyFalse

get anyFalse(): boolean

Whether any bits are set to false.

Returns

boolean

Source

src/dataframe.ts:1767


anyTrue

get anyTrue(): boolean

Whether any bits are set to true.

Returns

boolean

Source

src/dataframe.ts:1764


falseCount

get falseCount(): number

Number of unset bits

Returns

number

Source

src/dataframe.ts:1759


length

get length(): number

Number of bits in a bitset

Returns

number

Source

src/dataframe.ts:1749


onChanged

get onChanged(): Observable<any>

Returns

Observable<any>

  • fires when the bitset gets changed.

Source

src/dataframe.ts:1897


trueCount

get trueCount(): number

Number of set bits

Returns

number

Source

src/dataframe.ts:1754


version

get version(): number

Version of the bitset

Returns

number

Source

src/dataframe.ts:1770

Methods

and()

and(other, notify): BitSet

Modifies this bitset by performing the bitwise AND operation against the specified bitset. Returns this.

Parameters

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1787


andNot()

andNot(other, notify): BitSet

Modifies this bitset by performing the bitwise AND_NOT operation against the specified bitset. Returns this.

Parameters

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1808


clone()

clone(): BitSet

Clones a bitset

Returns

BitSet

Source

src/dataframe.ts:1774


copyFrom()

copyFrom(b, notify): BitSet

Copies the content from the other BitSet.

Parameters

ParameterTypeDefault value
bBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1887


findNext()

findNext(i, x): number

Finds the first index of value x, going forward from i-th position.

Parameters

ParameterTypeDescription
inumberindex
xboolean-

Returns

number

Source

src/dataframe.ts:1822


findPrev()

findPrev(i, x): number

Finds the first index of value x, going forward 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

Source

src/dataframe.ts:1830


fireChanged()

fireChanged(): void

Returns

void

Source

src/dataframe.ts:1892


get()

get(i): boolean

Gets i-th bit

Parameters

ParameterType
inumber

Returns

boolean

Source

src/dataframe.ts:1835


getBuffer()

getBuffer(): Int32Array

Returns the underlying storage. Be careful with the direct manipulations, as some statistics (set count, etc) are cached.

Returns

Int32Array

Source

src/dataframe.ts:1739


getSelectedIndexes()

getSelectedIndexes(): Int32Array

Indexes of all set bits. The result is cached.

Returns

Int32Array

Source

src/dataframe.ts:1882


handleClick()

handleClick(rowIndexPredicate, mouseEvent, modifiedSelectOnly): void

Parameters

ParameterTypeDefault value
rowIndexPredicateIndexPredicateundefined
mouseEventMouseEventundefined
modifiedSelectOnlybooleanfalse

Returns

void

Source

src/dataframe.ts:1914


init()

init(f, notify): BitSet

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

Source

src/dataframe.ts:1864


invert()

invert(notify): BitSet

Inverts a bitset.

Parameters

ParameterTypeDefault value
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1780


or()

or(other, notify): BitSet

Modifies this bitset by performing the bitwise OR operation against the specified bitset. Returns this.

Parameters

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1794


set()

set(i, x, notify): void

Sets i-th bit to x

Parameters

ParameterTypeDefault valueDescription
inumberundefined
xbooleanundefined
notifybooleantruewhether BitSet's changed event should be fired

Returns

void

Source

src/dataframe.ts:1844


setAll()

setAll(x, notify): BitSet

Sets all bits to x

Parameters

ParameterTypeDefault valueDescription
xbooleanundefined-
notifybooleantruewhether BitSet's changed event should be fired

Returns

BitSet

Source

src/dataframe.ts:1815


similarityTo()

similarityTo(b, metric): number

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

Source

src/dataframe.ts:1905


toBinaryString()

toBinaryString(): string

Returns

string

Source

src/dataframe.ts:1743


toString()

toString(): string

Returns

string

  • string representation of this bitset, like '0110'.

Source

src/dataframe.ts:1910


xor()

xor(other, notify): BitSet

Modifies this bitset by performing the bitwise XOR operation against the specified bitset. Returns this.

Parameters

ParameterTypeDefault value
otherBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1801


create()

static create(length, f?): BitSet

Creates a BitSet of the specified length with all bits set to false.

Parameters

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

Returns

BitSet

Source

src/dataframe.ts:1730


fromBytes()

static fromBytes(buffer, bitLength): BitSet

Creates a BitSet from the ArrayBuffer representing the bitset.

Parameters

ParameterTypeDescription
bufferArrayBufferAn array containing 1 and 0.
bitLengthnumbercount of bits.

Returns

BitSet

Source

src/dataframe.ts:1720


fromString()

static fromString(zerosOnes): BitSet

Creates a BitSet from the string representing the bitset.

Parameters

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

Returns

BitSet

Source

src/dataframe.ts:1712