From 9be00f21202a4e68c218867baab08a69834f5e87 Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Fri, 9 Mar 2018 11:08:32 +0100 Subject: [PATCH] simplification de l'utilisation de l'enum ComputeNodeType --- src/param.ts | 24 ++----------------- src/remous.ts | 2 +- src/section/section_circulaire.ts | 6 ++--- src/section/section_puissance.ts | 6 ++--- src/section/section_rectang.ts | 3 +-- src/section/section_trapez.ts | 8 +++---- src/section/section_type.ts | 9 ++++--- src/structure/parallel_structure_params.ts | 2 +- src/structure/rectangular_structure_params.ts | 6 ++--- src/structure/structure_params.ts | 2 +- 10 files changed, 23 insertions(+), 45 deletions(-) diff --git a/src/param.ts b/src/param.ts index f1897697..694c6804 100644 --- a/src/param.ts +++ b/src/param.ts @@ -295,32 +295,12 @@ export class ParamDefinition extends BaseParam { */ private _calculatorType: CalculatorType; - /** - * noeud de calcul parent - */ - private _computeNodeType: ComputeNodeType; - - // private static _idGen: number = 0; // A VIRER - // private _id: number; // A VIRER - - constructor(ct: CalculatorType, s: string, d: ParamDomain | ParamDomainValue, val?: number, nt: ComputeNodeType = ComputeNodeType.None) { + constructor(ct: CalculatorType, s: string, d: ParamDomain | ParamDomainValue, val?: number) { super(s, d, val); this._calculatorType = ct; - this._computeNodeType = nt; this._calc = undefined; this.checkValue(val); - - // this._id = ParamDefinition._idGen++; // A VIRER - // console.log("constructor param " + this._symbol + " id=" + this._id); // A VIRER - } - - // get id(): number { - // return this._id; - // } - - get computeNodeType(): ComputeNodeType { - return this._computeNodeType; } get v(): number { @@ -363,7 +343,7 @@ export class ParamDefinition extends BaseParam { } public clone(): ParamDefinition { - const res = new ParamDefinition(this._calculatorType, this.symbol, this.getDomain().clone(), this.uncheckedValue, this._computeNodeType); + const res = new ParamDefinition(this._calculatorType, this.symbol, this.getDomain().clone(), this.uncheckedValue); res._calc = this._calc; return res; } diff --git a/src/remous.ts b/src/remous.ts index 53704c8f..90e2601e 100644 --- a/src/remous.ts +++ b/src/remous.ts @@ -1,7 +1,7 @@ import { round, XOR } from "./base"; import { Dichotomie } from "./dichotomie"; import { Nub } from "./nub"; -import { ComputeNodeType, ParamCalculability, ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "./param"; +import { ParamCalculability, ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "./param"; import { acSection, ParamsSection } from "./section/section_type"; import { cLog } from "./util/log"; import { Message, MessageCode } from "./util/message"; diff --git a/src/section/section_circulaire.ts b/src/section/section_circulaire.ts index f3666a18..223c8155 100644 --- a/src/section/section_circulaire.ts +++ b/src/section/section_circulaire.ts @@ -1,4 +1,4 @@ -import { ComputeNodeType, ParamDefinition, ParamDomainValue, ParamCalculability, CalculatorType } from "../param"; +import { ParamDefinition, ParamDomainValue, ParamCalculability, CalculatorType } from "../param"; import { acSection, ParamsSection } from "./section_type"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; @@ -8,8 +8,8 @@ export class ParamsSectionCirc extends ParamsSection { private _D: ParamDefinition; // Diamètre du cercle constructor(rD: number, rY: number, rKs: number, rQ: number, rIf: number, rPrec: number, rYB: number) { - super(rY, undefined, rKs, rQ, rIf, rPrec, rYB, ComputeNodeType.None); - this._D = new ParamDefinition(CalculatorType.SectionParametree, 'D', ParamDomainValue.POS, rD, ComputeNodeType.SectionCercle); + super(rY, undefined, rKs, rQ, rIf, rPrec, rYB); + this._D = new ParamDefinition(CalculatorType.SectionParametree, 'D', ParamDomainValue.POS, rD); this.addParamDefinition(this._D); } diff --git a/src/section/section_puissance.ts b/src/section/section_puissance.ts index c762de16..0efc0d8b 100644 --- a/src/section/section_puissance.ts +++ b/src/section/section_puissance.ts @@ -1,4 +1,4 @@ -import { ComputeNodeType, ParamDefinition, ParamDomain, ParamDomainValue, ParamCalculability, CalculatorType } from "../param"; +import { ParamDefinition, ParamDomain, ParamDomainValue, ParamCalculability, CalculatorType } from "../param"; import { acSection, ParamsSection } from "./section_type"; import { Result } from "../util/result"; @@ -9,8 +9,8 @@ export class ParamsSectionPuiss extends ParamsSection { private _k: ParamDefinition; // Coefficient de forme compris entre 0 et 1 constructor(rk: number, rY: number, rLargeurBerge: number, rKs: number, rQ: number, rIf: number, rPrec: number, rYB: number) { - super(rY, rLargeurBerge, rKs, rQ, rIf, rPrec, rYB, ComputeNodeType.None); - this._k = new ParamDefinition(CalculatorType.SectionParametree, 'k', new ParamDomain(ParamDomainValue.INTERVAL, 0, 1), rk, ComputeNodeType.SectionPuissance); + super(rY, rLargeurBerge, rKs, rQ, rIf, rPrec, rYB); + this._k = new ParamDefinition(CalculatorType.SectionParametree, 'k', new ParamDomain(ParamDomainValue.INTERVAL, 0, 1), rk); this.addParamDefinition(this._k); } diff --git a/src/section/section_rectang.ts b/src/section/section_rectang.ts index fab309e9..a1bfe2cc 100644 --- a/src/section/section_rectang.ts +++ b/src/section/section_rectang.ts @@ -1,12 +1,11 @@ import { acSection, ParamsSection } from "./section_type"; -import { ComputeNodeType } from "../param"; import { Result } from "../util/result"; export class ParamsSectionRectang extends ParamsSection { constructor(rY: number, rLargeurFond: number, rKs: number, rQ: number, rIf: number, rPrec: number, rYB: number) { super(rY, rLargeurFond, // LargeurBerge=LargeurFond - rKs, rQ, rIf, rPrec, rYB, ComputeNodeType.SectionRectangle); + rKs, rQ, rIf, rPrec, rYB); } } diff --git a/src/section/section_trapez.ts b/src/section/section_trapez.ts index eb110326..1c725ba9 100644 --- a/src/section/section_trapez.ts +++ b/src/section/section_trapez.ts @@ -1,4 +1,4 @@ -import { ComputeNodeType, ParamDefinition, ParamDomainValue, ParamCalculability, CalculatorType } from "../param"; +import { ParamDefinition, ParamDomainValue, ParamCalculability, CalculatorType } from "../param"; import { acSection, ParamsSection } from "./section_type"; import { Result } from "../util/result"; @@ -7,9 +7,9 @@ export class ParamsSectionTrapez extends ParamsSection { private _Fruit: ParamDefinition; // Fruit des berges constructor(rLargeurFond: number, rFruit: number, rY: number, rKs: number, rQ: number, rIf: number, rPrec: number, rYB: number) { - super(rY, undefined, rKs, rQ, rIf, rPrec, rYB, ComputeNodeType.None); - this._LargeurFond = new ParamDefinition(CalculatorType.SectionParametree, 'LargeurFond', ParamDomainValue.POS_NULL, rLargeurFond, ComputeNodeType.SectionTrapeze); - this._Fruit = new ParamDefinition(CalculatorType.SectionParametree, 'Fruit', ParamDomainValue.POS_NULL, rFruit, ComputeNodeType.SectionTrapeze); + super(rY, undefined, rKs, rQ, rIf, rPrec, rYB); + this._LargeurFond = new ParamDefinition(CalculatorType.SectionParametree, 'LargeurFond', ParamDomainValue.POS_NULL, rLargeurFond); + this._Fruit = new ParamDefinition(CalculatorType.SectionParametree, 'Fruit', ParamDomainValue.POS_NULL, rFruit); this.addParamDefinition(this._LargeurFond); this.addParamDefinition(this._Fruit); diff --git a/src/section/section_type.ts b/src/section/section_type.ts index 8bf9b170..35c0a174 100644 --- a/src/section/section_type.ts +++ b/src/section/section_type.ts @@ -1,5 +1,5 @@ import { MessageCode, Message } from "../util/message"; -import { ComputeNodeType, ComputeNode, ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation, CalculatorType } from "../param"; +import { ComputeNode, ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation, CalculatorType } from "../param"; import { cHautCritique, cHautNormale, cHautCorrespondante, cHautConjuguee } from "./hauteur"; import { Result } from "../util/result"; @@ -87,11 +87,10 @@ export abstract class ParamsSection extends cParamsCanal { rQ: number, rIf: number, rPrec: number, - rYB: number, - nodeType: ComputeNodeType) { + rYB: number) { super(CalculatorType.SectionParametree, rKs, rQ, rIf, rPrec, rYB); - this._Y = new ParamDefinition(CalculatorType.SectionParametree, 'Y', ParamDomainValue.POS_NULL, rY, nodeType); - this._LargeurBerge = new ParamDefinition(CalculatorType.SectionParametree, 'LargeurBerge', ParamDomainValue.POS_NULL, rLargeurBerge, nodeType); + this._Y = new ParamDefinition(CalculatorType.SectionParametree, 'Y', ParamDomainValue.POS_NULL, rY); + this._LargeurBerge = new ParamDefinition(CalculatorType.SectionParametree, 'LargeurBerge', ParamDomainValue.POS_NULL, rLargeurBerge); this.addParamDefinition(this._Y); this.addParamDefinition(this._LargeurBerge); diff --git a/src/structure/parallel_structure_params.ts b/src/structure/parallel_structure_params.ts index 8c03ecf5..798d7585 100644 --- a/src/structure/parallel_structure_params.ts +++ b/src/structure/parallel_structure_params.ts @@ -1,5 +1,5 @@ import { Nub } from "../nub"; -import { ComputeNodeType, ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "../param"; +import { ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "../param"; /** * Common parameters of hydraulic structure equations diff --git a/src/structure/rectangular_structure_params.ts b/src/structure/rectangular_structure_params.ts index 8eb455bf..929e42d0 100644 --- a/src/structure/rectangular_structure_params.ts +++ b/src/structure/rectangular_structure_params.ts @@ -1,4 +1,4 @@ -import { ComputeNodeType, ParamCalculability, ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "../param"; +import { ParamCalculability, ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "../param"; import { Structure } from "./structure"; import { StructureParams } from "./structure_params"; @@ -25,9 +25,9 @@ export class RectangularStructureParams extends StructureParams { */ constructor(rQ: number, rZDV: number, rZ1: number, rZ2: number, rL: number, rCd: number, rW: number = Infinity) { super(rQ, rZDV, rZ1, rZ2, rW); - this.L = new ParamDefinition(CalculatorType.Structure, "L", ParamDomainValue.POS, rL, ComputeNodeType.StructureRectangle); + this.L = new ParamDefinition(CalculatorType.Structure, "L", ParamDomainValue.POS, rL); this.addParamDefinition(this.L); - this.Cd = new ParamDefinition(CalculatorType.Structure, "Cd", ParamDomainValue.POS, rCd, ComputeNodeType.StructureRectangle); + this.Cd = new ParamDefinition(CalculatorType.Structure, "Cd", ParamDomainValue.POS, rCd); this.addParamDefinition(this.Cd); } } diff --git a/src/structure/structure_params.ts b/src/structure/structure_params.ts index 1e90cb25..f782e0ed 100644 --- a/src/structure/structure_params.ts +++ b/src/structure/structure_params.ts @@ -1,5 +1,5 @@ import { Nub } from "../nub"; -import { ComputeNodeType, ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "../param"; +import { ParamDefinition, ParamDomainValue, ParamsEquation, CalculatorType } from "../param"; /** * Common parameters of hydraulic structure equations -- GitLab