Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Parser.cs
- XmlSchemaComplexType.cs
- pingexception.cs
- BindingCompleteEventArgs.cs
- PrefixHandle.cs
- StickyNote.cs
- DataSourceView.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- SimpleTypeResolver.cs
- XamlParser.cs
- InvokeMethodDesigner.xaml.cs
- InternalConfigRoot.cs
- FunctionNode.cs
- DataGridCommandEventArgs.cs
- XmlSchemaInfo.cs
- MSAANativeProvider.cs
- SchemaImporterExtensionElementCollection.cs
- ContentTextAutomationPeer.cs
- DataViewManagerListItemTypeDescriptor.cs
- odbcmetadatacollectionnames.cs
- SessionIDManager.cs
- EpmTargetPathSegment.cs
- EvidenceBase.cs
- FileAuthorizationModule.cs
- QuaternionRotation3D.cs
- TranslateTransform3D.cs
- TextRenderingModeValidation.cs
- DataColumnCollection.cs
- SpinLock.cs
- TdsParserSafeHandles.cs
- DataSourceSelectArguments.cs
- ImplicitInputBrush.cs
- ScriptModule.cs
- Claim.cs
- DefaultObjectMappingItemCollection.cs
- RequestStatusBarUpdateEventArgs.cs
- MouseGestureValueSerializer.cs
- ObsoleteAttribute.cs
- SystemParameters.cs
- WebEvents.cs
- XmlEncodedRawTextWriter.cs
- Attributes.cs
- PersonalizationProvider.cs
- RegexBoyerMoore.cs
- ListSurrogate.cs
- TraceFilter.cs
- EventDriven.cs
- Point.cs
- Decimal.cs
- LinqDataSourceValidationException.cs
- CLRBindingWorker.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- GuidConverter.cs
- HttpListener.cs
- WebPartDisplayModeCancelEventArgs.cs
- PrintController.cs
- ListSourceHelper.cs
- OutputCacheProfile.cs
- AlphaSortedEnumConverter.cs
- WebPartsSection.cs
- XmlElementCollection.cs
- CategoryEditor.cs
- ServiceReference.cs
- RegistryKey.cs
- DirectoryNotFoundException.cs
- TraceProvider.cs
- UrlMappingsSection.cs
- LineMetrics.cs
- BitmapImage.cs
- SmtpMail.cs
- DBCommand.cs
- SemanticResolver.cs
- XmlSchema.cs
- OneOfElement.cs
- AstTree.cs
- PathData.cs
- BaseEntityWrapper.cs
- InternalTypeHelper.cs
- GridViewCellAutomationPeer.cs
- AttachInfo.cs
- xsdvalidator.cs
- VariableQuery.cs
- FrameworkContextData.cs
- TreeViewAutomationPeer.cs
- ItemsPresenter.cs
- SmtpAuthenticationManager.cs
- OdbcEnvironment.cs
- FacetDescription.cs
- MetadataItem.cs
- WebConfigurationManager.cs
- XmlCharacterData.cs
- ScaleTransform.cs
- Converter.cs
- documentsequencetextview.cs
- XPathParser.cs
- PermissionSetEnumerator.cs
- ConfigurationProperty.cs
- HelpKeywordAttribute.cs
- LoginName.cs
- RtfToken.cs