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
- activationcontext.cs
- EtwTrackingBehaviorElement.cs
- ListQueryResults.cs
- DbMetaDataCollectionNames.cs
- ComponentRenameEvent.cs
- DirectoryNotFoundException.cs
- HwndAppCommandInputProvider.cs
- VarRefManager.cs
- UInt32Storage.cs
- FileInfo.cs
- WinEventTracker.cs
- PipelineModuleStepContainer.cs
- WebContext.cs
- HMACSHA256.cs
- SQLInt16Storage.cs
- MergeExecutor.cs
- HtmlTableRowCollection.cs
- RemoteWebConfigurationHostStream.cs
- xamlnodes.cs
- ToolStripScrollButton.cs
- input.cs
- WebPartManager.cs
- DefaultTraceListener.cs
- TextBoxAutoCompleteSourceConverter.cs
- HotSpot.cs
- DataGrid.cs
- NetNamedPipeSecurity.cs
- OutputCacheModule.cs
- AuthenticationConfig.cs
- _NTAuthentication.cs
- Timer.cs
- EntityType.cs
- XmlIncludeAttribute.cs
- ListViewSortEventArgs.cs
- TokenBasedSet.cs
- QilGenerator.cs
- View.cs
- MailDefinition.cs
- TemplateBamlRecordReader.cs
- SerializationAttributes.cs
- HtmlInputRadioButton.cs
- AutomationElementIdentifiers.cs
- PrePrepareMethodAttribute.cs
- WindowsListViewItemCheckBox.cs
- ConfigurationElementProperty.cs
- QuadraticBezierSegment.cs
- HttpProfileBase.cs
- DesignerActionVerbItem.cs
- AccessibleObject.cs
- EventToken.cs
- SplayTreeNode.cs
- EnterpriseServicesHelper.cs
- GridErrorDlg.cs
- SignedPkcs7.cs
- RepeatButton.cs
- Debugger.cs
- DecimalStorage.cs
- LicenseException.cs
- BitmapSourceSafeMILHandle.cs
- DataTableClearEvent.cs
- BindingWorker.cs
- CompensationExtension.cs
- NameValueConfigurationElement.cs
- DataServiceOperationContext.cs
- DataGridCell.cs
- XamlSerializerUtil.cs
- MimeMultiPart.cs
- BindingContext.cs
- SettingsPropertyIsReadOnlyException.cs
- LinkedResourceCollection.cs
- SqlNodeAnnotations.cs
- DataKeyCollection.cs
- Int64AnimationUsingKeyFrames.cs
- QueryConverter.cs
- SoapMessage.cs
- httpstaticobjectscollection.cs
- Message.cs
- ListDictionaryInternal.cs
- XmlSchemaIdentityConstraint.cs
- DefaultDiscoveryService.cs
- DateTimeFormat.cs
- CDSsyncETWBCLProvider.cs
- FontFaceLayoutInfo.cs
- DocumentationServerProtocol.cs
- RightsDocument.cs
- CodeCastExpression.cs
- BaseCollection.cs
- FixedSOMLineRanges.cs
- ProviderCollection.cs
- Accessible.cs
- SupportingTokenSpecification.cs
- DataPagerField.cs
- GeometryGroup.cs
- DatagridviewDisplayedBandsData.cs
- ServiceHost.cs
- BitmapSourceSafeMILHandle.cs
- ViewLoader.cs
- StructuredTypeEmitter.cs
- ModelUIElement3D.cs
- ThousandthOfEmRealDoubles.cs