// 2*3e void AnalyseInputG(int blacket) { if (blacket == 4) //有括号的 { if (IsOrder()) { // PushToShow("进入命令程序"); Command cm = new Command(); var funs = funstring.GetFuncExpressTemp(); switch (funstring.GetFuncName()) { case "plot": string[] paramers = funstring.GetParamersData(); FuncString funcs = FindFuncInTDC(paramers[0]); double left = 0; double right = 1; try { left = double.Parse(paramers[1]); right = double.Parse(paramers[2]); } catch { if (tdc.CheckName(paramers[1])) { BlockData bd = (BlockData)tdc.GetData(paramers[1]).GetCalData(); if (bd != null) { left = bd.GetXStart(); right = bd.GetXEnd(); } } } if (funcs != null) { new Thread(new ThreadStart(() => cm.PlotFunc(funcs, 6, 1000, left, right))).Start(); // new Thread(new ThreadStart(()=>cm.PlotFuncParallel(funcs, 6, 1000, -10, 10))).Start(); } else { PushToShow("Wrong!"); } break; case "list": #region 处理list bool needJudge = true; DataType dt = DataType.NONE; switch (funs) { case "exp": dt = DataType.EXP; break; case "matrix": dt = DataType.MATRIX; break; case "block": dt = DataType.BLOCK; break; case "func": dt = DataType.FUNC; break; default: needJudge = false; break; } TempData td; for (int i = 1; i < tdc.GetLength(); i++) { td = tdc.GetData(i); bool show = false; if (td != null) { CalData cd = td.GetCalData(); if (cd.CalType == dt) { show = true; } if (!needJudge || show) { PushToShow(td.ToString()); } } } #endregion break; case "beep": int times = 10; int.TryParse(funs, out times); if (times == 0) { times = 10; } for (int i = 0; i < times; i++) { PushToShow("倒计时" + (times - i - 1) + "s"); Console.Beep(1000 * 7, 500); Console.Beep(500, 500); } Console.Beep(30000, 1000); break; case "matrix": ConsoleCal.UIController uc = new ConsoleCal.UIController(); uc.Run(); break; case "clc": if (string.IsNullOrEmpty(funs)) { tdc.RemoveAll(); PushToShow("已清空存储数据"); } else { if (tdc.CheckName(funs)) { tdc.Remove(tdc.FindPosition(funs)); PushToShow("clear " + funs); } else { PushToShow("fail to clear.Can't find " + funs); } } break; case "exit": Environment.Exit(0); break; case "clear": Console.Clear(); break; //----------------------这个GetFuncExpressTemp最多返回""不会返回null case "help": cm.Help(funstring.GetFuncExpressTemp()); break; } return; } if (tdc.CheckName(funstring.GetFuncName())) { PushToShow("该函数存在数据中"); if (funstring.GetParamers() != null) { PushToShow("进入函数求值过程"); FuncString funs = FindFuncInTDC(funstring.GetFuncName()); double result = GetFuncResult(funs, new FuncString(InputData).GetParamersData()); PushToShow("结果:" + result); } else { PushToShow("没有输入参数"); } return; // PushToShow("这是啥:" + tdc.GetData(funstring.GetFuncName()).GetValue().ToString()); } { var str = SimpleCal(InputData); if (str == null) { PushToShow("没有此函数"); } else { PushToShow(str); } return; } } if (blacket == 1) //没有括号 Name即是计算的表达式 { var Name = funstring.GetFuncName(); CheckDataType(Name); } }
public int GetParamersCount() { return(funcstring.GetParamers().Length); }