DataDictionary.Interpreter.BinaryExpression.CreateSurfaceForUnbound C# (CSharp) Method

CreateSurfaceForUnbound() private method

Creates the graph for the unbount parameters provided
private CreateSurfaceForUnbound ( DataDictionary.Interpreter.InterpretationContext context, Expression expression, DataDictionary.Functions.Function function, List unbound, ExplanationPart explain ) : Surface
context DataDictionary.Interpreter.InterpretationContext
expression Expression
function DataDictionary.Functions.Function
unbound List
explain ExplanationPart
return Surface
        private Surface CreateSurfaceForUnbound(InterpretationContext context, Expression expression, Function function,
            List<Parameter> unbound, ExplanationPart explain)
        {
            Surface retVal;

            if (unbound.Count == 0)
            {
                if (function != null)
                {
                    Parameter xAxis = null;

                    if (function.FormalParameters.Count > 0)
                    {
                        xAxis = (Parameter) function.FormalParameters[0];
                    }
                    Parameter yAxis = null;
                    if (function.FormalParameters.Count > 1)
                    {
                        yAxis = (Parameter) function.FormalParameters[1];
                    }
                    retVal = function.CreateSurfaceForParameters(context, xAxis, yAxis, explain);
                }
                else
                {
                    retVal = Surface.createSurface(expression.GetValue(context, explain), null, null);
                }
            }
            else if (unbound.Count == 1)
            {
                Graph graph = createGraphForUnbound(context, expression, function, unbound, explain);
                retVal = Surface.createSurface(graph.Function, unbound[0], null);
            }
            else
            {
                if (function == null)
                {
                    retVal = expression.CreateSurface(context, unbound[0], unbound[1], explain);
                }
                else
                {
                    retVal = function.CreateSurfaceForParameters(context, unbound[0], unbound[1], explain);
                }
            }
            return retVal;
        }