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
- Model3D.cs
- CompiledRegexRunner.cs
- Rect.cs
- MethodImplAttribute.cs
- AssemblyAttributes.cs
- XpsFilter.cs
- Mapping.cs
- SBCSCodePageEncoding.cs
- MaskInputRejectedEventArgs.cs
- SqlInternalConnectionTds.cs
- NumberFormatter.cs
- RoutedEventConverter.cs
- BoundPropertyEntry.cs
- AutoResetEvent.cs
- arc.cs
- ProtocolsConfigurationEntry.cs
- FileRegion.cs
- Gdiplus.cs
- CallSiteBinder.cs
- StylusCollection.cs
- PageAdapter.cs
- _CacheStreams.cs
- StartUpEventArgs.cs
- BindingContext.cs
- CalendarDateChangedEventArgs.cs
- RouteUrlExpressionBuilder.cs
- KeyValuePair.cs
- x509utils.cs
- WebScriptServiceHost.cs
- ColumnHeader.cs
- EventPropertyMap.cs
- NetworkInterface.cs
- SafeWaitHandle.cs
- DataServiceStreamResponse.cs
- StreamUpdate.cs
- TraceListener.cs
- MasterPageParser.cs
- SqlBinder.cs
- SqlCacheDependencyDatabase.cs
- AttachInfo.cs
- DocumentViewerBaseAutomationPeer.cs
- CacheVirtualItemsEvent.cs
- DrawingAttributes.cs
- SHA1Cng.cs
- HttpCacheVary.cs
- ByteConverter.cs
- ConfigurationSectionGroupCollection.cs
- MailHeaderInfo.cs
- ClientSession.cs
- NameTable.cs
- VisualBasicExpressionConverter.cs
- TraceEventCache.cs
- BoundConstants.cs
- LineServicesCallbacks.cs
- TableDesigner.cs
- X509Certificate2Collection.cs
- MimeTypeMapper.cs
- ContractCodeDomInfo.cs
- DbFunctionCommandTree.cs
- IntranetCredentialPolicy.cs
- SignedInfo.cs
- Authorization.cs
- IsolatedStoragePermission.cs
- HostProtectionPermission.cs
- OperatingSystem.cs
- ListViewPagedDataSource.cs
- WrapperEqualityComparer.cs
- DataViewManagerListItemTypeDescriptor.cs
- SemaphoreSecurity.cs
- ToolStripItem.cs
- GeometryHitTestParameters.cs
- SatelliteContractVersionAttribute.cs
- Site.cs
- VarRemapper.cs
- ListBase.cs
- ProxyOperationRuntime.cs
- CompareInfo.cs
- FileSystemInfo.cs
- XmlSchemaNotation.cs
- ILGenerator.cs
- SqlDeflator.cs
- COAUTHIDENTITY.cs
- OdbcParameterCollection.cs
- SurrogateEncoder.cs
- StructuralCache.cs
- TextRangeEditTables.cs
- EntityDescriptor.cs
- SelectionItemProviderWrapper.cs
- Utility.cs
- AnnotationResourceCollection.cs
- CaseStatement.cs
- TextView.cs
- VisualStyleRenderer.cs
- EtwProvider.cs
- Vector3D.cs
- TTSEngineTypes.cs
- DashStyle.cs
- StringSorter.cs
- FileSecurity.cs
- ShutDownListener.cs