Beispiel #1
0
 private void init()
 {
     arg.Clear();
     for (int i = 0; i < 3; i++)
     {
         MathFormula f = MathFormula.FromString(MathSymbolFactory.Sizes, formulaStrings[i]);
         formulas[i] = f;
         f           = f.FullTransform(null);
         ObjectFormulaTree t = ObjectFormulaTree.CreateTree(f);
         trees[i] = t;
         arg.Add(t);
     }
 }
        void Set(Dictionary <string, string> variables)
        {
            MathFormula f = MathFormula.FromString(MathSymbolFactory.Sizes, formula);

            measures.Clear();
            Dictionary <char, object> table = new Dictionary <char, object>();

            foreach (string key in variables.Keys)
            {
                IMeasurement m = this.FindMeasurement(variables[key], false);
                measures[key[0]] = m;
                table[key[0]]    = m.Type;
            }
            IFormulaObjectCreator creator = VariableDetector.GetCreator(table);

            f    = f.FullTransform(null);
            tree = ObjectFormulaTree.CreateTree(f, creator);
            arg  = new ElementaryObjectArgument();
            arg.Add(tree);
            this.variables = variables;
        }
Beispiel #3
0
        /// <summary>
        /// Accepts parameters
        /// </summary>
        /// <param name="s">String of parameters</param>
        public void AcceptParameters(string s)
        {
            parameters.Clear();
            par = null;
            arg = new ElementaryObjectArgument();
            arg.Add(tree);
            string str = arg.Variables;

            foreach (char c in s)
            {
                if (str.IndexOf(c) < 0)
                {
                    throw new Exception("Illegal formula parameter");
                }
            }
            foreach (char c in s)
            {
                double a = 0;
                parameters["" + c] = a;
                arg[c]             = a;
            }
        }