-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDCGroupExpressionItem.cs
More file actions
96 lines (87 loc) · 2.54 KB
/
DCGroupExpressionItem.cs
File metadata and controls
96 lines (87 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
都昌数值表达式引擎 DCSoft.Expression
南京都昌信息科技有限公司 2018年 版权所有
公司网址 http://www.dcwriter.cn
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace DCSoft.Expression
{
/// <summary>
/// 表达式元素组。
/// </summary>
[System.Runtime.InteropServices.ComVisible(false)]
public class DCGroupExpressionItem : DCExpressionItem
{
public DCGroupExpressionItem()
{
}
private DCExpressoinItemList _Items = new DCExpressoinItemList();
/// <summary>
/// 子项目列表
/// </summary>
public DCExpressoinItemList Items
{
get
{
return _Items;
}
set
{
_Items = value;
}
}
/// <summary>
/// 执行表达式
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override object Eval(IDCExpressionContext context)
{
if (this.Items != null && this.Items.Count > 0)
{
return this.Items[0].Eval(context);
}
return null;
}
internal override void AddSubItem(DCExpressionItem item)
{
if (this._Items == null)
{
this._Items = new DCExpressoinItemList();
}
this._Items.Add(item);
}
public override DCExpressionItem Clone()
{
DCGroupExpressionItem resut = (DCGroupExpressionItem)this.MemberwiseClone();
if (this._Items != null)
{
resut._Items = this._Items.CloneDeeply();
}
return resut;
}
public override void ToDebugString(int indentLevel, StringBuilder str)
{
string preFix = new string(' ', indentLevel * 3);
if (this._Items != null && this._Items.Count > 0)
{
str.AppendLine(preFix + "(");
foreach (var item in this._Items)
{
item.ToDebugString(indentLevel + 1, str);
}
str.AppendLine(preFix + ")");
}
else
{
str.AppendLine(preFix + "( )");
}
}
public override string ToString()
{
return "Group()";
}
}
}