main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 16 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | declare namespace DRange {
|
---|
2 | interface SubRange {
|
---|
3 | low: number;
|
---|
4 | high: number;
|
---|
5 | length: number;
|
---|
6 | }
|
---|
7 | }
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * For adding/subtracting sets of range of numbers.
|
---|
11 | */
|
---|
12 | declare class DRange {
|
---|
13 | /**
|
---|
14 | * Creates a new instance of DRange.
|
---|
15 | */
|
---|
16 | constructor(low?: number, high?: number);
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * The total length of all subranges
|
---|
20 | */
|
---|
21 | length: number;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Adds a subrange
|
---|
25 | */
|
---|
26 | add(low: number, high?: number): this;
|
---|
27 | /**
|
---|
28 | * Adds all of another DRange's subranges
|
---|
29 | */
|
---|
30 | add(drange: DRange): this;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Subtracts a subrange
|
---|
34 | */
|
---|
35 | subtract(low?: number, high?: number): this;
|
---|
36 | /**
|
---|
37 | * Subtracts all of another DRange's subranges
|
---|
38 | */
|
---|
39 | subtract(drange: DRange): this;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Keep only subranges that overlap the given subrange
|
---|
43 | */
|
---|
44 | intersect(low?: number, high?: number): this;
|
---|
45 | /**
|
---|
46 | * Intersect all of another DRange's subranges
|
---|
47 | */
|
---|
48 | intersect(drange: DRange): this;
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Get the number at the specified index
|
---|
52 | */
|
---|
53 | index(i: number): number;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Clones the drange, so that changes to it are not reflected on its clone
|
---|
57 | */
|
---|
58 | clone(): this;
|
---|
59 |
|
---|
60 | toString(): string;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Get contained numbers
|
---|
64 | */
|
---|
65 | numbers(): number[];
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Get copy of subranges
|
---|
69 | */
|
---|
70 | subranges(): DRange.SubRange[];
|
---|
71 | }
|
---|
72 |
|
---|
73 | export = DRange;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.