Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataStreamFromComStream.cs
- ErrorHandler.cs
- UMPAttributes.cs
- CryptoKeySecurity.cs
- SecurityContextKeyIdentifierClause.cs
- SystemThemeKey.cs
- ThousandthOfEmRealDoubles.cs
- VersionConverter.cs
- HandlerWithFactory.cs
- DropDownButton.cs
- MediaContext.cs
- Scripts.cs
- CounterCreationData.cs
- XpsFilter.cs
- CodeParameterDeclarationExpressionCollection.cs
- HyperLinkField.cs
- Int16AnimationBase.cs
- AxHost.cs
- TableParaClient.cs
- SiteMapPath.cs
- DbBuffer.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- JumpList.cs
- VectorValueSerializer.cs
- EnumType.cs
- WebScriptEnablingBehavior.cs
- FrameworkTextComposition.cs
- WebPartDescription.cs
- ObjectParameterCollection.cs
- DataGridViewAccessibleObject.cs
- IndexOutOfRangeException.cs
- NetworkInformationException.cs
- BamlStream.cs
- IssuanceLicense.cs
- RoleBoolean.cs
- ToolStripDropDownClosingEventArgs.cs
- PropertyValueUIItem.cs
- DBSchemaRow.cs
- WSMessageEncoding.cs
- IItemContainerGenerator.cs
- GeometryModel3D.cs
- xmlfixedPageInfo.cs
- ReadOnlyDataSource.cs
- XsdBuilder.cs
- TemplateControlBuildProvider.cs
- AtomMaterializer.cs
- VariableAction.cs
- InvalidPrinterException.cs
- UserInitiatedNavigationPermission.cs
- NamedObject.cs
- ViewUtilities.cs
- HeaderUtility.cs
- StackBuilderSink.cs
- OleDbFactory.cs
- ColumnBinding.cs
- RSACryptoServiceProvider.cs
- ReadOnlyCollectionBuilder.cs
- DeferredTextReference.cs
- FreeFormPanel.cs
- WebPartDisplayModeCancelEventArgs.cs
- Bits.cs
- RequiredAttributeAttribute.cs
- ParameterReplacerVisitor.cs
- SystemIPGlobalStatistics.cs
- IdnElement.cs
- SerializationFieldInfo.cs
- TextShapeableCharacters.cs
- HtmlControl.cs
- TextLineBreak.cs
- Evaluator.cs
- DataGridRelationshipRow.cs
- SqlUDTStorage.cs
- EntityConnection.cs
- _NtlmClient.cs
- ViewKeyConstraint.cs
- GetReadStreamResult.cs
- TypedTableBase.cs
- SoapMessage.cs
- RenderOptions.cs
- CombinedGeometry.cs
- MultiByteCodec.cs
- ReferenceSchema.cs
- EventData.cs
- ADMembershipProvider.cs
- BinaryObjectReader.cs
- PropertyGroupDescription.cs
- SplayTreeNode.cs
- OdbcCommandBuilder.cs
- IDictionary.cs
- SmiContext.cs
- EllipseGeometry.cs
- designeractionlistschangedeventargs.cs
- LockedActivityGlyph.cs
- Bookmark.cs
- SapiRecoInterop.cs
- SystemNetHelpers.cs
- ImageIndexConverter.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- TypeTypeConverter.cs
- CompositionDesigner.cs