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
- PriorityQueue.cs
- BaseValidator.cs
- SqlServices.cs
- DeviceSpecificChoiceCollection.cs
- WebHttpSecurity.cs
- TemplateComponentConnector.cs
- ActivationServices.cs
- TriggerAction.cs
- RuleSettings.cs
- ChangeNode.cs
- MultipartContentParser.cs
- BamlTreeNode.cs
- Package.cs
- XmlSiteMapProvider.cs
- HtmlDocument.cs
- ColorConverter.cs
- AutoCompleteStringCollection.cs
- TraceSwitch.cs
- HttpsChannelFactory.cs
- SqlNodeAnnotations.cs
- SemanticBasicElement.cs
- AuthenticationConfig.cs
- ResourceExpressionEditor.cs
- SqlCharStream.cs
- ParseHttpDate.cs
- XmlQueryTypeFactory.cs
- EventToken.cs
- ThreadInterruptedException.cs
- CurrentChangedEventManager.cs
- ViewStateException.cs
- SecurityProtocol.cs
- HtmlInputPassword.cs
- Native.cs
- Bold.cs
- HtmlMeta.cs
- EntityObject.cs
- TextReader.cs
- RepeaterItemEventArgs.cs
- CheckPair.cs
- Transactions.cs
- AmbiguousMatchException.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- ManipulationInertiaStartingEventArgs.cs
- CodeExpressionStatement.cs
- ExtenderProvidedPropertyAttribute.cs
- AbstractSvcMapFileLoader.cs
- PropertyGridCommands.cs
- SQLBytes.cs
- SafeNativeMethods.cs
- MatchingStyle.cs
- GradientStop.cs
- Transform3D.cs
- KeyPressEvent.cs
- SqlCacheDependencyDatabaseCollection.cs
- AsymmetricKeyExchangeDeformatter.cs
- Environment.cs
- ImportedNamespaceContextItem.cs
- TrackingDataItemValue.cs
- PolyQuadraticBezierSegment.cs
- AttributeEmitter.cs
- DependencyPropertyChangedEventArgs.cs
- SerializationInfo.cs
- InternalControlCollection.cs
- ProvideValueServiceProvider.cs
- PKCS1MaskGenerationMethod.cs
- WSDualHttpSecurity.cs
- PageTextBox.cs
- ParenExpr.cs
- _IPv6Address.cs
- CuspData.cs
- SqlVisitor.cs
- RNGCryptoServiceProvider.cs
- ClickablePoint.cs
- wgx_sdk_version.cs
- DateTimeConverter2.cs
- RangeValuePattern.cs
- CFStream.cs
- OutputChannel.cs
- RoamingStoreFileUtility.cs
- MobileControlsSectionHelper.cs
- XmlWrappingReader.cs
- Resources.Designer.cs
- TileBrush.cs
- DbProviderFactoriesConfigurationHandler.cs
- BitmapEffectDrawing.cs
- EventLogPermissionAttribute.cs
- UshortList2.cs
- GradientStopCollection.cs
- DispatcherObject.cs
- ContainerUIElement3D.cs
- LinkUtilities.cs
- MailMessageEventArgs.cs
- RequestQueryParser.cs
- XPathDescendantIterator.cs
- Filter.cs
- TraceHandlerErrorFormatter.cs
- Inflater.cs
- XmlRootAttribute.cs
- DeferredTextReference.cs
- HttpInputStream.cs