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
- SchemaImporterExtensionElement.cs
- EventDescriptor.cs
- ObjectIDGenerator.cs
- EventEntry.cs
- UserInitiatedRoutedEventPermission.cs
- SessionEndedEventArgs.cs
- Durable.cs
- TextBlock.cs
- VirtualDirectoryMapping.cs
- dtdvalidator.cs
- CommandDevice.cs
- TransformPattern.cs
- SerializerWriterEventHandlers.cs
- MaterializeFromAtom.cs
- FileDialogCustomPlace.cs
- EtwTrace.cs
- odbcmetadatacolumnnames.cs
- Trigger.cs
- DataGridViewAdvancedBorderStyle.cs
- TraceContextRecord.cs
- DocumentEventArgs.cs
- Thread.cs
- ListViewInsertionMark.cs
- PathFigure.cs
- OleDbFactory.cs
- Repeater.cs
- CroppedBitmap.cs
- CodeGotoStatement.cs
- ZoneIdentityPermission.cs
- ProfilePropertySettingsCollection.cs
- StructuredProperty.cs
- DefaultAutoFieldGenerator.cs
- CalendarDateChangedEventArgs.cs
- NumericUpDown.cs
- StylusPointPropertyId.cs
- DataSourceCache.cs
- ErrorCodes.cs
- TypeConverterValueSerializer.cs
- BamlStream.cs
- Formatter.cs
- ElapsedEventArgs.cs
- TreeViewAutomationPeer.cs
- SystemResourceHost.cs
- OutputCacheProfileCollection.cs
- XmlIterators.cs
- TypeForwardedToAttribute.cs
- BuildDependencySet.cs
- WebPartsPersonalizationAuthorization.cs
- LayoutManager.cs
- FacetDescriptionElement.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- GridViewColumnHeaderAutomationPeer.cs
- PinnedBufferMemoryStream.cs
- SmtpDigestAuthenticationModule.cs
- ResourcePermissionBase.cs
- SamlDoNotCacheCondition.cs
- StatusBarDrawItemEvent.cs
- EntityDataSourceContextDisposingEventArgs.cs
- TextElement.cs
- Command.cs
- StylusButtonCollection.cs
- RelatedView.cs
- SendKeys.cs
- FontClient.cs
- MessageDecoder.cs
- HttpDebugHandler.cs
- ExceptionRoutedEventArgs.cs
- ScriptComponentDescriptor.cs
- DeflateEmulationStream.cs
- ScrollViewer.cs
- RectAnimationBase.cs
- StrongName.cs
- HuffModule.cs
- RegistryPermission.cs
- baseaxisquery.cs
- Int32.cs
- PenContext.cs
- NamedPermissionSet.cs
- WebPartEditVerb.cs
- _PooledStream.cs
- IndexedGlyphRun.cs
- ServiceModelConfigurationSectionCollection.cs
- BitmapSourceSafeMILHandle.cs
- HtmlElementCollection.cs
- AudioFormatConverter.cs
- HttpHandlerActionCollection.cs
- ButtonChrome.cs
- ConfigXmlWhitespace.cs
- mactripleDES.cs
- OpenTypeLayout.cs
- DataErrorValidationRule.cs
- ModuleBuilderData.cs
- PostBackTrigger.cs
- FixedPageStructure.cs
- SslStream.cs
- FragmentQueryProcessor.cs
- CellConstantDomain.cs
- XmlSchemaSimpleContentRestriction.cs
- MetafileHeader.cs
- ApplicationHost.cs