/// <summary> /// Accepts external parameters /// </summary> private void acceptParameters() { parameters.Clear(); timeVariable = null; foreach (char c in pars.Keys) { string s = pars[c] as string; if (s.Equals("Time")) { timeVariable = c.Create( StaticExtensionDataPerformerPortable.Factory.TimeProvider.TimeMeasurement, this); parameters[c] = timeVariable.Measurement; continue; } foreach (IMeasurements m in measurements) { string name = this.GetMeasurementsName(m); for (int i = 0; i < m.Count; i++) { IMeasurement mea = m[i]; string str = name + "." + mea.Name; if (s.Equals(str)) { parameters[c] = mea; goto next; } } } next: continue; } }
/// <summary> /// Accepts formulas /// </summary> private void acceptFormulas() { output.Clear(); acc.Clear(); foreach (char c in vars.Keys) { Variable v; output.Add(Variable.GetMeasure(c, this, out v)); acc[c + ""] = v; } foreach (char c in parameters.Keys) { IMeasurement m = parameters[c] as IMeasurement; VariableMeasurement v = c.Create(m, this); acc[c + ""] = v; } foreach (char c in aliases.Keys) { AliasNameVariable v = new AliasNameVariable(c, this); acc[c + ""] = v; object[] o = aliases[c] as object[]; } IAlias al = this; IList <string> l = al.AliasNames; foreach (string n in l) { if (n.Length == 1) { } } IFormulaObjectCreator creator = VariableDetector.GetCreator(this); variables.Clear(); foreach (char c in vars.Keys) { variables[c] = new object[4]; } IList <string> an = AliasNames; List <ObjectFormulaTree> tt = new List <ObjectFormulaTree>(); string proh = "\u03B4"; foreach (char c in parameters.Keys) { IMeasurement m = parameters[c]; if (m.Type is IOneVariableFunction) { proh += c; } } foreach (char c in vars.Keys) { object t = null; object[] os = vars[c] as object[]; if (an.Contains(c + "")) { t = GetType(c + ""); } else { t = os[2]; } if (t is IOneVariableFunction) { proh += c; } } foreach (char c in vars.Keys) { object[] os = vars[c] as object[]; object t = null; if (an.Contains(c + "")) { t = GetType(c + ""); } else { t = os[2]; } object[] ol = variables[c] as object[]; string f = os[1] as string; MathFormula form = MathFormula.FromString(MathSymbolFactory.Sizes, f); ObjectFormulaTree tree = ObjectFormulaTree.CreateTree(form.FullTransform(proh), creator); if (!t.Equals(tree.ReturnType)) { throw new Exception("Illegal return type"); } ol[1] = tree; tt.Add(tree); } trees = tt.ToArray(); }