blob: b04a766240735a9be1ba5042e4dca5fb83dc4404 (
plain)
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
97
|
//---------------------------------------------------------------------
// <copyright file="CaseExpr.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @owner Microsoft
// @backupOwner Microsoft
//---------------------------------------------------------------------
namespace System.Data.Common.EntitySql.AST
{
using System;
using System.Globalization;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Represents the Seached Case Expression - CASE WHEN THEN [ELSE] END.
/// </summary>
internal sealed class CaseExpr : Node
{
private readonly NodeList<WhenThenExpr> _whenThenExpr;
private readonly Node _elseExpr;
/// <summary>
/// Initializes case expression without else sub-expression.
/// </summary>
/// <param name="whenThenExpr">whenThen expression list</param>
internal CaseExpr(NodeList<WhenThenExpr> whenThenExpr)
: this(whenThenExpr, null)
{
}
/// <summary>
/// Initializes case expression with else sub-expression.
/// </summary>
/// <param name="whenThenExpr">whenThen expression list</param>
/// <param name="elseExpr">else expression</param>
internal CaseExpr(NodeList<WhenThenExpr> whenThenExpr, Node elseExpr)
{
_whenThenExpr = whenThenExpr;
_elseExpr = elseExpr;
}
/// <summary>
/// Returns the list of WhenThen expressions.
/// </summary>
internal NodeList<WhenThenExpr> WhenThenExprList
{
get { return _whenThenExpr; }
}
/// <summary>
/// Returns the optional Else expression.
/// </summary>
internal Node ElseExpr
{
get { return _elseExpr; }
}
}
/// <summary>
/// Represents the when then sub expression.
/// </summary>
internal class WhenThenExpr : Node
{
private readonly Node _whenExpr;
private readonly Node _thenExpr;
/// <summary>
/// Initializes WhenThen sub-expression.
/// </summary>
/// <param name="whenExpr">When expression</param>
/// <param name="thenExpr">Then expression</param>
internal WhenThenExpr(Node whenExpr, Node thenExpr)
{
_whenExpr = whenExpr;
_thenExpr = thenExpr;
}
/// <summary>
/// Returns When expression.
/// </summary>
internal Node WhenExpr
{
get { return _whenExpr; }
}
/// <summary>
/// Returns Then Expression.
/// </summary>
internal Node ThenExpr
{
get { return _thenExpr; }
}
}
}
|