|
Class: SelectingReadStream
Object
|
+--Stream
|
+--SelectingReadStream
- Package:
- stx:libbasic2
- Category:
- Streams-Misc
- Version:
- rev:
1.5
date: 2014/04/30 18:20:55
- user: cg
- file: SelectingReadStream.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
A stream which only delivers elements for which a select block returns true
from an underlying stream.
Needs readAhead for proper atEnd handling.
[instance variables:]
hasReadAhead - because nil is a valid read-element,
this is used to know if readAhead is valid.
copyrightCOPYRIGHT (c) 2009 by eXept Software AG
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.
instance creation
-
on: aStream selecting: aBlock
-
instance creation
-
on: aStream selecting: aBlock
-
queries
-
atEnd
-
(comment from inherited method)
return true if the end of the stream has been reached;
- we do not know here how to do it, it must be redefined in subclass
-
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)
reading
-
next
-
(comment from inherited method)
return the next element of the stream
- we do not know here how to do it, it must be redefined in subclass
|s|
s := SelectingReadStream
on:#(1 2 3 4 5 6 7 8) readStream
selecting:[:each | each even].
s upToEnd
|