bitMap

bitMap

createBitMap

Creates a new bitmap sized according to the block size

createBitMap(blockSize: number): BitMap
Parameters
blockSize (number)
Returns
BitMap

setBit

Set a bit

setBit(bitMap: BitMap, i: number): BitMap
Parameters
bitMap (BitMap)
i (number)
Returns
BitMap

unsetBit

Unsets a bit

unsetBit(bitMap: BitMap, i: number): BitMap
Parameters
bitMap (BitMap)
i (number)
Returns
BitMap

allSet

Checks if the entire bitmap is set

allSet(bitMap: BitMap): boolean
Parameters
bitMap (BitMap)
Returns
boolean

allUnset

Checks if the entire bitmap is unset

allUnset(bitMap: BitMap, blockSize: number): boolean
Parameters
bitMap (BitMap)
blockSize (number)
Returns
boolean

firstUnset

Find first set algorithm If null is returned, all items have been set

firstUnset(bitMap: BitMap): (number | null)
Parameters
bitMap (BitMap)
Returns
(number | null)

isSet

Checks if a bit is set.

isSet(bitMap: BitMap, i: number): boolean
Parameters
bitMap (BitMap)
i (number)
Returns
boolean

BitMapTree

BitMapTree

BitMapTree

Class representing a lazy recursive fully-persistent bitmap tree. Only the leaf bitmaps correspond to counters. Interior bitmaps index their child bitmaps. If an interior bit is set, that means there's no free bits in the child bitmap. If an interior bit is not set, that means there's at least 1 free bit in the child bitmap. The snapshot parameter for allocate and deallocate controls how the persistence works. If a snapshot is passed in to mutation methods and a mutation occurs either by changing the current node or leaf, or creating a new parent or child, then these will always create new nodes or leafs instead of mutating the current node or leaf. If the node or leaf to be copied is already in a snapshot, then it will not bother copying unnecessarily.

new BitMapTree(blockSize: number, shrink: boolean, begin: number, depth: number, bitMap: BitMap)
Parameters
blockSize (number)
shrink (boolean)
begin (number)
depth (number)
bitMap (BitMap)

Leaf

Class representing a Leaf of the recursive bitmap tree. This represents the base case of the lazy recursive bitmap tree.

new Leaf(blockSize: number, shrink: boolean, begin: number, bitMap: BitMap)

Extends BitMapTree

Parameters
blockSize (number)
shrink (boolean)
begin (number)
bitMap (BitMap)
Instance Members
allocate(counter, callback, snapshot)
deallocate(counter, callback, snapshot)
check(counter, callback)

Node

Class representing a Node of the recursive bitmap tree.

new Node(blockSize: number, shrink: boolean, begin: number, depth: number, bitMap: BitMap, bitMapTrees: Array<Tree>)

Extends BitMapTree

Parameters
blockSize (number)
shrink (boolean)
begin (number)
depth (number)
bitMap (BitMap)
bitMapTrees (Array<Tree>)
Instance Members
allocate(counter, callback, snapshot)
deallocate(counter, callback, snapshot)
check(counter, callback)

Counter

Counter
Instance Members
allocate(counter)
deallocate(counter)
check(counter)

Counter

Class representing allocatable and deallocatable counters. Counters are allocated in sequential manner, this applies to deallocated counters. Once a counter is deallocated, it will be reused on the next allocation. This is a mutable counter, which doesn't use snapshots.

new Counter(begin: number, blockSize: number, shrink: boolean, tree: Tree)
Parameters
begin (number = 0)
blockSize (number = 32)
shrink (boolean = true)
tree (Tree)
Instance Members
allocate(counter)
deallocate(counter)
check(counter)

CounterImmutable

CounterImmutable
Instance Members
allocate(counter)
deallocate(counter)
check(counter)
transaction(callback)

CounterImmutable

Class representing allocatable and deallocatable counters. Counters are allocated in sequential manner, this applies to deallocated counters. Once a counter is deallocated, it will be reused on the next allocation. This is an immutable counter. It will return a new counter on mutation.

new CounterImmutable(begin: number, blockSize: number, shrink: boolean, tree: Tree)
Parameters
begin (number = 0)
blockSize (number = 32)
shrink (boolean = true)
tree (Tree)
Instance Members
allocate(counter)
deallocate(counter)
check(counter)
transaction(callback)

counterUtil

counterUtil