-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
multi-set.d.ts
40 lines (36 loc) · 1.14 KB
/
multi-set.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
/**
* Mnemonist MultiSet Typings
* ===========================
*/
export default class MultiSet<K> implements Iterable<K> {
// Members
dimension: number;
size: number;
// Constructor
constructor();
// Methods
clear(): void;
add(key: K, count?: number): this;
set(key: K, count: number): this;
has(key: K): boolean;
delete(key: K): boolean;
remove(key: K, count?: number): void;
edit(a: K, b: K): this;
multiplicity(key: K): number;
count(key: K): number;
get(key: K): number;
frequency(key: K): number;
top(n: number): Array<[K, number]>;
forEach(callback: (value: K, key: K, set: this) => void, scope?: any): void;
forEachMultiplicity(callback: (value: number, key: K, set: this) => void, scope?: any): void;
keys(): IterableIterator<K>;
values(): IterableIterator<K>;
multiplicities(): IterableIterator<[K, number]>;
[Symbol.iterator](): IterableIterator<K>;
inspect(): any;
toJSON(): any;
// Statics
static from<I>(iterable: Iterable<I> | {[key: string]: I}): MultiSet<I>;
static isSubset<T>(a: MultiSet<T>, b: MultiSet<T>): boolean;
static isSuperset<T>(a: MultiSet<T>, b: MultiSet<T>): boolean;
}