#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Wed, 07 Feb 2018 12:07:50 +0100
changeset 4062 d1b18ea171a9
parent 4061 09d7c0183f51
child 4063 31ea26b7f26e
#REFACTORING by stefan class: Model comment/format in: #addDependent: changed: #dependents: class: Model class comment/format in: #documentation
Model.st
--- a/Model.st	Wed Jan 31 16:00:11 2018 +0100
+++ b/Model.st	Wed Feb 07 12:07:50 2018 +0100
@@ -52,6 +52,9 @@
       However, instances of Model (and subclasses) keep the dependents locally
       in an instance variable; thus speeding up access a bit.
 
+      Model redefines the dependency methods to use non-weak dependencies
+      (in contrast to weak dependencies used by Object).  
+
     [Instance variables:]
         dependents      <Collection>    those objects which depend on me.
                                         To save some storage, a single dependent 
@@ -124,9 +127,9 @@
             ] ifFalse:[
                 deps == anObject ifFalse:[
                     deps isNil ifTrue:[
-                        dependents := (IdentitySet with:anObject)
+                        dependents := IdentitySet with:anObject.
                     ] ifFalse:[
-                        dependents := (IdentitySet with:deps with:anObject)
+                        dependents := IdentitySet with:deps with:anObject.
                     ]
                 ]
             ]
@@ -137,7 +140,8 @@
         ]
     ]
 
-    "Modified: 8.1.1997 / 23:40:30 / cg"
+    "Modified: / 08-01-1997 / 23:40:30 / cg"
+    "Modified (format): / 07-02-2018 / 11:27:16 / stefan"
 !
 
 breakDependents
@@ -160,21 +164,22 @@
     "Modified: / 26.1.1998 / 11:18:24 / cg"
 !
 
-dependents:aCollection
+dependents:aCollectionOrNil
     "set the collection of dependents"
 
     |dep|
 
-    aCollection size == 1 ifTrue:[
-        dep := aCollection first.
+    aCollectionOrNil size == 1 ifTrue:[
+        dep := aCollectionOrNil first.
         dep isCollection ifFalse:[
-            dependents := aCollection first.
+            dependents := dep.
             ^ self
         ]
     ].
-    dependents := aCollection
+    dependents := aCollectionOrNil
 
-    "Modified: 19.4.1996 / 12:23:05 / cg"
+    "Modified: / 19-04-1996 / 12:23:05 / cg"
+    "Modified: / 07-02-2018 / 12:00:33 / stefan"
 !
 
 dependentsDo:aBlock