Method: PEROBS::BigTreeNode#statistics
- Defined in:
- lib/perobs/BigTreeNode.rb
#statistics(stats) ⇒ Object
Gather some statistics about the node and all sub nodes.
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/perobs/BigTreeNode.rb', line 702 def statistics(stats) traverse do |node, position, stack| if position == 0 if node.is_leaf? stats.leaf_nodes += 1 depth = stack.size + 1 if stats.min_depth.nil? || stats.min_depth < depth stats.min_depth = depth end if stats.max_depth.nil? || stats.max_depth > depth stats.max_depth = depth end else stats.branch_nodes += 1 end end end end |