public double FuncResult(string fs, TempDataCollection tdcl, params string[] nums) { double result = 0; if (fs != null) { PushToShow("有括号求值"); FuncCal fc = new FuncCal(); FuncString funs = tdcl.GetData(fs).ConvertTOFunString(); fc.SetFuncString(funs); fc.DealFuncstring(nums); result = fc.GetResult(); PushToShow("结果:" + fc.GetResult()); if (fc.IsWrong()) { PushToShow("出错了!" + fc.ErrorMessage()); } } return(result); }
public double FuncResult(string fs, TempDataCollection tdcl, params string[] nums) { double result = 0; if (fs != null) { PushToShow("有括号求值"); FuncCal fc = new FuncCal(); FuncData fd = (FuncData)tdc.GetData(fs).GetCalData(); FuncString funs = new FuncString(fs, fd.GetExpValue(), fd.GetParamers()); fc.SetFuncString(funs); fc.DealFuncstring(nums); result = fc.GetResult(); PushToShow("结果:" + fc.GetResult()); if (fc.IsWrong()) { PushToShow("出错了!" + fc.ErrorMessage()); } } return(result); }
/// <summary> /// 给定函数FuncString类型 求值 /// </summary> /// <param name="fs">必须得有参数 名字 表达式</param> /// <param name="nums">替换的参数</param> /// <returns>返回计算结果</returns> public double GetFuncResult(FuncString fs, params string[] nums) { //这里的fs应该时是完整的? double result = 0; if (fs != null) { //改一下 FuncCal fc = new FuncCal(); // FuncString funs=tdc.GetData(fs).ConvertTOFunString(); fc.SetFuncString(fs); fc.DealFuncstring(nums); result = fc.GetResult(); if (fc.IsWrong()) { PushToShow(fc.ErrorMessage(), "error"); } } return(result); }