コード例 #1
0
 public Symbol()
 {
     subSymbols = new List <Symbol>();
     operation  = SymbolOperator.none;
     polarity   = SymbolPolarity.positive;
     type       = SymbolType.numerical;
 }
コード例 #2
0
 public Symbol(List <Symbol> subSymbols, SymbolOperator operation) : this()
 {
     this.subSymbols = subSymbols;
     this.operation  = operation;
     this.type       = SymbolType.node;
 }
コード例 #3
0
 bool isOperatorTypeOf(SymbolOperator opwerator)
 {
     return(operation == opwerator);
 }
コード例 #4
0
 private static void MergeNodeSymbolsToOne(Symbol s1, Symbol s2, ref Symbol mergedTo, SymbolOperator operation)
 {
     mergedTo.type = SymbolType.node;
     if (s1.isOperatorTypeOf(s2.operation))
     {
         if (s1.isOperatorTypeOf(operation))
         {
             mergedTo.AbsorbeBranches(s1);
             mergedTo.AbsorbeBranches(s2);
         }
         else if (!s1.isOperatorTypeOf(operation))
         {
             mergedTo.subSymbols.Add(s1);
             mergedTo.subSymbols.Add(s2);
         }
     }
     else if (s1.isOperatorTypeOf(mergedTo.operation))
     {
         mergedTo.subSymbols = s1.StackSubsymbolsWith(s2);
     }
     else if (s2.isOperatorTypeOf(mergedTo.operation))
     {
         mergedTo.subSymbols = s2.StackSubsymbolsWith(s1);
     }
 }