@woosh/meep-engine 2.113.13 → 2.113.14

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.
Files changed (84) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/build/meep.cjs +4 -0
  3. package/build/meep.module.js +4 -0
  4. package/package.json +1 -1
  5. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  6. package/src/core/binary/BinaryBuffer.js +12 -4
  7. package/src/core/collection/array/typed/array_buffer_copy.d.ts +11 -0
  8. package/src/core/collection/array/typed/array_buffer_copy.d.ts.map +1 -0
  9. package/src/core/collection/array/typed/array_buffer_copy.js +55 -0
  10. package/src/core/collection/table/RowFirstTable.d.ts +2 -2
  11. package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
  12. package/src/core/collection/table/RowFirstTable.js +34 -23
  13. package/src/core/math/random/randomIntegerBetween.d.ts.map +1 -1
  14. package/src/core/math/random/randomIntegerBetween.js +3 -0
  15. package/src/core/model/reactive/model/ReactiveExpression.d.ts.map +1 -1
  16. package/src/core/model/reactive/model/ReactiveExpression.js +1 -1
  17. package/src/core/model/reactive/model/ReactiveUnaryExpression.d.ts +5 -1
  18. package/src/core/model/reactive/model/ReactiveUnaryExpression.d.ts.map +1 -1
  19. package/src/core/model/reactive/model/ReactiveUnaryExpression.js +4 -0
  20. package/src/core/model/reactive/model/arithmetic/ReactiveAdd.d.ts +7 -10
  21. package/src/core/model/reactive/model/arithmetic/ReactiveAdd.d.ts.map +1 -1
  22. package/src/core/model/reactive/model/arithmetic/ReactiveAdd.js +19 -13
  23. package/src/core/model/reactive/model/arithmetic/ReactiveDivide.d.ts +7 -9
  24. package/src/core/model/reactive/model/arithmetic/ReactiveDivide.d.ts.map +1 -1
  25. package/src/core/model/reactive/model/arithmetic/ReactiveDivide.js +14 -13
  26. package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.d.ts +7 -10
  27. package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.d.ts.map +1 -1
  28. package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.js +19 -13
  29. package/src/core/model/reactive/model/arithmetic/ReactiveNegate.d.ts +6 -8
  30. package/src/core/model/reactive/model/arithmetic/ReactiveNegate.d.ts.map +1 -1
  31. package/src/core/model/reactive/model/arithmetic/ReactiveNegate.js +14 -12
  32. package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.d.ts +7 -9
  33. package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.d.ts.map +1 -1
  34. package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.js +16 -14
  35. package/src/core/model/reactive/model/comparative/ReactiveEquals.d.ts +7 -10
  36. package/src/core/model/reactive/model/comparative/ReactiveEquals.d.ts.map +1 -1
  37. package/src/core/model/reactive/model/comparative/ReactiveEquals.js +18 -12
  38. package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.d.ts +7 -9
  39. package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.d.ts.map +1 -1
  40. package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.js +15 -14
  41. package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.d.ts +10 -8
  42. package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.d.ts.map +1 -1
  43. package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.js +18 -13
  44. package/src/core/model/reactive/model/comparative/ReactiveLessThan.d.ts +10 -8
  45. package/src/core/model/reactive/model/comparative/ReactiveLessThan.d.ts.map +1 -1
  46. package/src/core/model/reactive/model/comparative/ReactiveLessThan.js +18 -12
  47. package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.d.ts +10 -8
  48. package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.d.ts.map +1 -1
  49. package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.js +18 -12
  50. package/src/core/model/reactive/model/comparative/ReactiveNotEquals.d.ts +7 -10
  51. package/src/core/model/reactive/model/comparative/ReactiveNotEquals.d.ts.map +1 -1
  52. package/src/core/model/reactive/model/comparative/ReactiveNotEquals.js +18 -13
  53. package/src/core/model/reactive/model/logic/ReactiveAnd.d.ts.map +1 -1
  54. package/src/core/model/reactive/model/logic/ReactiveAnd.js +18 -13
  55. package/src/core/model/reactive/model/logic/ReactiveNot.d.ts +19 -9
  56. package/src/core/model/reactive/model/logic/ReactiveNot.d.ts.map +1 -1
  57. package/src/core/model/reactive/model/logic/ReactiveNot.js +24 -10
  58. package/src/core/model/reactive/model/logic/ReactiveOr.d.ts +7 -10
  59. package/src/core/model/reactive/model/logic/ReactiveOr.d.ts.map +1 -1
  60. package/src/core/model/reactive/model/logic/ReactiveOr.js +18 -13
  61. package/src/core/model/reactive/model/terminal/ReactiveLiteralBoolean.d.ts +9 -7
  62. package/src/core/model/reactive/model/terminal/ReactiveLiteralBoolean.d.ts.map +1 -1
  63. package/src/core/model/reactive/model/terminal/ReactiveLiteralBoolean.js +14 -11
  64. package/src/core/model/reactive/model/terminal/ReactiveLiteralNumber.d.ts +9 -7
  65. package/src/core/model/reactive/model/terminal/ReactiveLiteralNumber.d.ts.map +1 -1
  66. package/src/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +14 -11
  67. package/src/core/model/reactive/model/terminal/ReactiveLiteralString.d.ts +10 -8
  68. package/src/core/model/reactive/model/terminal/ReactiveLiteralString.d.ts.map +1 -1
  69. package/src/core/model/reactive/model/terminal/ReactiveLiteralString.js +14 -11
  70. package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
  71. package/src/core/model/reactive/model/terminal/ReactiveReference.js +25 -21
  72. package/src/core/model/reactive/model/util/createRandomReactiveExpression.d.ts +2 -2
  73. package/src/core/model/reactive/model/util/createRandomReactiveExpression.d.ts.map +1 -1
  74. package/src/core/model/reactive/model/util/createRandomReactiveExpression.js +41 -29
  75. package/src/core/model/reactive/trigger/ReactiveTrigger.d.ts.map +1 -1
  76. package/src/core/model/reactive/trigger/ReactiveTrigger.js +2 -0
  77. package/src/core/model/stat/LinearModifier.d.ts.map +1 -1
  78. package/src/core/model/stat/LinearModifier.js +4 -0
  79. package/src/core/model/scheme/Schema.d.ts +0 -38
  80. package/src/core/model/scheme/Schema.d.ts.map +0 -1
  81. package/src/core/model/scheme/Schema.js +0 -72
  82. package/src/core/model/scheme/SchemeRegistry.d.ts +0 -19
  83. package/src/core/model/scheme/SchemeRegistry.d.ts.map +0 -1
  84. package/src/core/model/scheme/SchemeRegistry.js +0 -55
