equal
deleted
inserted
replaced
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 "{ Package: 'stx:libbasic' }" |
12 "{ Package: 'stx:libbasic' }" |
|
13 |
|
14 "{ NameSpace: Smalltalk }" |
13 |
15 |
14 ArrayedCollection variableSubclass:#WeakArray |
16 ArrayedCollection variableSubclass:#WeakArray |
15 instanceVariableNames:'dependents' |
17 instanceVariableNames:'dependents' |
16 classVariableNames:'RegistrationFailedSignal AlreadyInitialized' |
18 classVariableNames:'RegistrationFailedSignal AlreadyInitialized' |
17 poolDictionaries:'' |
19 poolDictionaries:'' |
121 initialize |
123 initialize |
122 "setup the private signal" |
124 "setup the private signal" |
123 |
125 |
124 self flags:(Behavior flagWeakPointers). "/ read the comment in basicNew: |
126 self flags:(Behavior flagWeakPointers). "/ read the comment in basicNew: |
125 RegistrationFailedSignal isNil ifTrue:[ |
127 RegistrationFailedSignal isNil ifTrue:[ |
126 RegistrationFailedSignal := Error newSignalMayProceed:true. |
128 RegistrationFailedSignal := Error newSignalMayProceed:true. |
127 RegistrationFailedSignal nameClass:self message:#registrationFailedSignal. |
129 RegistrationFailedSignal nameClass:self message:#registrationFailedSignal. |
128 RegistrationFailedSignal notifierString:'weakArray registration failed'. |
130 RegistrationFailedSignal notifierString:'weakArray registration failed'. |
129 ]. |
131 ]. |
130 ! ! |
132 ! ! |
131 |
133 |
132 !WeakArray class methodsFor:'instance creation'! |
134 !WeakArray class methodsFor:'instance creation'! |
133 |
135 |
273 but only if still valid; otherwise return the value from exceptionalValue" |
275 but only if still valid; otherwise return the value from exceptionalValue" |
274 |
276 |
275 |el| |
277 |el| |
276 |
278 |
277 el := self basicAt:index. |
279 el := self basicAt:index. |
278 el == 0 ifTrue:[ |
280 el class == SmallInteger ifTrue:[ |
279 ^ exeptionalValue value |
281 ^ exeptionalValue value |
280 ]. |
282 ]. |
281 ^ el |
283 ^ el |
282 ! |
284 ! |
283 |
285 |
650 replaced by zero (due to a collected object). |
652 replaced by zero (due to a collected object). |
651 Be aware, that while indices are being enumerated, other |
653 Be aware, that while indices are being enumerated, other |
652 slots may change iff the garbage collector finds new garbage." |
654 slots may change iff the garbage collector finds new garbage." |
653 |
655 |
654 self keysAndValuesDo:[:index :element | |
656 self keysAndValuesDo:[:index :element | |
655 element == 0 ifTrue:[ |
657 element class == SmallInteger ifTrue:[ |
656 aBlock value:index |
658 aBlock value:index |
657 ] |
659 ] |
658 ] |
660 ] |
659 |
661 |
660 "Modified: 25.1.1997 / 14:50:59 / cg" |
662 "Modified: 25.1.1997 / 14:50:59 / cg" |
669 with future versions. |
671 with future versions. |
670 Be aware, that while indices are being enumerated, other |
672 Be aware, that while indices are being enumerated, other |
671 slots may change iff the garbage collector finds new garbage." |
673 slots may change iff the garbage collector finds new garbage." |
672 |
674 |
673 self keysAndValuesDo:[:index :element | |
675 self keysAndValuesDo:[:index :element | |
674 element == 0 ifTrue:[ |
676 element class == SmallInteger ifTrue:[ |
675 self at:index put:newValue. |
677 self at:index put:newValue. |
676 aBlock value:index. |
678 aBlock value:index. |
677 ] |
679 ] |
678 ] |
680 ] |
679 |
681 |
1025 ! ! |
1027 ! ! |
1026 |
1028 |
1027 !WeakArray class methodsFor:'documentation'! |
1029 !WeakArray class methodsFor:'documentation'! |
1028 |
1030 |
1029 version |
1031 version |
1030 ^ '$Header: /cvs/stx/stx/libbasic/WeakArray.st,v 1.70 2014-05-06 14:45:50 cg Exp $' |
1032 ^ '$Header$' |
1031 ! |
1033 ! |
1032 |
1034 |
1033 version_CVS |
1035 version_CVS |
1034 ^ '$Header: /cvs/stx/stx/libbasic/WeakArray.st,v 1.70 2014-05-06 14:45:50 cg Exp $' |
1036 ^ '$Header$' |
1035 ! ! |
1037 ! ! |
1036 |
1038 |
1037 |
1039 |
1038 WeakArray initialize! |
1040 WeakArray initialize! |