8 self shouldNotImplement!
12 position >= writeLimit
13 ifTrue: [self pastEndPut: anObject]
14 ifFalse: [ position := position + 1.
15 collection at: position put: anObject]!
19 "Grow the collection by creating a new bigger collection and then
20 copy over the contents from the old one. We grow by doubling the size
21 but the growth is kept between 20 and 1000000.
22 Finally we put <anObject> at the current write position."
24 | oldSize grownCollection |
25 oldSize := collection size.
26 grownCollection := collection class new: oldSize + ((oldSize max: 20) min: 1000000).
27 collection := grownCollection replaceFrom: 1 to: oldSize with: collection startingAt: 1.
28 writeLimit := collection size.
29 collection at: (position := position + 1) put: anObject.
36 " anInteger is the required minimal new size of the collection "
37 | oldSize grownCollection newSize |
38 oldSize := collection size.
39 newSize := anInteger + (oldSize // 4 max: 20).
40 grownCollection := collection class new: newSize.
41 collection := grownCollection replaceFrom: 1 to: oldSize with: collection startingAt: 1.
42 writeLimit := collection size!
46 nextPutAll: aCollection
49 newEnd := position + aCollection size.
51 ifTrue: [self growTo: newEnd + 10].
53 collection replaceFrom: position + 1 to: newEnd with: aCollection startingAt: 1.
59 self nextPut: Character cr!
63 self nextPut: Character tab!
68 readLimit := readLimit max: position.
69 ^ collection copyFrom: 1 to: position!
76 super on: aCollection.
78 writeLimit := aCollection size!