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
- NumericPagerField.cs
- SharedConnectionWorkflowTransactionService.cs
- Win32Native.cs
- OdbcPermission.cs
- MethodRental.cs
- GridViewActionList.cs
- AssociatedControlConverter.cs
- _Semaphore.cs
- DataControlButton.cs
- NetworkInterface.cs
- XmlReaderSettings.cs
- SrgsSubset.cs
- WebHttpBindingCollectionElement.cs
- UdpRetransmissionSettings.cs
- BasicKeyConstraint.cs
- TraceRecords.cs
- DockEditor.cs
- HitTestFilterBehavior.cs
- PrintEvent.cs
- QilSortKey.cs
- KeyGestureValueSerializer.cs
- TextTreeRootTextBlock.cs
- MultipleCopiesCollection.cs
- BuildProvider.cs
- QilDataSource.cs
- AsnEncodedData.cs
- DynamicDocumentPaginator.cs
- ParentUndoUnit.cs
- __ComObject.cs
- DataTableMappingCollection.cs
- SafeFileMappingHandle.cs
- EntityCommandDefinition.cs
- XmlSchemaComplexType.cs
- PublisherIdentityPermission.cs
- NativeMethodsOther.cs
- xdrvalidator.cs
- RouteParametersHelper.cs
- BlurEffect.cs
- TransformCryptoHandle.cs
- UnsupportedPolicyOptionsException.cs
- ProfileServiceManager.cs
- BamlLocalizationDictionary.cs
- WCFModelStrings.Designer.cs
- FastEncoderWindow.cs
- WorkflowEventArgs.cs
- ContentFileHelper.cs
- ApplicationInfo.cs
- RegexMatchCollection.cs
- ErrorHandler.cs
- GeneralTransform3D.cs
- AssociationSet.cs
- HttpException.cs
- VirtualPathProvider.cs
- SQLDateTimeStorage.cs
- QueryExpr.cs
- FixedHyperLink.cs
- XmlConverter.cs
- Identity.cs
- SortableBindingList.cs
- GridViewColumn.cs
- RSAPKCS1SignatureDeformatter.cs
- InternalConfigConfigurationFactory.cs
- ZipPackage.cs
- DataGridViewAdvancedBorderStyle.cs
- Journaling.cs
- Debugger.cs
- ColorConvertedBitmapExtension.cs
- ItemCheckedEvent.cs
- InternalDuplexBindingElement.cs
- RequestCacheValidator.cs
- XPathNavigator.cs
- EntityDataSource.cs
- CircleHotSpot.cs
- FaultPropagationRecord.cs
- CompiledQueryCacheEntry.cs
- ConfigurationSectionCollection.cs
- DataGridTableCollection.cs
- X509WindowsSecurityToken.cs
- CellPartitioner.cs
- MetadataCollection.cs
- SqlSupersetValidator.cs
- PerspectiveCamera.cs
- DefaultAssemblyResolver.cs
- OdbcDataReader.cs
- PropertyChangingEventArgs.cs
- IndependentAnimationStorage.cs
- HashAlgorithm.cs
- TableCell.cs
- Visual.cs
- TokenCreationException.cs
- SQLGuid.cs
- hebrewshape.cs
- SudsCommon.cs
- DataGrid.cs
- AncillaryOps.cs
- CallContext.cs
- ValidationError.cs
- WindowsIPAddress.cs
- ComboBoxAutomationPeer.cs
- TextElementEnumerator.cs