[squeak-dev] The Trunk: Collections-pre.763.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Aug 31 13:14:37 UTC 2017
Patrick Rein uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-pre.763.mcz
==================== Summary ====================
Name: Collections-pre.763
Author: pre
Time: 31 August 2017, 3:14:26.5764 pm
UUID: ffff1838-0f68-9e49-bd57-6263eaebd8d7
Ancestors: Collections-pre.762, Collections-tonyg.734
Merges Collections-tonyg.734 which fixes Mantis #4665 and deals with the difference in counting at the public interface of streams and counting the steps in the underlying buffer.
=============== Diff against Collections-pre.762 ===============
Item was changed:
----- Method: PositionableStream>>upToAll: (in category 'accessing') -----
upToAll: aCollection
"Answer a subcollection from the current access position to the occurrence (if any, but not inclusive) of aCollection. If aCollection is not in the stream, answer the entire rest of the stream."
| startPos endMatch result |
startPos := self position.
(self match: aCollection)
ifTrue: [endMatch := self position.
self position: startPos.
+ result := self upToPosition: endMatch - aCollection size.
- result := self next: endMatch - startPos - aCollection size.
self position: endMatch.
^ result]
ifFalse: [self position: startPos.
^ self upToEnd]!
Item was added:
+ ----- Method: PositionableStream>>upToPosition: (in category 'accessing') -----
+ upToPosition: anInteger
+ "Answer a subcollection containing items starting from the current position and ending including the given position. Usefully different to #next: in that in the case of MultiByteFileStream, and perhaps others, positions measure in terms of encoded items, while #next: convention is to name a number of items, independent of their encoding in the underlying buffer."
+ ^ self next: anInteger - position
+ !
More information about the Squeak-dev
mailing list
|