[squeak-dev] The Inbox: Collections-ct.908.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Aug 20 12:35:13 UTC 2020


A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-ct.908.mcz

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

Name: Collections-ct.908
Author: ct
Time: 20 August 2020, 2:35:10.09764 pm
UUID: b22d8a31-b3dd-ba49-924a-3f470da838c2
Ancestors: Collections-eem.907

Complements 60Deprecated-ct.80 (deprecation #doWithIndex: & Co.).

=============== Diff against Collections-eem.907 ===============

Item was removed:
- ----- Method: HashedCollection>>doWithIndex: (in category 'enumerating') -----
- doWithIndex: aBlock2
- 	"Support Set enumeration with a counter, even though not ordered"
- 	| index |
- 	index := 0.
- 	self do: [:item | aBlock2 value: item value: (index := index+1)]!

Item was added:
+ ----- Method: HashedCollection>>withIndexDo: (in category 'enumerating') -----
+ withIndexDo: elementAndIndexBlock
+ 	"Support Set enumeration with a counter, even though not ordered"
+ 	| index |
+ 	index := 0.
+ 	self do: [:item | elementAndIndexBlock value: item value: (index := index + 1)].!

Item was removed:
- ----- Method: SequenceableCollection>>collectWithIndex: (in category 'enumerating') -----
- collectWithIndex: elementAndIndexBlock
- 	"Use the new version with consistent naming"
- 	^ self withIndexCollect: elementAndIndexBlock!

Item was removed:
- ----- Method: SequenceableCollection>>doWithIndex: (in category 'enumerating') -----
- doWithIndex: elementAndIndexBlock
- 	"Use the new version with consistent naming"
- 	^ self withIndexDo: elementAndIndexBlock!

Item was changed:
  ----- Method: String>>compressWithTable: (in category 'converting') -----
  compressWithTable: tokens
  	"Return a string with all substrings that occur in tokens replaced
  	by a character with ascii code = 127 + token index.
  	This will work best if tokens are sorted by size.
  	Assumes this string contains no characters > 127, or that they
  	are intentionally there and will not interfere with this process."
  	| str null finalSize result ri c |
  	null := Character null.
  	str := self copyFrom: 1 to: self size.  "Working string will get altered"
  	finalSize := str size.
+ 	tokens withIndexDo:
- 	tokens doWithIndex:
  		[:token :tIndex |
  		| start ts |
  		start := 1.
  		[(start := str findString: token startingAt: start) > 0]
  			whileTrue:
  			[ts := token size.
  			((start + ts) <= str size
  				and: [(str at: start + ts) = $  and: [tIndex*2 <= 128]])
  				ifTrue: [ts := token size + 1.  "include training blank"
  						str at: start put: (Character value: tIndex*2 + 127)]
  				ifFalse: [str at: start put: (Character value: tIndex + 127)].
  			str at: start put: (Character value: tIndex + 127).
  			1 to: ts-1 do: [:i | str at: start+i put: null].
  			finalSize := finalSize - (ts - 1).
  			start := start + ts]].
  	result := String new: finalSize.
  	ri := 0.
  	1 to: str size do:
  		[:i | (c := str at: i) = null ifFalse: [result at: (ri := ri+1) put: c]].
  	^ result!



More information about the Squeak-dev mailing list