Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / XmlUtils / System / Xml / Xsl / QIL / QilList.cs / 1 / QilList.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; namespace System.Xml.Xsl.Qil { ////// View over a Qil operator having N children. /// ////// Don't construct QIL nodes directly; instead, use the internal class QilList : QilNode { private int count; private QilNode[] members; //----------------------------------------------- // Constructor //----------------------------------------------- ///QilFactory . ////// Construct a new (empty) QilList /// public QilList(QilNodeType nodeType) : base(nodeType) { this.members = new QilNode[4]; this.xmlType = null; } //----------------------------------------------- // QilNode methods //----------------------------------------------- ////// Lazily create the XmlQueryType. /// public override XmlQueryType XmlType { get { if (this.xmlType == null) { XmlQueryType xt = XmlQueryTypeFactory.Empty; if (this.count > 0) { if (this.nodeType == QilNodeType.Sequence) { for (int i = 0; i < this.count; i++) xt = XmlQueryTypeFactory.Sequence(xt, this.members[i].XmlType); // Sequences do not preserve DocOrderDistinct if (xt.IsDod) xt = XmlQueryTypeFactory.PrimeProduct(XmlQueryTypeFactory.NodeNotRtfS, xt.Cardinality); } else if (this.nodeType == QilNodeType.BranchList) { xt = this.members[0].XmlType; for (int i = 1; i < this.count; i++) xt = XmlQueryTypeFactory.Choice(xt, this.members[i].XmlType); } } this.xmlType = xt; } return this.xmlType; } } ////// Override in order to clone the "members" array. /// public override QilNode ShallowClone(QilFactory f) { QilList n = (QilList) MemberwiseClone(); n.members = (QilNode[]) this.members.Clone(); f.TraceNode(n); return n; } //----------------------------------------------- // IListmethods -- override //----------------------------------------------- public override int Count { get { return this.count; } } public override QilNode this[int index] { get { if (index >= 0 && index < this.count) return this.members[index]; throw new IndexOutOfRangeException(); } set { if (index >= 0 && index < this.count) this.members[index] = value; else throw new IndexOutOfRangeException(); // Invalidate XmlType this.xmlType = null; } } public override void Insert(int index, QilNode node) { if (index < 0 || index > this.count) throw new IndexOutOfRangeException(); if (this.count == this.members.Length) { QilNode[] membersNew = new QilNode[this.count * 2]; Array.Copy(this.members, membersNew, this.count); this.members = membersNew; } if (index < this.count) Array.Copy(this.members, index, this.members, index + 1, this.count - index); this.count++; this.members[index] = node; // Invalidate XmlType this.xmlType = null; } public override void RemoveAt(int index) { if (index < 0 || index >= this.count) throw new IndexOutOfRangeException(); this.count--; if (index < this.count) Array.Copy(this.members, index + 1, this.members, index, this.count - index); this.members[this.count] = null; // Invalidate XmlType this.xmlType = null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; namespace System.Xml.Xsl.Qil { ////// View over a Qil operator having N children. /// ////// Don't construct QIL nodes directly; instead, use the internal class QilList : QilNode { private int count; private QilNode[] members; //----------------------------------------------- // Constructor //----------------------------------------------- ///QilFactory . ////// Construct a new (empty) QilList /// public QilList(QilNodeType nodeType) : base(nodeType) { this.members = new QilNode[4]; this.xmlType = null; } //----------------------------------------------- // QilNode methods //----------------------------------------------- ////// Lazily create the XmlQueryType. /// public override XmlQueryType XmlType { get { if (this.xmlType == null) { XmlQueryType xt = XmlQueryTypeFactory.Empty; if (this.count > 0) { if (this.nodeType == QilNodeType.Sequence) { for (int i = 0; i < this.count; i++) xt = XmlQueryTypeFactory.Sequence(xt, this.members[i].XmlType); // Sequences do not preserve DocOrderDistinct if (xt.IsDod) xt = XmlQueryTypeFactory.PrimeProduct(XmlQueryTypeFactory.NodeNotRtfS, xt.Cardinality); } else if (this.nodeType == QilNodeType.BranchList) { xt = this.members[0].XmlType; for (int i = 1; i < this.count; i++) xt = XmlQueryTypeFactory.Choice(xt, this.members[i].XmlType); } } this.xmlType = xt; } return this.xmlType; } } ////// Override in order to clone the "members" array. /// public override QilNode ShallowClone(QilFactory f) { QilList n = (QilList) MemberwiseClone(); n.members = (QilNode[]) this.members.Clone(); f.TraceNode(n); return n; } //----------------------------------------------- // IListmethods -- override //----------------------------------------------- public override int Count { get { return this.count; } } public override QilNode this[int index] { get { if (index >= 0 && index < this.count) return this.members[index]; throw new IndexOutOfRangeException(); } set { if (index >= 0 && index < this.count) this.members[index] = value; else throw new IndexOutOfRangeException(); // Invalidate XmlType this.xmlType = null; } } public override void Insert(int index, QilNode node) { if (index < 0 || index > this.count) throw new IndexOutOfRangeException(); if (this.count == this.members.Length) { QilNode[] membersNew = new QilNode[this.count * 2]; Array.Copy(this.members, membersNew, this.count); this.members = membersNew; } if (index < this.count) Array.Copy(this.members, index, this.members, index + 1, this.count - index); this.count++; this.members[index] = node; // Invalidate XmlType this.xmlType = null; } public override void RemoveAt(int index) { if (index < 0 || index >= this.count) throw new IndexOutOfRangeException(); this.count--; if (index < this.count) Array.Copy(this.members, index + 1, this.members, index, this.count - index); this.members[this.count] = null; // Invalidate XmlType this.xmlType = null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebSysDisplayNameAttribute.cs
- DataFormat.cs
- OleServicesContext.cs
- RecognitionResult.cs
- ObjectQueryExecutionPlan.cs
- WebPartEditorOkVerb.cs
- ProcessModelSection.cs
- XmlSchemaObjectTable.cs
- DetailsViewInsertEventArgs.cs
- ApplicationFileCodeDomTreeGenerator.cs
- AuthenticationSection.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- ModuleElement.cs
- ToolStripItemImageRenderEventArgs.cs
- MultilineStringConverter.cs
- SecurityContextTokenCache.cs
- SecurityElement.cs
- BitStream.cs
- sapiproxy.cs
- UTF7Encoding.cs
- ParameterBuilder.cs
- UserValidatedEventArgs.cs
- SqlClientFactory.cs
- XsltArgumentList.cs
- SolidColorBrush.cs
- HttpCachePolicyBase.cs
- Material.cs
- DocumentViewerHelper.cs
- SqlBuilder.cs
- PropertyGridView.cs
- SoundPlayerAction.cs
- DPTypeDescriptorContext.cs
- WindowsListBox.cs
- StopStoryboard.cs
- Triplet.cs
- TypeDefinition.cs
- CompressionTransform.cs
- AnnotationService.cs
- WebConfigurationHost.cs
- Utility.cs
- CacheVirtualItemsEvent.cs
- SiteMapNode.cs
- ItemsControl.cs
- Pool.cs
- Task.cs
- UpdateTranslator.cs
- XmlException.cs
- UpdateEventArgs.cs
- MultiSelector.cs
- CoreSwitches.cs
- Pair.cs
- WebPartDisplayModeCollection.cs
- GridViewRowEventArgs.cs
- DataKeyArray.cs
- AnnotationHelper.cs
- MultiPageTextView.cs
- SHA256Managed.cs
- HwndSubclass.cs
- TextBox.cs
- ClientRuntimeConfig.cs
- SmtpMail.cs
- MatrixCamera.cs
- ComponentEvent.cs
- CharEnumerator.cs
- ScriptingSectionGroup.cs
- DataControlFieldHeaderCell.cs
- WindowsHyperlink.cs
- InputBuffer.cs
- QilUnary.cs
- TheQuery.cs
- SerializationInfo.cs
- CompilerResults.cs
- BinaryCommonClasses.cs
- ConstraintCollection.cs
- UriWriter.cs
- RegionIterator.cs
- HtmlDocument.cs
- Misc.cs
- Char.cs
- SqlDataSourceView.cs
- CapabilitiesState.cs
- StyleModeStack.cs
- smtpconnection.cs
- OperandQuery.cs
- FormsAuthenticationModule.cs
- CookielessHelper.cs
- NavigationEventArgs.cs
- AtomServiceDocumentSerializer.cs
- EndpointInfo.cs
- NullableDoubleAverageAggregationOperator.cs
- XXXOnTypeBuilderInstantiation.cs
- DefaultMergeHelper.cs
- MouseGestureConverter.cs
- ConnectionStringSettingsCollection.cs
- BatchStream.cs
- CurrencyManager.cs
- CodeLinePragma.cs
- StreamAsIStream.cs
- JsonSerializer.cs
- ResXResourceReader.cs