|
Class: IteratorStream
Object
|
+--Stream
|
+--PeekableStream
|
+--IteratorStream
|
+--RecursiveSeriesStream
- Package:
- stx:libbasic2
- Category:
- Streams
- Version:
- rev:
1.2
date: 2019/11/19 13:30:10
- user: cg
- file: IteratorStream.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
This is a pseudo stream, which generates values by using an iterator action;
this is a block which is called to generate the value to read.
The block gets the index (1..) as argument.
[instance variables:]
[class variables:]
copyrightCOPYRIGHT (c) 2019 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
example|s|
s := IteratorStream on:[:i | i].
s next:10.
s next:10.
s := IteratorStream on:[:i | i*2].
s next:10.
instance creation
-
on: aBlock
-
accessing
-
atEnd
-
-
contentsSpecies
-
return a class of which instances will be returned, when
parts of the collection are asked for.
(see upTo-kind of methods in Stream)
-
contentsSpecies: aCollectionClass
-
-
iterator: aOneArgBlock
-
-
position
-
-
position: newPosition
-
initialization
-
initialize
-
(comment from inherited method)
just to ignore initialize to objects which do not need it
reading
-
next
-
return the next element from the stream by evaluating the nextBlock
|