Filter

Origin: BMRSS 96
Reason: Perform composable transformations and computations on streams.
Synopsis: Define a composable interface common to all transformations and computations. Make implementations of the interface independent of their contexts.
Example: A class that counts the number of bytes and/or lines of a stream.
Solution:
Source There is both an interface and one or more concrete classes that abstract a stream that produces data. Has method to get data.
SourceFilter There is both an interface and one or more concrete classes that abstract filtering a Source. Has method to set the source and get data.
SinkFilter There is both an interface and one or more concrete classes that abstract filtering a Sink. Has method to set the sink and put data.
Sink There is both an interface and one or more concrete classes that abstract a stream that consumes data. Has method to put data.
See also: Decorator
Alternatives: Producer puts data to SinkFilter that puts data to Sink.
Consumer gets data from SourceFilter that gets data from Source.