Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Query / InternalTrees / NodeCounter.cs / 1305376 / NodeCounter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Globalization; using System.Diagnostics; using System.Data.Common; using md=System.Data.Metadata.Edm; namespace System.Data.Query.InternalTrees { ////// Counts the number of nodes in a tree /// internal class NodeCounter : BasicOpVisitorOfT{ /// /// Public entry point - Calculates the nubmer of nodes in the given subTree /// /// ///internal static int Count(Node subTree) { NodeCounter counter = new NodeCounter(); return counter.VisitNode(subTree); } /// /// Common processing for all node types /// Count = 1 (self) + count of children /// /// ///protected override int VisitDefault(Node n) { int count = 1; foreach (Node child in n.Children) { count += VisitNode(child); } return count; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Globalization; using System.Diagnostics; using System.Data.Common; using md=System.Data.Metadata.Edm; namespace System.Data.Query.InternalTrees { ////// Counts the number of nodes in a tree /// internal class NodeCounter : BasicOpVisitorOfT{ /// /// Public entry point - Calculates the nubmer of nodes in the given subTree /// /// ///internal static int Count(Node subTree) { NodeCounter counter = new NodeCounter(); return counter.VisitNode(subTree); } /// /// Common processing for all node types /// Count = 1 (self) + count of children /// /// ///protected override int VisitDefault(Node n) { int count = 1; foreach (Node child in n.Children) { count += VisitNode(child); } return count; } } } // 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
- AssemblyGen.cs
- SecuritySessionServerSettings.cs
- FormViewRow.cs
- ProfileProvider.cs
- ToolboxDataAttribute.cs
- FlowDocumentPage.cs
- Msec.cs
- WebMessageEncoderFactory.cs
- AtomMaterializerLog.cs
- RtfControlWordInfo.cs
- ProgressBar.cs
- WebBaseEventKeyComparer.cs
- TemplateControlBuildProvider.cs
- GeometryCollection.cs
- SmiGettersStream.cs
- SourceFilter.cs
- CharacterHit.cs
- QuaternionKeyFrameCollection.cs
- CollectionContainer.cs
- DateTimeOffsetStorage.cs
- InOutArgumentConverter.cs
- UIElement.cs
- TreeWalker.cs
- XmlWellformedWriter.cs
- StreamWithDictionary.cs
- BitmapEffectGroup.cs
- TimerTable.cs
- BindingMAnagerBase.cs
- ContainerAction.cs
- RuleEngine.cs
- Underline.cs
- PersonalizationProvider.cs
- AddInStore.cs
- MSAANativeProvider.cs
- GacUtil.cs
- CodeNamespace.cs
- VBCodeProvider.cs
- XmlSchemaSimpleContent.cs
- BaseCodeDomTreeGenerator.cs
- SectionVisual.cs
- ComponentCache.cs
- BindingOperations.cs
- DataKeyArray.cs
- HttpCacheParams.cs
- ECDsaCng.cs
- CrossContextChannel.cs
- SByteConverter.cs
- BuildProvider.cs
- VectorConverter.cs
- Exceptions.cs
- SQLRoleProvider.cs
- XNodeNavigator.cs
- WebRequest.cs
- MessageQueueConverter.cs
- WebPartEditorApplyVerb.cs
- XmlBoundElement.cs
- SqlFunctions.cs
- FormCollection.cs
- XmlSchemaComplexContentExtension.cs
- PropertyEntry.cs
- WebBrowser.cs
- EditCommandColumn.cs
- ISO2022Encoding.cs
- SiteMapHierarchicalDataSourceView.cs
- SqlBulkCopy.cs
- InfoCardTrace.cs
- NavigationService.cs
- DataRowExtensions.cs
- ChildDocumentBlock.cs
- SqlVersion.cs
- Asn1Utilities.cs
- StylusPointPropertyId.cs
- HttpsHostedTransportConfiguration.cs
- DataGridParentRows.cs
- RegexCode.cs
- TransformedBitmap.cs
- HandlerWithFactory.cs
- printdlgexmarshaler.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- DbProviderFactoriesConfigurationHandler.cs
- AutomationPattern.cs
- SecurityContext.cs
- XmlEventCache.cs
- FixedFlowMap.cs
- Codec.cs
- URI.cs
- WebPartZoneDesigner.cs
- SchemaImporterExtensionElement.cs
- Set.cs
- HtmlGenericControl.cs
- RequestResizeEvent.cs
- PageContentCollection.cs
- CaseStatementSlot.cs
- TypefaceCollection.cs
- ParameterToken.cs
- Geometry3D.cs
- NativeMethods.cs
- PersonalizableTypeEntry.cs
- RenderOptions.cs
- ProfileBuildProvider.cs