/// <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); Graph graph = InitialValue.CreateGraph(context, parameter, explain); if (graph != null) { ListValue value = ListExpression.GetValue(context, explain) as ListValue; if (value != null) { int token = PrepareIteration(context); AccumulatorVariable.Value = graph.Function; foreach (IValue v in value.Val) { if (v != EfsSystem.Instance.EmptyValue) { // All elements should always be != from EmptyValue ElementFound = true; IteratorVariable.Value = v; if (ConditionSatisfied(context, explain)) { MatchingElementFound = true; AccumulatorVariable.Value = IteratorExpression.GetValue(context, explain); } } NextIteration(); } Function function = AccumulatorVariable.Value as Function; if (function != null) { retVal = function.Graph; } else { retVal = Function.CreateGraphForValue(AccumulatorVariable.Value); } EndIteration(context, explain, token); } } else { throw new Exception("Cannot create graph for initial value " + InitialValue); } return(retVal); }