summaryrefslogtreecommitdiff
path: root/js/NonLinear/MAXMIN.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/NonLinear/MAXMIN.js')
-rw-r--r--js/NonLinear/MAXMIN.js89
1 files changed, 45 insertions, 44 deletions
diff --git a/js/NonLinear/MAXMIN.js b/js/NonLinear/MAXMIN.js
index c85734cb..b6726e22 100644
--- a/js/NonLinear/MAXMIN.js
+++ b/js/NonLinear/MAXMIN.js
@@ -10,59 +10,60 @@ function MAXMIN() {
model.ipar = 0;
exprs = [string(transpose([2,1,1]))];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
- x.graphics.style = "MAXMIN;displayedLabel=MAX";
+ this.x = standard_define([2,2],model,exprs,gr_i);
+ this.x.graphics.style = "MAXMIN;displayedLabel=MAX";
}
MAXMIN.prototype.details = function MAXMIN() {
+ return this.x;
}
MAXMIN.prototype.get = function MAXMIN() {
}
MAXMIN.prototype.set = function MAXMIN() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
while (true) {
- [ok,mm,nin,zcr,exprs] = scicos_getvalue("Set Max/Min block parameters",[["Min (1) or Max (2) "],["Number of input vectors (1 or 2)"],["zero-crossing (1: yes, 0;no)"]],list("vec",1,"vec",1,"vec",1),exprs);
- if (!ok) {
-break;
-}
- if (zcr!=0) {
- zcr = -1;
-}
- if (mm!=1) {
- mm = 2;
-}
- if (nin!=1&&nin!=2) {
-message("Wrong number of inputs, only 1 and 2 allowed");
- ok = false;
-}
- if (ok) {
- if (nin==1) {
- [model,graphics,ok] = check_io(model,graphics,-1,1,[],[]);
- } else {
- [model,graphics,ok] = check_io(model,graphics,[-1,-1],-1,[],[]);
-}
-}
- if (ok) {
- model.nzcross = zcr;
- if (nin==1) {
- model.nmode = abs(zcr);
- } else {
- model.nmode = zcr;
-}
- model.ipar = mm;
- if (mm==1) {
- label = "MIN";
- } else {
- label = "MAX";
-}
- graphics.style = "MAXMIN;displayedLabel="+label;
- graphics.exprs = exprs;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [ok,mm,nin,zcr,exprs] = scicos_getvalue("Set Max/Min block parameters",[["Min (1) or Max (2) "],["Number of input vectors (1 or 2)"],["zero-crossing (1: yes, 0;no)"]],list("vec",1,"vec",1,"vec",1),exprs);
+ if (!ok) {
+ break;
+ }
+ if (zcr!=0) {
+ zcr = -1;
+ }
+ if (mm!=1) {
+ mm = 2;
+ }
+ if (nin!=1&&nin!=2) {
+ message("Wrong number of inputs, only 1 and 2 allowed");
+ ok = false;
+ }
+ if (ok) {
+ if (nin==1) {
+ [model,graphics,ok] = check_io(model,graphics,-1,1,[],[]);
+ } else {
+ [model,graphics,ok] = check_io(model,graphics,[-1,-1],-1,[],[]);
+ }
+ }
+ if (ok) {
+ model.nzcross = zcr;
+ if (nin==1) {
+ model.nmode = abs(zcr);
+ } else {
+ model.nmode = zcr;
+ }
+ model.ipar = mm;
+ if (mm==1) {
+ label = "MIN";
+ } else {
+ label = "MAX";
+ }
+ graphics.style = "MAXMIN;displayedLabel="+label;
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}