Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / QIL / SubstitutionList.cs / 1305376 / 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
- RedistVersionInfo.cs
- NativeMethods.cs
- HashLookup.cs
- DBConnectionString.cs
- CodeGroup.cs
- ComponentDispatcher.cs
- WmlTextViewAdapter.cs
- FullTextLine.cs
- AssemblyLoader.cs
- BaseAddressPrefixFilterElement.cs
- XomlSerializationHelpers.cs
- X509ChainElement.cs
- OutOfMemoryException.cs
- IncrementalHitTester.cs
- ExpressionVisitorHelpers.cs
- SiteMapNodeCollection.cs
- AlphaSortedEnumConverter.cs
- Int16.cs
- UInt32.cs
- GeneratedView.cs
- SafeFileHandle.cs
- Highlights.cs
- OleDbTransaction.cs
- OdbcRowUpdatingEvent.cs
- DataContractAttribute.cs
- listitem.cs
- WindowsFormsSynchronizationContext.cs
- AttributeProviderAttribute.cs
- _ListenerResponseStream.cs
- XsltException.cs
- SingleAnimationUsingKeyFrames.cs
- TypeGeneratedEventArgs.cs
- Random.cs
- GeometryHitTestParameters.cs
- SmtpAuthenticationManager.cs
- TextPointerBase.cs
- DbInsertCommandTree.cs
- BitmapEffectInput.cs
- FlowLayoutPanel.cs
- PropertyEntry.cs
- CodeAttributeArgumentCollection.cs
- EditingCoordinator.cs
- DataGridViewIntLinkedList.cs
- RoamingStoreFile.cs
- CopyNamespacesAction.cs
- ClickablePoint.cs
- DeferredTextReference.cs
- Exception.cs
- InvokeMemberBinder.cs
- ProtocolsConfigurationEntry.cs
- SecurityException.cs
- AbsoluteQuery.cs
- UserNameSecurityTokenProvider.cs
- WS2007HttpBindingElement.cs
- ColumnWidthChangingEvent.cs
- HttpServerVarsCollection.cs
- TextChange.cs
- ReadOnlyHierarchicalDataSourceView.cs
- XmlAttributeHolder.cs
- GreenMethods.cs
- BitmapEffectGroup.cs
- BinarySerializer.cs
- ClientRoleProvider.cs
- SelectedCellsChangedEventArgs.cs
- IsolatedStorageException.cs
- LookupBindingPropertiesAttribute.cs
- XPathNavigatorKeyComparer.cs
- SQLMembershipProvider.cs
- ContainsRowNumberChecker.cs
- GregorianCalendarHelper.cs
- MissingSatelliteAssemblyException.cs
- AsymmetricSignatureDeformatter.cs
- ValuePattern.cs
- WindowsGraphicsWrapper.cs
- NativeObjectSecurity.cs
- VisemeEventArgs.cs
- IgnoreSection.cs
- CoTaskMemUnicodeSafeHandle.cs
- OrderingExpression.cs
- PolyBezierSegmentFigureLogic.cs
- ComponentChangingEvent.cs
- ConnectionPoint.cs
- ListViewInsertedEventArgs.cs
- ConstraintManager.cs
- AspProxy.cs
- SoapCodeExporter.cs
- Crypto.cs
- printdlgexmarshaler.cs
- JoinGraph.cs
- ScalarConstant.cs
- RightsManagementEncryptionTransform.cs
- NegatedCellConstant.cs
- PageStatePersister.cs
- TemplateField.cs
- HttpEncoder.cs
- JsonServiceDocumentSerializer.cs
- DrawTreeNodeEventArgs.cs
- MDIControlStrip.cs
- SafeRightsManagementPubHandle.cs
- CustomServiceCredentials.cs