--- a/SharedCollection.st Mon Jan 30 15:07:15 2017 +0100
+++ b/SharedCollection.st Thu Feb 02 17:05:04 2017 +0100
@@ -102,13 +102,12 @@
shallowCopy
"analog to species - copy the real collection"
- |rslt|
-
- accessLock critical:[
+ ^ accessLock critical:[
"get a consistent copy"
- rslt := realCollection shallowCopy
+ realCollection shallowCopy
].
- ^ rslt.
+
+ "Modified: / 02-02-2017 / 17:03:55 / stefan"
! !
!SharedCollection methodsFor:'initialization'!
@@ -124,130 +123,113 @@
"add the argument, anObject to the receiver.
Return the added element."
- |rslt|
+ ^ accessLock critical:[
+ realCollection add:anElement
+ ].
- accessLock critical:[
- rslt := realCollection add:anElement
- ].
- ^ rslt
+ "Modified: / 02-02-2017 / 17:01:08 / stefan"
!
at:index
- |rslt|
+ ^ accessLock critical:[
+ realCollection at:index
+ ].
- accessLock critical:[
- rslt := realCollection at:index
- ].
- ^ rslt
+ "Modified: / 02-02-2017 / 17:01:23 / stefan"
!
at:index put:value
- |rslt|
+ ^ accessLock critical:[
+ realCollection at:index put:value
+ ].
- accessLock critical:[
- rslt := realCollection at:index put:value
- ].
- ^ rslt
+ "Modified: / 02-02-2017 / 17:01:35 / stefan"
!
do:aBlock
- |rslt|
-
- accessLock critical:[
- rslt := realCollection do:aBlock
+ ^ accessLock critical:[
+ realCollection do:aBlock
].
- ^ rslt
"Created: / 22-11-2010 / 21:01:21 / cg"
+ "Modified: / 02-02-2017 / 17:02:00 / stefan"
!
doesNotUnderstand:aMessage
"catches everything not understood by the collection protocol"
- |rslt|
-
- accessLock critical:[
- rslt := aMessage sendTo:realCollection
+ ^ accessLock critical:[
+ aMessage sendTo:realCollection
].
- ^ rslt
"Modified: / 07-12-2006 / 17:38:30 / cg"
+ "Modified: / 02-02-2017 / 17:02:18 / stefan"
!
isEmpty
- |rslt|
-
- accessLock critical:[
- rslt := realCollection isEmpty
+ ^ accessLock critical:[
+ realCollection isEmpty
].
- ^ rslt
"Created: / 22-11-2010 / 20:59:01 / cg"
+ "Modified: / 02-02-2017 / 11:40:56 / stefan"
!
notEmpty
- |rslt|
-
- accessLock critical:[
- rslt := realCollection notEmpty
+ ^ accessLock critical:[
+ realCollection notEmpty
].
- ^ rslt
"Created: / 22-11-2010 / 20:59:06 / cg"
+ "Modified: / 02-02-2017 / 17:00:36 / stefan"
!
remove:someElement ifAbsent:aBlock
- |rslt|
-
- accessLock critical:[
- rslt := realCollection remove:someElement ifAbsent:aBlock
+ ^ accessLock critical:[
+ realCollection remove:someElement ifAbsent:aBlock
].
- ^ rslt
"Created: / 25-01-2017 / 22:57:32 / stefan"
+ "Modified: / 02-02-2017 / 17:00:54 / stefan"
!
removeAllSuchThat:aBlock
- |rslt|
-
- accessLock critical:[
- rslt := realCollection removeAllSuchThat:aBlock
+ ^ accessLock critical:[
+ realCollection removeAllSuchThat:aBlock
].
- ^ rslt
"Created: / 22-11-2010 / 20:59:27 / cg"
+ "Modified: / 02-02-2017 / 17:02:38 / stefan"
!
removeIdentical:someElement ifAbsent:aBlock
- |rslt|
-
- accessLock critical:[
- rslt := realCollection removeIdentical:someElement ifAbsent:aBlock
+ ^ accessLock critical:[
+ realCollection removeIdentical:someElement ifAbsent:aBlock
].
- ^ rslt
"Created: / 22-11-2010 / 21:00:33 / cg"
+ "Modified: / 02-02-2017 / 17:02:52 / stefan"
!
size
- |rslt|
+ ^ accessLock critical:[
+ realCollection size
+ ].
- accessLock critical:[
- rslt := realCollection size
- ].
- ^ rslt
+ "Modified: / 02-02-2017 / 17:03:06 / stefan"
!
subclassResponsibility
"catches every required message of the collection protocol"
- |msg rslt|
+ |msg|
msg := thisContext sender message.
- accessLock critical:[
- rslt := msg sendTo:realCollection
+ ^ accessLock critical:[
+ msg sendTo:realCollection
].
- ^ rslt
+
+ "Modified: / 02-02-2017 / 17:03:25 / stefan"
! !
!SharedCollection methodsFor:'queries'!