Esempio n. 1
0
        /// <summary>Subtracts the evaluation of the right side from the evaluation of the left side and returns the result.</summary>
        public override double Eval(VarMap v, FuncMap f)
        {
            double a = leftChild.Eval(v, f);
            double b = rightChild.Eval(v, f);

            return(a - b);
        }
Esempio n. 2
0
        /// <summary>Raises the evaluation of the left side to the power of the evaluation of the right side and returns the result.</summary>
        public override double Eval(VarMap v, FuncMap f)
        {
            double a = leftChild.Eval(v, f);
            double b = rightChild.Eval(v, f);

            return(MyMath.Pow(a, b));
        }
Esempio n. 3
0
        /// <summary>Returns the value associated with the variable name in the VarMap.</summary>
        public override double Eval(VarMap v, FuncMap f)
        {
            double val = v.GetValue(name);

            if (negate)
            {
                val = -val;
            }
            return(val);
        }
Esempio n. 4
0
        /// <summary>Evaluates each of the children, storing the result in an internal double array.</summary>
        /// <remarks>
        /// Evaluates each of the children, storing the result in an internal double array.  The FuncMap is
        /// used to obtain a Function object based on the name of this FuncNode.  The function is passed
        /// the double array and returns a result.  If negate is true, the result is negated.  The result
        /// is then returned.  The numParam passed to the function is the number of children of this FuncNode.
        /// </remarks>
        public override double Eval(VarMap v, FuncMap f)
        {
            int numParam = bag.Size();

            for (int i = 0; i < numParam; i++)
            {
                of[i] = Child(i).Eval(v, f);
            }
            double result = f.GetFunction(name, numParam).Of(of, numParam);

            if (negate)
            {
                result = -result;
            }
            return(result);
        }
Esempio n. 5
0
 /// <summary>Returns the value.</summary>
 public override double Eval(VarMap v, FuncMap f)
 {
     return(val);
 }
Esempio n. 6
0
 /// <summary>Returns the result of evaluating the expression tree rooted at this node.</summary>
 public abstract double Eval(VarMap v, FuncMap f);