author | Stefan Vogel <sv@exept.de> |
Wed, 01 Aug 2018 15:12:02 +0200 | |
changeset 4708 | 713e81a051ec |
parent 4352 | 7fd9c0a9ee6f |
child 4780 | 2d9224d441a6 |
permissions | -rw-r--r-- |
62 | 1 |
" |
290 | 2 |
COPYRIGHT. |
3 |
The above file is a Manchester Goodie protected by copyright. |
|
4 |
These conditions are imposed on the whole Goodie, and on any significant |
|
5 |
part of it which is separately transmitted or stored: |
|
355 | 6 |
* You must ensure that every copy includes this notice, and that |
7 |
source and author(s) of the material are acknowledged. |
|
8 |
* These conditions must be imposed on anyone who receives a copy. |
|
9 |
* The material shall not be used for commercial gain without the prior |
|
10 |
written consent of the author(s). |
|
290 | 11 |
Further information on the copyright conditions may be obtained by |
12 |
sending electronic mail: |
|
355 | 13 |
To: goodies-lib@cs.man.ac.uk |
14 |
Subject: copyright |
|
290 | 15 |
or by writing to The Smalltalk Goodies Library Manager, Dept of |
16 |
Computer Science, The University, Manchester M13 9PL, UK |
|
62 | 17 |
|
290 | 18 |
(C) Copyright 1992 University of Manchester |
19 |
For more information about the Manchester Goodies Library (from which |
|
20 |
this file was distributed) send e-mail: |
|
355 | 21 |
To: goodies-lib@cs.man.ac.uk |
22 |
Subject: help |
|
290 | 23 |
" |
993 | 24 |
"{ Package: 'stx:libbasic2' }" |
890
40421d1c3377
displayString (avoid iterating)
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
25 |
|
3477 | 26 |
"{ NameSpace: Smalltalk }" |
27 |
||
290 | 28 |
Collection subclass:#Iterator |
29 |
instanceVariableNames:'block' |
|
30 |
classVariableNames:'' |
|
31 |
poolDictionaries:'' |
|
32 |
category:'Collections-Sequenceable' |
|
62 | 33 |
! |
34 |
||
290 | 35 |
Iterator comment:'An Iterator is a read-only collection that evaluates a block to yield the elements |
925 | 36 |
of the collection.' |
37 |
! |
|
62 | 38 |
|
290 | 39 |
!Iterator class methodsFor:'documentation'! |
62 | 40 |
|
290 | 41 |
copyright |
42 |
" |
|
43 |
COPYRIGHT. |
|
62 | 44 |
The above file is a Manchester Goodie protected by copyright. |
45 |
These conditions are imposed on the whole Goodie, and on any significant |
|
46 |
part of it which is separately transmitted or stored: |
|
355 | 47 |
* You must ensure that every copy includes this notice, and that |
48 |
source and author(s) of the material are acknowledged. |
|
49 |
* These conditions must be imposed on anyone who receives a copy. |
|
50 |
* The material shall not be used for commercial gain without the prior |
|
51 |
written consent of the author(s). |
|
62 | 52 |
Further information on the copyright conditions may be obtained by |
53 |
sending electronic mail: |
|
355 | 54 |
To: goodies-lib@cs.man.ac.uk |
55 |
Subject: copyright |
|
62 | 56 |
or by writing to The Smalltalk Goodies Library Manager, Dept of |
57 |
Computer Science, The University, Manchester M13 9PL, UK |
|
58 |
||
59 |
(C) Copyright 1992 University of Manchester |
|
60 |
For more information about the Manchester Goodies Library (from which |
|
61 |
this file was distributed) send e-mail: |
|
355 | 62 |
To: goodies-lib@cs.man.ac.uk |
63 |
Subject: help |
|
290 | 64 |
" |
65 |
||
66 |
! |
|
67 |
||
68 |
documentation |
|
69 |
" |
|
70 |
Occasionally you may have a block that when evaluated can be |
|
355 | 71 |
treated as a collection -- i.e. it takes another block as parameter, |
290 | 72 |
then applies that to a sequence of values. |
73 |
||
74 |
This goodie wraps the block into an object -- an iterator -- which is |
|
75 |
part of the collection hierarchy, and therefore inherits a variety of |
|
76 |
useful collection-related methods. |
|
77 |
||
78 |
[info:] |
|
355 | 79 |
NAME Iterator |
80 |
AUTHOR miw@cs.man.ac.uk (Mario Wolczko) |
|
81 |
FUNCTION a wrapper for blocks that iterate over collections |
|
82 |
ST-VERSION 4.0 4.1 |
|
83 |
PREREQUISITES |
|
84 |
CONFLICTS |
|
85 |
DISTRIBUTION world |
|
86 |
VERSION 1 |
|
87 |
DATE 18 Jun 1991 |
|
88 |
SUMMARY |
|
290 | 89 |
|
90 |
[organisation:] |
|
355 | 91 |
Dept. of Computer Science Internet: mario@cs.man.ac.uk |
92 |
The University uucp: uknet!!!!man.cs!!!!mario |
|
93 |
Manchester M13 9PL JANET: mario@uk.ac.man.cs |
|
94 |
U.K. Tel: +44-61-275 6146 (FAX: 6236) |
|
95 |
______the mushroom project___________________________________ |
|
290 | 96 |
|
97 |
[author:] |
|
355 | 98 |
Mario Wolczko miw@cs.man.ac.uk |
290 | 99 |
" |
100 |
||
101 |
! |
|
102 |
||
103 |
examples |
|
104 |
" |
|
878 | 105 |
an iterator, simulating the collection of all classes in the system: |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
106 |
[exBegin] |
878 | 107 |
|i b| |
108 |
||
109 |
b := [:whatToDo | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
110 |
Smalltalk allClassesDo:[:cls | |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
111 |
whatToDo value:cls |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
112 |
] |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
113 |
]. |
878 | 114 |
|
115 |
i := Iterator on:b. |
|
116 |
i do:[:cls | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
117 |
Transcript showCR:cls name |
878 | 118 |
]. |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
119 |
[exEnd] |
878 | 120 |
much like above, one that simulates the collection of all methodNames starting with 'a': |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
121 |
[exBegin] |
290 | 122 |
|i b| |
123 |
||
124 |
b := [:whatToDo | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
125 |
Smalltalk allClassesDo:[:cls | |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
126 |
cls methodDictionary keysAndValuesDo:[:nm :mthd | |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
127 |
(nm startsWith:$a) ifTrue:[ |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
128 |
whatToDo value:nm |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
129 |
] |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
130 |
] |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
131 |
] |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
132 |
]. |
290 | 133 |
|
878 | 134 |
i := Iterator on:b. |
135 |
i do:[:nm | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
136 |
Transcript showCR:nm |
878 | 137 |
]. |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
138 |
[exEnd] |
878 | 139 |
an iterator, simulating a collection of 100 random values: |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
140 |
[exBegin] |
878 | 141 |
|i b| |
142 |
||
143 |
b := [:whatToDo | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
144 |
|rnd| |
878 | 145 |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
146 |
rnd := Random new. |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
147 |
1 to:100 do:[:i | |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
148 |
whatToDo value:(rnd next) |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
149 |
] |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
150 |
]. |
290 | 151 |
|
152 |
i := Iterator on:b. |
|
153 |
i do:[:j | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
154 |
j printNL |
290 | 155 |
]. |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
156 |
[exEnd] |
294 | 157 |
an iterator, simulating a collection of the lines |
158 |
in a file: |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
159 |
[exBegin] |
294 | 160 |
|i b| |
161 |
||
162 |
b := [:whatToDo | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
163 |
|s line| |
294 | 164 |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
165 |
s := 'smalltalk.rc' asFilename readStream. |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
166 |
[s atEnd] whileFalse:[ |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
167 |
line := s nextLine. |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
168 |
whatToDo value:line. |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
169 |
]. |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
170 |
s close |
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
171 |
]. |
294 | 172 |
|
173 |
i := Iterator on:b. |
|
174 |
i do:[:j | |
|
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
175 |
j printNL |
294 | 176 |
]. |
885
c31412b26306
package-definitions fixed/updated
Claus Gittinger <cg@exept.de>
parents:
878
diff
changeset
|
177 |
[exEnd] |
290 | 178 |
" |
179 |
! ! |
|
180 |
||
181 |
!Iterator class methodsFor:'instance creation'! |
|
182 |
||
183 |
on: aBlock |
|
184 |
^ self new block: aBlock |
|
185 |
||
186 |
" |
|
187 |
|i b| |
|
188 |
||
189 |
b := [:whatToDo | |
|
3130 | 190 |
1 to:10 do:[:i | |
191 |
whatToDo value:i |
|
192 |
] |
|
193 |
]. |
|
290 | 194 |
|
195 |
i := Iterator on:b. |
|
196 |
i do:[:j | |
|
3130 | 197 |
Transcript showCR:j |
290 | 198 |
]. |
199 |
" |
|
200 |
||
201 |
" |
|
202 |
an iterator, simulating a collection of 100 random values: |
|
203 |
||
204 |
|i b| |
|
205 |
||
206 |
b := [:whatToDo | |
|
3130 | 207 |
|rnd| |
290 | 208 |
|
3130 | 209 |
rnd := Random new. |
210 |
1 to:100 do:[:i | |
|
211 |
whatToDo value:(rnd next) |
|
212 |
] |
|
213 |
]. |
|
290 | 214 |
|
215 |
i := Iterator on:b. |
|
216 |
i do:[:j | |
|
3130 | 217 |
j printNL |
290 | 218 |
]. |
219 |
" |
|
220 |
||
221 |
"Modified: 9.5.1996 / 14:26:49 / cg" |
|
222 |
! |
|
223 |
||
3130 | 224 |
on:collection msg:oneArgSelector |
225 |
^ self new block: [ :aBlock | collection perform:oneArgSelector with: aBlock] |
|
290 | 226 |
|
227 |
" |
|
3130 | 228 |
|i| |
290 | 229 |
|
3130 | 230 |
i := Iterator on:#(1 2 3 4 5 6 7) msg:#reverseDo:. |
290 | 231 |
i do:[:j | |
3130 | 232 |
Transcript showCR:j |
290 | 233 |
]. |
234 |
" |
|
235 |
||
236 |
"Modified: 9.5.1996 / 14:21:40 / cg" |
|
237 |
! ! |
|
238 |
||
239 |
!Iterator methodsFor:'accessing'! |
|
240 |
||
241 |
identityIndexOf: anElement |
|
242 |
"Answer the identity index of anElement within the receiver. |
|
243 |
If the receiver does not contain anElement, answer 0." |
|
244 |
||
245 |
^self identityIndexOf: anElement ifAbsent: [0] |
|
246 |
! |
|
247 |
||
248 |
identityIndexOf: anElement ifAbsent: exceptionBlock |
|
249 |
"Answer the identity index of anElement within the receiver. |
|
250 |
If the receiver does not contain anElement, answer the result |
|
251 |
of evaluating the exceptionBlock." |
|
252 |
||
253 |
| index | |
|
254 |
index := 1. |
|
255 |
self do: [ :el | el == anElement ifTrue: [^index]. index := index + 1]. |
|
256 |
^exceptionBlock value |
|
257 |
! |
|
258 |
||
259 |
indexOf: anElement |
|
260 |
"Answer the index of anElement within the receiver. If the receiver does |
|
261 |
not contain anElement, answer 0." |
|
262 |
||
263 |
^self indexOf: anElement ifAbsent: [0] |
|
264 |
! |
|
265 |
||
266 |
indexOf: anElement ifAbsent: exceptionBlock |
|
2263
2f713a9c8498
comment/format in: #indexOf:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
267 |
"Answer the index of anElement within the receiver. If the receiver does |
2f713a9c8498
comment/format in: #indexOf:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
268 |
not contain anElement, answer the result of evaluating the exceptionBlock." |
290 | 269 |
|
270 |
| index | |
|
2263
2f713a9c8498
comment/format in: #indexOf:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
271 |
|
290 | 272 |
index := 1. |
273 |
self do: [ :el | el = anElement ifTrue: [^index]. index := index + 1]. |
|
2263
2f713a9c8498
comment/format in: #indexOf:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
274 |
^ exceptionBlock value |
290 | 275 |
! ! |
276 |
||
277 |
!Iterator methodsFor:'adding & removing'! |
|
278 |
||
279 |
add: anObject |
|
2929 | 280 |
"raises an error: Iterators are read-only" |
281 |
||
290 | 282 |
self shouldNotImplement |
283 |
! |
|
284 |
||
285 |
remove: oldObject ifAbsent: anExceptionBlock |
|
286 |
"Iterators are read-only." |
|
3710 | 287 |
|
290 | 288 |
self shouldNotImplement |
897 | 289 |
! |
290 |
||
291 |
removeIdentical: oldObject ifAbsent: anExceptionBlock |
|
292 |
"Iterators are read-only." |
|
3710 | 293 |
|
897 | 294 |
self shouldNotImplement |
290 | 295 |
! ! |
296 |
||
297 |
!Iterator methodsFor:'converting'! |
|
298 |
||
299 |
asOrderedCollection |
|
300 |
"Answer a new instance of OrderedCollection whose elements are the elements of |
|
301 |
the receiver. The order in which elements are added depends on the order in |
|
302 |
which the receiver enumerates its elements. In the case of unordered collections, |
|
303 |
the ordering is not necessarily the same for multiple requests for the conversion." |
|
304 |
||
2972 | 305 |
| anOrderedCollection | |
290 | 306 |
|
307 |
anOrderedCollection := OrderedCollection new. |
|
3131 | 308 |
self do: [:each | anOrderedCollection add:each]. |
290 | 309 |
^anOrderedCollection |
310 |
! ! |
|
311 |
||
312 |
!Iterator methodsFor:'enumerating'! |
|
313 |
||
3129 | 314 |
collect:aBlock as:aClass |
315 |
"Reimplemented here as Iterator does not support #size" |
|
316 |
||
317 |
|newCollection| |
|
318 |
||
319 |
newCollection := aClass new. |
|
320 |
self do:[:el | |
|
321 |
newCollection add:(aBlock value:el). |
|
322 |
]. |
|
323 |
^ newCollection |
|
324 |
||
325 |
" |
|
326 |
#(one two three four five six) collect:[:element | element asUppercase] as:OrderedCollection |
|
327 |
'abcdef' collect:[:char | char digitValue] as:ByteArray |
|
328 |
" |
|
329 |
||
330 |
"Created: / 21-10-2013 / 16:07:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
331 |
! |
|
332 |
||
3204 | 333 |
detectLast:aBlock ifNone:anExceptionValue |
3130 | 334 |
"evaluate the argument, aBlock for each element in the receiver until |
335 |
the block returns true; in this case return the element which caused |
|
336 |
the true evaluation. The elements are processed in reverse order. |
|
3204 | 337 |
If none of the evaluations returns true, return the value of anExceptionValue" |
3130 | 338 |
|
339 |
| last | |
|
340 |
||
341 |
self do: [:each | |
|
342 |
(aBlock value:each) ifTrue: [last := each] |
|
343 |
]. |
|
344 |
last isNil ifTrue:[ |
|
3204 | 345 |
^ anExceptionValue value. |
3130 | 346 |
]. |
347 |
^ last |
|
348 |
||
349 |
" |
|
350 |
(Iterator on:[:whatToDo| #(1 2 3 4) do:whatToDo]) detectLast:[:n | n odd] ifNone:['sorry'] |
|
351 |
(Iterator on:[:whatToDo| #(2 4 6 8) do:whatToDo]) detectLast:[:n | n odd] ifNone:['sorry'] |
|
352 |
" |
|
353 |
! |
|
354 |
||
290 | 355 |
do: aBlock |
356 |
block value: aBlock |
|
357 |
! |
|
358 |
||
2145 | 359 |
findFirst: aBlock ifNone:exceptionalValue |
290 | 360 |
"Answer the index of the first element of the receiver |
361 |
for which aBlock evaluates as true." |
|
362 |
||
363 |
| index | |
|
2145 | 364 |
|
290 | 365 |
index := 1. |
366 |
self do: [ :el | (aBlock value: el) ifTrue: [^index]. index := index + 1]. |
|
2145 | 367 |
^exceptionalValue value |
290 | 368 |
! |
369 |
||
370 |
findLast: aBlock |
|
371 |
"Answer the index of the last element of the receiver |
|
1425 | 372 |
for which aBlock evaluates as true." |
290 | 373 |
|
374 |
| index last | |
|
375 |
index := 1. |
|
376 |
last := 0. |
|
377 |
self do: [ :el | (aBlock value: el) ifTrue: [last := index]. index := index + 1]. |
|
378 |
^last |
|
379 |
! |
|
380 |
||
381 |
keysAndValuesDo: aBlock |
|
382 |
"Evaluate aBlock with each of the receiver's key/value pairs |
|
383 |
(e.g. indexes and elements) as the arguments." |
|
384 |
||
385 |
| index | |
|
3477 | 386 |
|
290 | 387 |
index := 1. |
388 |
self do: [:el | aBlock value: index value: el. index := index + 1] |
|
3130 | 389 |
! |
390 |
||
391 |
reverseDo:aBlock |
|
392 |
"evaluate the argument, aBlock for each element in reverse order." |
|
393 |
||
394 |
"it could be defined in terms of do: - but very inefficient. |
|
395 |
Better force programmer to define a better version ..." |
|
396 |
||
397 |
^ self shouldNotImplement |
|
290 | 398 |
! ! |
399 |
||
2929 | 400 |
|
890
40421d1c3377
displayString (avoid iterating)
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
401 |
!Iterator methodsFor:'printing & storing'! |
40421d1c3377
displayString (avoid iterating)
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
402 |
|
2494
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
403 |
displayOn:aGCOrStream |
3491 | 404 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
4352 | 405 |
"/ old ST80 means: draw-yourself on a GC. |
3321 | 406 |
(aGCOrStream isStream) ifTrue:[ |
2494
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
407 |
aGCOrStream nextPutAll:'Iterator('. |
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
408 |
block displayOn:aGCOrStream. |
3492 | 409 |
aGCOrStream nextPutAll:')'. |
2494
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
410 |
^ self |
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
411 |
]. |
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
412 |
^ super displayOn:aGCOrStream. |
1756 | 413 |
|
1758 | 414 |
"Modified: / 06-10-2006 / 14:35:23 / cg" |
4352 | 415 |
"Modified (comment): / 22-02-2017 / 16:48:43 / cg" |
1755 | 416 |
! |
417 |
||
418 |
printOn:aStream |
|
419 |
aStream nextPutAll:'Iterator('. |
|
420 |
block printOn:aStream. |
|
421 |
aStream nextPutAll:')'. |
|
422 |
||
423 |
"Created: / 06-10-2006 / 13:44:42 / cg" |
|
890
40421d1c3377
displayString (avoid iterating)
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
424 |
! ! |
40421d1c3377
displayString (avoid iterating)
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
425 |
|
290 | 426 |
!Iterator methodsFor:'private'! |
427 |
||
925 | 428 |
block |
429 |
^ block |
|
430 |
! |
|
431 |
||
290 | 432 |
block: aBlock |
433 |
block := aBlock |
|
434 |
! |
|
435 |
||
436 |
species |
|
1036 | 437 |
"return the type of collection to be returned by collect, select etc." |
438 |
||
439 |
^ OrderedCollection |
|
290 | 440 |
! ! |
441 |
||
586 | 442 |
!Iterator methodsFor:'queries'! |
443 |
||
1856 | 444 |
isEmpty |
445 |
^ false |
|
446 |
||
447 |
"Created: / 15-03-2007 / 16:23:48 / cg" |
|
448 |
! |
|
449 |
||
586 | 450 |
size |
451 |
self shouldNotImplement |
|
452 |
||
453 |
"Created: / 1.11.1997 / 17:29:03 / cg" |
|
454 |
! ! |
|
455 |
||
290 | 456 |
!Iterator class methodsFor:'documentation'! |
457 |
||
458 |
version |
|
3710 | 459 |
^ '$Header$' |
2494
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
460 |
! |
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
461 |
|
2178753f5534
Implement display with #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2263
diff
changeset
|
462 |
version_CVS |
3710 | 463 |
^ '$Header$' |
290 | 464 |
! ! |
2929 | 465 |