Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ComplexBindingPropertiesAttribute.cs
- TransformerConfigurationWizardBase.cs
- HwndStylusInputProvider.cs
- DispatcherFrame.cs
- PrintPreviewDialog.cs
- RoutedEventArgs.cs
- DataGridState.cs
- SmiSettersStream.cs
- PersianCalendar.cs
- SamlAuthorityBinding.cs
- BidOverLoads.cs
- SourceFileBuildProvider.cs
- MethodToken.cs
- DataGridViewCell.cs
- Lasso.cs
- WebPartHeaderCloseVerb.cs
- TcpClientChannel.cs
- ObjectNavigationPropertyMapping.cs
- WindowsImpersonationContext.cs
- Win32.cs
- EventMappingSettings.cs
- Errors.cs
- MailDefinition.cs
- UrlAuthFailedErrorFormatter.cs
- SelectionGlyphBase.cs
- FusionWrap.cs
- FormsAuthenticationUserCollection.cs
- ThreadStateException.cs
- GPStream.cs
- HostingEnvironment.cs
- PersonalizationEntry.cs
- Vector3DKeyFrameCollection.cs
- SQLInt32Storage.cs
- AssemblyNameProxy.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- OperatingSystemVersionCheck.cs
- DisposableCollectionWrapper.cs
- HtmlButton.cs
- StrokeRenderer.cs
- XmlSchemaComplexContentExtension.cs
- XmlWhitespace.cs
- ComPersistableTypeElement.cs
- XAMLParseException.cs
- TextTreeRootNode.cs
- XmlComment.cs
- MetadataItem_Static.cs
- ChannelParameterCollection.cs
- ParentQuery.cs
- IisTraceListener.cs
- Types.cs
- ObjectFullSpanRewriter.cs
- SchemeSettingElement.cs
- CustomAssemblyResolver.cs
- PageThemeCodeDomTreeGenerator.cs
- CodeDOMUtility.cs
- Contracts.cs
- DataGridViewCellStyleBuilderDialog.cs
- LogWriteRestartAreaState.cs
- ButtonColumn.cs
- NamespaceEmitter.cs
- AdPostCacheSubstitution.cs
- MsmqIntegrationMessagePool.cs
- ResourcePermissionBaseEntry.cs
- CompressedStack.cs
- ContractNamespaceAttribute.cs
- SqlFunctions.cs
- CodeExporter.cs
- FixedPage.cs
- DataGridRowAutomationPeer.cs
- Brush.cs
- GACMembershipCondition.cs
- XPathDocument.cs
- UIPermission.cs
- BaseCodeDomTreeGenerator.cs
- TemplateControlCodeDomTreeGenerator.cs
- RegexWriter.cs
- TdsRecordBufferSetter.cs
- OdbcReferenceCollection.cs
- ServiceHostFactory.cs
- LoginViewDesigner.cs
- SqlConnectionHelper.cs
- NavigationCommands.cs
- DbConnectionOptions.cs
- ServicesUtilities.cs
- ObjectDataSourceFilteringEventArgs.cs
- InheritanceRules.cs
- Point4D.cs
- ToolStripContainer.cs
- ContextMenuStripActionList.cs
- lengthconverter.cs
- FastPropertyAccessor.cs
- ExceptionHandlers.cs
- OracleRowUpdatedEventArgs.cs
- PeerCollaboration.cs
- TypeSystem.cs
- DesignConnectionCollection.cs
- DtdParser.cs
- SynchronizingStream.cs
- ObjectNotFoundException.cs
- EntitySetRetriever.cs