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
- TextEditorTyping.cs
- AccessKeyManager.cs
- OutputWindow.cs
- SystemFonts.cs
- ObjectList.cs
- CollectionChangedEventManager.cs
- AncillaryOps.cs
- Configuration.cs
- SafePipeHandle.cs
- ExtensibleSyndicationObject.cs
- ColorConvertedBitmap.cs
- RegexNode.cs
- RichTextBoxConstants.cs
- ParameterCollection.cs
- PersonalizationStateQuery.cs
- LinkLabelLinkClickedEvent.cs
- Parsers.cs
- PeerNearMe.cs
- EventArgs.cs
- SafeRightsManagementHandle.cs
- Point3DConverter.cs
- ScopelessEnumAttribute.cs
- TokenBasedSet.cs
- SymLanguageType.cs
- ValidatingReaderNodeData.cs
- DataTableCollection.cs
- OletxResourceManager.cs
- MultilineStringConverter.cs
- RecordsAffectedEventArgs.cs
- GlyphRunDrawing.cs
- DynamicHyperLink.cs
- WpfXamlLoader.cs
- WorkflowRuntimeServiceElementCollection.cs
- EntityContainer.cs
- LinearGradientBrush.cs
- SqlDataRecord.cs
- CodeSubDirectoriesCollection.cs
- CheckBox.cs
- RuntimeHandles.cs
- XDRSchema.cs
- AssociationTypeEmitter.cs
- Registry.cs
- ThemeableAttribute.cs
- WorkflowRuntime.cs
- SafeBitVector32.cs
- UriParserTemplates.cs
- ReadOnlyCollectionBase.cs
- VariableQuery.cs
- ZipIOBlockManager.cs
- ResourceDescriptionAttribute.cs
- GeneralTransform3D.cs
- MaskedTextProvider.cs
- CharAnimationUsingKeyFrames.cs
- ToolStripDropDownClosedEventArgs.cs
- ClientFormsIdentity.cs
- CacheChildrenQuery.cs
- BooleanStorage.cs
- safelinkcollection.cs
- SqlConnectionString.cs
- CodeIterationStatement.cs
- CodeMethodReturnStatement.cs
- __FastResourceComparer.cs
- PreviewKeyDownEventArgs.cs
- DoubleAnimation.cs
- UserMapPath.cs
- LogicalExpr.cs
- ApplicationDirectoryMembershipCondition.cs
- ButtonBaseAdapter.cs
- ResourceDisplayNameAttribute.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- HtmlLabelAdapter.cs
- ObjectListDesigner.cs
- xamlnodes.cs
- CodeAttributeArgument.cs
- Dispatcher.cs
- TextFindEngine.cs
- ListItemConverter.cs
- Certificate.cs
- ModelFunctionTypeElement.cs
- ConfigurationValidatorAttribute.cs
- KeyValueConfigurationElement.cs
- AuthenticatingEventArgs.cs
- ProxyAssemblyNotLoadedException.cs
- CompilationUtil.cs
- NativeMethods.cs
- TaskExceptionHolder.cs
- RoutedEventHandlerInfo.cs
- Command.cs
- WindowsFormsHelpers.cs
- GrammarBuilderPhrase.cs
- XmlSchemaDatatype.cs
- WorkflowView.cs
- ClientType.cs
- cookieexception.cs
- FormViewInsertEventArgs.cs
- SubMenuStyle.cs
- ExpressionVisitor.cs
- DataGridViewSelectedCellCollection.cs
- ValidationRule.cs
- DesignTimeVisibleAttribute.cs