-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintervalmap.d.mts
More file actions
34 lines (26 loc) · 985 Bytes
/
Copy pathintervalmap.d.mts
File metadata and controls
34 lines (26 loc) · 985 Bytes
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
import Interval from "@rawify/interval";
export default class IntervalMap<V = any> {
constructor();
set(it: Interval, val: V): this;
get(it: Interval): V | null;
delete(it: Interval): boolean;
hasOverlap(q: Interval): boolean;
getOverlapping(q: Interval): Array<{ interval: Interval; value: V }>;
getAt(x: number, getAll: true): Array<{ interval: Interval; value: V }>;
getAt(x: number, getAll?: false): V | null;
getSize(): number;
isEmpty(): boolean;
clear(): this;
forEach(fn: (interval: Interval, value: V) => void): this;
toArray(): Array<{ interval: Interval; value: V }>;
toString(): string;
clone(): IntervalMap<V>;
/**
* Build a balanced tree from pairs. When `mergeSame` is true,
* overlapping/touching intervals with equal value are coalesced first.
*/
static fromArray<V>(
pairs: Array<{ interval: Interval; value: V }>,
mergeSame?: boolean
): IntervalMap<V>;
}