Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data.SqlXml / System / Xml / Xsl / QIL / QilBinary.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="QilBinary.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 two 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 QilBinary : QilNode {
20         private QilNode left, right;
21
22
23         //-----------------------------------------------
24         // Constructor
25         //-----------------------------------------------
26
27         /// <summary>
28         /// Construct a new node
29         /// </summary>
30         public QilBinary(QilNodeType nodeType, QilNode left, QilNode right) : base(nodeType) {
31             this.left = left;
32             this.right = right;
33         }
34
35
36         //-----------------------------------------------
37         // IList<QilNode> methods -- override
38         //-----------------------------------------------
39
40         public override int Count {
41             get { return 2; }
42         }
43
44         public override QilNode this[int index] {
45             get {
46                 switch (index) {
47                     case 0: return this.left;
48                     case 1: return this.right;
49                     default: throw new IndexOutOfRangeException();
50                 }
51             }
52             set {
53                 switch (index) {
54                     case 0: this.left = value; break;
55                     case 1: this.right = value; break;
56                     default: throw new IndexOutOfRangeException();
57                 }
58             }
59         }
60
61
62         //-----------------------------------------------
63         // QilBinary methods
64         //-----------------------------------------------
65
66         public QilNode Left {
67             get { return this.left; }
68             set { this.left = value; }
69         }
70
71         public QilNode Right {
72             get { return this.right; }
73             set { this.right = value; }
74         }
75     }
76 }