コード例 #1
0
ファイル: If.cs プロジェクト: swmal/ExcelFormulaParser
 public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
 {
     ValidateArguments(arguments, 3);
     var condition = ArgToBool(arguments, 0);
     var firstStatement = arguments.ElementAt(1).Value;
     var secondStatement = arguments.ElementAt(2).Value;
     var factory = new CompileResultFactory();
     return condition ? factory.Create(firstStatement) : factory.Create(secondStatement);
 }
コード例 #2
0
 private CompileResult CompileRangeValues()
 {
     var result = _excelDataProvider.GetRangeValues(ExpressionString);
     if (result == null || result.Count() == 0)
     {
         return null;
     }
     var rangeValueList = HandleRangeValues(result);
     if (rangeValueList.Count > 1)
     {
         return new CompileResult(rangeValueList, DataType.Enumerable);
     }
     else
     {
         var factory = new CompileResultFactory();
         return factory.Create(rangeValueList.First());
     }
 }
コード例 #3
0
        private CompileResult CompileRangeValues()
        {
            var result = _excelDataProvider.GetRangeValues(ExpressionString);

            if (result == null || result.Count() == 0)
            {
                return(null);
            }
            var rangeValueList = HandleRangeValues(result);

            if (rangeValueList.Count > 1)
            {
                return(new CompileResult(rangeValueList, DataType.Enumerable));
            }
            else
            {
                var factory = new CompileResultFactory();
                return(factory.Create(rangeValueList.First()));
            }
        }
コード例 #4
0
 public NumericExpressionEvaluator(ValueMatcher valueMatcher, CompileResultFactory compileResultFactory)
 {
     _valueMatcher = valueMatcher;
     _compileResultFactory = compileResultFactory;
 }