public FormulaNode() { key = string.Empty; parent = null; childs = new List <FormulaNode>(); type = FormulaNodeType.None; }
public FormulaNode(string k, FormulaNode p, List <FormulaNode> list, FormulaNodeType t) { key = k; parent = p; childs = list; type = t; p.childs.Add(this); }
public FormulaObject Operate(FormulaObject obj, FormulaNodeType type) { switch (type) { case FormulaNodeType.Add: { return(this + obj); } case FormulaNodeType.Minus: { return(this - obj); } case FormulaNodeType.Mul: { return(this * obj); } case FormulaNodeType.Divid: { return(this * obj); } case FormulaNodeType.Pow: { return(Pow(obj)); } case FormulaNodeType.Sqrt: { return(Log(new FormulaObject("2"))); } case FormulaNodeType.Log: { return(Log(obj)); } } return(this); }