# File tk/lib/tkextlib/blt/tree.rb, line 23 def self.id2obj(tree, id) tpath = tree.path TreeNodeID_TBL.mutex.synchronize{ if TreeNodeID_TBL[tpath] if TreeNodeID_TBL[tpath][id] TreeNodeID_TBL[tpath][id] else begin # self.new(tree, nil, 'node'=>Integer(id)) id = Integer(id) if bool(tk_call(@tpath, 'exists', id)) (obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = tpath @path = @id = id TreeNodeID_TBL[@tpath] = {} unless TreeNodeID_TBL[@tpath] TreeNodeID_TBL[@tpath][@id] = self } obj else id end rescue id end end else id end } end
# File tk/lib/tkextlib/blt/tree.rb, line 55 def self.new(tree, parent, keys={}) keys = _symbolkey2str(keys) tpath = tree.path TreeNodeID_TBL.mutex.synchronize{ TreeNodeID_TBL[tpath] ||= {} if (id = keys['node']) && (obj = TreeNodeID_TBL[tpath][id]) keys.delete('node') tk_call(tree.path, 'move', id, parent, keys) if parent return obj end (obj = self.allocate).instance_eval{ initialize(tree, parent, keys) TreeNodeID_TBL[tpath][@id] = self } obj } end
# File tk/lib/tkextlib/blt/tree.rb, line 75 def initialize(tree, parent, keys={}) @parent = @tree = tree @tpath = @parent.path if (id = keys['node']) && bool(tk_call(@tpath, 'exists', id)) @path = @id = id keys.delete('node') tk_call(@tpath, 'move', @id, parent, keys) if parent else parent = tk_call(@tpath, 'root') unless parent @path = @id = tk_call(@tpath, 'insert', parent, keys) end end
# File tk/lib/tkextlib/blt/tree.rb, line 93 def apply(keys={}) @tree.apply(@id, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 98 def children() @tree.children(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 102 def copy(parent, keys={}) @tree.copy(@id, parent, keys) end
# File tk/lib/tkextlib/blt/tree.rb, line 105 def copy_to(dest_tree, parent, keys={}) @tree.copy_to(@id, dest_tree, parent, keys) end
# File tk/lib/tkextlib/blt/tree.rb, line 109 def degree() @tree.degree(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 113 def delete() @tree.delete(@id) self end
# File tk/lib/tkextlib/blt/tree.rb, line 118 def depth() @tree.depth(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 122 def dump() @tree.dump(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 126 def dump_to_file(file) @tree.dump_to_file(@id, file) self end
# File tk/lib/tkextlib/blt/tree.rb, line 131 def exist?(keys={}) @tree.exist?(@id, keys) end
# File tk/lib/tkextlib/blt/tree.rb, line 135 def find(keys={}) @tree.find(@id, keys) end
# File tk/lib/tkextlib/blt/tree.rb, line 139 def find_child(label) @tree.find_child(@id, label) end
# File tk/lib/tkextlib/blt/tree.rb, line 143 def first_child() @tree.first_child(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 200 def fullpath() @tree.fullpath(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 147 def get() @tree.get(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 150 def get_value(key, default_val=None) @tree.get_value(@id, key, default_val) end
# File tk/lib/tkextlib/blt/tree.rb, line 154 def index() @tree.index(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 168 def keys() @tree.keys(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 172 def label(text = nil) @tree.label(@id, nil) end
# File tk/lib/tkextlib/blt/tree.rb, line 175 def label=(text) @tree.label(@id, text) end
# File tk/lib/tkextlib/blt/tree.rb, line 179 def last_child() @tree.last_child(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 158 def leaf?() @tree.leaf?(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 161 def link?() @tree.link?(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 183 def move(dest, keys={}) @tree.keys(@id, dest, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 188 def next() @tree.next(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 192 def next_sibling() @tree.next_sibling(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 196 def parent() @tree.parent(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 204 def position() @tree.position(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 212 def prev_sibling() @tree.prev_sibling(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 208 def previous() @tree.previous(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 216 def restore(str, keys={}) @tree.restore(@id, str, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 225 def restore_from_file(file, keys={}) @tree.restore_from_file(@id, file, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 220 def restore_overwrite(str, keys={}) @tree.restore_overwrite(@id, str, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 229 def restore_overwrite_from_file(file, keys={}) @tree.restore_overwrite_from_file(@id, file, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 234 def root() @tree.root(@id) self end
# File tk/lib/tkextlib/blt/tree.rb, line 164 def root?() @tree.root?(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 239 def set(data) @tree.set(@id, data) self end
# File tk/lib/tkextlib/blt/tree.rb, line 244 def size() @tree.size(@id) end
# File tk/lib/tkextlib/blt/tree.rb, line 248 def sort(keys={}) @tree.sort(@id, keys) self end
# File tk/lib/tkextlib/blt/tree.rb, line 253 def type(key) @tree.type(@id, key) end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.