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
- StandardOleMarshalObject.cs
- Guid.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- BypassElementCollection.cs
- ContentWrapperAttribute.cs
- Sql8ExpressionRewriter.cs
- ObjectItemCachedAssemblyLoader.cs
- EncoderNLS.cs
- GraphicsContainer.cs
- ConstraintCollection.cs
- DelegatingStream.cs
- WebBrowsableAttribute.cs
- ConfigErrorGlyph.cs
- BatchWriter.cs
- AttributeProviderAttribute.cs
- VarInfo.cs
- CrossAppDomainChannel.cs
- XmlCountingReader.cs
- ConfigXmlWhitespace.cs
- CodeTypeDelegate.cs
- AsyncCompletedEventArgs.cs
- ImmutableObjectAttribute.cs
- ExtensionDataObject.cs
- CompilerState.cs
- InkCanvasInnerCanvas.cs
- RectValueSerializer.cs
- HttpResponse.cs
- GridPattern.cs
- CornerRadiusConverter.cs
- TextBoxBase.cs
- HtmlPanelAdapter.cs
- GenericTextProperties.cs
- WriteStateInfoBase.cs
- PropertyPath.cs
- DescendantQuery.cs
- CodeDelegateInvokeExpression.cs
- SettingsSavedEventArgs.cs
- DateTimeValueSerializer.cs
- CompositeCollection.cs
- ThicknessKeyFrameCollection.cs
- EntityCommandCompilationException.cs
- DataBindEngine.cs
- RegexCompiler.cs
- mongolianshape.cs
- WebPartDeleteVerb.cs
- PrivateFontCollection.cs
- ReferencedAssembly.cs
- ObfuscateAssemblyAttribute.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- PageContentCollection.cs
- OleDbEnumerator.cs
- RadioButtonStandardAdapter.cs
- RegistryKey.cs
- NamedElement.cs
- ILGenerator.cs
- recordstatescratchpad.cs
- ObjectDataSourceMethodEventArgs.cs
- ReadOnlyNameValueCollection.cs
- ArithmeticLiteral.cs
- DataGridRow.cs
- ObjectListSelectEventArgs.cs
- GZipDecoder.cs
- JumpTask.cs
- EndpointAddress.cs
- BindingSource.cs
- _BasicClient.cs
- XmlDataLoader.cs
- TemplateNameScope.cs
- ClientConfigurationHost.cs
- FragmentQueryKB.cs
- HMACMD5.cs
- SvcMapFileSerializer.cs
- HotCommands.cs
- StickyNoteHelper.cs
- StorageBasedPackageProperties.cs
- ReferencedAssembly.cs
- HttpListenerRequest.cs
- PageCache.cs
- RequestCacheManager.cs
- ContextMenu.cs
- ValidatorCompatibilityHelper.cs
- DbResourceAllocator.cs
- PrintDialogException.cs
- SynchronizationContext.cs
- EntityStoreSchemaFilterEntry.cs
- ValueTypeFixupInfo.cs
- ScopeCollection.cs
- MulticastNotSupportedException.cs
- XpsInterleavingPolicy.cs
- ConditionalAttribute.cs
- ScriptMethodAttribute.cs
- ExpressionDumper.cs
- MultiViewDesigner.cs
- ApplicationSecurityManager.cs
- Monitor.cs
- XNodeSchemaApplier.cs
- MasterPageCodeDomTreeGenerator.cs
- RNGCryptoServiceProvider.cs
- DocumentXmlWriter.cs
- EntityClassGenerator.cs