summaryrefslogtreecommitdiff
path: root/js/Branching/M_SWITCH.js
diff options
context:
space:
mode:
authorSunil Shetye2018-06-25 18:20:39 +0530
committerSunil Shetye2018-06-26 11:06:22 +0530
commit7465daea85285ba7f291b6bf6ddc45caa9e7ad65 (patch)
treee8e3e4dd60d469c290d55de15644ddbc1e013bc6 /js/Branching/M_SWITCH.js
parent7c70459c10aed0d74ee03896abaf47fefdbf7c8f (diff)
downloadsci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.tar.gz
sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.tar.bz2
sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.zip
add spacing to end of block also
Diffstat (limited to 'js/Branching/M_SWITCH.js')
-rw-r--r--js/Branching/M_SWITCH.js73
1 files changed, 37 insertions, 36 deletions
diff --git a/js/Branching/M_SWITCH.js b/js/Branching/M_SWITCH.js
index 724ea1f0..80d0d0ca 100644
--- a/js/Branching/M_SWITCH.js
+++ b/js/Branching/M_SWITCH.js
@@ -13,51 +13,52 @@ function M_SWITCH() {
model.dep_ut = [true,false];
exprs = [[string(nin)],[string(ipar)]];
gr_i = [];
- x = standard_define([2.5,2],model,exprs,gr_i);
+ this.x = standard_define([2.5,2],model,exprs,gr_i);
}
M_SWITCH.prototype.details = function M_SWITCH() {
+ return this.x;
}
M_SWITCH.prototype.get = function M_SWITCH() {
}
M_SWITCH.prototype.set = function M_SWITCH() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
while (true) {
- [ok,nin,base,rule,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["zero base indexing (0), otherwise 1"],["rounding rule: int (0), round (1), ceil (2), floor (3)"]],list("vec",1,"vec",1,"vec",1),exprs);
- if (!ok) {
-break;
-}
- nin = int(nin);
- base = int(base);
- if (nin<1) {
-message("Number of inputs must be >=1 ");
- } else if (!((base==1)||(base==0))) {
-message("base indexing must be 1 or 0");
- } else if (!((rule==1)||(rule==0)||(rule==2)||(rule==3))) {
-message("incorrect rounding rule");
- } else {
- if (nin==1) {
- in1 = [[1,1],[-1,1]];
- out = [1,1];
- } else {
- in1 = [[1],[-ones(nin,1)]];
- in2 = [[1],[-2*ones(nin,1)]];
- in1 = [in1,in2];
- out = [-1,-2];
-}
- it = [[-1],[-2*ones(nin,1)]];
- ot = -2;
- [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]);
- if (ok) {
- graphics.exprs = exprs;
- model.ipar = [[base],[rule]];
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [ok,nin,base,rule,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["zero base indexing (0), otherwise 1"],["rounding rule: int (0), round (1), ceil (2), floor (3)"]],list("vec",1,"vec",1,"vec",1),exprs);
+ if (!ok) {
+ break;
+ }
+ nin = int(nin);
+ base = int(base);
+ if (nin<1) {
+ message("Number of inputs must be >=1 ");
+ } else if (!((base==1)||(base==0))) {
+ message("base indexing must be 1 or 0");
+ } else if (!((rule==1)||(rule==0)||(rule==2)||(rule==3))) {
+ message("incorrect rounding rule");
+ } else {
+ if (nin==1) {
+ in1 = [[1,1],[-1,1]];
+ out = [1,1];
+ } else {
+ in1 = [[1],[-ones(nin,1)]];
+ in2 = [[1],[-2*ones(nin,1)]];
+ in1 = [in1,in2];
+ out = [-1,-2];
+ }
+ it = [[-1],[-2*ones(nin,1)]];
+ ot = -2;
+ [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]);
+ if (ok) {
+ graphics.exprs = exprs;
+ model.ipar = [[base],[rule]];
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}