Пример #1
0
        private void ComputeStatistics()
        {
            var actuary = new Actuary();

            NodeWalk.Walk(root, node =>
            {
                node.Node.Optimize();
                actuary.Track(node);
            });

            actuary.Publish();
            this.Statistics = actuary;
        }
Пример #2
0
            internal void Track(NodeWalk node)
            {
                this.NodeCount++;

                if (node.Node.IsEndOfWord)
                {
                    this.WordCount++;
                    this.CummulativeWordLength += node.Depth;

                    if (node.Depth > this.MaxWordLength)
                    {
                        this.MaxWordLength = node.Depth;
                    }
                }

                int childCount = node.Node.Children.Count;

                if (childCount > 0)
                {
                    internalNodeCount++;
                    cummulativeChildCount += childCount;
                }
            }