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