Class: ValueDepthVisitor
- Inherits:
-
BaseVisitor
- Object
- BaseVisitor
- ValueDepthVisitor
- Defined in:
- lib/visitor/value_depth_visitor.rb
Instance Attribute Summary
Attributes inherited from BaseVisitor
Instance Method Summary collapse
-
#initialize ⇒ ValueDepthVisitor
constructor
A new instance of ValueDepthVisitor.
- #preVisit(node) ⇒ Object
Methods inherited from BaseVisitor
Constructor Details
#initialize ⇒ ValueDepthVisitor
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 |