Example #1
0
 /// Get the first parameter even if it is wrapped in a parameterList
 private static EncapsulatedData GetFirstParameter(EncapsulatedData inputData)
 {
     if (inputData.type == DataType.ParameterList)
     {
         return(inputData.parameterList.First.Value);
     }
     else
     {
         return(inputData);
     }
 }
Example #2
0
        /// Throw an exception if the function's parameter count doesn't match the expected.
        private static void CheckParameterCount(EncapsulatedData inputData, int expectedCount)
        {
            int realCount = inputData.type == DataType.ParameterList ? inputData.parameterList.Count : 1;

            if (realCount != expectedCount)
            {
                throw new Exception(
                          String.Format(
                              "ParameterCountError: {0} parameters expected, {1} found.",
                              expectedCount,
                              realCount));
            }
        }
Example #3
0
 public static EncapsulatedData Evaluate(string functionName, EncapsulatedData parameters)
 {
     // NOTE parameters.type is not always parameterList.
     // SubExpressions following single-parameter functions evaluate to EncapsulatedData with a different type.
     return(FunctionLibrary[functionName](parameters));
 }
Example #4
0
 public SubExpression(EncapsulatedData Evaluated)
 {
     this.EvaluatedValue = Evaluated;
 }
Example #5
0
 public SubExpression(string functionName, EncapsulatedData parameterList)
 {
     // if it is initialized with a string and EncapsulatedData, it is a functioncall which was parsed.
     this.functionName  = functionName;
     this.parameterList = parameterList;
 }