Example #1
0
 private static void getOperationIndexes(MathFormula formula, List <int> list)
 {
     for (int i = 0; i < formula.Count; i++)
     {
         MathSymbol s = formula[i];
         for (int j = 0; j < s.Count; j++)
         {
             getOperationIndexes(s[j], list);
         }
         if (!(s is SeriesSymbol))
         {
             continue;
         }
         SeriesSymbol ss  = s as SeriesSymbol;
         int          ind = ss.index;
         if (!list.Contains(ind))
         {
             list.Add(ind);
         }
     }
 }
Example #2
0
 /// <summary>
 /// Sets operations to formula
 /// </summary>
 /// <param name="formula">The formula</param>
 /// <param name="table">Table of operations</param>
 public static void SetOperations(MathFormula formula, Dictionary <int, IOperationAcceptor> table)
 {
     for (int i = 0; i < formula.Count; i++)
     {
         MathSymbol s = formula[i];
         for (int j = 0; j < s.Count; j++)
         {
             SetOperations(s[j], table);
         }
         if (!(s is SeriesSymbol))
         {
             continue;
         }
         SeriesSymbol ss  = s as SeriesSymbol;
         int          ind = ss.index;
         ss.acceptor = null;
         if (!table.ContainsKey(ind))
         {
             throw new Exception("Operation with index " + ind + " does not exist");
         }
         IOperationAcceptor acc = table[ind];
         ss.acceptor = acc;
     }
 }
Example #3
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="s">Prototype</param>
 public SeriesSymbol(SeriesSymbol s)
     : this(s.index)
 {
 }