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
- RedBlackList.cs
- StrongNameIdentityPermission.cs
- ACE.cs
- FixedDSBuilder.cs
- StaticFileHandler.cs
- QueryComponents.cs
- _ListenerResponseStream.cs
- ToolStripLocationCancelEventArgs.cs
- TileModeValidation.cs
- CommandEventArgs.cs
- OverrideMode.cs
- StopStoryboard.cs
- CompensationToken.cs
- Selection.cs
- EmbeddedMailObject.cs
- XmlNamespaceManager.cs
- HtmlInputText.cs
- NavigationProperty.cs
- CodeSubDirectory.cs
- DragCompletedEventArgs.cs
- GraphicsContext.cs
- BrowserDefinitionCollection.cs
- AgileSafeNativeMemoryHandle.cs
- PartitionResolver.cs
- AuthStoreRoleProvider.cs
- MetadataExchangeBindings.cs
- OracleString.cs
- EditorPartCollection.cs
- ThumbAutomationPeer.cs
- SwitchLevelAttribute.cs
- ScriptingAuthenticationServiceSection.cs
- TransactionFlowProperty.cs
- PrintingPermissionAttribute.cs
- PriorityRange.cs
- XPathDocumentBuilder.cs
- MatrixTransform.cs
- PersianCalendar.cs
- Configuration.cs
- Native.cs
- EnterpriseServicesHelper.cs
- MenuAdapter.cs
- CheckoutException.cs
- TextDocumentView.cs
- CheckPair.cs
- ImageMapEventArgs.cs
- AutoGeneratedField.cs
- Guid.cs
- ApplicationCommands.cs
- FloaterParaClient.cs
- PeerApplicationLaunchInfo.cs
- OdbcException.cs
- DragStartedEventArgs.cs
- ReadingWritingEntityEventArgs.cs
- ZipIOLocalFileHeader.cs
- MetabaseServerConfig.cs
- TimeManager.cs
- PropertyTab.cs
- TreeNodeCollectionEditor.cs
- PrinterResolution.cs
- ComNativeDescriptor.cs
- x509utils.cs
- PaintEvent.cs
- RegionInfo.cs
- _FtpDataStream.cs
- UInt32Converter.cs
- TargetInvocationException.cs
- NumberFunctions.cs
- HtmlInputSubmit.cs
- LinkLabel.cs
- PartitionedDataSource.cs
- ButtonFieldBase.cs
- TypeDelegator.cs
- DesigntimeLicenseContextSerializer.cs
- WebServiceParameterData.cs
- SchemaAttDef.cs
- DataGridColumnFloatingHeader.cs
- DataGridColumnsPage.cs
- ToggleProviderWrapper.cs
- ArraySubsetEnumerator.cs
- PerfCounters.cs
- FormatConvertedBitmap.cs
- ContextMenuStripGroup.cs
- DBConnection.cs
- FlowDocumentScrollViewer.cs
- ItemsPresenter.cs
- PriorityRange.cs
- ExpressionLink.cs
- FontFamily.cs
- XmlWhitespace.cs
- ScrollBar.cs
- WorkflowEnvironment.cs
- ImageListStreamer.cs
- basecomparevalidator.cs
- HtmlTableRowCollection.cs
- DataControlFieldHeaderCell.cs
- DrawingContext.cs
- CompressEmulationStream.cs
- HttpGetProtocolReflector.cs
- ControlDesigner.cs
- FieldToken.cs