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
- AspNetPartialTrustHelpers.cs
- SystemIcons.cs
- KeyPullup.cs
- RuntimeResourceSet.cs
- SqlBuilder.cs
- HttpCapabilitiesEvaluator.cs
- DispatcherObject.cs
- TextEffect.cs
- InstallerTypeAttribute.cs
- TableCellCollection.cs
- ObjectViewFactory.cs
- Helpers.cs
- SimpleWorkerRequest.cs
- _ServiceNameStore.cs
- IPEndPoint.cs
- ClientTargetCollection.cs
- HostProtectionPermission.cs
- DefinitionBase.cs
- BoundColumn.cs
- TimelineCollection.cs
- XmlObjectSerializerReadContextComplexJson.cs
- Helpers.cs
- HostSecurityManager.cs
- WorkflowViewManager.cs
- WindowsGrip.cs
- X509Certificate.cs
- ParallelActivityDesigner.cs
- RuleSetBrowserDialog.cs
- PathTooLongException.cs
- DataGridViewSelectedRowCollection.cs
- XmlDocument.cs
- EventMappingSettingsCollection.cs
- SortKey.cs
- ModelItemKeyValuePair.cs
- ParenthesizePropertyNameAttribute.cs
- HierarchicalDataBoundControl.cs
- Publisher.cs
- TemplateControlBuildProvider.cs
- SizeAnimationBase.cs
- AssemblyAttributesGoHere.cs
- ValidatorUtils.cs
- ListBoxItemWrapperAutomationPeer.cs
- XmlDataDocument.cs
- DiscoveryRequestHandler.cs
- VoiceObjectToken.cs
- SetIterators.cs
- ViewRendering.cs
- ManagementOptions.cs
- BamlResourceSerializer.cs
- Formatter.cs
- SkewTransform.cs
- StrongNamePublicKeyBlob.cs
- FilterException.cs
- IdentityHolder.cs
- XmlDocumentType.cs
- ImageDrawing.cs
- FactoryId.cs
- XmlDocumentFieldSchema.cs
- GlobalId.cs
- WebResourceAttribute.cs
- EdmScalarPropertyAttribute.cs
- DefaultAsyncDataDispatcher.cs
- Vector.cs
- ConfigDefinitionUpdates.cs
- NativeMethods.cs
- QueryBranchOp.cs
- NetworkInformationPermission.cs
- BaseConfigurationRecord.cs
- RestHandlerFactory.cs
- ProfessionalColors.cs
- PostBackTrigger.cs
- sqlmetadatafactory.cs
- FlowNode.cs
- FrugalList.cs
- WebPartVerb.cs
- DiscreteKeyFrames.cs
- SyndicationDeserializer.cs
- ReflectionPermission.cs
- RegexRunnerFactory.cs
- DesignerVerbCollection.cs
- Span.cs
- ResizeGrip.cs
- ADMembershipProvider.cs
- AuthenticationModulesSection.cs
- Size.cs
- DataBinder.cs
- ReceiveActivity.cs
- MultiPageTextView.cs
- LinearQuaternionKeyFrame.cs
- CodeTypeOfExpression.cs
- indexingfiltermarshaler.cs
- GetWinFXPath.cs
- XmlElementAttribute.cs
- SpotLight.cs
- DesignRelationCollection.cs
- MostlySingletonList.cs
- SafeHandles.cs
- SiteMapNodeCollection.cs
- FunctionNode.cs
- diagnosticsswitches.cs