KWIC Implemented with Pipe and Filter Architectural
Style (Assignment 4)
1.
Questions
1. In both modifications of the current system you needed to extend the
functionality of the system. Which modules from the original KWIC system did you need to modify to implement the new functionality in both cases? Does this mean that the pipe and filter KWIC system is robust to design changes in the functionality of the system? Is the same true for any pipe and filter system?
解答:在两种情况下都只需修改原系统中的KWIC模块,即调度控
制模块。这意味着管道过滤器风格的KWIC系统是十分健壮的。但这并不一定适用于所有采用管道过滤器风格的系统。
2. Filters in pipe and filter systems are completely independent entities. Thus,
filters:
a. Do not share state (data) with other filters.
b. Do not know the identity of neighbor filters in the pipeline.
c. Process their data concurrently and incrementally, i.e., they do not
wait for other filters to start or finish their jobs.
Would it be possible to implement an interactive version of the KWIC system, which will allow users to delete certain lines from the data flow but still not violate any of the above defined filter properties?
解答:由于无法获知其它过滤器的状态以及流通与管道中的数据,因
此无法实现交互式的KWIC系统,若想删除特定行,可增加一个用于删除的过滤器。
3. Normally, filters in pipe and filter systems work as follows. They read data
from the input pipe, transform it and write it to the output pipe. Usually, this involves copying of data from the input to the output pipe. If the number of filters in a pipeline of a complex pipe and filter system is large then there is a lot of in-memory data copying. How this may affect the overall system performance?
解答:当有大量管道与过滤器存在时,由于有大量的数据拷贝会消耗
大量内存,这会严重影响系统性能,使系统处理数据的能力降低。
2.KWIC (Pipe and Filter)修改
一、 整体分析
管道过滤器风格的KWIC系统包含KWIC、Pipe、ShiftFilter、Input、Output、LineTransformer、CircularShifter、Alphabetizer几大模块。
其中Input、Output、LineTransformer、CircularShifter、Alphabetizer均为继承自抽象类Filter的过滤器。
调整各类输入、输出流之后,系统结构如下:
Inputin_csCircularShiftercs_sfShiftFiltersf_alOutput
lt_opLineTransformeral_ltAlphabetizer
二、运行结果截图:
1)noise.txt文件截图
Figure 1 noise.txt文件
line.txt文件截图
Figure 2 line.txt文件
程序运行结果截图
相关推荐: