diff --git a/src/nub.ts b/src/nub.ts index af89bbc157c48e7d0668bf8fe7e4d9353ecd96b4..8e5502200bfd8413a47ad495a577a41ed9909dd0 100644 --- a/src/nub.ts +++ b/src/nub.ts @@ -124,6 +124,7 @@ export abstract class Nub extends ComputeNode implements IObservable { if ( p.calculability !== ParamCalculability.NONE && p.symbol !== "Pr" + && p.visible && p !== otherThan && p.valueMode === ParamValueMode.SINGLE ) { diff --git a/src/param/param-definition.ts b/src/param/param-definition.ts index 13a02356f5eae140719747aa7b1ca8e9df1acc3f..7b1a9b8b8a389d09387e6b8ffc0ec5284bd83e71 100644 --- a/src/param/param-definition.ts +++ b/src/param/param-definition.ts @@ -310,9 +310,8 @@ export class ParamDefinition implements INamedIterableValues, IObservable { * its parent Nub */ public get isCalculated(): boolean { - if (this.parentComputeNode && this.parentComputeNode instanceof Nub) { - // return (this.parentComputeNode.calculatedParam.symbol === this.symbol); - return (this.parentComputeNode.calculatedParam === this); // should be the same object + if (this.parentNub) { + return (this.parentNub.calculatedParam === this); // should be the same object } return false; } @@ -321,8 +320,8 @@ export class ParamDefinition implements INamedIterableValues, IObservable { * Sets this parameter as the one to be calculated */ public setCalculated() { - if (this.parentComputeNode && this.parentComputeNode instanceof Nub) { - this.parentComputeNode.calculatedParam = this; + if (this.parentNub) { + this.parentNub.calculatedParam = this; } } diff --git a/src/structure/structure.ts b/src/structure/structure.ts index af2ff99c375a211a49f21628ffd328237a625531..f811fbef59de152f20d685f9a73c014ea0891b9a 100644 --- a/src/structure/structure.ts +++ b/src/structure/structure.ts @@ -97,6 +97,17 @@ export abstract class Structure extends Nub { } } + /** + * Forwards to parent, that has vsibility over + * all the parameters, including the Structure ones + */ + public get calculatedParam(): ParamDefinition { + if (this.parent) { + return this.parent.calculatedParam; + } + return undefined; + } + /** * Forwards to parent, that has vsibility over * all the parameters, including the Structure ones @@ -107,6 +118,17 @@ export abstract class Structure extends Nub { } } + /** + * Forwards to parent, that has vsibility over + * all the parameters, including the Structure ones + */ + public findFirstSingleParameter(otherThan?: ParamDefinition) { + if (this.parent) { + return this.parent.findFirstSingleParameter(otherThan); + } + return undefined; + } + /** * Forwards to parent, that has visibility over * all the parameters, including the Structure ones