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:1757

Properties

PropertyModifierType
dartpublicany

Accessors

anyFalse

get anyFalse(): boolean

Whether any bits are set to false.

Returns

boolean

Source

src/dataframe.ts:1819


anyTrue

get anyTrue(): boolean

Whether any bits are set to true.

Returns

boolean

Source

src/dataframe.ts:1816


falseCount

get falseCount(): number

Number of unset bits

Returns

number

Source

src/dataframe.ts:1811


length

get length(): number

Number of bits in a bitset

Returns

number

Source

src/dataframe.ts:1801


onChanged

get onChanged(): Observable<any>

Returns

Observable<any>

  • fires when the bitset gets changed.

Source

src/dataframe.ts:1955


trueCount

get trueCount(): number

Number of set bits

Returns

number

Source

src/dataframe.ts:1806


version

get version(): number

Version of the bitset

Returns

number

Source

src/dataframe.ts:1822

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:1839


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:1860


clone()

clone(): BitSet

Clones a bitset

Returns

BitSet

Source

src/dataframe.ts:1826


copyFrom()

copyFrom(b, notify): BitSet

Copies the content from the other BitSet.

Parameters

ParameterTypeDefault value
bBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1945


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:1878


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

Source

src/dataframe.ts:1886


fireChanged()

fireChanged(): void

Returns

void

Source

src/dataframe.ts:1950


get()

get(i): boolean

Gets i-th bit

Parameters

ParameterTypeDescription
inumber

Returns

boolean

Source

src/dataframe.ts:1893


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:1791


getSelectedIndexes()

getSelectedIndexes(): Int32Array

Indexes of all set bits. The result is cached.

Returns

Int32Array

Source

src/dataframe.ts:1940


handleClick()

handleClick(rowIndexPredicate, mouseEvent, modifiedSelectOnly): void

Parameters

ParameterTypeDefault value
rowIndexPredicateIndexPredicateundefined
mouseEventMouseEventundefined
modifiedSelectOnlybooleanfalse

Returns

void

Source

src/dataframe.ts:1972


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:1922


invert()

invert(notify): BitSet

Inverts a bitset.

Parameters

ParameterTypeDefault value
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1832


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:1846


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:1902


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:1869


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

Source

src/dataframe.ts:1963


toBinaryString()

toBinaryString(): string

Returns

string

Source

src/dataframe.ts:1795


toString()

toString(): string

Returns

string

Source

src/dataframe.ts:1968


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:1853


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:1782


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:1772


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:1764