Class: AdderTree

Inherits:
AdderTreeNode show all
Defined in:
lib/javaclass/adder_tree.rb

Overview

The root node of the adder tree. The “adder tree” is a simple add-only tree. Once the tree is build it can’t be changed. Only new elements can be added. The tree’s main functionality is defined in AdderTreeNode.

Author

Peter Kofler

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AdderTreeNode

#add, #children, #contain?, #debug_print, #levels, #size, #to_a

Constructor Details

#initialize(data) ⇒ AdderTree

Returns a new instance of AdderTree.



80
81
82
# File 'lib/javaclass/adder_tree.rb', line 80

def initialize(data)
  super(data, nil)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



78
79
80
# File 'lib/javaclass/adder_tree.rb', line 78

def data
  @data
end

#parentObject (readonly)

Returns the value of attribute parent.



77
78
79
# File 'lib/javaclass/adder_tree.rb', line 77

def parent
  @parent
end

Instance Method Details

#levelObject



84
85
86
# File 'lib/javaclass/adder_tree.rb', line 84

def level
  0
end

#rootObject



88
89
90
# File 'lib/javaclass/adder_tree.rb', line 88

def root
  self
end