Commit ee83e0f5 authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch '278-prebarrage-calculable-avec-champs-vides-cassiopee-nghyd-470' into 'devel'

Resolve "Prebarrage: calculable avec champs vides nghyd#470"

See merge request cassiopee/jalhyd!92
parents e937ad72 1da08255
......@@ -5,7 +5,7 @@ import { acSection, MacrorugoCompound, Pab, ParamDefinition, ParamsEquation,
import { LinkedValue } from "./linked-value";
import { ParamCalculability, ParamFamily } from "./param/param-definition";
import { ParamValueMode } from "./param/param-value-mode";
import { IParamDefinitionIterator } from "./param/param_definition_iterator";
import { IParamDefinitionIterator, ParamDefinitionIterator } from "./param/param_definition_iterator";
import { ParamsEquationArrayIterator } from "./param/params_equation_array_iterator";
import { Props } from "./props";
import { SessionSettings } from "./session_settings";
......@@ -1693,4 +1693,26 @@ export abstract class Nub extends ComputeNode implements IObservable {
return dicho.Dichotomie(target.v, SessionSettings.precision, rInit);
}
/**
* Check validity of all model parameters
*/
public check(withChildren: boolean = true): boolean {
let prmIt: IParamDefinitionIterator;
if(withChildren) {
prmIt = this.parameterIterator;
} else {
prmIt = new ParamDefinitionIterator(this._prms);
}
for (const p of prmIt) {
if (!p.isCalculated && p.visible) {
try {
// will throw an error if no value is defined at all
p.paramValues.check();
} catch (e) {
return false;
}
}
}
return true;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment