ArrayedCollection.st
changeset 14112 9fc40252441e
parent 14058 670252a21fb9
child 14615 4e5318533a06
equal deleted inserted replaced
14111:b2c382a874ce 14112:9fc40252441e
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
    13 
    13 
    14 SequenceableCollection subclass:#ArrayedCollection
    14 SequenceableCollection subclass:#ArrayedCollection
    15         instanceVariableNames:''
    15 	instanceVariableNames:''
    16         classVariableNames:''
    16 	classVariableNames:''
    17         poolDictionaries:''
    17 	poolDictionaries:''
    18         category:'Collections-Abstract'
    18 	category:'Collections-Abstract'
    19 !
    19 !
    20 
    20 
    21 !ArrayedCollection class methodsFor:'documentation'!
    21 !ArrayedCollection class methodsFor:'documentation'!
    22 
    22 
    23 copyright
    23 copyright
   356 
   356 
   357 copyEmptyAndGrow:size
   357 copyEmptyAndGrow:size
   358     "return a new instance of the receivers species with size
   358     "return a new instance of the receivers species with size
   359      nilled elements and any named instance variables copied."
   359      nilled elements and any named instance variables copied."
   360 
   360 
   361     "special case for Array, which has no named instance vars"
   361     "Performance optimization for classes like Array, String, ...,
   362 
   362      which have no named instance vars"
   363     |cls|
   363 
   364 
   364     self class instSize == 0 ifTrue:[
   365     (cls := self class) instSize == 0 ifTrue:[
   365         ^ self species new:size
   366         ^ cls new:size
       
   367     ].
   366     ].
   368     ^ super copyEmptyAndGrow:size
   367     ^ super copyEmptyAndGrow:size
   369 ! !
   368 ! !
   370 
   369 
   371 !ArrayedCollection methodsFor:'error handling'!
   370 !ArrayedCollection methodsFor:'error handling'!
   381 
   380 
   382     ^ self error:'cannot change size'
   381     ^ self error:'cannot change size'
   383 
   382 
   384     "Modified: 18.7.1996 / 21:39:09 / cg"
   383     "Modified: 18.7.1996 / 21:39:09 / cg"
   385 ! !
   384 ! !
       
   385 
   386 
   386 
   387 !ArrayedCollection methodsFor:'printing & storing'!
   387 !ArrayedCollection methodsFor:'printing & storing'!
   388 
   388 
   389 storeOn:aStream
   389 storeOn:aStream
   390     "output a printed representation (which can be re-read with readFrom:)
   390     "output a printed representation (which can be re-read with readFrom:)
   500 ! !
   500 ! !
   501 
   501 
   502 !ArrayedCollection class methodsFor:'documentation'!
   502 !ArrayedCollection class methodsFor:'documentation'!
   503 
   503 
   504 version
   504 version
   505     ^ '$Header: /cvs/stx/stx/libbasic/ArrayedCollection.st,v 1.62 2012-03-08 20:29:30 cg Exp $'
   505     ^ '$Header: /cvs/stx/stx/libbasic/ArrayedCollection.st,v 1.63 2012-04-21 15:45:38 stefan Exp $'
   506 ! !
   506 ! !