/* autogenerated from "macros/Branching/SWITCH_f.sci" */
function SWITCH_f() {
    SWITCH_f.prototype.define = function SWITCH_f() {
        i0 = 0;
        in1 = [[-1],[-1]];
        nin = 2;
        model = scicos_model();
        model.sim = list("switchn",2);
        model.in1 = in1;
        model.out = -1;
        model.ipar = i0;
        model.blocktype = "c";
        model.firing = [];
        model.dep_ut = [true,true];
        exprs = [[string(nin)],[string(i0+1)]];
        gr_i = [];
        x = standard_define([2,2],model,exprs,gr_i);
    }
    SWITCH_f.prototype.details = function SWITCH_f() {
    }
    SWITCH_f.prototype.get = function SWITCH_f() {
    }
    SWITCH_f.prototype.set = function SWITCH_f() {
        x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        model = arg1.model;
        ipar = model.ipar;
        while (true) {
        [ok,nin,z0,exprs] = scicos_getvalue("Set switch parameters",[["number of inputs"],["connected input"]],list("vec",1,"vec",1),exprs);
        if (!ok) {
break;
}
        if (z0>nin||z0<=0) {
message("initial connected input is not a valid input port number");
        } else {
        [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,[],[]);
        if (ok) {
        graphics.exprs = exprs;
        model.ipar = z0-1;
        x.graphics = graphics;
        x.model = model;
break;
}
}
}
    }
}