--- a/ArrColl.st Thu Nov 23 01:27:24 1995 +0100
+++ b/ArrColl.st Thu Nov 23 02:06:55 1995 +0100
@@ -11,10 +11,10 @@
"
SequenceableCollection subclass:#ArrayedCollection
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- category:'Collections-Abstract'
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Collections-Abstract'
!
!ArrayedCollection class methodsFor:'documentation'!
@@ -33,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/ArrColl.st,v 1.26 1995-11-22 22:06:32 cg Exp $'
-!
-
documentation
"
ArrayedCollection is an abstract superclass for all collections where
@@ -61,17 +57,10 @@
ST/X versions may be changed to trigger an error (instead of a
warning) in those situations.
"
-! !
-
-!ArrayedCollection class methodsFor:'queries'!
+!
-growIsCheap
- "return true, if this collection can easily grow
- (i.e. without a need for become:).
- Since this is the superclass of all indexed fix-size collections,
- return false here."
-
- ^ false
+version
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/ArrColl.st,v 1.27 1995-11-23 01:05:48 cg Exp $'
! !
!ArrayedCollection class methodsFor:'instance creation'!
@@ -179,27 +168,15 @@
"
! !
-!ArrayedCollection methodsFor:'testing'!
-
-includesKey:anIndex
- "return true, if anIndex is a valid key.
- NOTICE: in ST-80, this message is only defined for Dictionaries,
- however, having a common protocol with indexed collections
- often simplifies things."
-
- ^ (anIndex >= 1) and:[anIndex <= self size]
+!ArrayedCollection class methodsFor:'queries'!
- "
- #(1 2 3) includesKey:4
- #(1 2 3) includesKey:3
- "
-!
+growIsCheap
+ "return true, if this collection can easily grow
+ (i.e. without a need for become:).
+ Since this is the superclass of all indexed fix-size collections,
+ return false here."
-size
- "redefined to re-enable size->basicSize forwarding
- (it is cought in SequencableCollection)"
-
- ^ self basicSize
+ ^ false
! !
!ArrayedCollection methodsFor:'copying'!
@@ -218,6 +195,49 @@
^ super copyEmptyAndGrow:size
! !
+!ArrayedCollection methodsFor:'error handling'!
+
+fixedSizeError
+ "report an error that size of the collection cannot be changed.
+ This is obsolete now."
+
+ ^ self error:'cannot change size'
+! !
+
+!ArrayedCollection methodsFor:'printing & storing'!
+
+storeOn:aStream
+ "output a printed representation (which can be re-read with readFrom:)
+ onto the argument aStream. Redefined to output index access."
+
+ |index "{ Class: SmallInteger }"|
+
+ thisContext isRecursive ifTrue:[
+ Transcript showCr:'Error: storeOn: of self referencing collection.'.
+ aStream nextPutAll:'#recursive'.
+ ^ self
+ ].
+
+ aStream nextPutAll:'(('; nextPutAll:self class name; nextPutAll:' new:'.
+ self size printOn:aStream.
+ aStream nextPutAll:')'.
+ index := 1.
+ self do:[:element |
+ aStream nextPutAll:' at:'.
+ index printOn:aStream.
+ aStream nextPutAll:' put:('.
+ element storeOn:aStream.
+ aStream nextPutAll:');'.
+ index := index + 1
+ ].
+ index > 1 ifTrue:[aStream nextPutAll:' yourself'].
+ aStream nextPut:$)
+
+ "
+ (Array with:(1@2) with:(1->2)) storeString
+ "
+! !
+
!ArrayedCollection methodsFor:'resizing'!
grow:newSize
@@ -268,45 +288,26 @@
"
! !
-!ArrayedCollection methodsFor:'error handling'!
+!ArrayedCollection methodsFor:'testing'!
+
+includesKey:anIndex
+ "return true, if anIndex is a valid key.
+ NOTICE: in ST-80, this message is only defined for Dictionaries,
+ however, having a common protocol with indexed collections
+ often simplifies things."
+
+ ^ (anIndex >= 1) and:[anIndex <= self size]
-fixedSizeError
- "report an error that size of the collection cannot be changed.
- This is obsolete now."
+ "
+ #(1 2 3) includesKey:4
+ #(1 2 3) includesKey:3
+ "
+!
- ^ self error:'cannot change size'
+size
+ "redefined to re-enable size->basicSize forwarding
+ (it is cought in SequencableCollection)"
+
+ ^ self basicSize
! !
-!ArrayedCollection methodsFor:'printing & storing'!
-
-storeOn:aStream
- "output a printed representation (which can be re-read with readFrom:)
- onto the argument aStream. Redefined to output index access."
-
- |index "{ Class: SmallInteger }"|
-
- thisContext isRecursive ifTrue:[
- Transcript showCr:'Error: storeOn: of self referencing collection.'.
- aStream nextPutAll:'#recursive'.
- ^ self
- ].
-
- aStream nextPutAll:'(('; nextPutAll:self class name; nextPutAll:' new:'.
- self size printOn:aStream.
- aStream nextPutAll:')'.
- index := 1.
- self do:[:element |
- aStream nextPutAll:' at:'.
- index printOn:aStream.
- aStream nextPutAll:' put:('.
- element storeOn:aStream.
- aStream nextPutAll:');'.
- index := index + 1
- ].
- index > 1 ifTrue:[aStream nextPutAll:' yourself'].
- aStream nextPut:$)
-
- "
- (Array with:(1@2) with:(1->2)) storeString
- "
-! !