Commit 4c08e6e3 authored by Grand Francois's avatar Grand Francois
Browse files

#44 classe Nub : ajout d'une propriété de type Result

parent 63fdad62
No related merge requests found
Showing with 14 additions and 2 deletions
+14 -2
...@@ -9,6 +9,11 @@ import { Result } from "./util/result"; ...@@ -9,6 +9,11 @@ import { Result } from "./util/result";
export abstract class Nub extends ComputeNode { export abstract class Nub extends ComputeNode {
private _dichoStartIntervalMaxSteps: number = 100; private _dichoStartIntervalMaxSteps: number = 100;
/**
* résultat de Calc()/CalcSerie()
*/
protected _result: Result;
/* /*
* paramétrage de la dichotomie * paramétrage de la dichotomie
*/ */
...@@ -36,17 +41,20 @@ export abstract class Nub extends ComputeNode { ...@@ -36,17 +41,20 @@ export abstract class Nub extends ComputeNode {
rInit = this._prms.map[sVarCalc].v; rInit = this._prms.map[sVarCalc].v;
} }
if (this._prms.map[sVarCalc].isAnalytical()) { if (this._prms.map[sVarCalc].isAnalytical()) {
return this.Equation(sVarCalc); this._result = this.Equation(sVarCalc);
return this._result;
} }
const resSolve: Result = this.Solve(sVarCalc, rInit, rPrec); const resSolve: Result = this.Solve(sVarCalc, rInit, rPrec);
if (!resSolve.ok) { if (!resSolve.ok) {
return resSolve; this._result = resSolve;
return this._result;
} }
const sAnalyticalPrm: string = this.getFirstAnalyticalParameter().symbol; const sAnalyticalPrm: string = this.getFirstAnalyticalParameter().symbol;
this._prms.map[sVarCalc].v = resSolve.vCalc; this._prms.map[sVarCalc].v = resSolve.vCalc;
const res: Result = this.Equation(sAnalyticalPrm); const res: Result = this.Equation(sAnalyticalPrm);
res.vCalc = resSolve.vCalc; res.vCalc = resSolve.vCalc;
this._result = res;
return res; return res;
} }
...@@ -71,4 +79,8 @@ export abstract class Nub extends ComputeNode { ...@@ -71,4 +79,8 @@ export abstract class Nub extends ComputeNode {
const target = this._prms.getFirstAnalyticalParameter(); const target = this._prms.getFirstAnalyticalParameter();
return dicho.Dichotomie(target.v, rPrec, rInit); return dicho.Dichotomie(target.v, rPrec, rInit);
} }
public get result(): Result {
return this._result;
}
} }
Supports Markdown
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