Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data.SqlXml / System / Xml / Xsl / QIL / QilTernary.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="QilTernary.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
7 using System;
8 using System.Collections.Generic;
9 using System.Diagnostics;
10
11 namespace System.Xml.Xsl.Qil {
12
13     /// <summary>
14     /// View over a Qil operator having three children.
15     /// </summary>
16     /// <remarks>
17     /// Don't construct QIL nodes directly; instead, use the <see cref="QilFactory">QilFactory</see>.
18     /// </remarks>
19     internal class QilTernary : QilNode {
20         private QilNode left, center, right;
21
22
23         //-----------------------------------------------
24         // Constructor
25         //-----------------------------------------------
26
27         /// <summary>
28         /// Construct a new node
29         /// </summary>
30         public QilTernary(QilNodeType nodeType, QilNode left, QilNode center, QilNode right) : base(nodeType) {
31             this.left = left;
32             this.center = center;
33             this.right = right;
34         }
35
36
37         //-----------------------------------------------
38         // IList<QilNode> methods -- override
39         //-----------------------------------------------
40
41         public override int Count {
42             get { return 3; }
43         }
44
45         public override QilNode this[int index] {
46             get {
47                 switch (index) {
48                     case 0: return this.left;
49                     case 1: return this.center;
50                     case 2: return this.right;
51                     default: throw new IndexOutOfRangeException();
52                 }
53             }
54             set {
55                 switch (index) {
56                     case 0: this.left = value; break;
57                     case 1: this.center = value; break;
58                     case 2: this.right = value; break;
59                     default: throw new IndexOutOfRangeException();
60                 }
61             }
62         }
63
64
65         //-----------------------------------------------
66         // QilTernary methods
67         //-----------------------------------------------
68
69         public QilNode Left {
70             get { return this.left; }
71             set { this.left = value; }
72         }
73
74         public QilNode Center {
75             get { return this.center; }
76             set { this.center = value; }
77         }
78
79         public QilNode Right {
80             get { return this.right; }
81             set { this.right = value; }
82         }
83     }
84 }