Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ExceptionValidationRule.cs
- TextTreeTextBlock.cs
- HighlightVisual.cs
- TextEditorContextMenu.cs
- EntityDataSourceDataSelectionPanel.designer.cs
- IgnoreFileBuildProvider.cs
- ConfigUtil.cs
- EtwTrace.cs
- SmtpReplyReader.cs
- SecurityRuntime.cs
- XmlSerializerNamespaces.cs
- ProvideValueServiceProvider.cs
- AnnouncementInnerClient11.cs
- SiteMapDataSource.cs
- dataSvcMapFileLoader.cs
- SqlDataSourceCommandEventArgs.cs
- ProgressBar.cs
- SystemWebCachingSectionGroup.cs
- SystemResourceHost.cs
- _ConnectOverlappedAsyncResult.cs
- ConnectionPoint.cs
- ServiceBusyException.cs
- OdbcParameter.cs
- WCFServiceClientProxyGenerator.cs
- RequestCacheEntry.cs
- DefaultAsyncDataDispatcher.cs
- ElementAction.cs
- ActivityTypeResolver.xaml.cs
- SmtpReplyReaderFactory.cs
- EncryptedPackageFilter.cs
- ServicesSection.cs
- RegexGroup.cs
- ThicknessConverter.cs
- WindowsTreeView.cs
- BinaryCommonClasses.cs
- Border.cs
- EntryPointNotFoundException.cs
- GenerateScriptTypeAttribute.cs
- EmptyEnumerator.cs
- _AuthenticationState.cs
- ValidationHelper.cs
- Int16.cs
- TextSchema.cs
- RightsManagementInformation.cs
- PropertyGrid.cs
- Tablet.cs
- MediaSystem.cs
- Tracking.cs
- XmlUtil.cs
- RoleGroupCollectionEditor.cs
- XmlSchemaSimpleTypeUnion.cs
- MouseDevice.cs
- Point3DValueSerializer.cs
- IPEndPoint.cs
- TargetException.cs
- Relationship.cs
- GenericUI.cs
- QueryHandler.cs
- DataList.cs
- ViewBase.cs
- CompoundFileReference.cs
- BindingsCollection.cs
- RightsController.cs
- SatelliteContractVersionAttribute.cs
- FixedSOMImage.cs
- Section.cs
- MethodCallConverter.cs
- AudioBase.cs
- RangeValuePattern.cs
- ISAPIWorkerRequest.cs
- TreeIterators.cs
- RotateTransform3D.cs
- validationstate.cs
- SmiSettersStream.cs
- SessionState.cs
- selecteditemcollection.cs
- FixedHighlight.cs
- SqlNode.cs
- ExpressionBinding.cs
- Pointer.cs
- InternalRelationshipCollection.cs
- XmlHierarchicalDataSourceView.cs
- GeneratedContractType.cs
- TokenBasedSet.cs
- RelationshipManager.cs
- RemoteDebugger.cs
- SrgsText.cs
- StrongNameIdentityPermission.cs
- ValueSerializer.cs
- Rules.cs
- ReadOnlyDictionary.cs
- precedingsibling.cs
- Rectangle.cs
- ContractInferenceHelper.cs
- ReaderWriterLockSlim.cs
- oledbmetadatacolumnnames.cs
- XslException.cs
- NumericUpDownAccelerationCollection.cs
- SecurityPolicySection.cs
- ControlCollection.cs