ValueHolderWithWeakDependents.st
changeset 3488 287a7db6b8f4
parent 2950 4527bf8b1d19
child 3783 b7adf79a127e
--- a/ValueHolderWithWeakDependents.st	Thu Jul 16 13:54:20 2015 +0200
+++ b/ValueHolderWithWeakDependents.st	Thu Jul 23 13:25:09 2015 +0200
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1999 by eXept Software AG
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -23,7 +23,7 @@
 copyright
 "
  COPYRIGHT (c) 1999 by eXept Software AG
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -43,33 +43,33 @@
 
     wasBlocked := OperatingSystem blockInterrupts.
     [
-        |deps dep|
+	|deps dep|
 
-        deps := dependents.
-        "/
-        "/ store the very first dependent directly in
-        "/ the dependents instVar
-        "/
-        (deps isNil and:[anObject isCollection not]) ifTrue:[
-            dependents := WeakArray with:anObject
-        ] ifFalse:[
-            deps class == WeakArray ifTrue:[
-                dep := deps at:1.
-                dep ~~ anObject ifTrue:[
-                    (dep isNil or:[dep == 0]) ifTrue:[
-                        deps at:1 put:anObject
-                    ] ifFalse:[
-                        self dependents:(WeakIdentitySet with:dep with:anObject)
-                    ]
-                ]
-            ] ifFalse:[
-                deps add:anObject
-            ]
-        ]
+	deps := dependents.
+	"/
+	"/ store the very first dependent directly in
+	"/ the dependents instVar
+	"/
+	(deps isNil and:[anObject isCollection not]) ifTrue:[
+	    dependents := WeakArray with:anObject
+	] ifFalse:[
+	    deps class == WeakArray ifTrue:[
+		dep := deps at:1.
+		dep ~~ anObject ifTrue:[
+		    (dep isNil or:[dep class == SmallInteger]) ifTrue:[
+			deps at:1 put:anObject
+		    ] ifFalse:[
+			self dependents:(WeakIdentitySet with:dep with:anObject)
+		    ]
+		]
+	    ] ifFalse:[
+		deps add:anObject
+	    ]
+	]
     ] ensure:[
-        wasBlocked ifFalse:[
-            OperatingSystem unblockInterrupts
-        ]
+	wasBlocked ifFalse:[
+	    OperatingSystem unblockInterrupts
+	]
     ]
 
     "Modified: 8.1.1997 / 23:40:30 / cg"
@@ -82,11 +82,11 @@
 
     deps := dependents.
     deps size ~~ 0 ifTrue:[
-        deps do:[:d | 
-                    (d notNil and:[d ~~ 0]) ifTrue:[
-                        aBlock value:d
-                    ]
-                ]
+	deps do:[:d |
+		    (d notNil and:[d class ~~ SmallInteger]) ifTrue:[
+			aBlock value:d
+		    ]
+		]
     ].
 
 !
@@ -103,43 +103,43 @@
 
     wasBlocked := OperatingSystem blockInterrupts.
     [
-        |deps n d|
+	|deps n d|
 
-        deps := dependents.
-        deps size ~~ 0 ifTrue:[
+	deps := dependents.
+	deps size ~~ 0 ifTrue:[
 
-            "/ to save a fair amount of memory in case of
-            "/ many dependencies, we store a single dependent in
-            "/ a WeakArray, and switch to a WeakSet if more dependents are
-            "/ added. Here we have to do the inverse ...
+	    "/ to save a fair amount of memory in case of
+	    "/ many dependencies, we store a single dependent in
+	    "/ a WeakArray, and switch to a WeakSet if more dependents are
+	    "/ added. Here we have to do the inverse ...
 
-            deps class == WeakArray ifTrue:[
-                ((d := deps at:1) == anObject 
-                or:[d isNil
-                or:[d == 0]]) ifTrue:[
-                    dependents := nil
-                ]
-            ] ifFalse:[
-                deps remove:anObject ifAbsent:[].
-                (n := deps size) == 0 ifTrue:[
-                    dependents := nil
-                ] ifFalse:[
-                    n == 1 ifTrue:[
-                        d := deps firstIfEmpty:nil.
-                        d notNil ifTrue:[
-                            deps := WeakArray with:d
-                        ] ifFalse:[
-                            deps := nil
-                        ].
-                        dependents := deps.
-                    ]
-                ]
-            ]
-        ]
+	    deps class == WeakArray ifTrue:[
+		((d := deps at:1) == anObject
+		or:[d isNil
+		or:[d class == SmallInteger]]) ifTrue:[
+		    dependents := nil
+		]
+	    ] ifFalse:[
+		deps remove:anObject ifAbsent:[].
+		(n := deps size) == 0 ifTrue:[
+		    dependents := nil
+		] ifFalse:[
+		    n == 1 ifTrue:[
+			d := deps firstIfEmpty:nil.
+			d notNil ifTrue:[
+			    deps := WeakArray with:d
+			] ifFalse:[
+			    deps := nil
+			].
+			dependents := deps.
+		    ]
+		]
+	    ]
+	]
     ] ensure:[
-        wasBlocked ifFalse:[
-            OperatingSystem unblockInterrupts
-        ]
+	wasBlocked ifFalse:[
+	    OperatingSystem unblockInterrupts
+	]
     ]
 
     "Modified: / 26.1.1998 / 19:51:50 / cg"
@@ -148,5 +148,5 @@
 !ValueHolderWithWeakDependents class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ValueHolderWithWeakDependents.st,v 1.4 2011-09-29 11:19:53 cg Exp $'
+    ^ '$Header$'
 ! !