Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- User.cs
- HashSetEqualityComparer.cs
- InputLangChangeEvent.cs
- DocumentGridPage.cs
- Oid.cs
- FactoryGenerator.cs
- MenuItemBindingCollection.cs
- RegexFCD.cs
- XmlAttributeCache.cs
- UndirectedGraph.cs
- rsa.cs
- SoapElementAttribute.cs
- TypeUtil.cs
- GridPattern.cs
- HMAC.cs
- COM2IDispatchConverter.cs
- RequestContextBase.cs
- WebPartCloseVerb.cs
- FieldToken.cs
- QilTargetType.cs
- FilteredDataSetHelper.cs
- GeometryDrawing.cs
- DispatcherFrame.cs
- CreateUserWizard.cs
- SchemaImporterExtensionElementCollection.cs
- ObjectConverter.cs
- PagesSection.cs
- FileDialog.cs
- GenericWebPart.cs
- GZipStream.cs
- JapaneseCalendar.cs
- DataError.cs
- TextChangedEventArgs.cs
- SqlUtils.cs
- PathFigure.cs
- StreamInfo.cs
- PreDigestedSignedInfo.cs
- KeyValueSerializer.cs
- PinnedBufferMemoryStream.cs
- IisTraceWebEventProvider.cs
- SqlNodeAnnotations.cs
- IdentityManager.cs
- WebPartsPersonalizationAuthorization.cs
- OperationParameterInfo.cs
- Substitution.cs
- DefaultPrintController.cs
- NamespaceEmitter.cs
- ClientScriptItem.cs
- FontFamilyConverter.cs
- NullableLongMinMaxAggregationOperator.cs
- WebPartTransformerAttribute.cs
- EntityContainerRelationshipSetEnd.cs
- RecognizedPhrase.cs
- EditorAttribute.cs
- StructuredTypeEmitter.cs
- PointIndependentAnimationStorage.cs
- DataGridTable.cs
- XmlSchemaAnnotation.cs
- Geometry.cs
- PreloadedPackages.cs
- XmlConvert.cs
- IndexedSelectQueryOperator.cs
- CodeDOMProvider.cs
- SqlBinder.cs
- SupportingTokenSecurityTokenResolver.cs
- UrlPath.cs
- LinqDataSourceSelectEventArgs.cs
- DataSourceCache.cs
- AggregationMinMaxHelpers.cs
- WindowsToolbarAsMenu.cs
- DeflateStreamAsyncResult.cs
- FastEncoderStatics.cs
- DesignerActionList.cs
- DBPropSet.cs
- NativeConfigurationLoader.cs
- TransactionFilter.cs
- SynchronizedReadOnlyCollection.cs
- HttpHandlerActionCollection.cs
- CultureMapper.cs
- SecurityKeyUsage.cs
- DataGridCommandEventArgs.cs
- OLEDB_Enum.cs
- initElementDictionary.cs
- ProviderException.cs
- ObjectAssociationEndMapping.cs
- ResXFileRef.cs
- Propagator.cs
- ChangePasswordDesigner.cs
- ISSmlParser.cs
- DataGridViewDataErrorEventArgs.cs
- ToolboxCategory.cs
- BamlRecords.cs
- PanelDesigner.cs
- NGCSerializationManager.cs
- TypeUnloadedException.cs
- WorkflowOperationAsyncResult.cs
- NullableDoubleMinMaxAggregationOperator.cs
- VisualStyleRenderer.cs
- BooleanAnimationBase.cs
- MemberInfoSerializationHolder.cs