Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | namespace 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.