forked from SeasideSt/Grease
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGRCountingStream.class.st
More file actions
62 lines (52 loc) · 1.26 KB
/
GRCountingStream.class.st
File metadata and controls
62 lines (52 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"
A GRCountingStream counts how many elements have been added to it. This is necessary because the underlying stream may inflate the number of elements in the stream.
Instance Variables:
count <Integer>
count
- number of elements added to this stream
"
Class {
#name : #GRCountingStream,
#superclass : #GRDelegatingStream,
#instVars : [
'count'
],
#category : #'Grease-Core'
}
{ #category : #accessing }
GRCountingStream >> count [
^ count
]
{ #category : #streaming }
GRCountingStream >> greaseNext: anInteger putAll: aCollection startingAt: startIndex [
super greaseNext: anInteger putAll: aCollection startingAt: startIndex.
count := count + anInteger
]
{ #category : #initialization }
GRCountingStream >> initialize [
super initialize.
count := 0
]
{ #category : #streaming }
GRCountingStream >> next [
self shouldNotImplement
]
{ #category : #streaming }
GRCountingStream >> next: anInteger [
self shouldNotImplement
]
{ #category : #streaming }
GRCountingStream >> nextPut: aCharacter [
stream nextPut: aCharacter.
count := count + 1
]
{ #category : #streaming }
GRCountingStream >> nextPutAll: aString [
stream nextPutAll: aString.
count := count + aString size
]
{ #category : #accessing }
GRCountingStream >> reset [
super reset.
count := 0
]