class Node

Attributes

tmp[R]

Public Class Methods

new(depth) click to toggle source
# File lib/rdnode.rb, line 2
def initialize(depth)
  @tmp = {}
  @depth = depth
  @tree = nil
  @id = nil
end

Public Instance Methods

add_on_tree(idd, tree) click to toggle source
# File lib/rdnode.rb, line 29
def add_on_tree(idd, tree)
  tree.add_node(idd, self)
  @tree = tree
  @id = idd
  @depth = nil
end
depth() click to toggle source
# File lib/rdnode.rb, line 10
def depth
  if @depth == nil
    return do_depth
  end
  @depth
end
id() click to toggle source
# File lib/rdnode.rb, line 17
def id
  @id
end
id=(x) click to toggle source
# File lib/rdnode.rb, line 21
def id=(x)
  if @tree == nil
    @id = x
    return
  end
  raise "Error can not call id=(#{x}) for this node."
end

Private Instance Methods

do_depth() click to toggle source
# File lib/rdnode.rb, line 37
def do_depth
  @tree.depth(id)
end