Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2989_MovingPeaksBenchmark/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ConstantExpressions.cs

Last change on this file was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 817 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
7{
8    public static class ConstantExpressions
9    {
10        public static Expression Percent
11        {
12            get { return new ConstantExpression("Percent", () => new CompileResult(0.01, DataType.Decimal)); }
13        }
14    }
15
16    public class ConstantExpression : AtomicExpression
17    {
18        private readonly Func<CompileResult> _factoryMethod;
19
20        public ConstantExpression(string title, Func<CompileResult> factoryMethod)
21            : base(title)
22        {
23            _factoryMethod = factoryMethod;
24        }
25
26        public override CompileResult Compile()
27        {
28            return _factoryMethod();
29        }
30    }
31}
Note: See TracBrowser for help on using the repository browser.