forked from Yomguithereal/mnemonist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bit-vector.d.ts
42 lines (38 loc) · 1.15 KB
/
bit-vector.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Mnemonist BitVector Typings
* ============================
*/
type BitVectorOptions = {
initialLength?: number;
initialCapacity?: number;
policy?: (capacity: number) => number;
}
export default class BitVector implements Iterable<number> {
// Members
capacity: number;
length: number;
size: number;
// Constructor
constructor(length: number);
constructor(options: BitVectorOptions);
// Methods
clear(): void;
set(index: number, value?: boolean | number): this;
reset(index: number, value: boolean | number): void;
flip(index: number, value: boolean | number): void;
reallocate(capacity: number): this;
grow(capacity?: number): this;
resize(length: number): this;
push(value: boolean | number): number;
pop(): number | undefined;
get(index: number): number;
test(index: number): boolean;
rank(r: number): number;
select(r: number): number;
forEach(callback: (index: number, value: number, set: this) => void, scope?: any): void;
values(): IterableIterator<number>;
entries(): IterableIterator<[number, number]>;
[Symbol.iterator](): IterableIterator<number>;
inspect(): any;
toJSON(): Array<number>;
}