The Labs \ Source Viewer \ SSCLI \ System.Xml.Xsl.Qil \ QilUnary

  1. //------------------------------------------------------------------------------
  2. // <copyright file="QilUnary.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Diagnostics;
  18. namespace System.Xml.Xsl.Qil
  19. {
  20.    
  21.     /// <summary>
  22.     /// View over a Qil operator having one child.
  23.     /// </summary>
  24.     /// <remarks>
  25.     /// Don't construct QIL nodes directly; instead, use the <see cref="QilFactory">QilFactory</see>.
  26.     /// </remarks>
  27.     internal class QilUnary : QilNode
  28.     {
  29.         private QilNode child;
  30.        
  31.        
  32.         //-----------------------------------------------
  33.         // Constructor
  34.         //-----------------------------------------------
  35.        
  36.         /// <summary>
  37.         /// Construct a new node
  38.         /// </summary>
  39.         public QilUnary(QilNodeType nodeType, QilNode child) : base(nodeType)
  40.         {
  41.             this.child = child;
  42.         }
  43.        
  44.        
  45.         //-----------------------------------------------
  46.         // IList<QilNode> methods -- override
  47.         //-----------------------------------------------
  48.        
  49.         public override int Count {
  50.             get { return 1; }
  51.         }
  52.        
  53.         public override QilNode this[int index]
  54.         {
  55.             get {
  56.                 if (index != 0)
  57.                     throw new IndexOutOfRangeException();
  58.                 return this.child;
  59.             }
  60.             set {
  61.                 if (index != 0)
  62.                     throw new IndexOutOfRangeException();
  63.                 this.child = value;
  64.             }
  65.         }
  66.        
  67.        
  68.         //-----------------------------------------------
  69.         // QilUnary methods
  70.         //-----------------------------------------------
  71.        
  72.         public QilNode Child {
  73.             get { return this.child; }
  74.             set { this.child = value; }
  75.         }
  76.     }
  77. }

Developer Fusion