コード例 #1
0
        /// <summary>
        /// Creates the graph associated to this expression, when the given parameter ranges over the X axis
        /// </summary>
        /// <param name="context">The interpretation context</param>
        /// <param name="parameter">The parameters of *the enclosing function* for which the graph should be created</param>
        /// <returns></returns>
        public override Functions.Graph createGraph(InterpretationContext context, Parameter parameter)
        {
            Functions.Graph retVal = base.createGraph(context, parameter);

            if (Term != null)
            {
                retVal = Functions.Graph.createGraph(GetValue(context), parameter);
            }
            else if (Expression != null)
            {
                if (UnaryOp == null)
                {
                    retVal = Expression.createGraph(context, parameter);
                }
                else if (UnaryOp == MINUS)
                {
                    retVal = Expression.createGraph(context, parameter);
                    retVal.Negate();
                }
                else
                {
                    throw new Exception("Cannot create graph where NOT operator is defined");
                }
            }

            return(retVal);
        }
コード例 #2
0
        /// <summary>
        /// Creates the graph for the unbound parameters provided
        /// </summary>
        /// <param name="context"></param>
        /// <param name="expression"></param>
        /// <param name="function"></param>
        /// <param name="unbound"></param>
        /// <returns></returns>
        private Graph createGraphForUnbound(InterpretationContext context, Expression expression, Function function, List <Parameter> unbound)
        {
            Graph retVal = null;

            if (unbound.Count == 0)
            {
                if (function != null && function.FormalParameters.Count > 0)
                {
                    retVal = function.createGraph(context, (Parameter)function.FormalParameters[0]);
                }
                else
                {
                    retVal = Graph.createGraph(expression.GetValue(context), null);
                }
            }
            else
            {
                if (function == null)
                {
                    retVal = expression.createGraph(context, unbound[0]);
                }
                else
                {
                    retVal = function.createGraph(context, unbound[0]);
                }
            }

            return(retVal);
        }
コード例 #3
0
        /// <summary>
        /// Creates the graph associated to this expression, when the given parameter ranges over the X axis
        /// </summary>
        /// <param name="context">The interpretation context</param>
        /// <param name="parameter">The parameters of *the enclosing function* for which the graph should be created</param>
        /// <returns></returns>
        public override Functions.Graph createGraph(InterpretationContext context, Parameter parameter)
        {
            Functions.Graph retVal = base.createGraph(context, parameter);

            if (parameter == Parameters[0] || parameter == Parameters[1])
            {
                retVal = Expression.createGraph(context, parameter);
            }
            else
            {
                throw new Exception("Cannot create graph for parameter " + parameter.Name);
            }

            return(retVal);
        }
コード例 #4
0
        /// <summary>
        /// Creates the graph for the unbound parameters provided
        /// </summary>
        /// <param name="context"></param>
        /// <param name="expression"></param>
        /// <param name="function"></param>
        /// <param name="unbound"></param>
        /// <returns></returns>
        private Graph createGraphForUnbound(InterpretationContext context, Expression expression, Function function, List<Parameter> unbound)
        {
            Graph retVal = null;

            if (unbound.Count == 0)
            {
                if (function != null && function.FormalParameters.Count > 0)
                {
                    retVal = function.createGraph(context, (Parameter)function.FormalParameters[0]);
                }
                else
                {
                    retVal = Graph.createGraph(expression.GetValue(context), null);
                }
            }
            else
            {
                if (function == null)
                {
                    retVal = expression.createGraph(context, unbound[0]);
                }
                else
                {
                    retVal = function.createGraph(context, unbound[0]);
                }
            }

            return retVal;
        }