static StaticExtensionFormulaEditor() { "orderby".AddAdditionalFormula(); "where".AddAdditionalFormula(); "average".AddAdditionalFormula(); "IndexOf".AddAdditionalFormula(); MathSymbolFactory.Sizes = new int[] { 15, 11, 9, 6 }; loadFormulaResources(); ObjectFormulaTree.Creator = new FormulaArrayObjectCreator(ElementaryFunctionsCreator.Object); ElementaryFunctionOperation.InitDeri(); ElementaryIntegerOperation.Prepare(); ParallelCount = 0; }
/// <summary> /// Chooses symbol from string /// </summary> /// <param name="str">The string</param> /// <param name="b">The begin position</param> /// <param name="e">The end position</param> /// <returns>The chosen symbol</returns> public override MathSymbol ChooseSymbol(string str, int b, int e) { char c = str[b]; char by = str[b + 1]; char cb = (char)by; if ((c == '\u2221') & (by == '|')) { string s1 = ""; int ii = b + 2; for (; ii < str.Length; ii++) { if (str[ii] == '|') { break; } s1 += str[ii]; } ++ii; return(new FieldSymbol(s1)); } if ((c == '\u2220') & (by == '|')) { string s1 = ""; int ii = b + 2; for (; ii < str.Length; ii++) { if (str[ii] == '|') { break; } s1 += str[ii]; } ++ii; string s2 = ""; for (; ii < str.Length; ii++) { if (str[ii] == '|') { break; } s2 += str[ii]; } return(new SubscriptedSymbol(s1, s2)); } switch (by) { case '0': { return(new SimpleSymbol(c, 0x0, false, false)); } case '1': if (c == '%') { return(new SimpleSymbol('%', (byte)FormulaConstants.Variable, true, "\u03c0")); //break; } return(new SimpleSymbol(c)); //break; case '2': if (c == 'P') { return(new BracketsSymbol()); } else if (c == 'F') { return(new FractionSymbol()); } else if (c == 'A') { return(new BinaryFunctionSymbol('A', "atan2")); } else if (c == 'Q') { return(new RootSymbol()); } else if (c == 'A') { return(new BinaryFunctionSymbol('A', "atan2")); } break; case '3': string ss = ""; ss += c; if (c == (byte)'*') { ss = "\u2219"; } if (c == '\u2266') { ss = "<<"; } if (c == '\u2267') { ss = ">>"; } if (c == '\u2216') { ss = "AND"; } if (c == '\u8835') { ss = "=>"; } if (c == '\u2217') { ss = "OR"; } if (108 == (byte)c) { ss = "LIKE"; } if (c == '%') { ss = "%"; } b += 2; return(new BinarySymbol(c, false, ss)); //break; case '4': string comp = c + ""; if (!comp.Equals(comp.ToLower())) { return(new SimpleSymbol(c, (byte)FormulaConstants.Unary, false, ElementaryIntegerOperation.GetString(c))); } return(new SimpleSymbol(c, false, (byte)FormulaConstants.Unary)); case '5': return(new SimpleSymbol(c, false, (byte)FormulaConstants.Number)); //break; case '7': return(new SeriesSymbol(Int32.Parse(c + ""))); //break; case '8': return(new IndexedSymbol(c)); case '9': return(new PoweredIndexedSymbol(c)); } return(null); }