Sha256: 34414b477360379702c1336a9988a94152da7c46d9da3218c4c5045770a0b865
Contents?: true
Size: 336 Bytes
Versions: 1
Compression:
Stored size: 336 Bytes
Contents
# # Simple visitor: show how calculate the depth of a tree # class DepthTreeNodeVisitor < TreeNodeVisitor attr_reader :depth def initialize super @depth = 0 end def enter_tree_node( treeNode ) @depth += 1 end def exit_tree_node( treeNode ) @depth -= 1 end def visit_leaf_node( leafNode ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gf-treevisitor-0.0.10 | lib/treevisitor/visitors/depth_tree_node_visitor.rb |