The Trunk: Collections-eem.578.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-eem.578.mcz

commits-2
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.578.mcz

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

Name: Collections-eem.578
Author: eem
Time: 28 July 2014, 9:59:54.044 am
UUID: 5ecf4e5c-8071-4cba-b887-144271ecfa61
Ancestors: Collections-nice.577

Implement peekLast in TranscriptStream.
Implement WriteStream>>ensureEndsWith: in terms of peekLast.

=============== Diff against Collections-nice.577 ===============

Item was removed:
- ----- Method: TranscriptStream>>ensureEndsWith: (in category 'accessing') -----
- ensureEndsWith: anObject
- "Append anObject to the receiver IFF there is not one on the end."
-
- lastChar = anObject ifTrue: [^self].
- super ensureEndsWith: anObject!

Item was added:
+ ----- Method: TranscriptStream>>peekLast (in category 'character writing') -----
+ peekLast
+ "Return that item just put at the end of the stream"
+
+ ^ position > 0
+ ifTrue: [collection at: position]
+ ifFalse: [lastChar]!

Item was changed:
  ----- Method: WriteStream>>ensureEndsWith: (in category 'accessing') -----
  ensureEndsWith: anObject
  "Append anObject to the receiver IFF there is not one on the end."
 
+ self peekLast = anObject ifFalse:
+ [self nextPut: anObject]!
- (position > 0 and: [(collection at: position) = anObject]) ifTrue: [^self].
- self nextPut: anObject!