@@ -13,7 +13,7 @@ export class ReactiveLiteralBoolean extends ReactiveExpression {
13
13
  constructor(v) {
14
14
  super();
15
15
 
16
- assert.typeOf(v, "boolean", 'v');
16
+ assert.isBoolean(v, 'v');
17
17
 
18
18
  //save some ram by using a dummy signal, it never fires anyway since value is constant
19
19
  this.onChanged = dummySignal;
@@ -67,6 +67,16 @@ export class ReactiveLiteralBoolean extends ReactiveExpression {
67
67
  toCode() {
68
68
  return this.value ? "true" : "false";
69
69
  }
70
+
71
+ /**
72
+ *
73
+ * @param {boolean} v
74
+ * @returns {ReactiveLiteralBoolean}
75
+ */
76
+ static from(v) {
77
+ return new ReactiveLiteralBoolean(v);
78
+ }
79
+
70
80
  }
71
81
 
72
82
  /**
@@ -87,15 +97,8 @@ ReactiveLiteralBoolean.prototype.isTerminal = true;
87
97
  ReactiveLiteralBoolean.prototype.isLiteral = true;
88
98
 
89
99
 
90
- ReactiveLiteralBoolean.prototype.isReactiveLiteralBoolean = true;
91
-
92
100
  /**
93
- *
94
- * @param {boolean} v
95
- * @returns {ReactiveLiteralBoolean}
101
+ * @readonly
102
+ * @type {boolean}
96
103
  */
97
- ReactiveLiteralBoolean.from = function (v) {
98
- const r = new ReactiveLiteralBoolean(v);
99
-
100
- return r;
101
- };
104
+ ReactiveLiteralBoolean.prototype.isReactiveLiteralBoolean = true;
@@ -1,4 +1,10 @@
1
1
  export class ReactiveLiteralNumber extends ReactiveExpression<any> {
2
+ /**
3
+ *
4
+ * @param {number} v
5
+ * @returns {ReactiveLiteralNumber}
6
+ */
7
+ static from(v: number): ReactiveLiteralNumber;
2
8
  /**
3
9
  *
4
10
  * @param {number} v
@@ -41,15 +47,11 @@ export class ReactiveLiteralNumber extends ReactiveExpression<any> {
41
47
  * @type {boolean}
42
48
  */
43
49
  readonly isLiteral: boolean;
44
- isReactiveLiteralNumber: boolean;
45
- }
46
- export namespace ReactiveLiteralNumber {
47
50
  /**
48
- *
49
- * @param {number} v
50
- * @returns {ReactiveLiteralNumber}
51
+ * @readonly
52
+ * @type {boolean}
51
53
  */
52
- function from(v: number): ReactiveLiteralNumber;
54
+ readonly isReactiveLiteralNumber: boolean;
53
55
  }
54
56
  import { ReactiveExpression } from "../ReactiveExpression.js";
55
57
  import Signal from "../../../../events/signal/Signal.js";
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveLiteralNumber.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveLiteralNumber.js"],"names":[],"mappings":"AAQA;IACI;;;OAGG;IACH,eAFW,MAAM,EAgBhB;IARG,0DAA4B;IAE5B;;;;OAIG;IACH,uBAAc;IAGlB;;;OAGG;IACH,YAFW,qBAAqB,QAI/B;IAED;;;OAGG;IACH,SAFY,qBAAqB,CAIhC;IAED,4BAMC;IAED,eAEC;IAED,6BAEC;IAED,mBAEC;IAED,iBAEC;IAGL;;;OAGG;IACH,mBAFU,WAAS,MAAM,CAEe;IAExC;;;OAGG;IACH,qBAFU,OAAO,CAEyB;IAC1C;;;OAGG;IACH,oBAFU,OAAO,CAEwB;IAGzC,iCAAuD;CApBtD;;IAsBD;;;;OAIG;IACH,gDAIC;;mCAhGkC,0BAA0B;mBAF1C,qCAAqC"}
1
+ {"version":3,"file":"ReactiveLiteralNumber.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveLiteralNumber.js"],"names":[],"mappings":"AAQA;IA6DI;;;;OAIG;IACH,eAHW,MAAM,GACJ,qBAAqB,CAIjC;IAnED;;;OAGG;IACH,eAFW,MAAM,EAgBhB;IARG,0DAA4B;IAE5B;;;;OAIG;IACH,uBAAc;IAGlB;;;OAGG;IACH,YAFW,qBAAqB,QAI/B;IAED;;;OAGG;IACH,SAFY,qBAAqB,CAIhC;IAED,4BAMC;IAED,eAEC;IAED,6BAEC;IAED,mBAEC;IAED,iBAEC;IAYL;;;OAGG;IACH,mBAFU,WAAS,MAAM,CAEe;IAExC;;;OAGG;IACH,qBAFU,OAAO,CAEyB;IAC1C;;;OAGG;IACH,oBAFU,OAAO,CAEwB;IAGzC;;;OAGG;IACH,kCAFU,OAAO,CAEsC;CAxBtD;mCAzEkC,0BAA0B;mBAH1C,qCAAqC"}
@@ -1,8 +1,8 @@
1
1
  import { assert } from "../../../../assert.js";
2
2
  import Signal from "../../../../events/signal/Signal.js";
3
3
  import DataType from "../../../../parser/simple/DataType.js";
4
- import { ReactiveExpression } from "../ReactiveExpression.js";
5
4
  import { computeHashFloat } from "../../../../primitives/numbers/computeHashFloat.js";
5
+ import { ReactiveExpression } from "../ReactiveExpression.js";
6
6
 
7
7
  const dummySignal = new Signal();
8
8
 
@@ -14,7 +14,7 @@ export class ReactiveLiteralNumber extends ReactiveExpression {
14
14
  constructor(v) {
15
15
  super();
16
16
 
17
- assert.typeOf(v, "number", 'v');
17
+ assert.isNumber(v, 'v');
18
18
 
19
19
  //save some ram by using a dummy signal, it never fires anyway since value is constant
20
20
  this.onChanged = dummySignal;
@@ -66,6 +66,15 @@ export class ReactiveLiteralNumber extends ReactiveExpression {
66
66
  toCode() {
67
67
  return this.value.toString(10);
68
68
  }
69
+
70
+ /**
71
+ *
72
+ * @param {number} v
73
+ * @returns {ReactiveLiteralNumber}
74
+ */
75
+ static from(v) {
76
+ return new ReactiveLiteralNumber(v);
77
+ }
69
78
  }
70
79
 
71
80
  /**
@@ -86,15 +95,9 @@ ReactiveLiteralNumber.prototype.isTerminal = true;
86
95
  ReactiveLiteralNumber.prototype.isLiteral = true;
87
96
 
88
97
 
89
- ReactiveLiteralNumber.prototype.isReactiveLiteralNumber = true;
90
-
91
98
  /**
92
- *
93
- * @param {number} v
94
- * @returns {ReactiveLiteralNumber}
99
+ * @readonly
100
+ * @type {boolean}
95
101
  */
96
- ReactiveLiteralNumber.from = function (v) {
97
- const r = new ReactiveLiteralNumber(v);
102
+ ReactiveLiteralNumber.prototype.isReactiveLiteralNumber = true;
98
103
 
99
- return r;
100
- };
@@ -1,6 +1,16 @@
1
1
  export class ReactiveLiteralString extends ReactiveExpression<any> {
2
+ /**
3
+ *
4
+ * @param {string} v
5
+ * @returns {ReactiveLiteralString}
6
+ */
7
+ static from(v: string): ReactiveLiteralString;
2
8
  constructor(v?: string);
3
9
  onChanged: Signal<any, any, any, any, any, any, any, any>;
10
+ /**
11
+ *
12
+ * @type {string}
13
+ */
4
14
  value: string;
5
15
  copy(other: any): void;
6
16
  clone(): ReactiveLiteralString;
@@ -30,14 +40,6 @@ export class ReactiveLiteralString extends ReactiveExpression<any> {
30
40
  */
31
41
  isReactiveLiteralString: boolean;
32
42
  }
33
- export namespace ReactiveLiteralString {
34
- /**
35
- *
36
- * @param {string} v
37
- * @returns {ReactiveLiteralString}
38
- */
39
- function from(v: string): ReactiveLiteralString;
40
- }
41
43
  import { ReactiveExpression } from "../ReactiveExpression.js";
42
44
  import Signal from "../../../../events/signal/Signal.js";
43
45
  //# sourceMappingURL=ReactiveLiteralString.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveLiteralString.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveLiteralString.js"],"names":[],"mappings":"AAQA;IACI,wBASC;IAHG,0DAA4B;IAE5B,cAAc;IAGlB,uBAEC;IAED,+BAEC;IAED,4BAMC;IAED,eAEC;IAED,6BAEC;IAED,mBAEC;IAED,iBAGC;IAGL;;;OAGG;IACH,mBAFU,WAAS,MAAM,CAEe;IAExC;;;OAGG;IACH,qBAFU,OAAO,CAEyB;IAE1C;;;OAGG;IACH,oBAFU,OAAO,CAEwB;IAEzC;;;OAGG;IACH,yBAFU,OAAO,CAEsC;CAxBtD;;IA0BD;;;;OAIG;IACH,gDAIC;;mCAnFkC,0BAA0B;mBAH1C,qCAAqC"}
1
+ {"version":3,"file":"ReactiveLiteralString.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveLiteralString.js"],"names":[],"mappings":"AAQA;IAiDI;;;;OAIG;IACH,eAHW,MAAM,GACJ,qBAAqB,CAIjC;IAvDD,wBAaC;IAPG,0DAA4B;IAE5B;;;OAGG;IACH,OAFU,MAAM,CAEF;IAGlB,uBAEC;IAED,+BAEC;IAED,4BAMC;IAED,eAEC;IAED,6BAEC;IAED,mBAEC;IAED,iBAGC;IAYL;;;OAGG;IACH,mBAFU,WAAS,MAAM,CAEe;IAExC;;;OAGG;IACH,qBAFU,OAAO,CAEyB;IAE1C;;;OAGG;IACH,oBAFU,OAAO,CAEwB;IAEzC;;;OAGG;IACH,yBAFU,OAAO,CAEsC;CAxBtD;mCA7DkC,0BAA0B;mBAH1C,qCAAqC"}
@@ -10,11 +10,15 @@ export class ReactiveLiteralString extends ReactiveExpression {
10
10
  constructor(v = '') {
11
11
  super();
12
12
 
13
- assert.typeOf(v, "string", 'v');
13
+ assert.isString(v, 'v');
14
14
 
15
15
  //save some ram by using a dummy signal, it never fires anyway since value is constant
16
16
  this.onChanged = dummySignal;
17
17
 
18
+ /**
19
+ *
20
+ * @type {string}
21
+ */
18
22
  this.value = v;
19
23
  }
20
24
 
@@ -50,6 +54,15 @@ export class ReactiveLiteralString extends ReactiveExpression {
50
54
  // TODO add escaping
51
55
  return `"${this.value}"`;
52
56
  }
57
+
58
+ /**
59
+ *
60
+ * @param {string} v
61
+ * @returns {ReactiveLiteralString}
62
+ */
63
+ static from(v) {
64
+ return new ReactiveLiteralString(v);
65
+ }
53
66
  }
54
67
 
55
68
  /**
@@ -76,13 +89,3 @@ ReactiveLiteralString.prototype.isLiteral = true;
76
89
  */
77
90
  ReactiveLiteralString.prototype.isReactiveLiteralString = true;
78
91
 
79
- /**
80
- *
81
- * @param {string} v
82
- * @returns {ReactiveLiteralString}
83
- */
84
- ReactiveLiteralString.from = function (v) {
85
- const r = new ReactiveLiteralString(v);
86
-
87
- return r;
88
- };
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveReference.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveReference.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IAEI;;;OAGG;IACH,kBAFW,MAAM,EAgBhB;IAXG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,QAFU,mDAA0C,CAElC;IAGtB;;;OAGG;IACH,YAFW,iBAAiB,QAU3B;IAED;;;OAGG;IACH,SAFY,iBAAiB,CAQ5B;IAED,gCAEC;IAED,2BAmBC;IAED,mBAQC;IAED,wBAKC;IAED,iBAEC;IAGD,eAKC;IAED,0BAGC;IAOL;;;OAGG;IACH,qBAFU,OAAO,CAEqB;IAEtC;;;OAGG;IACH,sBAFU,OAAO,CAEsB;CAZtC;;IAcD;;;;;OAKG;IACH,6DAaC;;mCArJkC,0BAA0B"}
1
+ {"version":3,"file":"ReactiveReference.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveReference.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IAkHI;;;;;OAKG;IACH,oBAJW,2CAAuC,SACvC,MAAM,GACJ,iBAAiB,CAe7B;IAnID;;;OAGG;IACH,kBAFW,MAAM,EAkBhB;IAXG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,QAFU,mDAA0C,CAElC;IAGtB;;;OAGG;IACH,YAFW,iBAAiB,QAU3B;IAED;;;OAGG;IACH,SAFY,iBAAiB,CAQ5B;IAED,gCAEC;IAED,2BAmBC;IAED,mBAQC;IAED,wBAKC;IAED,iBAEC;IAGD,eAKC;IAED,0BAGC;IA8BL;;;OAGG;IACH,qBAFU,OAAO,CAEqB;IAEtC;;;OAGG;IACH,sBAFU,OAAO,CAEsB;CAZtC;mCA7IkC,0BAA0B"}
@@ -17,6 +17,8 @@ export class ReactiveReference extends ReactiveExpression {
17
17
  constructor(name) {
18
18
  super();
19
19
 
20
+ assert.isString(name, 'name');
21
+
20
22
  /**
21
23
  *
22
24
  * @type {string}
@@ -118,6 +120,29 @@ export class ReactiveReference extends ReactiveExpression {
118
120
  getValue() {
119
121
  return this.source.getValue();
120
122
  }
123
+
124
+
125
+ /**
126
+ *
127
+ * @param {ObservedBoolean|Vector1|ObservedInteger} source
128
+ * @param {string} [name]
129
+ * @returns {ReactiveReference}
130
+ */
131
+ static from(source, name = 'undefined') {
132
+ const r = new ReactiveReference(name);
133
+
134
+ r.connect(source);
135
+
136
+ //copy source data type
137
+ if (source.isObservedBoolean) {
138
+ r.dataType = DataType.Boolean;
139
+ } else {
140
+ r.dataType = DataType.Number;
141
+ }
142
+
143
+ return r;
144
+ }
145
+
121
146
  }
122
147
 
123
148
  /**
@@ -131,24 +156,3 @@ ReactiveReference.prototype.isTerminal = true;
131
156
  * @type {boolean}
132
157
  */
133
158
  ReactiveReference.prototype.isReference = true;
134
-
135
- /**
136
- *
137
- * @param {ObservedBoolean|Vector1|ObservedInteger} source
138
- * @param {string} [name]
139
- * @returns {ReactiveReference}
140
- */
141
- ReactiveReference.from = function (source, name = 'undefined') {
142
- const r = new ReactiveReference(name);
143
-
144
- r.connect(source);
145
-
146
- //copy source data type
147
- if (source.isObservedBoolean) {
148
- r.dataType = DataType.Boolean;
149
- } else {
150
- r.dataType = DataType.Number;
151
- }
152
-
153
- return r;
154
- };
@@ -2,8 +2,8 @@
2
2
  *
3
3
  * @param {function} random
4
4
  * @param {ReactiveExpression[]} terminals
5
- * @param {number} tuples
5
+ * @param {number} [tuples] How many sub-expression to generate from terminals before aggregating them all
6
6
  * @returns {ReactiveExpression}
7
7
  */
8
- export function createRandomReactiveExpression(random: Function, terminals: ReactiveExpression[], tuples: number): ReactiveExpression;
8
+ export function createRandomReactiveExpression(random: Function, terminals: ReactiveExpression[], tuples?: number): ReactiveExpression;
9
9
  //# sourceMappingURL=createRandomReactiveExpression.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createRandomReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/util/createRandomReactiveExpression.js"],"names":[],"mappings":"AAsIA;;;;;;GAMG;AACH,4EAJW,oBAAoB,UACpB,MAAM,sBAkChB"}
1
+ {"version":3,"file":"createRandomReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/util/createRandomReactiveExpression.js"],"names":[],"mappings":"AA8GA;;;;;;GAMG;AACH,4EAJW,oBAAoB,WACpB,MAAM,sBAsEhB"}
@@ -1,9 +1,5 @@
1
- /**
2
- *
3
- * @param {ReactiveExpression} a
4
- * @param {ReactiveExpression} b
5
- * @returns {ReactiveExpression}
6
- */
1
+ import { assert } from "../../../../assert.js";
2
+ import { randomFromArray } from "../../../../math/random/randomFromArray.js";
7
3
  import DataType from "../../../../parser/simple/DataType.js";
8
4
  import { ReactiveAdd } from "../arithmetic/ReactiveAdd.js";
9
5
  import { ReactiveDivide } from "../arithmetic/ReactiveDivide.js";
@@ -19,7 +15,6 @@ import { ReactiveAnd } from "../logic/ReactiveAnd.js";
19
15
  import { ReactiveOr } from "../logic/ReactiveOr.js";
20
16
  import { ReactiveLiteralNumber } from "../terminal/ReactiveLiteralNumber.js";
21
17
  import { ReactiveLiteralString } from "../terminal/ReactiveLiteralString.js";
22
- import { randomFromArray } from "../../../../math/random/randomFromArray.js";
23
18
 
24
19
  /**
25
20
  *
@@ -46,6 +41,7 @@ function convert_to_boolean(exp) {
46
41
  * @param {function} random
47
42
  * @param {ReactiveExpression} a
48
43
  * @param {ReactiveExpression} b
44
+ * @returns {ReactiveExpression}
49
45
  */
50
46
  function join(random, a, b) {
51
47
  const dataType = a.dataType;
@@ -112,34 +108,24 @@ function add_to_type_map(exp, map) {
112
108
 
113
109
  }
114
110
 
115
- function build_level(random, nodes) {
116
- const type_map = {};
117
-
118
- const n = nodes.length;
119
-
120
- for (let i = 0; i < n; i++) {
121
- add_to_type_map(nodes[i], type_map);
122
- }
123
-
124
- for (let i = 0; i < tuples; i++) {
125
- const a = randomFromArray(random, terminals);
126
-
127
- const dataType = a.dataType;
128
-
129
- const b = randomFromArray(undefined, type_map[dataType]);
130
-
131
-
132
- }
133
- }
134
-
135
111
  /**
136
112
  *
137
113
  * @param {function} random
138
114
  * @param {ReactiveExpression[]} terminals
139
- * @param {number} tuples
115
+ * @param {number} [tuples] How many sub-expression to generate from terminals before aggregating them all
140
116
  * @returns {ReactiveExpression}
141
117
  */
142
- export function createRandomReactiveExpression(random, terminals, tuples) {
118
+ export function createRandomReactiveExpression(
119
+ random,
120
+ terminals,
121
+ tuples = Math.max(0, terminals.length - 1)
122
+ ) {
123
+ assert.isFunction(random, 'random');
124
+ assert.isFiniteNumber(tuples, 'tuples');
125
+ assert.isNonNegativeInteger(tuples, 'tuples');
126
+ assert.isArray(terminals, 'terminals');
127
+ assert.greaterThan(terminals.length, 0, 'must supply at least one terminal');
128
+
143
129
  const type_map = {};
144
130
 
145
131
  const n = terminals.length;
@@ -148,6 +134,16 @@ export function createRandomReactiveExpression(random, terminals, tuples) {
148
134
  add_to_type_map(terminals[i], type_map);
149
135
  }
150
136
 
137
+ /**
138
+ *
139
+ * @type {Set<ReactiveExpression>}
140
+ */
141
+ const visited_terminals = new Set();
142
+
143
+ /**
144
+ *
145
+ * @type {ReactiveExpression[]}
146
+ */
151
147
  const open = [];
152
148
 
153
149
  for (let i = 0; i < tuples; i++) {
@@ -160,6 +156,22 @@ export function createRandomReactiveExpression(random, terminals, tuples) {
160
156
  const t = join(random, a, b);
161
157
 
162
158
  open.push(t);
159
+
160
+ // remember
161
+ visited_terminals.add(a);
162
+ visited_terminals.add(b);
163
+ }
164
+
165
+ // include terminals that were not used in any tuples
166
+ for (let i = 0; i < terminals.length; i++) {
167
+ const terminal = terminals[i];
168
+
169
+ if (visited_terminals.has(terminal)) {
170
+ continue;
171
+ }
172
+
173
+ // tuple was not included into the tree, let's add it
174
+ open.push(terminal);
163
175
  }
164
176
 
165
177
  while (open.length > 1) {
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/trigger/ReactiveTrigger.js"],"names":[],"mappings":"AAKA;IACI;;;OAGG;IACH,kBAFW,MAAM,EAgChB;IA1BG;;;OAGG;IACH,+BAAiD;IAUjD;;;OAGG;IACH,YAFU,mBAAmB,CAET;IAUxB;;;;OAIG;IACH,mFAEC;IAED;;;;OAIG;IACH,yBAWC;IAED,mBAQC;CACJ"}
1
+ {"version":3,"file":"ReactiveTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/trigger/ReactiveTrigger.js"],"names":[],"mappings":"AAKA;IACI;;;OAGG;IACH,kBAFW,MAAM,EAgChB;IA1BG;;;OAGG;IACH,+BAAiD;IAUjD;;;OAGG;IACH,YAFU,mBAAmB,CAET;IAUxB;;;;OAIG;IACH,mFAEC;IAED;;;;OAIG;IACH,yBAaC;IAED,mBAQC;CACJ"}
@@ -55,6 +55,8 @@ export class ReactiveTrigger {
55
55
  * @param {Object} data
56
56
  */
57
57
  connect(data) {
58
+ assert.isObject(data, 'data');
59
+
58
60
  const references = this.references;
59
61
  const ref_count = references.length;
60
62
 
@@ -1 +1 @@
1
- {"version":3,"file":"LinearModifier.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/stat/LinearModifier.js"],"names":[],"mappings":";AAIA;;;GAGG;AACH;IACI;;;;OAIG;IACH,gBAJW,MAAM,MACN,MAAM,EAgChB;IAzBG;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,WAFU,OAAO,CAEK;IAG1B;;;OAGG;IACH,YAFW,cAAc,QAOxB;IAED;;;OAGG;IACH,SAFY,cAAc,CAQzB;IAED;;;OAGG;IACH,WAFW,cAAc,QAKxB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAOnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAOjB;IAED,mBAEC;IAED;;;;;MAOC;IAED;;;;;aAUC;CACJ;;sBAIS,cAAc"}
1
+ {"version":3,"file":"LinearModifier.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/stat/LinearModifier.js"],"names":[],"mappings":";AAIA;;;GAGG;AACH;IACI;;;;OAIG;IACH,gBAJW,MAAM,MACN,MAAM,EAgChB;IAzBG;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,WAFU,OAAO,CAEK;IAG1B;;;OAGG;IACH,YAFW,cAAc,QAOxB;IAED;;;OAGG;IACH,SAFY,cAAc,CAQzB;IAED;;;OAGG;IACH,WAFW,cAAc,QAKxB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAOnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAOjB;IAED,mBAEC;IAED;;;;;MAOC;IAED;;;;;aAUC;CACJ;;sBAIS,cAAc;uBAKd,cAAc"}
@@ -129,6 +129,10 @@ class LinearModifier {
129
129
  * @type {LinearModifier}
130
130
  */
131
131
  LinearModifier.CONSTANT_ONE = Object.freeze(new LinearModifier(0, 1));
132
+ /**
133
+ * @readonly
134
+ * @type {LinearModifier}
135
+ */
132
136
  LinearModifier.CONSTANT_ZERO = Object.freeze(new LinearModifier(0, 0));
133
137
 
134
138
  export default LinearModifier;
@@ -1,38 +0,0 @@
1
- export default Schema;
2
- declare class Schema {
3
- /**
4
- *
5
- * @param {String} name
6
- * @constructor
7
- */
8
- constructor(name: string);
9
- /**
10
- *
11
- * @type {String}
12
- */
13
- name: string;
14
- /**
15
- *
16
- * @type {Array.<Field>}
17
- */
18
- fields: Array<Field>;
19
- /**
20
- *
21
- * @param {String} name
22
- * @returns {Field | undefined}
23
- */
24
- getFieldByName(name: string): Field | undefined;
25
- add(name: any, type: any, multiplicity?: number): this;
26
- /**
27
- *
28
- * @param {Field} field
29
- */
30
- addField(field: Field): void;
31
- /**
32
- *
33
- * @param {Schema} other
34
- */
35
- copyFields(other: Schema): void;
36
- }
37
- import Field from "../../binary/type/Field.js";
38
- //# sourceMappingURL=Schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/scheme/Schema.js"],"names":[],"mappings":";AAIA;IACI;;;;OAIG;IACH,0BAcC;IAXG;;;OAGG;IACH,aAAgB;IAEhB;;;OAGG;IACH,QAFU,MAAO,KAAK,CAAC,CAEP;IAGpB;;;;OAIG;IACH,8BAFa,KAAK,GAAG,SAAS,CAI7B;IAED,uDAKC;IAED;;;OAGG;IACH,gBAFW,KAAK,QAWf;IAED;;;OAGG;IACH,kBAFW,MAAM,QAShB;CACJ;kBApEiB,4BAA4B"}
@@ -1,72 +0,0 @@
1
- import { assert } from "../../assert.js";
2
- import Field from "../../binary/type/Field.js";
3
- import MultiplicityType from "../../binary/type/MultiplicityType.js";
4
-
5
- class Schema {
6
- /**
7
- *
8
- * @param {String} name
9
- * @constructor
10
- */
11
- constructor(name) {
12
- assert.equal(typeof name, "string", `Name must be of type "string", instead was "${typeof name}"`);
13
-
14
- /**
15
- *
16
- * @type {String}
17
- */
18
- this.name = name;
19
-
20
- /**
21
- *
22
- * @type {Array.<Field>}
23
- */
24
- this.fields = [];
25
- }
26
-
27
- /**
28
- *
29
- * @param {String} name
30
- * @returns {Field | undefined}
31
- */
32
- getFieldByName(name) {
33
- return this.fields.find(f => f.name === name);
34
- }
35
-
36
- add(name, type, multiplicity = MultiplicityType.AtMostOne) {
37
- const field = new Field(name, type, multiplicity);
38
- this.addField(field);
39
-
40
- return this;
41
- }
42
-
43
- /**
44
- *
45
- * @param {Field} field
46
- */
47
- addField(field) {
48
- const existingField = this.getFieldByName(field.name);
49
-
50
- if (existingField !== undefined) {
51
- throw new Error(`Field "${field.name}" is already defined`);
52
- }
53
-
54
-
55
- this.fields.push(field);
56
- }
57
-
58
- /**
59
- *
60
- * @param {Schema} other
61
- */
62
- copyFields(other) {
63
- const otherFields = other.fields;
64
- for (let i = 0, l = otherFields.length; i < l; i++) {
65
- const field = otherFields[i];
66
-
67
- this.addField(field);
68
- }
69
- }
70
- }
71
-
72
- export default Schema;
@@ -1,19 +0,0 @@
1
- export default SchemeRegistry;
2
- declare class SchemeRegistry {
3
- types: {};
4
- /**
5
- *
6
- * @param {Schema} scheme
7
- * @param {Array.<String>} path
8
- * @private
9
- */
10
- private __add;
11
- add(scheme: any): void;
12
- /**
13
- *
14
- * @param {string} name
15
- * @returns {Schema|null}
16
- */
17
- get(name: string): Schema | null;
18
- }
19
- //# sourceMappingURL=SchemeRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemeRegistry.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/scheme/SchemeRegistry.js"],"names":[],"mappings":";AAAA;IAEQ,UAAe;IAGnB;;;;;OAKG;IACH,cAsBC;IAED,uBAEC;IAED;;;;OAIG;IACH,UAHW,MAAM,GACJ,SAAO,IAAI,CASvB;CACJ"}
@@ -1,55 +0,0 @@
1
- class SchemeRegistry {
2
- constructor() {
3
- this.types = {};
4
- }
5
-
6
- /**
7
- *
8
- * @param {Schema} scheme
9
- * @param {Array.<String>} path
10
- * @private
11
- */
12
- __add(scheme, path) {
13
- const name = scheme.name;
14
-
15
- if (this.types.hasOwnProperty(name)) {
16
- //type already exists, see if it's the same one
17
- if (this.types[name] === scheme) {
18
- //same scheme, nothing else to do
19
- return;
20
- } else {
21
- throw new Error(`A different scheme is already registered under name "${name}", path: /${path.join("/")}`);
22
- }
23
- }
24
-
25
- this.types[name] = scheme;
26
-
27
- //recurse over fields
28
- const fields = scheme.fields;
29
- for (let i = 0, l = fields.length; i < l; i++) {
30
- const field = fields[i];
31
-
32
- this.__add(field.type, path.concat(field.name + "::" + field.type.name));
33
- }
34
- }
35
-
36
- add(scheme) {
37
- this.__add(scheme, []);
38
- }
39
-
40
- /**
41
- *
42
- * @param {string} name
43
- * @returns {Schema|null}
44
- */
45
- get(name) {
46
- const type = this.types[name];
47
- if (type === undefined) {
48
- return null;
49
- } else {
50
- return type;
51
- }
52
- }
53
- }
54
-
55
- export default SchemeRegistry;