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
- DataServiceProviderMethods.cs
- WorkflowValidationFailedException.cs
- LinkAreaEditor.cs
- DataBinder.cs
- PrimitiveXmlSerializers.cs
- BindingContext.cs
- ProjectionCamera.cs
- StandardCommands.cs
- DataServiceProcessingPipeline.cs
- Message.cs
- PropertyTabChangedEvent.cs
- EditorZoneBase.cs
- ControlPaint.cs
- LinqDataSource.cs
- AnnotationElement.cs
- PeerTransportListenAddressValidator.cs
- OAVariantLib.cs
- SqlBinder.cs
- AsyncResult.cs
- RealizedColumnsBlock.cs
- AsymmetricCryptoHandle.cs
- TakeQueryOptionExpression.cs
- BitmapCache.cs
- WebPartConnection.cs
- TraceHandlerErrorFormatter.cs
- BrushValueSerializer.cs
- ExecutionEngineException.cs
- LinkConverter.cs
- Descriptor.cs
- DataGridViewCheckBoxCell.cs
- HotSpotCollection.cs
- sqlinternaltransaction.cs
- PagesChangedEventArgs.cs
- ServiceInstallComponent.cs
- BasePropertyDescriptor.cs
- ExceptionHelpers.cs
- RegexCapture.cs
- ExecutionEngineException.cs
- DataGridViewCellLinkedList.cs
- PropertyBuilder.cs
- InvalidFilterCriteriaException.cs
- RightsManagementPermission.cs
- ObjectStorage.cs
- UpdateTracker.cs
- MetabaseServerConfig.cs
- DataSetUtil.cs
- securitycriticaldataClass.cs
- KoreanCalendar.cs
- HttpContextServiceHost.cs
- Knowncolors.cs
- BitmapCacheBrush.cs
- IPipelineRuntime.cs
- ImmutableObjectAttribute.cs
- WsdlParser.cs
- ModelTreeManager.cs
- DrawingAttributesDefaultValueFactory.cs
- Sentence.cs
- TCPClient.cs
- MexBindingBindingCollectionElement.cs
- PasswordPropertyTextAttribute.cs
- BreakRecordTable.cs
- ArgumentNullException.cs
- _emptywebproxy.cs
- ArrangedElement.cs
- UInt64.cs
- UnconditionalPolicy.cs
- CodeStatementCollection.cs
- OutOfMemoryException.cs
- BooleanFacetDescriptionElement.cs
- MimeParameterWriter.cs
- DictionaryEntry.cs
- DomainConstraint.cs
- DeferredTextReference.cs
- WindowsSlider.cs
- DataGridViewRowCollection.cs
- MarshalDirectiveException.cs
- TransactionFlowProperty.cs
- CodeBinaryOperatorExpression.cs
- PanelStyle.cs
- AutomationInteropProvider.cs
- FontStretchConverter.cs
- AdornerDecorator.cs
- UnsafeNativeMethods.cs
- DataGridItemEventArgs.cs
- ResourcePool.cs
- ContextStack.cs
- HtmlControl.cs
- EntityTypeEmitter.cs
- SqlWebEventProvider.cs
- Calendar.cs
- ToolboxCategoryItems.cs
- ReferencedCategoriesDocument.cs
- TypePropertyEditor.cs
- DependentList.cs
- ViewKeyConstraint.cs
- bindurihelper.cs
- TextStore.cs
- MemberNameValidator.cs
- WindowsSolidBrush.cs
- ToolBarButtonDesigner.cs