public Symbol() { subSymbols = new List <Symbol>(); operation = SymbolOperator.none; polarity = SymbolPolarity.positive; type = SymbolType.numerical; }
public Symbol(List <Symbol> subSymbols, SymbolOperator operation) : this() { this.subSymbols = subSymbols; this.operation = operation; this.type = SymbolType.node; }
bool isOperatorTypeOf(SymbolOperator opwerator) { return(operation == opwerator); }
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); } }