WeakDependencyDictionary.st
changeset 18620 b4e9f25d6ce6
parent 14305 a5626a16240d
child 18630 a74d669db937
child 20036 c84dadf61250
--- a/WeakDependencyDictionary.st	Thu Jul 23 12:40:48 2015 +0200
+++ b/WeakDependencyDictionary.st	Thu Jul 23 13:10:17 2015 +0200
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1997 by Claus Gittinger
-              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) 1997 by Claus Gittinger
-              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
@@ -42,10 +42,10 @@
     dependency mechanism.
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [See also:]
-        WeakArray WeakIdentityDictionary WeakValueDictionary WeakIdentitySet
+	WeakArray WeakIdentityDictionary WeakValueDictionary WeakIdentitySet
 "
 ! !
 
@@ -79,48 +79,48 @@
 
     index := 1.
     [index <= keyArray size] whileTrue:[
-        "/ get the size again - it could have changed
+	"/ get the size again - it could have changed
 
-        wasBlocked := OperatingSystem blockInterrupts.
+	wasBlocked := OperatingSystem blockInterrupts.
 
-        keyArray ~~ originalKeyArray ifTrue:[
-            index := 1. "/ start over
-            "/ 'restart removeEmpty' infoPrintCR.
-            originalKeyArray := keyArray.
-        ].
+	keyArray ~~ originalKeyArray ifTrue:[
+	    index := 1. "/ start over
+	    "/ 'restart removeEmpty' infoPrintCR.
+	    originalKeyArray := keyArray.
+	].
 
-        index <= keyArray size ifTrue:[
-            key := keyArray basicAt:index.
-            key == 0 ifTrue:[
-                "/ that one is gone
-                key := DeletedEntry.
-                keyArray basicAt:index put:key.
-                valueArray basicAt:index put:nil.
-                tally := tally - 1.
-            ].
+	index <= keyArray size ifTrue:[
+	    key := keyArray basicAt:index.
+	    key class == SmallInteger ifTrue:[
+		"/ that one is gone
+		key := DeletedEntry.
+		keyArray basicAt:index put:key.
+		valueArray basicAt:index put:nil.
+		tally := tally - 1.
+	    ].
 
-            (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
-                deps := valueArray basicAt:index.
-                deps notNil ifTrue:[
-                    "/ is it an empty WeakArray ?
+	    (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
+		deps := valueArray basicAt:index.
+		deps notNil ifTrue:[
+		    "/ is it an empty WeakArray ?
 
-                    (deps isMemberOf:WeakArray) ifTrue:[
-                        t := deps findFirst:[:el | el notNil and:[el ~~ 0]].
-                        t == 0 ifTrue:[
-                            "/ yes - nil it
-                            valueArray basicAt:index put:nil.
-                            keyArray basicAt:index put:DeletedEntry.
-                            tally := tally - 1.
-                        ]
-                    ] ifFalse:[
-                       "/ is it an empty WeakIdSet ?
+		    (deps isMemberOf:WeakArray) ifTrue:[
+			t := deps findFirst:[:el | el notNil and:[el ~~ 0]].
+			t == 0 ifTrue:[
+			    "/ yes - nil it
+			    valueArray basicAt:index put:nil.
+			    keyArray basicAt:index put:DeletedEntry.
+			    tally := tally - 1.
+			]
+		    ] ifFalse:[
+		       "/ is it an empty WeakIdSet ?
 
-                       (deps isMemberOf:WeakIdentitySet) ifTrue:[
-                            (t := deps size) == 0 ifTrue:[
-                                "/ yes - nil it
-                                valueArray basicAt:index put:nil.
-                                keyArray basicAt:index put:DeletedEntry.
-                                tally := tally - 1.
+		       (deps isMemberOf:WeakIdentitySet) ifTrue:[
+			    (t := deps size) == 0 ifTrue:[
+				"/ yes - nil it
+				valueArray basicAt:index put:nil.
+				keyArray basicAt:index put:DeletedEntry.
+				tally := tally - 1.
 "/                            ] ifFalse:[
 "/                                t == 1 ifTrue:[
 "/                                    "/ careful - it could actually be empty
@@ -136,19 +136,19 @@
 "/                                        ]
 "/                                    ]
 "/                                ]
-                            ]
-                        ]
-                    ]
-                ] ifFalse:[
-                    "/ 'oops: nil value for key' infoPrint. key infoPrintCR.
-                    keyArray basicAt:index put:DeletedEntry.
-                    tally := tally - 1.
-                ]
-            ]
-        ].
+			    ]
+			]
+		    ]
+		] ifFalse:[
+		    "/ 'oops: nil value for key' infoPrint. key infoPrintCR.
+		    keyArray basicAt:index put:DeletedEntry.
+		    tally := tally - 1.
+		]
+	    ]
+	].
 
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-        index := index + 1.
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	index := index + 1.
     ].
 
 "/ 'done' printCR.
@@ -163,5 +163,5 @@
 !WeakDependencyDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/WeakDependencyDictionary.st,v 1.14 2012-08-06 12:38:10 cg Exp $'
+    ^ '$Header$'
 ! !