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
- FileUpload.cs
- ToggleButton.cs
- MSHTMLHost.cs
- AnimationTimeline.cs
- ZipFileInfo.cs
- StringSorter.cs
- AnonymousIdentificationSection.cs
- Types.cs
- ProjectionPlan.cs
- MetaModel.cs
- xmlsaver.cs
- StretchValidation.cs
- IntegerValidator.cs
- ReadOnlyNameValueCollection.cs
- EnumConverter.cs
- HelpProvider.cs
- HtmlValidatorAdapter.cs
- DatePicker.cs
- PageAsyncTask.cs
- GridItemPattern.cs
- XmlNamespaceDeclarationsAttribute.cs
- MenuStrip.cs
- RowBinding.cs
- AvtEvent.cs
- SortDescriptionCollection.cs
- OleDbFactory.cs
- InlineUIContainer.cs
- CompressStream.cs
- Themes.cs
- RuleProcessor.cs
- safesecurityhelperavalon.cs
- NetworkInformationPermission.cs
- GridView.cs
- Context.cs
- DocumentXPathNavigator.cs
- BindingObserver.cs
- followingquery.cs
- Matrix3D.cs
- NameScopePropertyAttribute.cs
- MessageContractAttribute.cs
- ToolStripGrip.cs
- MediaPlayer.cs
- XmlSerializableServices.cs
- Normalization.cs
- PersonalizationStateInfoCollection.cs
- TextRunTypographyProperties.cs
- FixedSOMTableCell.cs
- XpsResourcePolicy.cs
- UniqueIdentifierService.cs
- ProfileManager.cs
- HelpExampleGenerator.cs
- OleDbDataAdapter.cs
- GeometryCollection.cs
- ManualResetEventSlim.cs
- ElementHostAutomationPeer.cs
- Empty.cs
- DBConnection.cs
- TypeHelpers.cs
- SingleSelectRootGridEntry.cs
- DataPagerFieldCollection.cs
- Collection.cs
- RowTypeElement.cs
- TextDecorationLocationValidation.cs
- X509CertificateValidator.cs
- TreeIterator.cs
- XmlEncodedRawTextWriter.cs
- Currency.cs
- PageMediaType.cs
- Model3D.cs
- RadioButtonFlatAdapter.cs
- OdbcDataAdapter.cs
- XamlPoint3DCollectionSerializer.cs
- ColorDialog.cs
- SerialPinChanges.cs
- ZeroOpNode.cs
- odbcmetadatafactory.cs
- TextWriter.cs
- TableRowCollection.cs
- NativeStructs.cs
- TemplateKey.cs
- odbcmetadatacollectionnames.cs
- DetailsViewInsertedEventArgs.cs
- TextBoxBase.cs
- MouseGestureConverter.cs
- DependencySource.cs
- ObjectTag.cs
- ErrorStyle.cs
- WinEventWrap.cs
- HttpHandlerActionCollection.cs
- EventWaitHandle.cs
- ChangePassword.cs
- Claim.cs
- WorkflowQueueInfo.cs
- SpoolingTask.cs
- ToolStripCollectionEditor.cs
- SqlGenerator.cs
- TextTreeText.cs
- SigningCredentials.cs
- CompiledAction.cs
- NavigationHelper.cs