#BUGFIX by stefan
authorStefan Vogel <sv@exept.de>
Sun, 29 Jul 2018 21:05:11 +0200
changeset 5857 66fab69b1e30
parent 5856 8f19731c7fe0
child 5858 3d7eef6e0069
#BUGFIX by stefan class: AbstractHierarchicalItem comment/format in: #basicAddAll:beforeIndex: #remove: #removeAll: changed:16 methods Repair #add* protocol (return argument)
AbstractHierarchicalItem.st
--- a/AbstractHierarchicalItem.st	Sun Jul 29 20:37:43 2018 +0200
+++ b/AbstractHierarchicalItem.st	Sun Jul 29 21:05:11 2018 +0200
@@ -527,19 +527,20 @@
 add:aChildItem
     "add a child at end"
 
-    self synchronized:[
+    ^ self synchronized:[
         self add:aChildItem beforeIndex:(self children size + 1).
     ].
 
     "Modified: / 28-07-2018 / 13:35:08 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:23:01 / Stefan Vogel"
 !
 
 add:aChildItem after:aChild
     "add an item after an existing item"
 
-    |index|
-
-    self synchronized:[
+    ^ self synchronized:[
+        |index|
+
         index := self identityIndexOf:aChild.
         index == 0 ifTrue:[ self subscriptBoundsError:index ].
 
@@ -547,20 +548,22 @@
     ].
 
     "Modified: / 28-07-2018 / 13:35:18 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:23:26 / Stefan Vogel"
 !
 
 add:aChildItem afterIndex:anIndex
     "add an item after an index"
 
-    self add:aChildItem beforeIndex:(anIndex + 1).
+    ^ self add:aChildItem beforeIndex:(anIndex + 1).
 
     "Modified: / 28-07-2018 / 13:37:32 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:23:39 / Stefan Vogel"
 !
 
 add:aChildItem before:aChild
     "add an item before an existing item"
 
-    self synchronized:[
+    ^ self synchronized:[
         |index|
 
         index := self identityIndexOf:aChild.
@@ -570,6 +573,7 @@
     ].
 
     "Modified: / 28-07-2018 / 13:35:47 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:22:28 / Stefan Vogel"
 !
 
 add:aChildItem beforeIndex:anIndex
@@ -578,34 +582,38 @@
     aChildItem notNil ifTrue:[
         self addAll:(Array with:aChildItem) beforeIndex:anIndex
     ].
+    ^ aChildItem.
 
     "Modified: / 28-07-2018 / 13:35:01 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:24:07 / Stefan Vogel"
 !
 
 add:aChild sortBlock:aBlock
     "add a child sorted"
 
-    self synchronized:[
+    ^ self synchronized:[
         self basicAdd:aChild sortBlock:aBlock
     ].
 
     "Modified: / 28-07-2018 / 13:37:12 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:24:31 / Stefan Vogel"
 !
 
 addAll:aList
     "add children at the end"
 
-    self synchronized:[
+    ^ self synchronized:[
         self addAll:aList beforeIndex:(self children size + 1)
     ]
 
     "Modified: / 28-07-2018 / 13:37:25 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:25:09 / Stefan Vogel"
 !
 
 addAll:aList before:aChild
     "add an item before an existing item"
 
-    self synchronized:[
+    ^ self synchronized:[
         |index|
 
         index := self identityIndexOf:aChild.
@@ -615,12 +623,13 @@
     ].
 
     "Modified: / 28-07-2018 / 13:37:53 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:25:18 / Stefan Vogel"
 !
 
 addAll:aList beforeIndex:anIndex
     "add children before an index"
 
-    aList size ~~ 0 ifTrue:[
+    aList notEmptyOrNil ifTrue:[
         self synchronized:[
             self basicAddAll:aList beforeIndex:anIndex
         ]
@@ -628,12 +637,13 @@
     ^ aList
 
     "Modified: / 28-07-2018 / 13:38:02 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:25:38 / Stefan Vogel"
 !
 
 addAll:aList sortBlock:aBlock
     "add children sorted"
 
-    aList size == 0 ifTrue:[ ^ aList ].
+    aList notEmptyOrNil ifTrue:[ ^ aList ].
 
     aBlock isNil ifTrue:[
         self addAll:aList.
@@ -642,40 +652,46 @@
             aList do:[:el| self basicAdd:el sortBlock:aBlock ]
         ]
     ].
+    ^ aList
 
     "Modified: / 28-07-2018 / 13:38:14 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:26:24 / Stefan Vogel"
 !
 
 addAllFirst:aCollectionOfItems
     "add children at the beginning"
 
-    self addAll:aCollectionOfItems beforeIndex:1
+    ^ self addAll:aCollectionOfItems beforeIndex:1
 
     "Modified: / 28-07-2018 / 13:38:24 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:26:47 / Stefan Vogel"
 !
 
 addAllLast:aCollectionOfItems
     "add children at the end"
 
-    self addAll:aCollectionOfItems
+    ^ self addAll:aCollectionOfItems
 
     "Modified: / 28-07-2018 / 13:38:32 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:26:55 / Stefan Vogel"
 !
 
 addFirst:aChildItem
     "add a child at the beginning"
 
-    self add:aChildItem beforeIndex:1.
+    ^ self add:aChildItem beforeIndex:1.
 
     "Modified: / 28-07-2018 / 13:38:47 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:27:01 / Stefan Vogel"
 !
 
 addLast:anItem
     "add a child at the end"
 
-    self add:anItem
+    ^ self add:anItem
 
     "Modified: / 28-07-2018 / 13:38:52 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:27:09 / Stefan Vogel"
 !
 
 remove
@@ -685,7 +701,8 @@
         parent isHierarchicalItem ifTrue:[parent remove:self]   "parent is HierarchicalItem"
                                  ifFalse:[parent root:nil]      "parent is HierarchicalList"
     ].
-    ^ self
+
+    "Modified: / 29-07-2018 / 20:31:18 / Stefan Vogel"
 !
 
 remove:aChild
@@ -696,6 +713,7 @@
     ].
 
     "Modified: / 28-07-2018 / 13:39:47 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:40:47 / Stefan Vogel"
 !
 
 removeAll
@@ -730,6 +748,7 @@
     ].
 
     "Modified (format): / 28-07-2018 / 13:44:51 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 20:39:01 / Stefan Vogel"
 !
 
 removeAllIdentical:aList
@@ -858,8 +877,8 @@
     children from:1 to:(anIndex - 1) do:[:anItem|
         index := 1 + index + anItem numberOfVisibleChildren
     ].
+
     coll := OrderedCollection new.
-
     aList do:[:anItem|
         coll add:anItem.
         anItem addVisibleChildrenTo:coll.
@@ -872,6 +891,7 @@
     ^ aList
 
     "Modified (comment): / 28-07-2018 / 13:46:06 / Claus Gittinger"
+    "Modified (format): / 29-07-2018 / 20:30:33 / Stefan Vogel"
 !
 
 basicRemoveFromIndex:startIndex toIndex:stopIndex
@@ -1376,13 +1396,14 @@
     |model|
 
     (model := self model) notNil ifTrue:[
-        model synchronized:aBlock
+        ^ model synchronized:aBlock
     ] ifFalse:[
         self breakPoint:#cg. "/ should not happen
-        aBlock value
+        ^ aBlock value
     ]
 
     "Created: / 28-07-2018 / 13:58:54 / Claus Gittinger"
+    "Modified: / 29-07-2018 / 21:02:22 / Stefan Vogel"
 ! !
 
 !AbstractHierarchicalItem methodsFor:'private-displaying'!