[Pkg] The Trunk: Collections-eem.567.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri May 2 16:55:32 UTC 2014
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.567.mcz
==================== Summary ====================
Name: Collections-eem.567
Author: eem
Time: 2 May 2014, 9:54:58.139 am
UUID: 78f9c7bb-cb9d-487c-91ba-edd8b89502c1
Ancestors: Collections-nice.566
Fix ([Read|Write]Stream on:...from:...to:...) contents. The old code
would always copy from 1 to the end, not from whatever the
from: argument was.
=============== Diff against Collections-nice.566 ===============
Item was changed:
PositionableStream subclass: #ReadStream
+ instanceVariableNames: 'initialPositionOrNil'
- instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Collections-Streams'!
!ReadStream commentStamp: '<historical>' prior: 0!
I represent an accessor for a sequence of objects that can only read objects from the sequence.!
Item was added:
+ ----- Method: ReadStream>>contents (in category 'accessing') -----
+ contents
+ "Answer with a copy of my collection from the start to readLimit."
+
+ ^collection copyFrom: (initialPositionOrNil ifNil: [1]) to: readLimit!
Item was changed:
----- Method: ReadStream>>on:from:to: (in category 'private') -----
on: aCollection from: firstIndex to: lastIndex
| len |
collection := aCollection.
readLimit := lastIndex > (len := collection size)
ifTrue: [len]
ifFalse: [lastIndex].
position := firstIndex <= 1
ifTrue: [0]
+ ifFalse: [firstIndex - 1].
+ initialPositionOrNil := position + 1!
- ifFalse: [firstIndex - 1]!
Item was changed:
----- Method: ReadWriteStream>>contents (in category 'accessing') -----
contents
+ "Answer with a copy of my collection from the start to readLimit."
- "Answer with a copy of my collection from 1 to readLimit."
readLimit := readLimit max: position.
+ ^collection copyFrom: (initialPositionOrNil ifNil: [1]) to: readLimit!
- ^collection copyFrom: 1 to: readLimit!
Item was changed:
PositionableStream subclass: #WriteStream
+ instanceVariableNames: 'writeLimit initialPositionOrNil'
- instanceVariableNames: 'writeLimit'
classVariableNames: ''
poolDictionaries: ''
category: 'Collections-Streams'!
!WriteStream commentStamp: '<historical>' prior: 0!
I represent an accessor for a sequence of objects that can only store objects in the sequence.!
Item was changed:
----- Method: WriteStream>>contents (in category 'accessing') -----
contents
+ "Answer with a copy of my collection from the start to the current position."
-
readLimit := readLimit max: position.
+ ^collection copyFrom: (initialPositionOrNil ifNil: [1]) to: position!
- ^collection copyFrom: 1 to: position!
Item was changed:
----- Method: WriteStream>>on:from:to: (in category 'private') -----
on: aCollection from: firstIndex to: lastIndex
| len |
collection := aCollection.
readLimit :=
writeLimit := lastIndex > (len := collection size)
ifTrue: [len]
ifFalse: [lastIndex].
position := firstIndex <= 1
ifTrue: [0]
+ ifFalse: [firstIndex - 1].
+ initialPositionOrNil := position + 1!
- ifFalse: [firstIndex - 1]!
More information about the Packages
mailing list