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 / XsltOld / TemplateManager.cs / 1 / TemplateManager.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; using System.Collections; internal class TemplateManager { private XmlQualifiedName mode; internal ArrayList templates; private Stylesheet stylesheet; // Owning stylesheet private class TemplateComparer : IComparer { public int Compare(object x, object y) { Debug.Assert(x != null && x is TemplateAction); Debug.Assert(y != null && y is TemplateAction); TemplateAction tx = (TemplateAction) x; TemplateAction ty = (TemplateAction) y; Debug.Assert(! Double.IsNaN(tx.Priority)); Debug.Assert(! Double.IsNaN(ty.Priority)); if (tx.Priority == ty.Priority) { Debug.Assert(tx.TemplateId != ty.TemplateId || tx == ty); return tx.TemplateId - ty.TemplateId; } else { return tx.Priority > ty.Priority ? 1 : -1; } } } private static TemplateComparer s_TemplateComparer = new TemplateComparer(); internal XmlQualifiedName Mode { get { return this.mode; } } internal TemplateManager(Stylesheet stylesheet, XmlQualifiedName mode) { this.mode = mode; this.stylesheet = stylesheet; } internal void AddTemplate(TemplateAction template) { Debug.Assert(template != null); Debug.Assert( ((object) this.mode == (object) template.Mode) || (template.Mode == null && this.mode.Equals(XmlQualifiedName.Empty)) || this.mode.Equals(template.Mode) ); if (this.templates == null) { this.templates = new ArrayList(); } this.templates.Add(template); } internal void ProcessTemplates() { if (this.templates != null) { this.templates.Sort(s_TemplateComparer); } } internal TemplateAction FindTemplate(Processor processor, XPathNavigator navigator) { if (this.templates == null) { return null; } Debug.Assert(this.templates != null); for (int templateIndex = this.templates.Count - 1; templateIndex >= 0 ; templateIndex --) { TemplateAction action = (TemplateAction) this.templates[templateIndex]; int matchKey = action.MatchKey; if (matchKey != Compiler.InvalidQueryKey) { if (processor.Matches(navigator, matchKey)) { return action; } } } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; using System.Collections; internal class TemplateManager { private XmlQualifiedName mode; internal ArrayList templates; private Stylesheet stylesheet; // Owning stylesheet private class TemplateComparer : IComparer { public int Compare(object x, object y) { Debug.Assert(x != null && x is TemplateAction); Debug.Assert(y != null && y is TemplateAction); TemplateAction tx = (TemplateAction) x; TemplateAction ty = (TemplateAction) y; Debug.Assert(! Double.IsNaN(tx.Priority)); Debug.Assert(! Double.IsNaN(ty.Priority)); if (tx.Priority == ty.Priority) { Debug.Assert(tx.TemplateId != ty.TemplateId || tx == ty); return tx.TemplateId - ty.TemplateId; } else { return tx.Priority > ty.Priority ? 1 : -1; } } } private static TemplateComparer s_TemplateComparer = new TemplateComparer(); internal XmlQualifiedName Mode { get { return this.mode; } } internal TemplateManager(Stylesheet stylesheet, XmlQualifiedName mode) { this.mode = mode; this.stylesheet = stylesheet; } internal void AddTemplate(TemplateAction template) { Debug.Assert(template != null); Debug.Assert( ((object) this.mode == (object) template.Mode) || (template.Mode == null && this.mode.Equals(XmlQualifiedName.Empty)) || this.mode.Equals(template.Mode) ); if (this.templates == null) { this.templates = new ArrayList(); } this.templates.Add(template); } internal void ProcessTemplates() { if (this.templates != null) { this.templates.Sort(s_TemplateComparer); } } internal TemplateAction FindTemplate(Processor processor, XPathNavigator navigator) { if (this.templates == null) { return null; } Debug.Assert(this.templates != null); for (int templateIndex = this.templates.Count - 1; templateIndex >= 0 ; templateIndex --) { TemplateAction action = (TemplateAction) this.templates[templateIndex]; int matchKey = action.MatchKey; if (matchKey != Compiler.InvalidQueryKey) { if (processor.Matches(navigator, matchKey)) { return action; } } } 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
- listitem.cs
- CharacterHit.cs
- StateBag.cs
- SoapFault.cs
- HtmlInputRadioButton.cs
- PlainXmlDeserializer.cs
- HttpInputStream.cs
- XmlQueryCardinality.cs
- OverflowException.cs
- HostingEnvironment.cs
- WebPartUserCapability.cs
- UnmanagedMemoryStreamWrapper.cs
- TextElementCollectionHelper.cs
- AutoCompleteStringCollection.cs
- SweepDirectionValidation.cs
- DescriptionAttribute.cs
- CharacterBufferReference.cs
- XomlCompilerError.cs
- SettingsPropertyCollection.cs
- SmtpReplyReaderFactory.cs
- AppDomainProtocolHandler.cs
- TimeStampChecker.cs
- DataQuery.cs
- CompilerTypeWithParams.cs
- InProcStateClientManager.cs
- DataFormats.cs
- FixedFlowMap.cs
- WindowsFormsHostPropertyMap.cs
- CollectionBase.cs
- XmlDigitalSignatureProcessor.cs
- BitmapEffectGeneralTransform.cs
- ImpersonateTokenRef.cs
- WebZoneDesigner.cs
- StreamWriter.cs
- ExpressionPrefixAttribute.cs
- StreamGeometry.cs
- AbsoluteQuery.cs
- HtmlForm.cs
- AliasExpr.cs
- StyleSelector.cs
- UnregisterInfo.cs
- MembershipAdapter.cs
- Color.cs
- CharacterShapingProperties.cs
- ByteStorage.cs
- SafeEventLogWriteHandle.cs
- EventManager.cs
- PropertyGridEditorPart.cs
- ButtonFieldBase.cs
- Int32AnimationBase.cs
- WizardStepBase.cs
- Msec.cs
- Command.cs
- DeploymentExceptionMapper.cs
- ResourceDescriptionAttribute.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- SHA384Managed.cs
- FlowPosition.cs
- ReaderContextStackData.cs
- GlyphsSerializer.cs
- XmlIterators.cs
- Renderer.cs
- ProxyHelper.cs
- CheckBoxDesigner.cs
- NetworkAddressChange.cs
- AsyncResult.cs
- MonitoringDescriptionAttribute.cs
- ToolBarButtonClickEvent.cs
- ConvertersCollection.cs
- TiffBitmapEncoder.cs
- DataGridTable.cs
- GradientStopCollection.cs
- BooleanToVisibilityConverter.cs
- ObjectNavigationPropertyMapping.cs
- OleDbCommand.cs
- SqlGenericUtil.cs
- Run.cs
- HttpServerVarsCollection.cs
- XamlTypeWithExplicitNamespace.cs
- EntityClassGenerator.cs
- ExpressionBinding.cs
- Padding.cs
- StreamHelper.cs
- ValueConversionAttribute.cs
- Size.cs
- BulletedList.cs
- EnumValAlphaComparer.cs
- EnumBuilder.cs
- ConnectionString.cs
- FlowLayout.cs
- DbConnectionPoolOptions.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- BaseCAMarshaler.cs
- AnnotationResource.cs
- ObjectHandle.cs
- ValueUnavailableException.cs
- StylusSystemGestureEventArgs.cs
- OpenTypeMethods.cs
- latinshape.cs