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

Properties

PropertyModifierType
dartpublicany

Accessors

anyFalse

get anyFalse(): boolean

Whether any bits are set to false.

Returns

boolean

Source

src/dataframe.ts:1760


anyTrue

get anyTrue(): boolean

Whether any bits are set to true.

Returns

boolean

Source

src/dataframe.ts:1757


falseCount

get falseCount(): number

Number of unset bits

Returns

number

Source

src/dataframe.ts:1752


length

get length(): number

Number of bits in a bitset

Returns

number

Source

src/dataframe.ts:1742


onChanged

get onChanged(): Observable<any>

Returns

Observable<any>

  • fires when the bitset gets changed.

Source

src/dataframe.ts:1896


trueCount

get trueCount(): number

Number of set bits

Returns

number

Source

src/dataframe.ts:1747


version

get version(): number

Version of the bitset

Returns

number

Source

src/dataframe.ts:1763

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


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


clone()

clone(): BitSet

Clones a bitset

Returns

BitSet

Source

src/dataframe.ts:1767


copyFrom()

copyFrom(b, notify): BitSet

Copies the content from the other BitSet.

Parameters

ParameterTypeDefault value
bBitSetundefined
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1886


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


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


fireChanged()

fireChanged(): void

Returns

void

Source

src/dataframe.ts:1891


get()

get(i): boolean

Gets i-th bit

Parameters

ParameterTypeDescription
inumber

Returns

boolean

Source

src/dataframe.ts:1834


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


getSelectedIndexes()

getSelectedIndexes(): Int32Array

Indexes of all set bits. The result is cached.

Returns

Int32Array

Source

src/dataframe.ts:1881


handleClick()

handleClick(rowIndexPredicate, mouseEvent, modifiedSelectOnly): void

Parameters

ParameterTypeDefault value
rowIndexPredicateIndexPredicateundefined
mouseEventMouseEventundefined
modifiedSelectOnlybooleanfalse

Returns

void

Source

src/dataframe.ts:1913


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


invert()

invert(notify): BitSet

Inverts a bitset.

Parameters

ParameterTypeDefault value
notifybooleantrue

Returns

BitSet

Source

src/dataframe.ts:1773


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


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


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


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


toBinaryString()

toBinaryString(): string

Returns

string

Source

src/dataframe.ts:1736


toString()

toString(): string

Returns

string

Source

src/dataframe.ts:1909


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


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


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


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