-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
36 lines (32 loc) · 1.05 KB
/
index.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
import LiveSet from 'live-set';
export class TagTreeNode<T> {
protected constructor();
getValue(): T;
getParent(): null | TagTreeNode<T>;
getOwnedByTag(tag: string): LiveSet<TagTreeNode<T>>;
getOwned(): Map<string, LiveSet<TagTreeNode<T>>>;
getTag(): null | string;
ownsNode(node: TagTreeNode<T>): boolean;
getTagOfOwnedNode(node: TagTreeNode<T>): string;
}
export interface TagTreeController<T> {
tree: TagTree<T>;
addTaggedValue(parent: TagTreeNode<T>, tag: string, value: T): TagTreeNode<T>;
removeTaggedNode(
parent: TagTreeNode<T>,
tag: string,
node: TagTreeNode<T>
): void;
end(): void;
}
export interface TagTreeInit<T> {
root: T;
tags: ReadonlyArray<{ tag: string; ownedBy?: null | ReadonlyArray<string> }>;
executor: (controller: TagTreeController<T>) => void;
}
export class TagTree<T> extends TagTreeNode<T> {
constructor(init: TagTreeInit<T>);
getNodesForValue(value: T): ReadonlyArray<TagTreeNode<T>>;
getAllByTag(tag: string): LiveSet<TagTreeNode<T>>;
getAll(): Map<string, LiveSet<TagTreeNode<T>>>;
}