AbstractHierarchicalItem.st
changeset 6026 1a089d0cbdcc
parent 6019 3f48805b8cac
child 6047 80dad68e23a2
--- a/AbstractHierarchicalItem.st	Tue Mar 05 02:21:28 2019 +0100
+++ b/AbstractHierarchicalItem.st	Tue Mar 05 10:07:47 2019 +0100
@@ -1685,20 +1685,21 @@
 !AbstractHierarchicalItem methodsFor:'private-enumerating'!
 
 nonCriticalDo:aOneArgBlock
-    "WARNING: may fetch lazy children
+    "WARNING: may fetch lazy children (i.e. calls #children)
      evaluate a block noncritical for each child.
      Not synchronized - should only be called internally
      within a synchronized region."
 
     ^ self nonCriticalFrom:1 to:nil do:aOneArgBlock
 
-    "Modified (comment): / 12-02-2019 / 18:49:05 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:37:32 / Claus Gittinger"
 !
 
 nonCriticalFrom:startIndex to:endIndex do:aOneArgBlock
-    "WARNING: may fetch lazy children
+    "WARNING: may fetch lazy children (i.e. calls #children)
      evaluate a block noncritical for each child starting with the
-     child at startIndex to the endIndex (if nil to end of list).
+     child at startIndex to the endIndex (if nil: to end of list).
+     Returns the value of the last block's evaluation.
      Not synchronized - should only be called internally
      within a synchronized region.
      Answer the value of the block executed on the last element."
@@ -1725,26 +1726,27 @@
 
     "Modified (comment): / 02-08-2018 / 16:02:13 / Stefan Vogel"
     "Modified: / 12-02-2019 / 16:55:20 / Claus Gittinger"
-    "Modified (comment): / 12-02-2019 / 18:48:58 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:37:28 / Claus Gittinger"
 !
 
-nonCriticalFrom:startIndex to:endIndex reverseDo:aOneArgBlock
-    "WARNING: may fetch lazy children
+nonCriticalFrom:startIndex to:endIndexArg reverseDo:aOneArgBlock
+    "WARNING: may fetch lazy children (i.e. calls #children)
      evaluate a block non critical for each child starting with the
-     child at endIndex (if nil to end of list) to startIndex.
+     child at endIndex (if nil: from the end of list) down to to startIndex.
+     Returns the value of the last block's evaluation.
      Not synchronized - should only be called internally
      within a synchronized region."
 
-    |list size resp|
+    |list endIndex resp|
 
     list := self children.
-    size := list size.
+    endIndex := list size.
     resp := nil.
 
-    endIndex notNil ifTrue:[
-        size := size min:endIndex
+    endIndexArg notNil ifTrue:[
+        endIndex := endIndex min:endIndexArg
     ].
-    size to:startIndex by:-1 do:[:i| 
+    endIndex to:startIndex by:-1 do:[:i| 
         |item|
 
         item := list at:i ifAbsent:nil.
@@ -1753,11 +1755,11 @@
     ].
     ^ resp
 
-    "Modified (comment): / 12-02-2019 / 18:49:11 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:40:33 / Claus Gittinger"
 !
 
 nonCriticalKeysAndValuesReverseDo:aOneArgBlock
-    "WARNING: may fetch lazy children
+    "WARNING: may fetch lazy children (i.e. calls #children)
      evaluate the argument, aBlock in reverse order for every
      child, passing both index and element as arguments.
      Not synchronized - should only be called internally
@@ -1778,11 +1780,11 @@
     ].
     ^ resp
 
-    "Modified (comment): / 12-02-2019 / 18:49:16 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:37:35 / Claus Gittinger"
 !
 
 nonCriticalRecursiveDo:aOneArgBlock
-    "WARNING: may fetch lazy children
+    "WARNING: may fetch lazy children (i.e. calls #children)
      evaluate the block non critical for each item and all the sub-items.
      Not synchronized - should only be called internally
      within a synchronized region."
@@ -1792,11 +1794,11 @@
         eachChild nonCriticalRecursiveDo:aOneArgBlock
     ].
 
-    "Modified (comment): / 12-02-2019 / 18:49:23 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:37:48 / Claus Gittinger"
 !
 
 nonCriticalRecursiveReverseDo:aOneArgBlock
-    "WARNING: may fetch lazy children
+    "WARNING: may fetch lazy children (i.e. calls #children)
      evaluate the block non critical for each item and all the sub-items;
      proccesing children in reverse direction.
      Not synchronized - should only be called internally
@@ -1807,11 +1809,12 @@
         aOneArgBlock value:eachChild.
     ].
 
-    "Modified (comment): / 12-02-2019 / 18:48:45 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:37:52 / Claus Gittinger"
 !
 
 nonCriticalRecursiveSort:aSortBlock
-    "evaluate a block noncritical for each child.
+    "recursively sort children using aSortBlock.
+     Does NOT fetch children (via #children), but sort the ones which are already present.
      Not synchronized - should only be called internally
      within a synchronized region."
 
@@ -1826,6 +1829,7 @@
     ].
 
     "Modified: / 03-02-2019 / 19:24:03 / Claus Gittinger"
+    "Modified (comment): / 05-03-2019 / 09:39:57 / Claus Gittinger"
 ! !
 
 !AbstractHierarchicalItem methodsFor:'private-hierarchy'!