diff options
Diffstat (limited to 'js/NonLinear/PRODUCT.js')
-rw-r--r-- | js/NonLinear/PRODUCT.js | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/js/NonLinear/PRODUCT.js b/js/NonLinear/PRODUCT.js index 03fbc655..e6449743 100644 --- a/js/NonLinear/PRODUCT.js +++ b/js/NonLinear/PRODUCT.js @@ -11,55 +11,56 @@ function PRODUCT() { model.dep_ut = [true,false]; exprs = sci2exp(sgn); gr_i = []; - x = standard_define([2,3],model,exprs,gr_i); + this.x = standard_define([2,3],model,exprs,gr_i); } PRODUCT.prototype.details = function PRODUCT() { + return this.x; } PRODUCT.prototype.get = function PRODUCT() { } PRODUCT.prototype.set = function PRODUCT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,sgn,exprs] = scicos_getvalue([[" Set multiplication block parameters"],["(multiplication is set with + 1, division with -1)"],[""]],"Number of inputs or sign vector",list("vec",-1),exprs); - if (!ok) { -break; -} - sgn = sgn.slice(); - if (size(sgn,1)==1) { - if (sgn<1) { -message("Number of inputs must be > 0"); - ok = false; - } else if (sgn==1) { - in1 = -1; - sgn = []; - nout = 1; - } else { - in1 = -ones(sgn,1); - sgn = ones(sgn,1); - nout = -1; -} - } else { - if (!and(abs(sgn)==1)) { -message("Signs can only be +1 or -1"); - ok = false; - } else { - in1 = -ones(size(sgn,1),1); - nout = -1; -} -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,in1,nout,[],[]); -} - if (ok) { - model.ipar = sgn; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,sgn,exprs] = scicos_getvalue([[" Set multiplication block parameters"],["(multiplication is set with + 1, division with -1)"],[""]],"Number of inputs or sign vector",list("vec",-1),exprs); + if (!ok) { + break; + } + sgn = sgn.slice(); + if (size(sgn,1)==1) { + if (sgn<1) { + message("Number of inputs must be > 0"); + ok = false; + } else if (sgn==1) { + in1 = -1; + sgn = []; + nout = 1; + } else { + in1 = -ones(sgn,1); + sgn = ones(sgn,1); + nout = -1; + } + } else { + if (!and(abs(sgn)==1)) { + message("Signs can only be +1 or -1"); + ok = false; + } else { + in1 = -ones(size(sgn,1),1); + nout = -1; + } + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,in1,nout,[],[]); + } + if (ok) { + model.ipar = sgn; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } |