Class: DepthTreeNodeVisitor

Inherits:
TreeNodeVisitor show all
Defined in:
lib/tree_visitor/tree_node_visitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDepthTreeNodeVisitor

Returns a new instance of DepthTreeNodeVisitor.



111
112
113
114
# File 'lib/tree_visitor/tree_node_visitor.rb', line 111

def initialize
  super
  @depth = 0
end

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth.



109
110
111
# File 'lib/tree_visitor/tree_node_visitor.rb', line 109

def depth
  @depth
end

Instance Method Details

#enter_treeNode(treeNode) ⇒ Object



116
117
118
# File 'lib/tree_visitor/tree_node_visitor.rb', line 116

def enter_treeNode( treeNode )
  @depth += 1
end

#exit_treeNode(treeNode) ⇒ Object



120
121
122
# File 'lib/tree_visitor/tree_node_visitor.rb', line 120

def exit_treeNode( treeNode )
  @depth -= 1
end

#visit_leafNode(leafNode) ⇒ Object



124
125
# File 'lib/tree_visitor/tree_node_visitor.rb', line 124

def visit_leafNode( leafNode )
end