linny-r 1.4.3 → 1.4.4

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 (49) hide show
  1. package/README.md +102 -48
  2. package/package.json +1 -1
  3. package/server.js +31 -6
  4. package/static/images/check-off-not-same-changed.png +0 -0
  5. package/static/images/check-off-not-same-not-changed.png +0 -0
  6. package/static/images/check-off-same-changed.png +0 -0
  7. package/static/images/check-off-same-not-changed.png +0 -0
  8. package/static/images/check-on-not-same-changed.png +0 -0
  9. package/static/images/check-on-not-same-not-changed.png +0 -0
  10. package/static/images/check-on-same-changed.png +0 -0
  11. package/static/images/check-on-same-not-changed.png +0 -0
  12. package/static/images/eq-not-same-changed.png +0 -0
  13. package/static/images/eq-not-same-not-changed.png +0 -0
  14. package/static/images/eq-same-changed.png +0 -0
  15. package/static/images/eq-same-not-changed.png +0 -0
  16. package/static/images/ne-not-same-changed.png +0 -0
  17. package/static/images/ne-not-same-not-changed.png +0 -0
  18. package/static/images/ne-same-changed.png +0 -0
  19. package/static/images/ne-same-not-changed.png +0 -0
  20. package/static/images/sort-asc-lead.png +0 -0
  21. package/static/images/sort-asc.png +0 -0
  22. package/static/images/sort-desc-lead.png +0 -0
  23. package/static/images/sort-desc.png +0 -0
  24. package/static/images/sort-not.png +0 -0
  25. package/static/index.html +51 -35
  26. package/static/linny-r.css +167 -53
  27. package/static/scripts/linny-r-gui-actor-manager.js +340 -0
  28. package/static/scripts/linny-r-gui-chart-manager.js +944 -0
  29. package/static/scripts/linny-r-gui-constraint-editor.js +681 -0
  30. package/static/scripts/linny-r-gui-controller.js +4005 -0
  31. package/static/scripts/linny-r-gui-dataset-manager.js +1176 -0
  32. package/static/scripts/linny-r-gui-documentation-manager.js +739 -0
  33. package/static/scripts/linny-r-gui-equation-manager.js +307 -0
  34. package/static/scripts/linny-r-gui-experiment-manager.js +1944 -0
  35. package/static/scripts/linny-r-gui-expression-editor.js +449 -0
  36. package/static/scripts/linny-r-gui-file-manager.js +392 -0
  37. package/static/scripts/linny-r-gui-finder.js +727 -0
  38. package/static/scripts/linny-r-gui-model-autosaver.js +230 -0
  39. package/static/scripts/linny-r-gui-monitor.js +448 -0
  40. package/static/scripts/linny-r-gui-paper.js +2789 -0
  41. package/static/scripts/linny-r-gui-receiver.js +323 -0
  42. package/static/scripts/linny-r-gui-repository-browser.js +819 -0
  43. package/static/scripts/linny-r-gui-scale-unit-manager.js +244 -0
  44. package/static/scripts/linny-r-gui-sensitivity-analysis.js +778 -0
  45. package/static/scripts/linny-r-gui-undo-redo.js +560 -0
  46. package/static/scripts/linny-r-model.js +24 -11
  47. package/static/scripts/linny-r-utils.js +10 -0
  48. package/static/scripts/linny-r-vm.js +21 -12
  49. package/static/scripts/linny-r-gui.js +0 -16908
