ruby-****@sourc*****
ruby-****@sourc*****
2012年 8月 22日 (水) 03:09:30 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees ------------------------- @@ -171,7 +171,7 @@ list[7] = GroceryItem.new(P_CHILD, false, 3, "Chips") list[8] = GroceryItem.new(P_CHILD, true, 4, "Soda") -Beside our initial setup of our array called ((*list*)) you will find numerous hints that this indeed is the case. Parent/child relationship dictates that we bundle together all children of a parent below it. When later on application inserts new rows, particularly children, they have to be inserted into, or better immediately after, the list children of such a group. This makes indices to certain rows ephemeral. For instance if you store (memorize) an index to a certain row that index will became invalid after an insertion or a deletion of a row positioned before the element (row) for which you have stored (memorized) the index. Also the orderly sequential organization of the rows in a tree store allows you to readily process the data, since you can always be sure about locations of rows and the groupings of the children can be determined in a predictable manner. In our example program we exploited this fact in the loop calculating the totals for the parents by iterating th rough their groups of children: +Parent/child relationship dictates that we bundle together all children of a parent below it. When later on application inserts new rows, particularly children, they have to be inserted into, or better immediately after, the list children of such a group. This makes indices to certain rows ephemeral. For instance if you store (memorize) an index to a certain row that index will became invalid after an insertion or a deletion of a row positioned before the element (row) for which you have stored (memorized) the index. Also the orderly sequential organization of the rows in a tree store allows you to readily process the data, since you can always be sure about locations of rows and the groupings of the children can be determined in a predictable manner. In our example program we exploited this fact in the loop calculating the totals for the parents by iterating through their groups of children: list.each_with_index do |e, i|