-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
vector.d.ts
82 lines (70 loc) · 2.44 KB
/
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
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
/**
* Mnemonist Vector Typings
* =========================
*/
import {IArrayLikeConstructor} from './utils/types';
type VectorOptions = {
initialLength?: number;
initialCapacity?: number;
policy?: (capacity: number) => number;
}
export default class Vector implements Iterable<number> {
// Members
capacity: number;
length: number;
size: number;
// Constructor
constructor(ArrayClass: IArrayLikeConstructor, initialCapacityOrOptions: number | VectorOptions);
// Methods
clear(): void;
set(index: number, value: number): this;
reallocate(capacity: number): this;
grow(capacity?: number): this;
resize(length: number): this;
push(value: number): number;
pop(): number | undefined;
get(index: 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(): any;
// Statics
static from<I>(iterable: Iterable<I> | {[key: string]: I}, ArrayClass: IArrayLikeConstructor, capacity?: number): Vector;
}
declare class TypedVector implements Iterable<number> {
// Members
capacity: number;
length: number;
size: number;
// Constructor
constructor(initialCapacityOrOptions: number | VectorOptions);
// Methods
clear(): void;
set(index: number, value: number): this;
reallocate(capacity: number): this;
grow(capacity?: number): this;
resize(length: number): this;
push(value: number): number;
pop(): number | undefined;
get(index: 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(): any;
// Statics
static from<I>(iterable: Iterable<I> | {[key: string]: I}, capacity?: number): TypedVector;
}
export class Int8Vector extends TypedVector {}
export class Uint8Vector extends TypedVector {}
export class Uint8ClampedVector extends TypedVector {}
export class Int16Vector extends TypedVector {}
export class Uint16Vector extends TypedVector {}
export class Int32Vector extends TypedVector {}
export class Uint32Vector extends TypedVector {}
export class Float32Vector extends TypedVector {}
export class Float64Vector extends TypedVector {}
export class PointerVector extends TypedVector {}