Add function trace

This commit is contained in:
Иван Ивашкин
2024-12-20 15:24:03 +05:00
parent 7996bd7a3d
commit ceefe3dbca
12 changed files with 80 additions and 40 deletions

View File

@@ -85,8 +85,6 @@ namespace StructureHelperCommon.Models.Functions
public object Clone()
{
var formulaFunction = new FormulaFunction();
//Здесь будет стратегия
formulaFunction.Type = Type;
formulaFunction.Name = $"{Name} {COPY}";
formulaFunction.Description = Description;
@@ -104,6 +102,8 @@ namespace StructureHelperCommon.Models.Functions
double yValue = 0;
current_xValue = xValue;
yValue = Math.Round(Expression.CalculateValue(new double[] { xValue }), 2);
Trace = string.Empty;
Trace += $"Function: {Formula}, Input: {xValue}, Output: {yValue};\n";
return yValue;
}
public GraphSettings GetGraphSettings()
@@ -117,5 +117,9 @@ namespace StructureHelperCommon.Models.Functions
}
return graphSettings;
}
public string GetTrace()
{
return Trace;
}
}
}