diff --git a/src/nub.ts b/src/nub.ts index 125609f151c5af8c37bfce58c8003712ce78424c..43970a54e102804ab30088d383b8e0af628c7806 100644 --- a/src/nub.ts +++ b/src/nub.ts @@ -180,11 +180,7 @@ export abstract class Nub extends ComputeNode implements IObservable { ) ) { // first SINGLE calculable parameter if any - let newCalculatedParam = this.findFirstSingleParameter(requirer); - if (! newCalculatedParam) { - // first MIMAX/LISTE calculable parameter if any - newCalculatedParam = this.findFirstVariableParameter(requirer); - } + const newCalculatedParam = this.findFirstCalculableParameter(requirer); if (newCalculatedParam) { this.calculatedParam = newCalculatedParam; } else { @@ -202,30 +198,10 @@ export abstract class Nub extends ComputeNode implements IObservable { /** * Returns the first visible calculable parameter other than "Pr", - * and other than otherThan, that is set to SINGLE mode - * (there might be none) - */ - public findFirstSingleParameter(otherThan?: ParamDefinition) { - for (const p of this.parameterIterator) { - if ( - [ ParamCalculability.EQUATION, ParamCalculability.DICHO ].includes(p.calculability) - && p.symbol !== "Pr" - && p.visible - && p !== otherThan - && p.valueMode === ParamValueMode.SINGLE - ) { - return p; - } - } - return undefined; - } - - /** - * Returns the first visible calculable parameter other than "Pr", - * and other than otherThan, that is set to MINMAX or LISTE mode - * (there might be none) + * and other than otherThan, that is set to SINGLE, MINMAX or LISTE + * mode (there might be none) */ - public findFirstVariableParameter(otherThan?: ParamDefinition) { + public findFirstCalculableParameter(otherThan?: ParamDefinition) { for (const p of this.parameterIterator) { if ( [ ParamCalculability.EQUATION, ParamCalculability.DICHO ].includes(p.calculability) diff --git a/src/structure/structure.ts b/src/structure/structure.ts index 68eb9930a751f81c36ba04c4c13f2d0448b417f0..123d0490d8b9cf906af2cc109b43fa505c421cf9 100644 --- a/src/structure/structure.ts +++ b/src/structure/structure.ts @@ -137,9 +137,9 @@ export abstract class Structure extends Nub { * Forwards to parent, that has vsibility over * all the parameters, including the Structure ones */ - public findFirstSingleParameter(otherThan?: ParamDefinition) { + public findFirstCalculableParameter(otherThan?: ParamDefinition) { if (this.parent) { - return this.parent.findFirstSingleParameter(otherThan); + return this.parent.findFirstCalculableParameter(otherThan); } return undefined; }