public Formula(string formula) { Text = formula; try { evalNode = EvalNodeBuilder.Build(formula); } catch (Exception) { evalNode = new ValueNode(0); } }
public EvalNodeBuilder(List <string> postfix) { var tokens = new Queue <string>(postfix); while (tokens.Count > 0) { var token = tokens.Dequeue(); if (OperatorLibrary.IsOperator(token)) { PushOperator(token); } else if (IsFunction(token)) { var arity = int.Parse(tokens.Dequeue()); PushFunction(token, arity); } else if (IsBool(token)) { PushBool(token); } else if (IsValue(token)) { PushValue(token); } else if (IsString(token)) { PushString(token); } else { PushCellReferenceNode(token); } } Root = treeNodes.Pop(); }
public void AddChild(EvalNode child) { children.Insert(0, child); }
public Formula() { Text = "0"; evalNode = new ValueNode(0); }