@packtrack/layout 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/.built/device/channel.d.ts +0 -8
- package/.built/device/channel.js +0 -12
- package/.built/device/device.d.ts +0 -11
- package/.built/device/device.js +0 -20
- package/.built/device/index.d.ts +0 -11
- package/.built/device/index.js +0 -20
- package/.built/district.d.ts +0 -22
- package/.built/district.js +0 -83
- package/.built/layout.d.ts +0 -35
- package/.built/layout.js +0 -331
- package/.built/monitor.d.ts +0 -9
- package/.built/monitor.js +0 -15
- package/.built/position.d.ts +0 -12
- package/.built/position.js +0 -45
- package/.built/positioner/index.d.ts +0 -2
- package/.built/positioner/index.js +0 -2
- package/.built/positioner/point.d.ts +0 -13
- package/.built/positioner/point.js +0 -23
- package/.built/positioner/responder-type.d.ts +0 -5
- package/.built/positioner/responder-type.js +0 -9
- package/.built/power-district/activator.d.ts +0 -7
- package/.built/power-district/activator.js +0 -8
- package/.built/power-district/index.d.ts +0 -14
- package/.built/power-district/index.js +0 -17
- package/.built/power-district/monitor.d.ts +0 -7
- package/.built/power-district/monitor.js +0 -8
- package/.built/power-district/reverser.d.ts +0 -7
- package/.built/power-district/reverser.js +0 -8
- package/.built/power-district.d.ts +0 -8
- package/.built/power-district.js +0 -14
- package/.built/route.d.ts +0 -10
- package/.built/route.js +0 -13
- package/.built/router.d.ts +0 -14
- package/.built/router.js +0 -36
- package/.built/section.d.ts +0 -40
- package/.built/section.js +0 -213
- package/.built/source/device/device.d.ts +0 -11
- package/.built/source/device/device.js +0 -24
- package/.built/source/power-district.d.ts +0 -8
- package/.built/source/power-district.js +0 -18
- package/.built/span.d.ts +0 -12
- package/.built/span.js +0 -77
- package/.built/throttle.d.ts +0 -9
- package/.built/throttle.js +0 -15
- package/.built/tile.d.ts +0 -57
- package/.built/tile.js +0 -73
- package/.built/track.d.ts +0 -12
- package/.built/track.js +0 -25
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Positioner } from ".";
|
|
2
|
-
import { Channel } from "../device/channel";
|
|
3
|
-
import { Track } from "../track";
|
|
4
|
-
import { ResponderType } from "./responder-type";
|
|
5
|
-
export declare class PointPositioner extends Positioner {
|
|
6
|
-
track: Track;
|
|
7
|
-
offset: number;
|
|
8
|
-
channel: Channel;
|
|
9
|
-
responder: ResponderType;
|
|
10
|
-
constructor(track: Track, offset: number, channel: Channel, responder: ResponderType);
|
|
11
|
-
get position(): import("..").SectionPosition;
|
|
12
|
-
dump(): void;
|
|
13
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Positioner } from ".";
|
|
2
|
-
export class PointPositioner extends Positioner {
|
|
3
|
-
track;
|
|
4
|
-
offset;
|
|
5
|
-
channel;
|
|
6
|
-
responder;
|
|
7
|
-
constructor(track, offset, channel, responder) {
|
|
8
|
-
super();
|
|
9
|
-
this.track = track;
|
|
10
|
-
this.offset = offset;
|
|
11
|
-
this.channel = channel;
|
|
12
|
-
this.responder = responder;
|
|
13
|
-
}
|
|
14
|
-
get position() {
|
|
15
|
-
return this.track.head.advance(this.offset);
|
|
16
|
-
}
|
|
17
|
-
dump() {
|
|
18
|
-
console.group('Point positioner');
|
|
19
|
-
console.log('offset:', this.offset);
|
|
20
|
-
this.channel.dump();
|
|
21
|
-
console.groupEnd();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PowerDistrictActivator } from "./activator";
|
|
2
|
-
import { District } from "../district";
|
|
3
|
-
import { PowerDistrictMonitor } from "./monitor";
|
|
4
|
-
import { PowerDistrictReverser } from "./reverser";
|
|
5
|
-
export declare class PowerDistrict {
|
|
6
|
-
name: string;
|
|
7
|
-
district: District;
|
|
8
|
-
activator?: PowerDistrictActivator;
|
|
9
|
-
reverser?: PowerDistrictReverser;
|
|
10
|
-
monitor?: PowerDistrictMonitor;
|
|
11
|
-
constructor(name: string, district: District);
|
|
12
|
-
get domainName(): string;
|
|
13
|
-
dump(): void;
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export class PowerDistrict {
|
|
2
|
-
name;
|
|
3
|
-
district;
|
|
4
|
-
activator;
|
|
5
|
-
reverser;
|
|
6
|
-
monitor;
|
|
7
|
-
constructor(name, district) {
|
|
8
|
-
this.name = name;
|
|
9
|
-
this.district = district;
|
|
10
|
-
}
|
|
11
|
-
get domainName() {
|
|
12
|
-
return `${this.name}.${this.district.domainName}`;
|
|
13
|
-
}
|
|
14
|
-
dump() {
|
|
15
|
-
console.log(this.name);
|
|
16
|
-
}
|
|
17
|
-
}
|
package/.built/power-district.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class PowerDistrict {
|
|
2
|
-
name;
|
|
3
|
-
district;
|
|
4
|
-
constructor(name, district) {
|
|
5
|
-
this.name = name;
|
|
6
|
-
this.district = district;
|
|
7
|
-
}
|
|
8
|
-
get domainName() {
|
|
9
|
-
return `${this.name}.${this.district.domainName}`;
|
|
10
|
-
}
|
|
11
|
-
dump() {
|
|
12
|
-
console.log(this.name);
|
|
13
|
-
}
|
|
14
|
-
}
|
package/.built/route.d.ts
DELETED
package/.built/route.js
DELETED
package/.built/router.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { District } from "./district";
|
|
2
|
-
import { Route } from "./route";
|
|
3
|
-
export declare class Router {
|
|
4
|
-
name: string;
|
|
5
|
-
district: District;
|
|
6
|
-
activeRoute?: Route;
|
|
7
|
-
routes: Route[];
|
|
8
|
-
constructor(name: string, district: District);
|
|
9
|
-
get domainName(): string;
|
|
10
|
-
dump(): void;
|
|
11
|
-
toDotReference(): string;
|
|
12
|
-
toDotDefinition(): string;
|
|
13
|
-
toDotConnection(): string;
|
|
14
|
-
}
|
package/.built/router.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export class Router {
|
|
2
|
-
name;
|
|
3
|
-
district;
|
|
4
|
-
activeRoute;
|
|
5
|
-
routes = [];
|
|
6
|
-
constructor(name, district) {
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.district = district;
|
|
9
|
-
}
|
|
10
|
-
get domainName() {
|
|
11
|
-
return `${this.name}.${this.district.domainName}`;
|
|
12
|
-
}
|
|
13
|
-
dump() {
|
|
14
|
-
console.group(`Router ${this.domainName}`);
|
|
15
|
-
for (let route of this.routes) {
|
|
16
|
-
route.dump();
|
|
17
|
-
}
|
|
18
|
-
console.groupEnd();
|
|
19
|
-
}
|
|
20
|
-
toDotReference() {
|
|
21
|
-
return `router_${this.name.replace(/-/g, '_')}_${this.district.toDotReference()}`;
|
|
22
|
-
}
|
|
23
|
-
toDotDefinition() {
|
|
24
|
-
return `
|
|
25
|
-
${this.toDotReference()} [ label = ${JSON.stringify(this.name)}, shape = diamond ]
|
|
26
|
-
`;
|
|
27
|
-
}
|
|
28
|
-
toDotConnection() {
|
|
29
|
-
return `
|
|
30
|
-
${this.routes.map(route => `
|
|
31
|
-
${route.in.toDotReference()} -> ${this.toDotReference()} [ headlabel = ${JSON.stringify(route.name)} ]
|
|
32
|
-
${this.toDotReference()} -> ${route.out.toDotReference()} [ taillabel = ${JSON.stringify(route.name)} ]
|
|
33
|
-
`).join('')}
|
|
34
|
-
`;
|
|
35
|
-
}
|
|
36
|
-
}
|
package/.built/section.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { District } from "./district";
|
|
2
|
-
import { SectionPosition } from "./position";
|
|
3
|
-
import { PowerDistrict } from "./power-district";
|
|
4
|
-
import { Router } from "./router";
|
|
5
|
-
import { Tile } from "./tile";
|
|
6
|
-
import { Track } from "./track";
|
|
7
|
-
export declare class Section {
|
|
8
|
-
name: string;
|
|
9
|
-
district: District;
|
|
10
|
-
powerDistrict: PowerDistrict;
|
|
11
|
-
tracks: Track[];
|
|
12
|
-
tiles: Tile[];
|
|
13
|
-
in?: Router | Section;
|
|
14
|
-
out?: Router | Section;
|
|
15
|
-
constructor(name: string, district: District);
|
|
16
|
-
get domainName(): string;
|
|
17
|
-
next(reverse: boolean): Section;
|
|
18
|
-
getTilesInRange(startPosition: SectionPosition, endPosition: SectionPosition): {
|
|
19
|
-
offset: {
|
|
20
|
-
start: number;
|
|
21
|
-
end: number;
|
|
22
|
-
};
|
|
23
|
-
tiles: Tile[];
|
|
24
|
-
};
|
|
25
|
-
dump(): void;
|
|
26
|
-
get length(): number;
|
|
27
|
-
get tileLength(): number;
|
|
28
|
-
trail(offset: number, reversed: boolean, length: number): {
|
|
29
|
-
sections: Section[];
|
|
30
|
-
tip: SectionPosition;
|
|
31
|
-
};
|
|
32
|
-
toDotReference(): string;
|
|
33
|
-
toDotDefinition(): string;
|
|
34
|
-
toDotConnection(): string;
|
|
35
|
-
toSVG(): string;
|
|
36
|
-
findSVGPositions(): {
|
|
37
|
-
x: number;
|
|
38
|
-
y: number;
|
|
39
|
-
}[];
|
|
40
|
-
}
|
package/.built/section.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { SectionPosition } from "./position";
|
|
2
|
-
import { Router } from "./router";
|
|
3
|
-
export class Section {
|
|
4
|
-
name;
|
|
5
|
-
district;
|
|
6
|
-
powerDistrict;
|
|
7
|
-
tracks = [];
|
|
8
|
-
tiles = [];
|
|
9
|
-
in;
|
|
10
|
-
out;
|
|
11
|
-
constructor(name, district) {
|
|
12
|
-
this.name = name;
|
|
13
|
-
this.district = district;
|
|
14
|
-
}
|
|
15
|
-
get domainName() {
|
|
16
|
-
return `${this.name}.${this.district.domainName}`;
|
|
17
|
-
}
|
|
18
|
-
// returns the next currently set section
|
|
19
|
-
next(reverse) {
|
|
20
|
-
if (reverse) {
|
|
21
|
-
if (!this.in) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
if (this.in instanceof Section) {
|
|
25
|
-
return this.in;
|
|
26
|
-
}
|
|
27
|
-
if (this.in instanceof Router) {
|
|
28
|
-
const activeRoute = this.in.activeRoute;
|
|
29
|
-
if (!activeRoute) {
|
|
30
|
-
throw new Error(`Router '${this.in.domainName}' has no active route`);
|
|
31
|
-
}
|
|
32
|
-
if (activeRoute.in == this) {
|
|
33
|
-
return activeRoute.out;
|
|
34
|
-
}
|
|
35
|
-
if (activeRoute.out == this) {
|
|
36
|
-
return activeRoute.in;
|
|
37
|
-
}
|
|
38
|
-
throw new Error(`Router '${this.in.domainName}' is not routing from '${this.domainName}'`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
if (!this.out) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
if (this.out instanceof Section) {
|
|
46
|
-
return this.out;
|
|
47
|
-
}
|
|
48
|
-
if (this.out instanceof Router) {
|
|
49
|
-
const activeRoute = this.out.activeRoute;
|
|
50
|
-
if (!activeRoute) {
|
|
51
|
-
throw new Error(`Router '${this.out.domainName}' has no active route`);
|
|
52
|
-
}
|
|
53
|
-
if (activeRoute.in == this) {
|
|
54
|
-
return activeRoute.out;
|
|
55
|
-
}
|
|
56
|
-
if (activeRoute.out == this) {
|
|
57
|
-
return activeRoute.in;
|
|
58
|
-
}
|
|
59
|
-
throw new Error(`Router '${this.in?.domainName}' is not routing from '${this.domainName}'`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getTilesInRange(startPosition, endPosition) {
|
|
64
|
-
if (startPosition.section != this && endPosition.section != this) {
|
|
65
|
-
return {
|
|
66
|
-
offset: {
|
|
67
|
-
start: 0,
|
|
68
|
-
end: this.tiles[this.tiles.length - 1].pattern.length
|
|
69
|
-
},
|
|
70
|
-
tiles: [...this.tiles]
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
let start = 0;
|
|
74
|
-
let end = this.length;
|
|
75
|
-
// only use the position limit if it is within our section
|
|
76
|
-
if (startPosition.section == this) {
|
|
77
|
-
end = startPosition.absolutePosition;
|
|
78
|
-
}
|
|
79
|
-
if (endPosition.section == this) {
|
|
80
|
-
start = endPosition.absolutePosition;
|
|
81
|
-
}
|
|
82
|
-
// flip if the range was reversed
|
|
83
|
-
if (end < start) {
|
|
84
|
-
const small = end;
|
|
85
|
-
end = start;
|
|
86
|
-
start = small;
|
|
87
|
-
}
|
|
88
|
-
let passed = 0;
|
|
89
|
-
const tiles = [];
|
|
90
|
-
const tileUnitLength = this.length / this.tileLength;
|
|
91
|
-
const offset = {
|
|
92
|
-
start: 0,
|
|
93
|
-
end: 0
|
|
94
|
-
};
|
|
95
|
-
for (let tile of this.tiles) {
|
|
96
|
-
const length = tile.pattern.length * tileUnitLength;
|
|
97
|
-
if (start - length <= passed && end + length >= passed) {
|
|
98
|
-
tiles.push(tile);
|
|
99
|
-
if (start <= passed) {
|
|
100
|
-
offset.start = (start + length - passed) * tile.pattern.length / length;
|
|
101
|
-
}
|
|
102
|
-
if (end >= passed) {
|
|
103
|
-
offset.end = 0.5; // (start + length - passed) * tile.pattern.length / length;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
passed += length;
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
offset,
|
|
110
|
-
tiles
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
dump() {
|
|
114
|
-
console.group(`Section ${this.domainName}`);
|
|
115
|
-
console.log('in', this.in?.name ?? 'buffer');
|
|
116
|
-
console.log('out', this.out?.name ?? 'buffer');
|
|
117
|
-
console.group(`tracks`);
|
|
118
|
-
for (let track of this.tracks) {
|
|
119
|
-
track.dump();
|
|
120
|
-
}
|
|
121
|
-
console.groupEnd();
|
|
122
|
-
console.groupEnd();
|
|
123
|
-
}
|
|
124
|
-
get length() {
|
|
125
|
-
return this.tracks.reduce((accumulator, track) => accumulator + track.length, 0);
|
|
126
|
-
}
|
|
127
|
-
get tileLength() {
|
|
128
|
-
return this.tiles.reduce((accumulator, tile) => accumulator + tile.pattern.length, 0);
|
|
129
|
-
}
|
|
130
|
-
// follow the active path ahead (reverse = true = back)
|
|
131
|
-
// uses the currently set routes
|
|
132
|
-
// returns all touched sections
|
|
133
|
-
trail(offset, reversed, length) {
|
|
134
|
-
let tip = this;
|
|
135
|
-
const sections = [this];
|
|
136
|
-
if (reversed) {
|
|
137
|
-
length -= offset;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
length -= this.length - offset;
|
|
141
|
-
}
|
|
142
|
-
while (length > 0) {
|
|
143
|
-
let next;
|
|
144
|
-
if (reversed) {
|
|
145
|
-
next = tip.in;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
next = tip.out;
|
|
149
|
-
}
|
|
150
|
-
if (!next) {
|
|
151
|
-
return {
|
|
152
|
-
sections,
|
|
153
|
-
tip: new SectionPosition(tip, tip.length, false)
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
if (next instanceof Section) {
|
|
157
|
-
tip = next;
|
|
158
|
-
}
|
|
159
|
-
if (next instanceof Router) {
|
|
160
|
-
if (!next.activeRoute) {
|
|
161
|
-
throw new Error(`Router '${next.domainName}' has no active route (routes: ${next.routes.map(route => `'${route.name}'`).join(', ')})`);
|
|
162
|
-
}
|
|
163
|
-
// TODO: handle flipped cases
|
|
164
|
-
if (reversed) {
|
|
165
|
-
tip = next.activeRoute.in;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
tip = next.activeRoute.out;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
sections.push(tip);
|
|
172
|
-
length -= tip.length;
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
sections,
|
|
176
|
-
tip: new SectionPosition(tip, reversed ? -length : tip.length + length, false)
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
toDotReference() {
|
|
180
|
-
return `section_${this.name.replace(/-/g, '_')}_${this.district.toDotReference()}`;
|
|
181
|
-
}
|
|
182
|
-
toDotDefinition() {
|
|
183
|
-
return `
|
|
184
|
-
${this.toDotReference()} [ label = ${JSON.stringify(`${this.name}\n${this.length}`)}, shape = box ]
|
|
185
|
-
`;
|
|
186
|
-
}
|
|
187
|
-
toDotConnection() {
|
|
188
|
-
return `
|
|
189
|
-
${this.out instanceof Section ? `${this.toDotReference()} -> ${this.out.toDotReference()}` : ''}
|
|
190
|
-
`;
|
|
191
|
-
}
|
|
192
|
-
toSVG() {
|
|
193
|
-
return `
|
|
194
|
-
<g id=${JSON.stringify(this.domainName).split('.').join('_')}>
|
|
195
|
-
<style>
|
|
196
|
-
|
|
197
|
-
g#${this.domainName.split('.').join('_')} path {
|
|
198
|
-
stroke: hsl(${(this.length / this.tileLength)}deg, 100%, 50%);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
</style>
|
|
202
|
-
|
|
203
|
-
${this.tiles.map(tile => tile.toSVG()).join('')}
|
|
204
|
-
</g>
|
|
205
|
-
`;
|
|
206
|
-
}
|
|
207
|
-
findSVGPositions() {
|
|
208
|
-
return this.tiles.map(tile => ({
|
|
209
|
-
x: tile.x,
|
|
210
|
-
y: tile.y
|
|
211
|
-
}));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Device = void 0;
|
|
4
|
-
class Device {
|
|
5
|
-
identifier;
|
|
6
|
-
channels = [];
|
|
7
|
-
lastDiscovery;
|
|
8
|
-
constructor(identifier) {
|
|
9
|
-
this.identifier = identifier;
|
|
10
|
-
}
|
|
11
|
-
dump() {
|
|
12
|
-
console.group(`Device ${this.identifier}`);
|
|
13
|
-
if (this.lastDiscovery) {
|
|
14
|
-
console.log(`last discovery: ${this.lastDiscovery.date.toISOString()} ${this.lastDiscovery.address}`);
|
|
15
|
-
}
|
|
16
|
-
console.group('channels');
|
|
17
|
-
for (let channel of this.channels) {
|
|
18
|
-
channel.dump();
|
|
19
|
-
}
|
|
20
|
-
console.groupEnd();
|
|
21
|
-
console.groupEnd();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.Device = Device;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PowerDistrict = void 0;
|
|
4
|
-
class PowerDistrict {
|
|
5
|
-
name;
|
|
6
|
-
district;
|
|
7
|
-
constructor(name, district) {
|
|
8
|
-
this.name = name;
|
|
9
|
-
this.district = district;
|
|
10
|
-
}
|
|
11
|
-
get domainName() {
|
|
12
|
-
return `${this.name}.${this.district.domainName}`;
|
|
13
|
-
}
|
|
14
|
-
dump() {
|
|
15
|
-
console.log(this.name);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.PowerDistrict = PowerDistrict;
|
package/.built/span.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SectionPosition } from "./position";
|
|
2
|
-
import { Section } from "./section";
|
|
3
|
-
export declare class Span {
|
|
4
|
-
head: SectionPosition;
|
|
5
|
-
inside: Section[];
|
|
6
|
-
tail: SectionPosition;
|
|
7
|
-
constructor(head: SectionPosition, inside: Section[], tail: SectionPosition);
|
|
8
|
-
contains(position: SectionPosition): boolean;
|
|
9
|
-
overlap(peer: Span): boolean;
|
|
10
|
-
get length(): number;
|
|
11
|
-
static trail(start: SectionPosition, end: SectionPosition): Span;
|
|
12
|
-
}
|
package/.built/span.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
export class Span {
|
|
2
|
-
head;
|
|
3
|
-
inside;
|
|
4
|
-
tail;
|
|
5
|
-
constructor(head, inside, tail) {
|
|
6
|
-
this.head = head;
|
|
7
|
-
this.inside = inside;
|
|
8
|
-
this.tail = tail;
|
|
9
|
-
}
|
|
10
|
-
// TODO verify reverse
|
|
11
|
-
contains(position) {
|
|
12
|
-
if (this.inside.includes(position.section)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
if (position.section == this.head.section) {
|
|
16
|
-
if (this.head.reversed) {
|
|
17
|
-
if (this.head.absolutePosition > position.absolutePosition) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
if (this.head.offset < position.absolutePosition) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (position.section == this.tail.section) {
|
|
28
|
-
if (this.tail.reversed) {
|
|
29
|
-
if (this.tail.absolutePosition < position.absolutePosition) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
if (this.tail.offset > position.absolutePosition) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
overlap(peer) {
|
|
42
|
-
return this.contains(peer.head) || this.contains(peer.tail);
|
|
43
|
-
}
|
|
44
|
-
get length() {
|
|
45
|
-
let length = 0;
|
|
46
|
-
if (this.head.reversed) {
|
|
47
|
-
length += this.head.section.length - this.head.offset;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
length += this.head.offset;
|
|
51
|
-
}
|
|
52
|
-
for (let section of this.inside) {
|
|
53
|
-
length += section.length;
|
|
54
|
-
}
|
|
55
|
-
if (this.tail.reversed) {
|
|
56
|
-
length += this.tail.section.length - this.tail.offset;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
length += this.tail.offset;
|
|
60
|
-
}
|
|
61
|
-
return length;
|
|
62
|
-
}
|
|
63
|
-
// TODO verify reverse
|
|
64
|
-
// TODO add efficient algo
|
|
65
|
-
static trail(start, end) {
|
|
66
|
-
let head = start;
|
|
67
|
-
const sections = [];
|
|
68
|
-
const increment = 1;
|
|
69
|
-
while (head.section != end.section) {
|
|
70
|
-
head = head.advance(increment);
|
|
71
|
-
if (head.section != start.section && head.section != end.section && !sections.includes(head.section)) {
|
|
72
|
-
sections.push(head.section);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return new Span(start, sections, end);
|
|
76
|
-
}
|
|
77
|
-
}
|
package/.built/throttle.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Device } from "./device";
|
|
2
|
-
import { District } from "./district";
|
|
3
|
-
import { Layout } from "./layout";
|
|
4
|
-
export declare class Throttle {
|
|
5
|
-
device: Device;
|
|
6
|
-
scope: District | Layout;
|
|
7
|
-
constructor(device: Device, scope: District | Layout);
|
|
8
|
-
dump(): void;
|
|
9
|
-
}
|