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 / SubstitutionList.cs / 1 / SubstitutionList.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Collections; using System.Diagnostics; namespace System.Xml.Xsl.Qil { ////// Data structure for use in CloneAndReplace /// ///Isolates the many QilNode classes from changes in /// the underlying data structure. internal sealed class SubstitutionList { // private ArrayList s; public SubstitutionList() { this.s = new ArrayList(4); } ////// Add a substituion pair /// /// a node to be replaced /// its replacement public void AddSubstitutionPair(QilNode find, QilNode replace) { s.Add(find); s.Add(replace); } ////// Remove the last a substituion pair /// public void RemoveLastSubstitutionPair() { s.RemoveRange(s.Count - 2, 2); } ////// Remove the last N substitution pairs /// public void RemoveLastNSubstitutionPairs(int n) { Debug.Assert(n >= 0, "n must be nonnegative"); if (n > 0) { n *= 2; s.RemoveRange(s.Count - n, n); } } ////// Find the replacement for a node /// /// the node to replace ///null if no replacement is found public QilNode FindReplacement(QilNode n) { Debug.Assert(s.Count % 2 == 0); for (int i = s.Count-2; i >= 0; i-=2) if (s[i] == n) return (QilNode)s[i+1]; return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Collections; using System.Diagnostics; namespace System.Xml.Xsl.Qil { ////// Data structure for use in CloneAndReplace /// ///Isolates the many QilNode classes from changes in /// the underlying data structure. internal sealed class SubstitutionList { // private ArrayList s; public SubstitutionList() { this.s = new ArrayList(4); } ////// Add a substituion pair /// /// a node to be replaced /// its replacement public void AddSubstitutionPair(QilNode find, QilNode replace) { s.Add(find); s.Add(replace); } ////// Remove the last a substituion pair /// public void RemoveLastSubstitutionPair() { s.RemoveRange(s.Count - 2, 2); } ////// Remove the last N substitution pairs /// public void RemoveLastNSubstitutionPairs(int n) { Debug.Assert(n >= 0, "n must be nonnegative"); if (n > 0) { n *= 2; s.RemoveRange(s.Count - n, n); } } ////// Find the replacement for a node /// /// the node to replace ///null if no replacement is found public QilNode FindReplacement(QilNode n) { Debug.Assert(s.Count % 2 == 0); for (int i = s.Count-2; i >= 0; i-=2) if (s[i] == n) return (QilNode)s[i+1]; return 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
- AspNetHostingPermission.cs
- SupportingTokenProviderSpecification.cs
- ModelPropertyCollectionImpl.cs
- Permission.cs
- ReferenceEqualityComparer.cs
- KnownTypes.cs
- GlyphInfoList.cs
- RuleRefElement.cs
- SynchronousChannelMergeEnumerator.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- XmlArrayItemAttribute.cs
- WeakRefEnumerator.cs
- BadImageFormatException.cs
- TabPageDesigner.cs
- RelatedEnd.cs
- SafeNativeMemoryHandle.cs
- DataControlFieldCollection.cs
- RawTextInputReport.cs
- DescendantOverDescendantQuery.cs
- LogWriteRestartAreaAsyncResult.cs
- Atom10FormatterFactory.cs
- ValueConversionAttribute.cs
- FigureParagraph.cs
- ParameterModifier.cs
- InlineCollection.cs
- BackEase.cs
- ReadOnlyCollectionBase.cs
- DefaultExpressionVisitor.cs
- InteropEnvironment.cs
- NativeMethods.cs
- Stack.cs
- FilteredDataSetHelper.cs
- PackageDigitalSignatureManager.cs
- FlowLayoutSettings.cs
- TextBoxBase.cs
- SimpleType.cs
- SapiRecoInterop.cs
- LicenseException.cs
- SqlFileStream.cs
- handlecollector.cs
- EndpointDiscoveryMetadata11.cs
- CodeAttributeArgumentCollection.cs
- SafeLocalAllocation.cs
- EventLogPermission.cs
- MULTI_QI.cs
- XmlSortKey.cs
- Decimal.cs
- DataObjectFieldAttribute.cs
- EdmFunction.cs
- printdlgexmarshaler.cs
- SizeIndependentAnimationStorage.cs
- RadioButtonBaseAdapter.cs
- IIS7WorkerRequest.cs
- CalculatedColumn.cs
- StoreItemCollection.Loader.cs
- ElementsClipboardData.cs
- PolyLineSegment.cs
- Int64Animation.cs
- CustomExpression.cs
- ADMembershipUser.cs
- MasterPage.cs
- MergeLocalizationDirectives.cs
- DataPagerCommandEventArgs.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- Bold.cs
- XmlDigitalSignatureProcessor.cs
- NetPipeSection.cs
- ResourceIDHelper.cs
- DesignerResources.cs
- DesignerHierarchicalDataSourceView.cs
- Stack.cs
- login.cs
- SBCSCodePageEncoding.cs
- RelationshipWrapper.cs
- RegexRunner.cs
- SerializationStore.cs
- HashMembershipCondition.cs
- InternalConfigRoot.cs
- WebPartManager.cs
- mactripleDES.cs
- AspNetSynchronizationContext.cs
- BaseTemplateCodeDomTreeGenerator.cs
- FontNamesConverter.cs
- SuppressIldasmAttribute.cs
- GPPOINT.cs
- SymbolDocumentGenerator.cs
- ContextMenu.cs
- SchemaAttDef.cs
- StrongNamePublicKeyBlob.cs
- SqlDuplicator.cs
- NavigatorInput.cs
- TlsSspiNegotiation.cs
- SpStreamWrapper.cs
- DataGridViewCellParsingEventArgs.cs
- EntityViewContainer.cs
- QilReference.cs
- RelatedEnd.cs
- TriggerCollection.cs
- XsdDataContractExporter.cs
- WorkflowItemsPresenter.cs