jclic 2.1.21 → 2.1.23

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 (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1,1081 +0,0 @@
1
- "use strict";
2
- exports.id = 5977;
3
- exports.ids = [5977,2379];
4
- exports.modules = {
5
-
6
- /***/ 2379:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11
- /* harmony export */ });
12
- /* unused harmony export AutoContentProvider */
13
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1253);
14
- /**
15
- * File : automation/AutoContentProvider.js
16
- * Created : 13/04/2015
17
- * By : Francesc Busquets <francesc@gmail.com>
18
- *
19
- * JClic.js
20
- * An HTML5 player of JClic activities
21
- * https://projectestac.github.io/jclic.js
22
- *
23
- * @source https://github.com/projectestac/jclic.js
24
- *
25
- * @license EUPL-1.2
26
- * @licstart
27
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
28
- *
29
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
30
- * the European Commission- subsequent versions of the EUPL (the "Licence");
31
- * You may not use this work except in compliance with the Licence.
32
- *
33
- * You may obtain a copy of the Licence at:
34
- * https://joinup.ec.europa.eu/software/page/eupl
35
- *
36
- * Unless required by applicable law or agreed to in writing, software
37
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
38
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
39
- * Licence for the specific language governing permissions and limitations
40
- * under the Licence.
41
- * @licend
42
- * @module
43
- */
44
-
45
-
46
-
47
- /**
48
- * This abstract class is the base for classes that create on-time automatic content for JClic
49
- * activities, usually using random parameters to assure different content in each session.
50
- *
51
- * Activities with `AutoContentProvider` objects rely on them to build new content on every start.
52
- */
53
- class AutoContentProvider {
54
- /**
55
- * AutoContentProvider constructor
56
- */
57
- constructor() {
58
- }
59
-
60
- /**
61
- * Dynamic constructor that returns a specific type of AutoContentProvider based on the `class`
62
- * attribute declared on an $xml element.
63
- * It should be called only from {@link module:Activity.Activity#setProperties Activity.setProperties}
64
- * @param {external.jQuery} $xml - The XML element to parse
65
- * @returns {module:automation/AutoContentProvider.AutoContentProvider}
66
- */
67
- static getProvider($xml) {
68
- let automation = null;
69
- if ($xml) {
70
- const
71
- className = ($xml.attr('class') || '').replace(/^edu\.xtec\.jclic\.automation\./, '@'),
72
- cl = AutoContentProvider.CLASSES[className];
73
- if (cl) {
74
- automation = new cl();
75
- automation.setProperties($xml);
76
- } else
77
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__/* .log */ .Rm)('error', `Unknown AutoContentProvider class: ${className}`);
78
- }
79
- return automation;
80
- }
81
-
82
- /**
83
- * Loads the object settings from a specific jQuery XML element
84
- * @param {external:jQuery} $xml - The XML element to parse
85
- */
86
- setProperties($xml) {
87
- this.className = ($xml.attr('class') || '').replace(/^edu\.xtec\.jclic\.automation\./, '@');
88
- return this;
89
- }
90
-
91
- /**
92
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
93
- * parent references, constants and also attributes retaining the default value.
94
- * The resulting object is commonly usued to serialize elements in JSON format.
95
- * @returns {object} - The resulting object, with minimal attrributes
96
- */
97
- getAttributes() {
98
- // To be overrided!
99
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__/* .getAttr */ .iu)(this, ['className']);
100
- }
101
-
102
- /**
103
- * Builds a new AutoContentProvider, based on the properties specified in a data object
104
- * @param {object} data - The data object to be parsed
105
- * @param {object[]} params - Optional parameters to be passed to `setAttributes`
106
- * @returns {module:shapers/Shaper.Shaper}
107
- */
108
- static factory(data, params = []) {
109
- const cl = AutoContentProvider.CLASSES[data.className];
110
- return (new cl()).setAttributes(data, ...params);
111
- }
112
-
113
- /**
114
- * Initializes the content provider
115
- */
116
- init() {
117
- // To be implemented in real content providers
118
- }
119
-
120
- /**
121
- * Builds an {@link module:automation/AutoContentProvider/ActiveBagContentKit ActiveBagContentKit} and generates the automatized content.
122
- * @param {number} nRows - Number of rows to be processed
123
- * @param {number} nCols - Number of columns to be processed
124
- * @param {module:boxes/ActiveBagContent.ActiveBagContent[]} content - Array with one or more containers of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent}
125
- * objects to be filled with new content.
126
- * @param {boolean} useIds - When `true`, the `id` field of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent} objects is significant
127
- * @returns {boolean} - `true` if the process was OK. `false` otherwise.
128
- */
129
- generateContent(nRows, nCols, content, useIds) {
130
- return this.process(new AutoContentProvider.ActiveBagContentKit(nRows, nCols, content, useIds));
131
- }
132
-
133
- /**
134
- * Generates the automatized content
135
- * @param {module:automation/AutoContentProvider.ActiveBagContentKit} _kit - The objects to be filled with content
136
- * @returns {boolean} - `true` if the process was OK. `false` otherwise.
137
- */
138
- process(_kit) {
139
- // To be implemented in subclasses
140
- return false;
141
- }
142
-
143
- /**
144
- * Registers a new type of AutoContentProvider
145
- * @param {string} providerName - The name used to identify this AutoContentProvider
146
- * @param {function} providerClass - The activity class, usually extending AutoContentProvider
147
- * @returns {module:automation/AutoContentProvider.AutoContentProvider} - The provider class
148
- */
149
- static registerClass(providerName, providerClass) {
150
- AutoContentProvider.CLASSES[providerName] = providerClass;
151
- return providerClass;
152
- }
153
- }
154
-
155
- Object.assign(AutoContentProvider.prototype, {
156
- /**
157
- * This AutoContentProvider manages numeric expressions, so text literals should be
158
- * converted to numbers for comparisions, taking in account the
159
- * number format of the current locale (dot or comma as decimal separator)
160
- * @name module:automation/AutoContentProvider.AutoContentProvider#numericContent
161
- * @type {boolean} */
162
- numericContent: false,
163
- });
164
-
165
- /**
166
- * Utility class used to encapsulate multiple sets of box contents
167
- * @param {number} nRows - Number of rows to be processed
168
- * @param {number} nCols - Number of columns to be processed
169
- * @param {module:boxes/ActiveBagContent.ActiveBagContent[]} content - Array with one or more containers of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent}
170
- * objects to be filled with new content.
171
- * @param {boolean} useIds - `true` when the `id` field of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent} objects is significant.
172
- */
173
- AutoContentProvider.ActiveBagContentKit = class {
174
- constructor(nRows, nCols, content, useIds) {
175
- this.nRows = nRows;
176
- this.nCols = nCols;
177
- this.content = content;
178
- this.useIds = useIds;
179
- }
180
- };
181
-
182
- /**
183
- * Contains the current list of classes derived from AutoContentProvider.
184
- * This object should be updated by real automation classes at declaration time.
185
- * Currently, only two types of "AutoContentProvider" are defined: {@link module:automation/arith/Arith.Arith Arith} and TagReplace.
186
- * @type {object} */
187
- AutoContentProvider.CLASSES = {
188
- // TODO: Implement TagReplace
189
- '@tagreplace.TagReplace': AutoContentProvider
190
- };
191
-
192
- // TODO: Implement TagReplace
193
- AutoContentProvider.registerClass('@tagreplace.TagReplace', AutoContentProvider);
194
-
195
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AutoContentProvider);
196
-
197
-
198
- /***/ }),
199
-
200
- /***/ 5977:
201
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
202
-
203
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
204
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
205
- /* harmony export */ });
206
- /* unused harmony export Arith */
207
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
208
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
209
- /* harmony import */ var _AutoContentProvider_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2379);
210
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1253);
211
- /**
212
- * File : automation/arith/Arith.js
213
- * Created : 28/05/2015
214
- * By : Francesc Busquets <francesc@gmail.com>
215
- *
216
- * JClic.js
217
- * An HTML5 player of JClic activities
218
- * https://projectestac.github.io/jclic.js
219
- *
220
- * @source https://github.com/projectestac/jclic.js
221
- *
222
- * @license EUPL-1.2
223
- * @licstart
224
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
225
- *
226
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
227
- * the European Commission- subsequent versions of the EUPL (the "Licence");
228
- * You may not use this work except in compliance with the Licence.
229
- *
230
- * You may obtain a copy of the Licence at:
231
- * https://joinup.ec.europa.eu/software/page/eupl
232
- *
233
- * Unless required by applicable law or agreed to in writing, software
234
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
235
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
236
- * Licence for the specific language governing permissions and limitations
237
- * under the Licence.
238
- * @licend
239
- * @module
240
- */
241
-
242
- /* global Intl */
243
-
244
-
245
-
246
-
247
-
248
- //
249
- // Miscellaneous constants used by Arith:
250
- const
251
- NMAXLOOPS = 60,
252
- OPSTR = ['+', '-', String.fromCharCode(215), ':'],
253
- RES = -12345,
254
- // Use comma as a decimal separator, based on current locale settings
255
- // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl
256
- DOTASCOMMA = Intl && Intl.NumberFormat().format(1.1).indexOf(',') > 0;
257
-
258
- /**
259
- * Arith provides randomly generated mental arithmetics operations, ready to be used in JClic activities.
260
- *
261
- * The operations can be additions, subtractions, multiplications or divides. The unknown of these
262
- * operations can be the result of the operation (`A op B = ?`), any of the two operators
263
- * (`A op ? = C` or `? op B = C`) or also the operator itself (`A ? B = C`).
264
- * @extends module:automation/AutoContentProvider.AutoContentProvider
265
- */
266
- class Arith extends _AutoContentProvider_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
267
- /**
268
- * Arith constructor
269
- */
270
- constructor() {
271
- super();
272
- this.className = '@arith.Arith';
273
- this.numericContent = true;
274
- this.opA = new Arith.Operator();
275
- this.opB = new Arith.Operator();
276
- }
277
-
278
- /**
279
- * Formats the number with a fixed number of decimals, optionally filling the result with leading
280
- * zeroes to have a fixed number of digits.
281
- * @param {number} val - The value to format
282
- * @param {number} dec - Number of decimals
283
- * @param {number} pre - Minimal number of digits before dot.
284
- * @returns {string}
285
- */
286
- static DecFormat(val, dec, pre) {
287
- let result = val.toFixed(dec);
288
- if (pre) {
289
- let n = result.indexOf('.');
290
- if (n < 0)
291
- n = result.length;
292
- for (; n < pre; n++)
293
- result = `0${result}`;
294
- }
295
- return result;
296
- }
297
-
298
- /**
299
- * Loads the object settings from a specific JQuery XML element
300
- * @override
301
- * @param {external:jQuery} $xml - The XML element to parse
302
- */
303
- setProperties($xml) {
304
- $xml.children().each((_n, child) => {
305
- const $node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(child);
306
- let xNum = '';
307
- switch (child.nodeName) {
308
- case 'operand':
309
- switch ($node.attr('id')) {
310
- case 'A':
311
- this.opA.setProperties($node);
312
- break;
313
- case 'B':
314
- this.opB.setProperties($node);
315
- break;
316
- }
317
- break;
318
- case 'operations':
319
- this.use_add = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('plus'));
320
- this.use_subst = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('minus'));
321
- this.use_mult = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('multiply'));
322
- this.use_div = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('divide'));
323
- break;
324
- case 'unknown':
325
- this.exp_abx = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('result'));
326
- this.exp_xbc = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('first'));
327
- this.exp_axc = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('last'));
328
- this.exp_axbc = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('operand'));
329
- this.exp_caxb = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('inverse'));
330
- break;
331
- case 'result':
332
- xNum = $node.attr('from');
333
- this.resultLimInf = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getNumber */ .WZ)(xNum === 'x' ? 0 : xNum, this.resultLimInf);
334
- xNum = $node.attr('to');
335
- this.resultLimSup = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getNumber */ .WZ)(xNum === 'x' ? 0 : xNum, this.resultLimSup);
336
- this.resultCarry = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('notCarry'), this.resultCarry);
337
- this.resultNoDup = !(0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('duplicates'), !this.resultNoDup);
338
- let s = $node.attr('order');
339
- this.resultOrder = s === 'ascending' ? 'SORTASC' : s === 'descending' ? 'SORTDESC' : 'NOSORT';
340
- s = $node.attr('condition');
341
- this.opCond = s === 'firstBig' ? 'AGB' : s === 'lastBig' ? 'BGA' : 'INDIF';
342
- break;
343
- }
344
- });
345
- return this;
346
- }
347
-
348
- /**
349
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
350
- * parent references, constants and also attributes retaining the default value.
351
- * The resulting object is commonly usued to serialize elements in JSON format.
352
- * @returns {object} - The resulting object, with minimal attrributes
353
- */
354
- getAttributes() {
355
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getAttr */ .iu)(this, [
356
- 'className',
357
- 'opA', 'opB', // Operator
358
- 'use_add', 'use_subst', 'use_mult', 'use_div',
359
- 'exp_abx|true', 'exp_axc|false', 'exp_xbc|false', 'exp_axbc|false', 'exp_caxb|false',
360
- 'resultLimInf|0', 'resultLimSup|9999', 'resultCarry|false', 'resultNoDup|false', 'resultOrder|NOSORT',
361
- 'opCond|INDIF'
362
- ]);
363
- }
364
-
365
- /**
366
- * Reads the properties of this Arith object from a dataset
367
- * @param {object} data - The data object to be parsed
368
- * @returns {object}
369
- */
370
- setAttributes(data) {
371
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .setAttr */ .ob)(this, data, [
372
- 'className',
373
- { key: 'opA', fn: Arith.Operator },
374
- { key: 'opB', fn: Arith.Operator },
375
- 'use_add', 'use_subst', 'use_mult', 'use_div',
376
- 'exp_abx', 'exp_axc', 'exp_xbc', 'exp_axbc', 'exp_caxb',
377
- 'resultLimInf', 'resultLimSup', 'resultCarry', 'resultNoDup', 'resultOrder',
378
- 'opCond',
379
- ]);
380
- }
381
-
382
- /**
383
- * Fills the `n` parameter (an {@link module:automation/arith/Arith.Num Num}) with a value in accordance with the
384
- * specifications of `op` (an {@link module:automation/arith/Arith.Operator Operator}), between two limits.
385
- * @param {module:automation/arith/Arith.Num} n - The number
386
- * @param {module:automation/arith/Arith.Operator} op - The operator
387
- * @param {number} limInf2 - Lower limit
388
- * @param {number} limSup2 - Upper limit
389
- * @returns {boolean} - `true` if all was OK
390
- */
391
- genNum(n, op, limInf2, limSup2) {
392
- let solved = false;
393
- n.c = op.numDec;
394
- const exp = n.c === 0 ? 1 : n.c === 1 ? 10 : 100;
395
-
396
- let ls = op.limSup;
397
- if (limSup2 !== RES && limSup2 < ls)
398
- ls = limSup2;
399
- let li = op.limInf;
400
- if (limInf2 !== RES && limInf2 > li)
401
- li = limInf2;
402
-
403
- if (op.fromList > 0) {
404
- n.vf = op.lst[Math.floor(Math.random() * op.fromList)];
405
- solved = true;
406
- }
407
- if (!solved) {
408
- const r = Math.floor(Math.random() * 100);
409
- if (op.wZero && r <= 10) {
410
- n.vf = 0;
411
- solved = true;
412
- } else if (op.wOne && r > 10 && r <= 20) {
413
- n.vf = 1;
414
- solved = true;
415
- } else if (op.wMinusOne && r > 20 && r <= 30) {
416
- n.vf = -1;
417
- solved = true;
418
- }
419
- }
420
- if (!solved) {
421
- if (li > ls) {
422
- const k = li;
423
- li = ls;
424
- ls = k;
425
- }
426
- let rang = Math.floor(ls - li + 1);
427
- if (rang < 0)
428
- rang = 1;
429
- let v = (Math.floor(Math.random() * rang) + li) * exp;
430
- if (exp > 1)
431
- v += Math.floor(Math.random() * exp);
432
- n.vf = v / exp;
433
- }
434
- return true;
435
- }
436
-
437
- /**
438
- * Fills the provided {@link module:automation/arith/Arith.Operator Operator} with real values
439
- * @param {module:automation/arith/Arith.Operator} o - The operator to use to generate the operation
440
- * @returns {boolean} - `true` if all was OK
441
- */
442
- genOp(o) {
443
- let i, ri2, rs2, q, va, vb, bufa, bufb;
444
- const
445
- ops = [],
446
- rlinf = this.resultLimInf,
447
- rlsup = this.resultLimSup;
448
-
449
- let nops = 0;
450
- if (this.use_add)
451
- ops[nops++] = 'SUM';
452
- if (this.use_subst)
453
- ops[nops++] = 'REST';
454
- if (this.use_mult)
455
- ops[nops++] = 'MULT';
456
- if (this.use_div)
457
- ops[nops++] = 'DIV';
458
-
459
- const op = ops[Math.floor(Math.random() * nops)];
460
- switch (op) {
461
- case 'SUM':
462
- for (i = 0; i < NMAXLOOPS; i++) {
463
- this.genNum(o.numA, this.opA, this.RES, rlsup);
464
- ri2 = o.numA.vf < rlinf ? rlinf - Math.floor(o.numA.vf) : this.RES;
465
- rs2 = rlsup - Math.floor(o.numA.vf);
466
- switch (this.opCond) {
467
- case 'AGB':
468
- if (rs2 === this.RES || rs2 > o.numA.vf)
469
- rs2 = Math.floor(o.numA.vf);
470
- break;
471
- case 'BGA':
472
- if (ri2 === this.RES || ri2 < o.numA.vf)
473
- ri2 = Math.floor(o.numA.vf);
474
- break;
475
- }
476
- this.genNum(o.numB, this.opB, ri2, rs2);
477
- o.numR.vf = o.numA.vf + o.numB.vf;
478
- if (o.numR.vf >= rlinf && o.numR.vf <= rlsup)
479
- break;
480
- }
481
- o.numR.c = o.numA.c > o.numB.c ? o.numA.c : o.numB.c;
482
- o.op = 0;
483
- if (this.resultCarry && o.numA.vf > 0 && o.numB.vf > 0) {
484
- q = o.numR.c === 2 ? 100 : o.numR.c === 1 ? 10 : 1;
485
-
486
- bufa = Arith.DecFormat(Math.floor(o.numA.vf * q + 0.5), 0, 10).split('');
487
- bufb = Arith.DecFormat(Math.floor(o.numB.vf * q + 0.5), 0, 10).split('');
488
- for (i = 0; i < 10; i++)
489
- if (bufa[i] !== '0' || bufb[i] !== '0')
490
- break;
491
- for (; i < 10; i++) {
492
- va = parseInt(bufa[i]);
493
- vb = parseInt(bufb[i]);
494
- if (va + vb < 10)
495
- continue;
496
- while (va + vb > 9) {
497
- if (va > vb)
498
- va = va > 0 ? Math.floor(Math.random() * va) : 0;
499
- else
500
- vb = vb > 0 ? Math.floor(Math.random() * vb) : 0;
501
- }
502
- bufa[i] = va.toFixed(0);
503
- bufb[i] = vb.toFixed(0);
504
- }
505
-
506
- o.numA.vf = parseInt(bufa.join('')) / q;
507
- o.numB.vf = parseInt(bufb.join('')) / q;
508
- // Corrected 2019/02/11: Factors should be multiplied by 'q'!
509
- // INCORRECT: o.numR.vf = Math.floor(o.numA.vf + o.numB.vf + 0.5) / q
510
- o.numR.vf = Math.floor(o.numA.vf * q + o.numB.vf * q + 0.5) / q;
511
- }
512
- break;
513
-
514
- case 'REST':
515
- for (i = 0; i < NMAXLOOPS; i++) {
516
- this.genNum(o.numA, this.opA, rlinf, this.RES);
517
- ri2 = o.numA.vf > rlsup ? Math.floor(o.numA.vf - rlsup) : this.RES;
518
- rs2 = Math.floor(o.numA.vf - rlinf);
519
- switch (this.opCond) {
520
- case 'AGB':
521
- if (rs2 === this.RES || rs2 > o.numA.vf)
522
- rs2 = Math.floor(o.numA.vf);
523
- break;
524
- case 'BGA':
525
- if (ri2 === this.RES || ri2 < o.numA.vf)
526
- ri2 = Math.floor(o.numA.vf);
527
- break;
528
- }
529
- this.genNum(o.numB, this.opB, ri2, rs2);
530
- o.numR.vf = o.numA.vf - o.numB.vf;
531
- if (o.numR.vf >= rlinf && o.numR.vf <= rlsup)
532
- break;
533
- }
534
- o.numR.c = o.numA.c > o.numB.c ? o.numA.c : o.numB.c;
535
- o.op = 1;
536
- if (this.resultCarry && o.numA.vf > 0 && o.numB.vf > 0 && o.numA.vf >= o.numB.vf) {
537
- q = o.numR.c === 2 ? 100 : o.numR.c === 1 ? 10 : 1;
538
- bufa = Arith.DecFormat(Math.floor(o.numA.vf * q + 0.5), 0, 10).split('');
539
- bufb = Arith.DecFormat(Math.floor(o.numB.vf * q + 0.5), 0, 10).split('');
540
- for (i = 0; i < 10; i++)
541
- if (bufb[i] !== '0')
542
- break;
543
- for (; i < 10; i++) {
544
- va = parseInt(bufa[i]);
545
- vb = parseInt(bufb[i]);
546
- if (va >= vb)
547
- continue;
548
- vb = va > 0 ? Math.floor(Math.random() * va) : 0;
549
- bufb[i] = vb.toFixed(0);
550
- }
551
-
552
- o.numA.vf = parseInt(bufa.join('')) / q;
553
- o.numB.vf = parseInt(bufb.join('')) / q;
554
- // Corrected 2019/02/11: Factors should be multiplied by 'q'!
555
- // o.numR.vf = Math.floor(o.numA.vf - o.numB.vf + 0.5) / q
556
- o.numR.vf = Math.floor(o.numA.vf * q - o.numB.vf * q + 0.5) / q;
557
- }
558
- break;
559
-
560
- case 'MULT':
561
- for (i = 0; i < NMAXLOOPS; i++) {
562
- this.genNum(o.numA, this.opA, this.RES, this.RES);
563
- ri2 = this.opB.limInf;
564
- rs2 = this.opB.limSup;
565
- switch (this.opCond) {
566
- case 'AGB':
567
- if (rs2 > o.numA.vf)
568
- rs2 = Math.floor(o.numA.vf);
569
- break;
570
- case 'BGA':
571
- if (ri2 < o.numA.vf)
572
- ri2 = Math.floor(o.numA.vf);
573
- break;
574
- }
575
- this.genNum(o.numB, this.opB, ri2, rs2);
576
- o.numR.vf = o.numA.vf * o.numB.vf;
577
- if (o.numR.vf >= rlinf && o.numR.vf <= rlsup)
578
- break;
579
- }
580
- o.numR.c = o.numA.c + o.numB.c;
581
- o.op = 2;
582
- break;
583
-
584
- case 'DIV':
585
- for (i = 0; i < NMAXLOOPS; i++) {
586
- this.genNum(o.numA, this.opA, this.RES, this.RES);
587
- ri2 = this.opB.limInf;
588
- rs2 = this.opB.limSup;
589
- switch (this.opCond) {
590
- case 'AGB':
591
- if (rs2 > o.numA.vf)
592
- rs2 = Math.floor(o.numA.vf);
593
- break;
594
- case 'BGA':
595
- if (ri2 < o.numA.vf)
596
- ri2 = Math.floor(o.numA.vf);
597
- break;
598
- }
599
- this.genNum(o.numB, this.opB, ri2, rs2);
600
- if (o.numB.vf !== 0 &&
601
- Math.abs(o.numA.vf) >= Math.abs(o.numB.vf) &&
602
- (o.numR.vf = o.numA.vf / o.numB.vf) >= rlinf &&
603
- o.numR.vf <= rlsup)
604
- break;
605
- }
606
- if (o.numB.vf === 0)
607
- o.numB.vf = 1;
608
- o.numR.vf = o.numA.vf / o.numB.vf;
609
- i = o.numA.c - o.numB.c;
610
- q = Math.pow(10, i);
611
- o.numA.vf *= q;
612
- o.numR.vf *= q;
613
- o.numR.vf = Math.floor(o.numR.vf);
614
- o.numA.vf = o.numR.vf * o.numB.vf;
615
- o.numA.vf /= q;
616
- o.numR.vf /= q;
617
- o.numR.c = i > 0 ? i : 0;
618
- o.op = 3;
619
- break;
620
-
621
- default:
622
- return false;
623
- }
624
- return true;
625
- }
626
-
627
- /**
628
- * Fills the provided ActiveBagContentKit with randomly generated operations
629
- * @override
630
- * @param {module:automation/AutoContentProvider.ActiveBagContentKit} kit - The composite object to be filled with data.
631
- * @returns {boolean} - `true` if all was OK
632
- */
633
- process(kit) {
634
- let nRows = kit.nRows,
635
- nCols = kit.nCols,
636
- content = kit.content, //Array of ActiveBagContent
637
- useIds = kit.useIds,
638
- i, j, k,
639
- o, op = [], // Array of Arith.Operation
640
- tipus = [],
641
- numTipus, tipX,
642
- tipInv = this.exp_caxb,
643
- va = '', vb = '', vc = '', operator = '',
644
- stra = [], strb = [], strc = [],
645
- nColsB = nCols, nRowsB = nRows,
646
- nCells = nRows * nCols,
647
- ass = null;
648
-
649
- if (nRows <= 0 || nCols <= 0 ||
650
- content === null || content.length < 1 || content[0] === null)
651
- return false;
652
-
653
- if (nCells < 2)
654
- return false;
655
-
656
- numTipus = 0;
657
- if (this.exp_abx)
658
- tipus[numTipus++] = 'ABX';
659
- if (this.exp_axc)
660
- tipus[numTipus++] = 'AXC';
661
- if (this.exp_xbc)
662
- tipus[numTipus++] = 'XBC';
663
- if (this.exp_axbc)
664
- tipus[numTipus++] = 'AXBC';
665
- if (numTipus === 0)
666
- return false;
667
-
668
- for (i = 0; i < nCells; i++) {
669
- o = new Arith.Operation();
670
- for (j = 0; j < NMAXLOOPS; j++) {
671
- this.genOp(o);
672
- if (this.resultNoDup) {
673
- for (k = 0; k < i; k++) {
674
- if (o.numR.vf === op[k].numR.vf)
675
- break;
676
- }
677
- if (k === i)
678
- break;
679
- } else
680
- break;
681
- }
682
- op[i] = o;
683
- }
684
-
685
- if (this.resultOrder !== 0) {
686
- for (i = nCells - 1; i > 0; i--) {
687
- for (j = 0; j < i; j++) {
688
- if (this.resultOrder === 'SORTASC' && op[j].numR.vf > op[j + 1].numR.vf ||
689
- this.resultOrder === 'SORTDESC' && op[j].numR.vf < op[j + 1].numR.vf) {
690
- // Switch values
691
- o = op[j];
692
- op[j] = op[j + 1];
693
- op[j + 1] = o;
694
- }
695
- }
696
- }
697
- }
698
-
699
- for (i = 0; i < nCells; i++) {
700
- tipX = tipus[Math.floor(Math.random() * numTipus)];
701
- va = Arith.DecFormat(op[i].numA.vf, op[0].numA.c);
702
- vb = Arith.DecFormat(op[i].numB.vf, op[0].numB.c);
703
- vc = Arith.DecFormat(op[i].numR.vf, op[0].numR.c);
704
- operator = OPSTR[op[i].op];
705
-
706
- // Use the special blank space ASCII 160 (\xA0) instead of regular blank spaces
707
-
708
- if (tipInv)
709
- strc[i] = `${vc}\xA0=\xA0${va}\xA0${operator}\xA0${vb}`;
710
- else
711
- strc[i] = `${va}\xA0${operator}\xA0${vb}\xA0=\xA0${vc}`;
712
-
713
- switch (tipX) {
714
- case 'AXC':
715
- strb[i] = vb;
716
- stra[i] = tipInv ? `${vc}\xA0=\xA0${va}\xA0${operator}\xA0?` : `${va}\xA0${operator}\xA0?\xA0=\xA0${vc}`;
717
- break;
718
-
719
- case 'XBC':
720
- strb[i] = va;
721
- stra[i] = tipInv ? `${vc}\xA0=\xA0?\xA0${operator}\xA0${vb}` : `?\xA0${operator}\xA0${vb}\xA0=\xA0${vc}`;
722
- break;
723
-
724
- case 'AXBC':
725
- strb[i] = operator;
726
- stra[i] = tipInv ? `${vc}\xA0=\xA0${va}\xA0?\xA0${vb}` : `${va}\xA0?\xA0${vb}\xA0=\xA0${vc}`;
727
- break;
728
-
729
- default:
730
- strb[i] = vc;
731
- stra[i] = tipInv ? `?\xA0=\xA0${va}\xA0${operator}\xA0${vb}` : `${va}\xA0${operator}\xA0${vb}\xA0=`;
732
- break;
733
- }
734
- }
735
-
736
- if (useIds) {
737
- ass = [];
738
- let strbx = [];
739
- k = 0;
740
- for (i = 0; i < nCells; i++) {
741
- for (j = 0; j < k; j++)
742
- if (strb[i] === strbx[j])
743
- break;
744
- if (j === k) {
745
- strbx[k] = strb[i];
746
- ass[i] = k;
747
- k++;
748
- } else
749
- ass[i] = j;
750
- }
751
-
752
- strb = [];
753
- for (i = 0; i < k; i++)
754
- strb[i] = strbx[i];
755
-
756
- if (nRowsB * nColsB !== k) {
757
- let distH = false;
758
- switch (k) {
759
- case 6:
760
- nRowsB = distH ? 2 : 3;
761
- nColsB = distH ? 3 : 2;
762
- break;
763
-
764
- case 8:
765
- nRowsB = distH ? 2 : 4;
766
- nColsB = distH ? 4 : 2;
767
- break;
768
-
769
- case 9:
770
- nRowsB = 3;
771
- nColsB = 3;
772
- break;
773
-
774
- case 10:
775
- nRowsB = distH ? 2 : 5;
776
- nColsB = distH ? 5 : 2;
777
- break;
778
-
779
- case 12:
780
- nRowsB = distH ? 3 : 4;
781
- nColsB = distH ? 4 : 3;
782
- break;
783
-
784
- case 14:
785
- nRowsB = distH ? 2 : 7;
786
- nColsB = distH ? 7 : 2;
787
- break;
788
-
789
- case 15:
790
- nRowsB = distH ? 3 : 5;
791
- nColsB = distH ? 3 : 5;
792
- break;
793
-
794
- case 16:
795
- nRowsB = 4;
796
- nColsB = 4;
797
- break;
798
-
799
- case 18:
800
- nRowsB = distH ? 6 : 3;
801
- nColsB = distH ? 3 : 6;
802
- break;
803
-
804
- case 20:
805
- nRowsB = distH ? 4 : 5;
806
- nColsB = distH ? 5 : 4;
807
- break;
808
-
809
- default:
810
- nRowsB = distH ? 1 : k;
811
- nColsB = distH ? k : 1;
812
- break;
813
- }
814
- }
815
- }
816
-
817
- // Added 2019/02/11
818
- // Use comma instead of dot for decimal separator, accordingly to current locale
819
- if (DOTASCOMMA) {
820
- function replaceDot(s) { return s.replace(/\./g, ','); }
821
- stra = stra.map(replaceDot);
822
- strb = strb.map(replaceDot);
823
- strc = strc.map(replaceDot);
824
- }
825
-
826
- content[0].setTextContent(stra, nCols, nRows);
827
- if (ass !== null)
828
- content[0].setIds(ass);
829
- if (content.length > 1 && content[1] !== null) {
830
- content[1].setTextContent(strb, nColsB, nRowsB);
831
- content[1].getShaper().reset(nColsB, nRowsB);
832
- }
833
- if (content.length > 2 && content[2] !== null)
834
- content[2].setTextContent(strc, nCols, nRows);
835
-
836
- return true;
837
- }
838
- }
839
-
840
- Object.assign(Arith.prototype, {
841
- //
842
- // Operations use two operators:
843
- /**
844
- * First operator
845
- * @name module:automation/arith/Arith.Arith#opA
846
- * @type {module:automation/arith/Arith.Operator} */
847
- opA: null,
848
- /**
849
- * Second operator
850
- * @name module:automation/arith/Arith.Arith#opB
851
- * @type {module:automation/arith/Arith.Operator} */
852
- opB: null,
853
- /**
854
- * Allow additions
855
- * @name module:automation/arith/Arith.Arith#use_add
856
- * @type {boolean} */
857
- use_add: true,
858
- /**
859
- * Allow subtractions
860
- * @name module:automation/arith/Arith.Arith#use_subst
861
- * @type {boolean} */
862
- use_subst: false,
863
- /**
864
- * Allow multiplications
865
- * @name module:automation/arith/Arith.Arith#use_mult
866
- * @type {boolean} */
867
- use_mult: false,
868
- /**
869
- * Allow divides
870
- * @name module:automation/arith/Arith.Arith#use_div
871
- * @type {boolean} */
872
- use_div: false,
873
- /**
874
- * Allow expressions of type `A op B = X`
875
- * @name module:automation/arith/Arith.Arith#exp_abx
876
- * @type {boolean} */
877
- exp_abx: true,
878
- /**
879
- * Allow expressions of type `A op X = C`
880
- * @name module:automation/arith/Arith.Arith#exp_axc
881
- * @type {boolean} */
882
- exp_axc: false,
883
- /**
884
- * Allow expressions of type `X op B = C`
885
- * @name module:automation/arith/Arith.Arith#exp_xbc
886
- * @type {boolean} */
887
- exp_xbc: false,
888
- /**
889
- * Allow expressions of type `A x B = C`
890
- * @name module:automation/arith/Arith.Arith#exp_axbc
891
- * @type {boolean} */
892
- exp_axbc: false,
893
- /**
894
- * Allow inverse expressions, like `C = A op B`
895
- * @name module:automation/arith/Arith.Arith#exp_caxb
896
- * @type {boolean} */
897
- exp_caxb: false,
898
- /**
899
- * Lower limit of the result
900
- * @name module:automation/arith/Arith.Arith#resultLimInf
901
- * @type {number} */
902
- resultLimInf: 0,
903
- /**
904
- * Upper limit of the result
905
- * @name module:automation/arith/Arith.Arith#resultLimSup
906
- * @type {number} */
907
- resultLimSup: 9999,
908
- /**
909
- * Allow carry operations
910
- * @see {@link https://en.wikipedia.org/wiki/Carry_(arithmetic)}
911
- * @name module:automation/arith/Arith.Arith#resultCarry
912
- * @type {boolean} */
913
- resultCarry: false,
914
- /**
915
- * Avoid operations with the same result
916
- * @name module:automation/arith/Arith.Arith#resultNoDup
917
- * @type {boolean} */
918
- resultNoDup: false,
919
- /**
920
- * Type of sorting of results. Possible values are: 'NOSORT', 'SORTASC' and 'SORTDESC'
921
- * @name module:automation/arith/Arith.Arith#resultOrder
922
- * @type {string} */
923
- resultOrder: 'NOSORT',
924
- /**
925
- * Sorting of the operands in commutative operations. Possible values are: 'AGB' (_A greater than B_),
926
- * 'BGA' (_B greater tan A_) and 'INDIF' (default)
927
- * @name module:automation/arith/Arith.Arith#opCond
928
- * @type {string} */
929
- opCond: 'INDIF',
930
- });
931
-
932
- /**
933
- * Operator is an Utility class used by Arith to encapsulate the properties and methods related
934
- * to the members of the operations.
935
- */
936
- Arith.Operator = class {
937
- constructor() {
938
- }
939
-
940
- /**
941
- * Loads Operator settings from a specific JQuery XML element
942
- * @param {external:jQuery} $xml - The XML element to parse
943
- */
944
- setProperties($xml) {
945
- // Read attributes
946
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .attrForEach */ .GM)($xml.get(0).attributes, (name, val) => {
947
- switch (name) {
948
- case 'decimals':
949
- this.numDec = Number(val);
950
- break;
951
-
952
- case 'values':
953
- this.lst = val.split(' ').map(v => Number(v));
954
- this.fromList = this.lst.length;
955
- break;
956
-
957
- case 'from':
958
- this.limInf = Number(val === 'x' ? 0 : val);
959
- break;
960
-
961
- case 'to':
962
- this.limSup = Number(val === 'x' ? 0 : val);
963
- break;
964
- }
965
-
966
- $xml.children().each((_n, child) => {
967
- const $node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(child);
968
- switch (child.nodeName) {
969
- case 'include':
970
- this.wZero = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('zero'));
971
- this.wOne = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('one'));
972
- this.wMinusOne = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)($node.attr('minusOne'));
973
- break;
974
- }
975
- });
976
- });
977
- return this;
978
- }
979
-
980
- /**
981
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
982
- * parent references, constants and also attributes retaining the default value.
983
- * The resulting object is commonly usued to serialize elements in JSON format.
984
- * @returns {object} - The resulting object, with minimal attrributes
985
- */
986
- getAttributes() {
987
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getAttr */ .iu)(this, [
988
- 'limInf', 'limSup',
989
- 'numDec|0',
990
- 'wZero|false', 'wOne|false', 'wMinusOne|false',
991
- 'fromList|0', 'lst',
992
- ]);
993
- }
994
-
995
- /**
996
- * Reads the properties of this operator from a dataset
997
- * @param {object} data - The data object to be parsed
998
- * @returns {module:automation/arith/Arith.Arith}
999
- */
1000
- setAttributes(data) {
1001
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .setAttr */ .ob)(this, data, [
1002
- 'limInf', 'limSup',
1003
- 'numDec',
1004
- 'wZero', 'wOne', 'wMinusOne',
1005
- 'fromList', 'lst',
1006
- ]);
1007
- }
1008
- };
1009
-
1010
- Object.assign(Arith.Operator.prototype, {
1011
- /**
1012
- * Lower limit
1013
- * @name module:automation/arith/Arith.Arith.Operator#limInf
1014
- * @type {number} */
1015
- limInf: 0,
1016
- /**
1017
- * Upper limit
1018
- * @name module:automation/arith/Arith.Arith.Operator#limSup
1019
- * @type {number} */
1020
- limSup: 10,
1021
- /**
1022
- * Number of decimal places
1023
- * @name module:automation/arith/Arith.Arith.Operator#numDec
1024
- * @type {number} */
1025
- numDec: 0,
1026
- /**
1027
- * Including 0
1028
- * @name module:automation/arith/Arith.Arith.Operator#wZero
1029
- * @type {boolean} */
1030
- wZero: false,
1031
- /**
1032
- * Including 1
1033
- * @name module:automation/arith/Arith.Arith.Operator#wOne
1034
- * @type {boolean} */
1035
- wOne: false,
1036
- /**
1037
- * Including -1
1038
- * @name module:automation/arith/Arith.Arith.Operator#wMinusOne
1039
- * @type {boolean} */
1040
- wMinusOne: false,
1041
- /**
1042
- * Take values from list. This member stores the list length.
1043
- * @name module:automation/arith/Arith.Arith.Operator#fromList
1044
- * @type {number} */
1045
- fromList: 0,
1046
- /**
1047
- * The list of possible values
1048
- * @name module:automation/arith/Arith.Arith.Operator#lst
1049
- * @type {number[]} */
1050
- lst: [],
1051
- });
1052
-
1053
- Arith.Num = class {
1054
- constructor() {
1055
- this.vf = 0.0; // The number value
1056
- this.c = 0; // Number of decimals to be used when representing the number
1057
- }
1058
-
1059
- format() {
1060
- return Arith.DecFormat(this.vf, this.c);
1061
- }
1062
- };
1063
-
1064
- Arith.Operation = class {
1065
- constructor() {
1066
- this.numA = new Arith.Num();
1067
- this.numB = new Arith.Num();
1068
- this.numR = new Arith.Num();
1069
- this.op = 0;
1070
- }
1071
- };
1072
-
1073
- // Register class in AutoContentProvider.CLASSES
1074
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_AutoContentProvider_js__WEBPACK_IMPORTED_MODULE_1__["default"].registerClass('@arith.Arith', Arith));
1075
-
1076
-
1077
- /***/ })
1078
-
1079
- };
1080
- ;
1081
- //# sourceMappingURL=5977.jclic-node.js.map