# File lib/tree.rb, line 571
    def depth
      begin
        require 'structured_warnings'   # To enable a nice way of deprecating of the depth method.
        warn DeprecatedMethodWarning, 'This method is deprecated.  Please use nodeDepth() or nodeHeight() instead (bug # 22535)'
      rescue LoadError
        # Oh well. Will use the standard Kernel#warn.  Behavior will be identical.
        warn 'Tree::TreeNode#depth() method is deprecated.  Please use nodeDepth() or nodeHeight() instead (bug # 22535)'
      end

      return 1 if isLeaf?
      1 + @children.collect { |child| child.depth }.max
    end