The Trunk: Collections-ul.938.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.938.mcz

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

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

Name: Collections-ul.938
Author: ul
Time: 14 April 2021, 12:04:31.18204 pm
UUID: 0ebddf60-7622-4708-976d-62ebea16aee5
Ancestors: Collections-mt.937

- implement PositionableStream >> #basicSkipTo:
- make PositionableStream >> #basicUpTo: do what other #basic* methods do
- use #streamContents: in PositionableStream >> #upTo:

=============== Diff against Collections-mt.937 ===============

Item was added:
+ ----- Method: PositionableStream>>basicSkipTo: (in category 'accessing - multibyte support') -----
+ basicSkipTo: anObject
+
+ ^self skipTo: anObject!

Item was changed:
+ ----- Method: PositionableStream>>basicUpTo: (in category 'accessing - multibyte support') -----
- ----- Method: PositionableStream>>basicUpTo: (in category 'private basic') -----
  basicUpTo: anObject
+
+ ^self upTo: anObject!
- "Answer a subcollection from the current access position to the
- occurrence (if any, but not inclusive) of anObject in the receiver. If
- anObject is not in the collection, answer the entire rest of the receiver."
- | newStream element |
- newStream := WriteStream on: (self collectionSpecies new: 100).
- [self atEnd or: [(element := self basicNext) = anObject]]
- whileFalse: [newStream nextPut: element].
- ^newStream contents!

Item was changed:
  ----- Method: PositionableStream>>upTo: (in category 'accessing') -----
  upTo: anObject
  "Answer a subcollection from the current access position to the
  occurrence (if any, but not inclusive) of anObject in the receiver. If
  anObject is not in the collection, answer the entire rest of the receiver."
+
+ ^self collectionSpecies streamContents: [ :stream |
+ | element |
+ [self atEnd or: [(element := self next) = anObject]]
+ whileFalse: [stream nextPut: element]]!
- | newStream element |
- newStream := WriteStream on: (self collectionSpecies new: 100).
- [self atEnd or: [(element := self next) = anObject]]
- whileFalse: [newStream nextPut: element].
- ^newStream contents!