ImageVerifierCode 换一换
格式:DOCX , 页数:15 ,大小:146.46KB ,
资源ID:11359750      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/11359750.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(管道风格kwiclxy.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

管道风格kwiclxy.docx

1、管道风格kwiclxyKWIC Implemented with Pipe Filter Architectural Style 采用管道过滤器体系结构风格实现KWIC关键词索引系统 KWIC Implemented with Pipe Filter Architectural Style. 2采用管道过滤器体系结构风格实现KWIC关键词索引系统. 21 Pipe Filter Systems in General. 21 一般而言的管道过滤器系统. 22 Architecture. 32 体系结构. 32.1 Pipes in KWIC system. 32.1 KWIC系统中的管道. 32

2、.2 Filters in KWIC System. 42.2 KWIC系统中的过滤器. 42.3 Pipeline in KWIC system. 52.3 KWIC系统中的传输途径. 53 Students Assignment . 63 学生作业. 63.1 Implement Shift Filter Mechanism . 63.1 循环移位机制实现. 63.2 Implement Line and Shift Transform Mechanism. 63.2 行与循环移位变换机制的实现. 63.3 Answer understanding questions . 73.3 回答理

3、解问题. 7KWIC Implemented with Pipe Filter Architectural Style采用管道过滤器体系结构风格实现KWIC关键词索引系统1 Pipe Filter Systems in General 1 一般而言的管道过滤器系统In a pipe and filter style each component has a set of input streams and a set of output streams. A component reads streams of data on its input streams, processes the

4、data and writes the resulting data on its output streams. Hence components are termed filters. The connectors of this style merge the streams together, i.e., they transmit outputs of one filter to inputs of another filter. Hence the connectors are termed pipes. 在管道和过滤器风格,每个组件有一个输入流和输出流。一个组件从输入流读取数据流

5、,然后处理数据,并向输出流写入结果数据。因此组件被称为过滤器。这种风格的连接器把流合并一起,即,他们发送一个过滤器的输出到另一过滤器的输入。因连接器此被称为管道。 Figure 1: Pipe-filters topology in a general pipe-filter systemAmong the important invariants of the style is the condition that filters must be independent entities: in particular, they should not share state with oth

6、er filters. Another important invariant is that filters do not know the identity of their upstream and downstream filters. Thus, filters may not identify the components on the ends of their pipes. 图1:管道过滤器系统的一般管道过滤器拓扑结构在这种风格中最重要的不变量就是过滤器必须是独立的实体:特别是,他们不应该与其他过滤器共享状态。另一个重要的不变量是过滤器不知道上游和下游的过滤器的识别方式。因此,

7、过滤器可能无法识别的管道两端的组件。Common specializations of this style include pipelines (see figure below), which restrict the topologies to linear sequences of filters; bounded pipes, which restrict the amount of data that can reside on a pipe; and typed pipes, which require that the data passed between two filte

8、rs have a well-defined type. 这种风格常见的特点包括管道(见下图),这限制了过滤器线性序列的拓扑;有界管道,这限制了可以驻留在一个管的数据的数量;和输入管,这要求通过两过滤器之间的数据有一个明确的类型。Figure 2: Pipeline topology in a specific pipe-filter systemThe best-known examples of pipe and filter architectures are programs written in the UNIX shell. UNIX supports this style by

9、providing a notation for connecting components (represented as UNIX processes) and by providing run-time mechanisms for implementing pipes. 图2:一个具体管道过滤器系统的管道拓扑最有名管道和过滤器的结构的例子是用UNIX操作系统编写的程序。UNIX支持这种风格提供了一个连接组件的符号(代表操作过程)并为实现管道提供运行时机制。2 Architecture Pipe and Filter KWIC system is composed of the foll

10、owing components: Input filter, which reads the content of a KWIC input file, parses it, and writes the parsed lines to its output stream. 2架构管道和过滤器的关键词检索系统由以下部件组成:输入过滤器,它读取关键词索引输入文件的内容,分析它,并将分析到的内容写到其输出流。 CircularShifter filter connected with a pipe to the output stream of Input filter. Thus, the l

11、ines produced by Input filter serve as input for CircularShifter filter. CircularShifter processes the input lines producing circular shifts of those lines. The produced shifts are written to the CircularShifters output stream. circularshifter过滤器通过管道连接输出流到输入流过滤器。因此,这些行通过为circularshifter过滤器输入服务的输入流产生

12、。Circularshifter对这些行的处理就产生了这些行的循环移位行。所产生的循环移位行是写入到输出circularshifter。 Alphabetizer filter connected with a pipe to the output stream of CircularShifter filter. Thus, circular shifts produced by CircularShifter serve as input for Alphabetizer. Alphabetizer sorts these shifts alphabetically and writes

13、them to its output stream. Alphabetizer filter(按字母顺序排列过滤器)通过管道连接到circularshifter过滤器的输出流。因此由circularshifter产生的循环移位行作为Alphabetizer filter的输入。Alphabetizer filter把这些循环移位行按字母顺序排序并写入到输出流 Output filter connected with a pipe to the output stream of Alphabetizer. Thus, Output reads sorted shifts from its inp

14、ut stream and writes them to the standard output. 输出过滤器通过管道连接到Alphabetizer流的输出。因此,Output从输入流读取排好序的行并写入到标准输出。 Master Control, which manages filter and pipe mechanism, by creating a pipeline of the above described filters. 主控制,通过建立以上所述的过滤器的管道序列,管理过滤器和管道机制。Figure 3: Pipeline in KWIC system2.1 Pipes in

15、KWIC system Pipes in the KWIC system are represented as instances of the Pipe class. An instance of the Pipe class is a composition of two streams: an input and an output stream. Pipe class connects these two streams in the following way. The data that is written to the input stream is transmitted t

16、o the output stream. In this way these data become available for reading from the output stream. 图3:关键词检索系统中的管道2.1个管道关键词检索系统管道在关键词检索系统的表示为管道类的实例。管道的实例类是一个两个流的组合:一个输入和输出流。管类连接这些流的方式如下。写入到输入流的数据被传输到输出流。这样,这些数据可用于被从输出流读取。The Pipe class encapsulates the input and output streams as its private instance v

17、ariables and provide just a simple public interface for writing and reading data to a pipe object. Thus, clients simply write some data to a pipe object by calling its write method. This data becomes then available for other clients, which can call the read method of the pipe object to retrieve the

18、data. 管道类封装输入、输出流是通过作为它的私有的实例变量并且仅仅提供一个向管道读取数据的一个公共接口,因此,用户在向一个管道对象写数据的时候只需要通过调用它的写方法,然后这些数据变得可以被其他客户可用,这些客户可以通过调用管道对象的读方法来检索数据。Figure 4: Pipe class diagramThere are few important properties of pipe objects: Pipe objects limit the amount of data they can hold. However, whenever clients read the data

19、 from a pipe, this data is considered consumed and the space that was occupied by the retrieved data is made free again. 图4:管类图管道对象有几个重要的性能:管对象限制可以承受的数据量。然而,当客户端从一个管读取数据,这一数据被认为是“消费的”和被检索到的数据所占去的空间就被释放了。 Pipe objects are synchronized. This has two major consequences. Firstly, there can be only one t

20、hread working with a pipe object at a specific moment, i.e, there can be only one thread currently writing or reading the data from a pipe object. Secondly, threads reading from an empty pipe or writing to a full pipe are blocked as long as there are not some data to read from the pipe, or there is

21、no free space in the pipe to write the data. Thus, a pipe object may be seen as a typical shared synchronized data structure for producer/consumer multi-thread scenarios. Thus, a pipe object is always shared between a producer and a consumer thread, where the producer thread writes some data to the

22、pipe, and the consumer thread consumes that data from the pipe. 管对象是同步的。这两家主要的后果。首先,只能有一个线程在一个特定的时刻通过一个管道对象工作,即,只能有一个线程正在从一个管道对象读或写数据。其次,从一个空的管道读或向一个满的管道写就会受阻,只要管道没有数据可读或没有空间可写,就会阻塞。因此,一管对象可被视为一个典型的共享数据结构的生产者/消费者多线程情况。因此,一管对象始终是被生产者和消费者线程共享,在这里在生产者线程写入一些数据到管道,消费者线程从数据管“消费”数据。2.2 Filters in KWIC Syst

23、em Filters in the KWIC system are represented by an abstract class named Filter. An instance of Filter class is composed of: 2.2 关键词检索系统的过滤器关键词检索系统的过滤器是由一个抽象类命名的过滤器。过滤器类的实例组成是: Input pipe object, from which the filter object reads the data Output pipe object, to which the filter object writes the pr

24、ocessed data Thread of control. Each filter object runs in its own thread and is independent of any other filters in the system, i.e., it does not share state with other filters in the system. 输入管对象,从该过滤器对象读取数据输出管对象,该过滤器对象写入处理过的数据线程控制。每个过滤器对象运行在它自己的线程,独立于系统中任何其他过滤器,即,在系统中它与其他过滤器不共享状态。Figure 5: Filte

25、r class diagramThe current implementation of the Filter class provides already the basic filter functionality. Thus, clients start the execution of the filter object by invoking its start method. In turn, this method starts the control thread, which consecutively invokes the filters transform method

26、. 图5:过滤类图当前实现的过滤器类已经提供了基本过滤器功能。因此,客户通过调用其start方法开始执行的过滤器对象。反过来,这种方法启动了控制线程,(控制线程)连续调用过滤器的转换方法。In the current implementation the transform method is an abstract method, which means that subclasses of Filter class should provide a particular implementation for that specific filter object. For example,

27、 CircularShifter filter implements transform method in the following way. The lines retrieved from the input pipe are processed and circular shifts of those lines are made. Thereafter the produced shifts are written to the output pipe. Speaking more generally, subclasses of Filter class implement their transform methods in the following way: the data is retrieved from the input pipe, transformed (processed) and written out to the output pipe. 在当前的实现中transform method(转换方法)是一个抽象方法,即过滤器

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1