@dra2020/baseclient 1.0.102 → 1.0.103
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/dist/baseclient.js +22 -24
- package/dist/baseclient.js.map +1 -1
- package/dist/poly/topo.d.ts +10 -7
- package/lib/poly/topo.ts +27 -32
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -10094,18 +10094,16 @@ exports.topoMergeFeatures = topoMergeFeatures;
|
|
|
10094
10094
|
let UniqueState = FSM.FSM_CUSTOM1;
|
|
10095
10095
|
let FSM_COMPUTING = UniqueState++;
|
|
10096
10096
|
class FsmIncrementalUnion extends FSM.Fsm {
|
|
10097
|
-
constructor(env, options, key, map) {
|
|
10097
|
+
constructor(env, options, multi, key, map) {
|
|
10098
10098
|
super(env);
|
|
10099
10099
|
this.options = options;
|
|
10100
|
+
this.multi = multi;
|
|
10100
10101
|
this.key = key;
|
|
10101
10102
|
this.result = null;
|
|
10102
10103
|
this.map = null;
|
|
10103
10104
|
if (map)
|
|
10104
10105
|
this.recompute(map);
|
|
10105
10106
|
}
|
|
10106
|
-
matches(key) {
|
|
10107
|
-
return Util.shallowEqual(this.key, key);
|
|
10108
|
-
}
|
|
10109
10107
|
recompute(map) {
|
|
10110
10108
|
if (this.map != null && map != null && Util.shallowEqual(map, this.map)) {
|
|
10111
10109
|
this.work = { nUnion: 0, nDifference: 0, ms: 0 };
|
|
@@ -10119,7 +10117,7 @@ class FsmIncrementalUnion extends FSM.Fsm {
|
|
|
10119
10117
|
let values = Object.values(map);
|
|
10120
10118
|
this.work = { nUnion: values.length, nDifference: 0, ms: 0 };
|
|
10121
10119
|
let elapsed = new Util.Elapsed();
|
|
10122
|
-
this.result = topoMergeFeatures(this.
|
|
10120
|
+
this.result = topoMergeFeatures(this.multi.allTopo(), values);
|
|
10123
10121
|
this.work.ms = elapsed.ms();
|
|
10124
10122
|
this.map = map;
|
|
10125
10123
|
}
|
|
@@ -10145,41 +10143,36 @@ class FsmTopoUnion extends FSM.Fsm {
|
|
|
10145
10143
|
constructor(env, options) {
|
|
10146
10144
|
super(env);
|
|
10147
10145
|
this.options = Util.shallowAssignImmutable(P.DefaultTickOptions, options);
|
|
10148
|
-
this.unions =
|
|
10146
|
+
this.unions = {};
|
|
10149
10147
|
this.work = { nUnion: 0, nDifference: 0, ms: 0 };
|
|
10150
10148
|
}
|
|
10151
10149
|
get result() {
|
|
10152
|
-
if (this.unions
|
|
10153
|
-
return this.unions.map((i) => ({ key: i.key, poly: i.result, work: i.work }));
|
|
10150
|
+
if (Util.countKeys(this.unions) > 0 && this.state === FSM.FSM_DONE)
|
|
10151
|
+
return Object.values(this.unions).map((i) => ({ key: i.key, poly: i.result, work: i.work }));
|
|
10154
10152
|
else
|
|
10155
10153
|
return null;
|
|
10156
10154
|
}
|
|
10157
10155
|
cancel() {
|
|
10158
|
-
this.unions.forEach((i) => {
|
|
10156
|
+
Object.values(this.unions).forEach((i) => {
|
|
10159
10157
|
i.cancel();
|
|
10160
10158
|
});
|
|
10161
|
-
this.unions =
|
|
10159
|
+
this.unions = {};
|
|
10162
10160
|
this.setState(FSM.FSM_DONE);
|
|
10163
10161
|
}
|
|
10164
10162
|
cancelOne(key) {
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
u.cancel();
|
|
10169
|
-
return;
|
|
10170
|
-
}
|
|
10171
|
-
}
|
|
10163
|
+
let u = this.unions[key];
|
|
10164
|
+
if (u)
|
|
10165
|
+
u.cancel();
|
|
10172
10166
|
}
|
|
10173
|
-
recompute(key, map) {
|
|
10174
|
-
let fsm = this.unions
|
|
10175
|
-
if (fsm == null) {
|
|
10176
|
-
fsm = new FsmIncrementalUnion(this.env, this.options, key, map);
|
|
10177
|
-
this.unions
|
|
10167
|
+
recompute(multi, key, map) {
|
|
10168
|
+
let fsm = this.unions[key];
|
|
10169
|
+
if (fsm == null || fsm.multi !== multi) {
|
|
10170
|
+
fsm = new FsmIncrementalUnion(this.env, this.options, multi, key, map);
|
|
10171
|
+
this.unions[key] = fsm;
|
|
10178
10172
|
}
|
|
10179
10173
|
else
|
|
10180
10174
|
fsm.recompute(map);
|
|
10181
10175
|
this.work = { nUnion: 0, nDifference: 0, ms: 0 };
|
|
10182
|
-
this.unions.forEach((u) => { this.work.nUnion += u.work.nUnion; this.work.nDifference += u.work.nDifference; });
|
|
10183
10176
|
this.waitOn(fsm);
|
|
10184
10177
|
this.setState(FSM_COMPUTING);
|
|
10185
10178
|
}
|
|
@@ -10188,8 +10181,13 @@ class FsmTopoUnion extends FSM.Fsm {
|
|
|
10188
10181
|
switch (this.state) {
|
|
10189
10182
|
case FSM.FSM_STARTING:
|
|
10190
10183
|
case FSM_COMPUTING:
|
|
10184
|
+
this.work = { nUnion: 0, nDifference: 0, ms: 0 };
|
|
10191
10185
|
if (this.unions)
|
|
10192
|
-
this.unions.forEach((
|
|
10186
|
+
Object.values(this.unions).forEach((i) => {
|
|
10187
|
+
this.work.ms += i.work.ms;
|
|
10188
|
+
this.work.nUnion += i.work.nUnion;
|
|
10189
|
+
this.work.nDifference += i.work.nDifference;
|
|
10190
|
+
});
|
|
10193
10191
|
this.setState(FSM.FSM_DONE);
|
|
10194
10192
|
break;
|
|
10195
10193
|
}
|