コード例 #1
0
 public FormulaNode()
 {
     key    = string.Empty;
     parent = null;
     childs = new List <FormulaNode>();
     type   = FormulaNodeType.None;
 }
コード例 #2
0
 public FormulaNode(string k, FormulaNode p, List <FormulaNode> list, FormulaNodeType t)
 {
     key    = k;
     parent = p;
     childs = list;
     type   = t;
     p.childs.Add(this);
 }
コード例 #3
0
        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);
        }