forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doublearray.d.ts
99 lines (94 loc) · 5.84 KB
/
doublearray.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Type definitions for doublearray
// Project: https://github.com/takuyaa/doublearray
// Definitions by: MIZUSHIMA Junki <https://github.com/mzsm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module doublearray {
interface KeyValue {
k: string;
v: number;
}
interface BaseAndCheck {
getBaseBuffer(): any; // Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array
getCheckBuffer(): any; // Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array
loadBaseBuffer(base_buffer: Int8Array): BaseAndCheck;
loadBaseBuffer(base_buffer: Int16Array): BaseAndCheck;
loadBaseBuffer(base_buffer: Int32Array): BaseAndCheck;
loadBaseBuffer(base_buffer: Uint8Array): BaseAndCheck;
loadBaseBuffer(base_buffer: Uint16Array): BaseAndCheck;
loadBaseBuffer(base_buffer: Uint32Array): BaseAndCheck;
loadCheckBuffer(check_buffer: Int8Array): BaseAndCheck;
loadCheckBuffer(check_buffer: Int16Array): BaseAndCheck;
loadCheckBuffer(check_buffer: Int32Array): BaseAndCheck;
loadCheckBuffer(check_buffer: Uint8Array): BaseAndCheck;
loadCheckBuffer(check_buffer: Uint16Array): BaseAndCheck;
loadCheckBuffer(check_buffer: Uint32Array): BaseAndCheck;
size(): number;
getBase(): number;
getCheck(): number;
setBase(index: number, base_value: number): void;
setCheck(index: number, check_value: number): void;
setFirstUnusedNode(index: number): void;
getFirstUnusedNode(): number;
shrink(): void;
calc(): {all: number; unused: number; efficiency: number};
dump(): string;
}
interface DoubleArrayBuilder {
bc: BaseAndCheck;
keys: KeyValue[];
append(key: string, record: number): DoubleArrayBuilder;
build(keys?: KeyValue[], sorted?: boolean): DoubleArray;
getChildrenInfo(position: number, start: number, length: number): Int32Array;
setBC(parent_id: number, children_info: Int32Array, _base: number): void;
findAllocatableBase(children_info: Int32Array): number;
isUnusedNode(index: number): boolean;
}
interface DoubleArray {
bc: BaseAndCheck;
contain(key: string): boolean;
lookup(key: string): number;
commonPrefixSearch(key: string): KeyValue;
traverse(parent: number, code: number): number;
size(): number;
calc(): {all: number; unused: number; efficiency: number};
dump(): string;
}
export function builder(initial_size?: number): DoubleArrayBuilder;
// TODO: Replace to union types in the future.
export function load(base_buffer: Int8Array, check_buffer: Int8Array): DoubleArray;
export function load(base_buffer: Int8Array, check_buffer: Int16Array): DoubleArray;
export function load(base_buffer: Int8Array, check_buffer: Int32Array): DoubleArray;
export function load(base_buffer: Int8Array, check_buffer: Uint8Array): DoubleArray;
export function load(base_buffer: Int8Array, check_buffer: Uint16Array): DoubleArray;
export function load(base_buffer: Int8Array, check_buffer: Uint32Array): DoubleArray;
export function load(base_buffer: Int16Array, check_buffer: Int8Array): DoubleArray;
export function load(base_buffer: Int16Array, check_buffer: Int16Array): DoubleArray;
export function load(base_buffer: Int16Array, check_buffer: Int32Array): DoubleArray;
export function load(base_buffer: Int16Array, check_buffer: Uint8Array): DoubleArray;
export function load(base_buffer: Int16Array, check_buffer: Uint16Array): DoubleArray;
export function load(base_buffer: Int16Array, check_buffer: Uint32Array): DoubleArray;
export function load(base_buffer: Int32Array, check_buffer: Int8Array): DoubleArray;
export function load(base_buffer: Int32Array, check_buffer: Int16Array): DoubleArray;
export function load(base_buffer: Int32Array, check_buffer: Int32Array): DoubleArray;
export function load(base_buffer: Int32Array, check_buffer: Uint8Array): DoubleArray;
export function load(base_buffer: Int32Array, check_buffer: Uint16Array): DoubleArray;
export function load(base_buffer: Int32Array, check_buffer: Uint32Array): DoubleArray;
export function load(base_buffer: Uint8Array, check_buffer: Int8Array): DoubleArray;
export function load(base_buffer: Uint8Array, check_buffer: Int16Array): DoubleArray;
export function load(base_buffer: Uint8Array, check_buffer: Int32Array): DoubleArray;
export function load(base_buffer: Uint8Array, check_buffer: Uint8Array): DoubleArray;
export function load(base_buffer: Uint8Array, check_buffer: Uint16Array): DoubleArray;
export function load(base_buffer: Uint8Array, check_buffer: Uint32Array): DoubleArray;
export function load(base_buffer: Uint16Array, check_buffer: Int8Array): DoubleArray;
export function load(base_buffer: Uint16Array, check_buffer: Int16Array): DoubleArray;
export function load(base_buffer: Uint16Array, check_buffer: Int32Array): DoubleArray;
export function load(base_buffer: Uint16Array, check_buffer: Uint8Array): DoubleArray;
export function load(base_buffer: Uint16Array, check_buffer: Uint16Array): DoubleArray;
export function load(base_buffer: Uint16Array, check_buffer: Uint32Array): DoubleArray;
export function load(base_buffer: Uint32Array, check_buffer: Int8Array): DoubleArray;
export function load(base_buffer: Uint32Array, check_buffer: Int16Array): DoubleArray;
export function load(base_buffer: Uint32Array, check_buffer: Int32Array): DoubleArray;
export function load(base_buffer: Uint32Array, check_buffer: Uint8Array): DoubleArray;
export function load(base_buffer: Uint32Array, check_buffer: Uint16Array): DoubleArray;
export function load(base_buffer: Uint32Array, check_buffer: Uint32Array): DoubleArray;
}