Class: ValueDepthVisitor

Inherits:
BaseVisitor show all
Defined in:
lib/visitor/value_depth_visitor.rb

Instance Attribute Summary

Attributes inherited from BaseVisitor

#postCounter, #preCounter

Instance Method Summary collapse

Methods inherited from BaseVisitor

#postVisit

Constructor Details

#initializeValueDepthVisitor

Returns a new instance of ValueDepthVisitor.



4
5
6
# File 'lib/visitor/value_depth_visitor.rb', line 4

def initialize
  super
end

Instance Method Details

#preVisit(node) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/visitor/value_depth_visitor.rb', line 8

def preVisit(node)
  if (node.isInternal) then
    node.valueDepth = node.parent.valueDepth + node.incomingEdgeLength
  elsif (node.isLeaf) then
    node.valueDepth = Node::LEAF_DEPTH
  end
  return true
end