public CreateGraph ( DataDictionary.Interpreter.InterpretationContext context, Parameter parameter, |
||
context | DataDictionary.Interpreter.InterpretationContext | The interpretation context |
parameter | Parameter | The parameters of *the enclosing function* for which the graph should be created |
explain | ||
return | Graph |
/// <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> /// <param name="explain"></param> /// <returns></returns> public override Graph CreateGraph(InterpretationContext context, Parameter parameter, ExplanationPart explain) { Graph retVal = base.CreateGraph(context, parameter, explain); if (Term != null) { retVal = Graph.createGraph(GetValue(context, explain), parameter, explain); } else if (Expression != null) { if (UnaryOp == null) { retVal = Expression.CreateGraph(context, parameter, explain); } else if (UnaryOp == Minus) { retVal = Expression.CreateGraph(context, parameter, explain); retVal.Negate(); } else { throw new Exception("Cannot create graph where NOT operator is defined"); } } return(retVal); }
/// <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> /// <param name="explain"></param> /// <returns></returns> public override Graph CreateGraph(InterpretationContext context, Parameter parameter, ExplanationPart explain) { Graph retVal; if (parameter == Parameters[0] || parameter == Parameters[1]) { retVal = Expression.CreateGraph(context, parameter, explain); } else { throw new Exception("Cannot create graph for parameter " + parameter.Name); } return(retVal); }
/// <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> /// <param name="explain"></param> /// <returns></returns> private Graph createGraphForUnbound(InterpretationContext context, Expression expression, Function function, List<Parameter> unbound, ExplanationPart explain) { Graph retVal; if (unbound.Count == 0) { if (function != null && function.FormalParameters.Count > 0) { retVal = function.CreateGraph(context, (Parameter) function.FormalParameters[0], explain); } else { retVal = Graph.createGraph(expression.GetValue(context, explain), null, explain); } } else { if (function == null) { retVal = expression.CreateGraph(context, unbound[0], explain); } else { retVal = function.CreateGraph(context, unbound[0], explain); } } return retVal; }