µ±Ç°Î»ÖãºÊ×Ò³ > assignment4-pf-ÎÊÌâ½â´ð
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Îļþ
³ÌÐòÔËÐнá¹û½ØÍ¼
¹²·ÖÏí92ƪÏà¹ØÎĵµ