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

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

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

Name: Collections-nice.499
Author: nice
Time: 25 January 2013, 11:09:44.244 pm
UUID: a0703731-567b-4e87-9fbc-94cfbeed1534
Ancestors: Collections-bf.498

Rename RunArray unique selector #addLast:times: as #add:withOccurrences:
It's a bit less expressive but it's universal.
Deprecate #addLast:times:

=============== Diff against Collections-bf.498 ===============

Item was added:
+ ----- Method: RunArray>>add:withOccurrences: (in category 'adding') -----
+ add: value withOccurrences: times
+ "Add value as the last element of the receiver, the given number of times"
+ times = 0 ifTrue: [ ^self ].
+ lastIndex := nil.  "flush access cache"
+ (runs size=0 or: [values last ~= value])
+  ifTrue:
+ [runs := runs copyWith: times.
+ values := values copyWith: value]
+  ifFalse:
+ [runs at: runs size put: runs last+times]!

Item was changed:
  ----- Method: RunArray>>addLast:times: (in category 'adding') -----
+ addLast: value times: times
- addLast: value  times: times
  "Add value as the last element of the receiver, the given number of times"
+ self deprecated: 'use add:withOccurrences:'.
+ ^self add: value withOccurrences: times!
- times = 0 ifTrue: [ ^self ].
- lastIndex := nil.  "flush access cache"
- (runs size=0 or: [values last ~= value])
-  ifTrue:
- [runs := runs copyWith: times.
- values := values copyWith: value]
-  ifFalse:
- [runs at: runs size put: runs last+times]!