Exemple #1
0
        /** Calculate the height of the subtree rooted at this node. */
        public int treeHeight()
        {
            int height = 0;

            if (this._childCount > 0)
            {
                SafraTreeNode it = this._oldestChild;
                while (it != null)
                {
                    SafraTreeNode cur_child    = it;
                    int           child_height = cur_child.treeHeight();
                    if (child_height > height)
                    {
                        height = child_height;
                    }
                    it = it._youngerBrother;
                }
            }

            return(height + 1);
        }