The Trunk: Collections-nice.770.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-nice.770.mcz

commits-2
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.770.mcz

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

Name: Collections-nice.770
Author: nice
Time: 30 November 2017, 6:01:07.729917 pm
UUID: bab44976-95d4-e142-a0f7-eb954c3c237c
Ancestors: Collections-tpr.769

Let CharacterSet union: work as expected and answer a (Wide)CharacterSet(Complement) when possible.

=============== Diff against Collections-tpr.769 ===============

Item was added:
+ ----- Method: CharacterSet>>union: (in category 'enumerating') -----
+ union: aCollection
+ (self species = aCollection species or: [aCollection isString]) ifFalse: [^super union: aCollection].
+ aCollection class = CharacterSetComplement ifTrue: [^aCollection union: self].
+ ^self copy addAll: aCollection; yourself!

Item was added:
+ ----- Method: CharacterSetComplement>>intersection: (in category 'enumerating') -----
+ intersection: aCollection
+ aCollection class = self class ifTrue: [^(self complement union: aCollection complement) complement].
+ ^(aCollection intersection: self) as: CharacterSet!

Item was added:
+ ----- Method: CharacterSetComplement>>union: (in category 'enumerating') -----
+ union: aCollection
+ aCollection class = self class ifTrue: [^(self complement intersection: aCollection complement) complement].
+ (aCollection species = CharacterSet or: [aCollection isString]) ifFalse: [^self error: 'no way to compute the union, this collection is too big'].
+ ^(absent reject: [:e | aCollection includes: e]) complement!

Item was added:
+ ----- Method: WideCharacterSet>>union: (in category 'enumerating') -----
+ union: aCollection
+ (self species = aCollection species or: [aCollection isString]) ifFalse: [^super union: aCollection].
+ ^self copy addAll: aCollection; yourself!