コード例 #1
0
        private static string[] CalculateRange(string rawEquation, string variables)
        {
            int success = Consolidate.ConvertAndCheckInputs(rawEquation, variables, Solver.GetValidOperators(), Solver.GetValidTerminators(), Input.GetLineDelimiter(), Input.GetFieldDelimiter());

            string[] results = null;

            if (success == 0)
            {
                EquationStruct   eq        = Consolidate.GetEquationStruct();
                IntervalStruct[] intervals = Consolidate.GetIntervalStructList();
                IntervalStruct   range     = Solver.FindRange(eq, intervals);
                if (range != null)
                {
                    results = new string[] { Output.PrintInterval(range, false), Output.PrintEquationTree(eq) };
                    frm_Main.UpdateLog("Range calculated successfully." + System.Environment.NewLine);
                    hasRun = true;
                }
            }
            else
            {
                successCode = success;
            }

            return(results);
        }
コード例 #2
0
        public static string[,] GetVariableInfo()
        {
            string[,] ivInfo = null;

            if (hasRun)
            {
                IntervalStruct[] intervals = Consolidate.GetIntervalStructList();
                if (intervals != null)
                {
                    ivInfo = new string[intervals.Length, 3];

                    for (int i = 0; i < intervals.Length; i++)
                    {
                        ivInfo[i, 0] = intervals[i].GetVariableName();
                        ivInfo[i, 1] = intervals[i].GetMinBound().ToString();
                        ivInfo[i, 2] = intervals[i].GetMaxBound().ToString();
                    }
                }
            }

            return(ivInfo);
        }