Example #1
0
        /// <summary>
        /// 给定函数的名字 返回修改Funcexpresstemp后的FuncString对象 连同变量一同替换 一步到位
        /// </summary>
        /// <param name="funname">函数名</param>
        /// <returns>FuncString 或者 null</returns>
        public FuncString FindFuncInTDC(string funname)
        {
            FuncString fs = null;

            if (tdc.CheckName(funname))
            {
                FuncData   fd          = (FuncData)tdc.GetData(funname).GetCalData();
                FuncString funs        = new  FuncString(funname, fd.GetExpValue(), fd.GetParamers());
                string     funcexpress = ReplaceParamers(funs.GetFuncExpress(), funs.GetParamers());
                if (funcexpress != null)
                {
                    funs.SetFuncExpress(funcexpress);
                }
                fs = funs;
            }
            return(fs);
        }
Example #2
0
        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);
        }
Example #3
0
        public Function.FuncString ConvertTOFunString()
        {
            FuncData fd = (FuncData)Value;

            return(new Function.FuncString(Name, fd.GetExpValue(), fd.GetParamers()));
        }