The Trunk: Collections-ul.379.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.379.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.379.mcz

==================== Summary ====================

Name: Collections-ul.379
Author: ul
Time: 12 September 2010, 3:53:45.584 am
UUID: e13385ca-4f9f-7b42-a1d6-35cb7d984ee6
Ancestors: Collections-ar.378

- fix: ByteArray should understand #indexOf:startingAt: because StandardFileStream >> #upTo: uses it in binary mode. Also added a general implementation for SequenceableCollection.
- fix: Symbol class >> #allSymbolTablesDo:after: missed some elements, so Alt+q (Cmd+q on Mac) missed some selectors. WeakSet >> #do:after: was also responsible for some misses.
- enh: faster String >> #indexOfAscii:inString:startingAt:

=============== Diff against Collections-ar.378 ===============

Item was added:
+ ----- Method: ByteArray>>indexOf:startingAt: (in category 'accessing') -----
+ indexOf: anInteger startingAt: start
+
+ (anInteger isInteger and: [
+ anInteger >= 0 and: [
+ anInteger <= 255 ] ]) ifFalse: [ ^0 ].
+ ^ByteString indexOfAscii: anInteger inString: self startingAt: start!

Item was added:
+ ----- Method: SequenceableCollection>>indexOf:startingAt: (in category 'accessing') -----
+ indexOf: anElement startingAt: start
+ "Answer the index of the first occurence of anElement after start
+ within the receiver. If the receiver does not contain anElement,
+ answer 0."
+
+ | index endIndex |
+ index := start.
+ endIndex := self size.
+ [ index <= endIndex ] whileTrue: [
+ (self at: index) = anElement ifTrue: [ ^index ].
+ index := index + 1 ].
+ ^0!

Item was changed:
  ----- Method: String class>>indexOfAscii:inString:startingAt: (in category 'primitives') -----
  indexOfAscii: anInteger inString: aString startingAt: start
  "Trivial, non-primitive version"
+
+ | index endIndex |
+ endIndex := aString size.
+ index := start - 1.
+ [ (index := index + 1) <= endIndex ] whileTrue: [
+ (aString basicAt: index) = anInteger ifTrue: [ ^index ] ].
+ ^0
- | stringSize |
- stringSize := aString size.
- start to: stringSize do: [:pos |
- (aString at: pos) asInteger = anInteger ifTrue: [^ pos]].
- ^ 0
  !

Item was changed:
  ----- Method: Symbol class>>allSymbolTablesDo:after: (in category 'class initialization') -----
  allSymbolTablesDo: aBlock after: aSymbol
 
+ (NewSymbols includes: aSymbol)
+ ifTrue: [
+ NewSymbols do: aBlock after: aSymbol.
+ SymbolTable do: aBlock after: aSymbol ]
+ ifFalse: [
+ SymbolTable do: aBlock after: aSymbol.
+ NewSymbols do: aBlock after: aSymbol ]
+ !
- NewSymbols do: aBlock after: aSymbol.
- SymbolTable do: aBlock after: aSymbol.!

Item was changed:
  ----- Method: WeakSet>>do:after: (in category 'public') -----
  do: aBlock after: anElement
 
+ | index endIndex |
- | startIndex |
  tally = 0 ifTrue: [ ^self ].
+ anElement
+ ifNil: [ index := 0 ]
+ ifNotNil: [
+ index := self scanFor: anElement.
+ (array at: index) == flag ifTrue: [
+ index := 0 ] ].
+ endIndex := array size.
+ [ (index := index + 1) <= endIndex ] whileTrue: [
- startIndex := anElement
- ifNil: [ 0 ]
- ifNotNil: [ self scanFor: anElement ].
- startIndex + 1 to: array size do: [ :index |
  (array at: index) ifNotNil: [ :object |
  object == flag ifFalse: [
  aBlock value: object enclosedSetElement] ] ]!