@@ -454,18 +454,24 @@ class Expression {
454
454
  this.stack.pop();
455
455
  // Check whether either number is an error code
456
456
  let check = Math.min(dyad[0], dyad[1]);
457
- if(check < VM.MINUS_INFINITY) {
458
- // If so, leave the severest error on top of the stack
457
+ if(check < VM.MINUS_INFINITY &&
458
+ // Exception: "array index out of bounds" error may also be
459
+ // ignored by using the | operator.
460
+ !(no_check && check === VM.ARRAY_INDEX)) {
461
+ // If error, leave the severest error on top of the stack
459
462
  this.retop(check);
460
463
  this.trace(VM.errorMessage(check) + ' in dyad: ' + dyad.toString());
461
464
  return false;
462
465
  }
463
- // Likewise check for "undefined", "not computed", and "still computing"
466
+ // Now check for "undefined", "not computed", and "still computing".
464
467
  check = dyad[0];
465
468
  if(no_check) {
466
- // for VMI_replace_undefined, ignore that A is "undefined" unless
467
- // B is also "undefined"
468
- if(check === VM.UNDEFINED) check = dyad[1];
469
+ // For VMI_replace_undefined, ignore that A is "undefined" or even
470
+ // "array index out of bounds" unless B is also "undefined".
471
+ if(check === VM.UNDEFINED || check === VM.ARRAY_INDEX) {
472
+ dyad[0] = VM.UNDEFINED; // Treat "out of bounds" as "undefined".
473
+ check = dyad[1];
474
+ }
469
475
  } else {
470
476
  check = Math.max(check, dyad[1]);
471
477
  }
@@ -474,7 +480,7 @@ class Expression {
474
480
  this.trace(VM.errorMessage(check) + ' in dyad: ' + dyad.toString());
475
481
  return false;
476
482
  }
477
- // No problem(s)? Then return the dyad
483
+ // No problem(s)? Then return the dyad.
478
484
  return dyad;
479
485
  }
480
486
 
@@ -5993,6 +5999,12 @@ function VMI_push_dataset_modifier(x, args) {
5993
5999
  // defines the expression to use. If not, `obj` will be the dataset
5994
6000
  // vector (so same as when "use data" is set).
5995
6001
  obj = ds.activeModifierExpression;
6002
+ if(wcnr === false && obj instanceof Expression && MODEL.running_experiment) {
6003
+ // If experiment run defines the modifier selector, the active
6004
+ // combination may provide a context for #.
6005
+ wcnr = matchingNumberInList(MODEL.running_experiment.activeCombination,
6006
+ obj.attribute);
6007
+ }
5996
6008
  }
5997
6009
  if(!obj) {
5998
6010
  console.log('ANOMALY: no object. obj, wcnr, args, x', obj, wcnr, args, x);
@@ -6021,7 +6033,6 @@ function VMI_push_dataset_modifier(x, args) {
6021
6033
  VM.out_of_bounds_array = ds.displayName;
6022
6034
  VM.out_of_bounds_msg = `Index ${index} not in array dataset ` +
6023
6035
  `${ds.displayName}, which has length ${obj.length}`;
6024
- console.log(VM.out_of_bounds_msg);
6025
6036
  }
6026
6037
  }
6027
6038
  // Fall through: no change to `v` => dataset default value is pushed.
@@ -6030,8 +6041,6 @@ function VMI_push_dataset_modifier(x, args) {
6030
6041
  // NOTE: Readjust `t` when `obj` is an expression for an *array-type*
6031
6042
  // dataset modifier.
6032
6043
  if(obj.object instanceof Dataset && obj.object.array) t++;
6033
- // Pass modifier selector (if specified; may be FALSE) so that result
6034
- // will be recomputed with this selector as context for #.
6035
6044
  v = obj.result(t, wcnr);
6036
6045
  }
6037
6046
  // Trace only now that time step t has been computed.
@@ -6306,7 +6315,7 @@ function VMI_push_statistic(x, args) {
6306
6315
  function VMI_replace_undefined(x, empty) {
6307
6316
  // Replaces one of the two top numbers on the stack by the other if the one
6308
6317
  // is undefined
6309
- const d = x.pop(true); // true denotes that "undefined" should be ignored as issue
6318
+ const d = x.pop(true); // TRUE denotes that "undefined" should be ignored as issue
6310
6319
  if(d !== false) {
6311
6320
  if(DEBUGGING) console.log('REPLACE UNDEFINED (' + d.join(', ') + ')');
6312
6321
  x.retop(d[0] === VM.UNDEFINED ? d[1] : d[0]);
@@ -7706,7 +7715,7 @@ const
7706
7715
 
7707
7716
  OPERATORS = DYADIC_OPERATORS.concat(MONADIC_OPERATORS),
7708
7717
  OPERATOR_CODES = DYADIC_CODES.concat(MONADIC_CODES),
7709
- PRIORITIES = [1, 2, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9,
7718
+ PRIORITIES = [1, 2, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 10,
7710
7719
  9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
7711
7720
  ACTUAL_SYMBOLS = CONSTANT_SYMBOLS.concat(OPERATORS),
7712
7721
  SYMBOL_CODES = CONSTANT_CODES.concat(OPERATOR_CODES);