Collection.st
branchjv
changeset 18011 deb0c3355881
parent 17993 956342c369a2
parent 14614 6b02772b261d
child 18017 7fef9e17913f
--- a/Collection.st	Thu Dec 20 11:48:59 2012 +0000
+++ b/Collection.st	Sat Jan 19 01:30:00 2013 +0000
@@ -287,6 +287,20 @@
     ^ ValueNotFoundSignal
 ! !
 
+!Collection class methodsFor:'instance creation-streaming'!
+
+writeStreamClass
+    "the type of stream used in writeStream"
+
+    ^ WriteStream
+
+    "
+     OrderedCollection writeStreamClass
+    "
+
+    "Created: / 09-01-2011 / 10:37:15 / cg"
+! !
+
 !Collection class methodsFor:'misc ui support'!
 
 iconInBrowserSymbol
@@ -1598,7 +1612,7 @@
 !
 
 asSortedStrings
-    "Create & return a SortedCollection that sorts the receivers
+    "Create & return a SortedCollection that sorts the receiver's
      elements according to the locales collating policy.
      This is currently not really support - strings are sorted
      without caring for the locale."
@@ -1614,7 +1628,7 @@
 !
 
 asSortedStrings:sortBlock
-    "Create & return a SortedCollection that sorts the receivers
+    "Create & return a SortedCollection that sorts the receiver's
      elements using sortBlock and according to the locales collating policy,
      which is passed as first arg to sortBlock.
      This is currently not really support - strings are sorted
@@ -1632,7 +1646,7 @@
 !
 
 asSortedStrings:sortBlock with:aCollationPolicy
-    "Create & return a SortedCollection that sorts the receivers
+    "Create & return a SortedCollection that sorts the receiver's
      elements using sortBlock and according to the specified locales collating policy.
      This is currently not really support - strings are sorted
      without caring for the locale."
@@ -1649,7 +1663,7 @@
 !
 
 asSortedStringsWith: aCollationPolicy
-    "Create & return a SortedCollection that sorts the receivers
+    "Create & return a SortedCollection that sorts the receiver's
      elements according to the specified locales collating policy.
      This is currently not really support - strings are sorted
      without caring for the locale."
@@ -1873,7 +1887,7 @@
 writeStream
     "return a stream for writing onto the receiver"
 
-    ^ WriteStream on:self
+    ^ self class writeStreamClass on:self
 
     "
      |s|
@@ -2451,6 +2465,7 @@
      (1 to:15) reduce:[:x :y| '(', x printString, '+', y printString, ')']
      #('if' 'it' 'is' 'to' 'be' 'it' 'is' 'up' 'to' 'me') fold: [:a :b | a, ' ', b]
      #('if' 'it' 'is' 'to' 'be' 'it' 'is' 'up' 'to' 'me') reduce: [:a :b | a, ' ', b]
+     #() fold: [:a :b | a, ' ', b] -- raises an error
     "
 
     "Created: / 14-09-2011 / 16:29:53 / cg"
@@ -3134,8 +3149,9 @@
 !
 
 emptyCollectionError
-    "report an error that the operation is not allowed for
-     empty collections"
+    "report an error that the operation is not allowed for empty collections"
+
+    <resource: #skipInDebuggersWalkBack>
 
     ^ EmptyCollectionSignal raise
 !
@@ -3143,18 +3159,24 @@
 errorInvalidKey:aKey
     "report an error that the given key was invalid"
 
+    <resource: #skipInDebuggersWalkBack>
+
     ^ InvalidKeySignal raiseRequestWith:aKey
 !
 
 errorNotKeyed
     "report an error that keyed access methods are not allowed"
 
+    <resource: #skipInDebuggersWalkBack>
+
     ^ self error:(self class name, 's do not respond to keyed accessing messages')
 !
 
 errorValueNotFound:anObject
     "report an error that an object was not found in the collection"
 
+    <resource: #skipInDebuggersWalkBack>
+
     ^ ValueNotFoundSignal raiseRequestWith:anObject
 
     "Modified: / 30.10.1997 / 15:52:18 / cg"
@@ -3166,7 +3188,9 @@
 
     |creator msg context|
 
-    creator := Method allSubInstances detect:[:aMethod | (aMethod referencesGlobal:self)] ifNone:nil.
+    creator := Method allSubInstances 
+                detect:[:aMethod | (aMethod referencesGlobal:self)] 
+                ifNone:nil.
     creator notNil ifTrue:[
         msg := ' (' , creator whoString , ')'
     ].
@@ -3190,6 +3214,8 @@
     "report an error that the operation is not allowed,  
      since not enough elements are in the collection"
 
+    <resource: #skipInDebuggersWalkBack>
+
     ^ NotEnoughElementsSignal raise
 ! !
 
@@ -3210,7 +3236,7 @@
 !
 
 grow:howBig
-    "change the receivers size"
+    "change the receiver's size"
 
     ^ self subclassResponsibility
 !
@@ -4268,8 +4294,8 @@
 !
 
 isEmptyOrNil
-    "return true if I am nil or an empty collection - true here, if the receivers size is 0,
-     (from Sqeak)"
+    "return true if I am nil or an empty collection - true here, if the receiver's size is 0,
+     (from Squeak)"
 
     ^ self isEmpty
 
@@ -4429,15 +4455,12 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.283 2012/11/23 16:35:50 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.286 2012-12-21 11:58:02 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/Collection.st,v 1.283 2012/11/23 16:35:50 stefan Exp §'
-!
-
-version_SVN
-    ^ '$Id: Collection.st 10876 2012-11-30 17:19:23Z vranyj1 $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.286 2012-12-21 11:58:02 cg Exp $'
 ! !
 
+
 Collection initialize!