版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、软件体系结构,软件体系结构,课程内容,2,软件体系结构样式(2),软件体系结构样式,概述,虚拟机到解释程序样式虚拟机(Virtual machitecture Styles虚拟机,5,问题,您认为JAVA最有吸引力的特征是什么?built-in networking、good performance、dynamic binding、security、automatic memory management、several dangerous feesimport Java . io . io exception;public class pipe private piped reader _;p
2、rivate piped writer _;public pipe()throws io exception writer _=new piped writer();reader _=new piped reader();/let this piped writer to be connected to the piped reader writer _。connect(reader _);管道,47,/writes char to the piped output stream public void write(intc)throows io exception writer _。写入(c
3、);/reads the next character of data from this piped stream public intread()throws io exception return reader _。read();public void close writer()throowio exception writer _。flush();Writer_。close();public void close reader()throws io exception reader _。close();过滤器、Abstract Class Filter、48、过滤器、49、publi
4、c Abstract Class Filter implements runnable protected pipe input _;protected Pipe output _;private boolean is _ started _=false;Public filter (pipe input,pipe output)input _=input;Output _=outputPublic void start() if(!is _ started _)is _ started _=true;Thread Thread=new Thread(this);thread . start(
5、);public void stop()is _ started _=false;滤镜、50、public void run()transform();/* * this method transforms the data from the input pipe and writes the * transformed data into output pipe。*/abstract protected void transform();过滤器,concrete class,51,kwic,52,in=new file input stream(file);Pipe in _ cs=new
6、Pipe();/create three objects of pipe pipe cs _ al=new pipe();/and one object of type pipe al _ ou=new pipe();/file inputstream input=new input(in,in _ cs);circular shifter=new circular shifter(in _ cs,cs _ al);alphabetizer alpha=new alphabetizer(cs _ al,al _ ou);Output Output=new Output(al _ ou);/ou
7、tput to screen input . start();shifter . start();阿尔法。start();output . start();解决方案1:管道和过滤器,优点:进程流高度直观支持过滤器易于修改的功能相互隔离新功能添加缺点:不支持交互系统例如:如果手动删除行,则空间复杂性高每个过滤器都必须将所有数据复制到输出,53,与其他方案比较:调用子程序,54,private ArrayList kwicListPublic kwic(字符串文件名)kwi clist=new ArrayList();k wiclist=read(filename);shift();/kwicLi
8、st sort()操作;/kwicList display()操作;/kwicList操作.解决方案2:面向对象的样式,55,解决方案2:面向对象的样式,采用OO的想法,对数据和数据进行的读写操作封装在object中,主程序调用这些object以形成控制过程。数据不再由组件直接共享,封装在对象内的每个对象都提供了一个接口,其他对象可以通过该接口调用对封装在该对象内的数据的操作(类图:主控制程序、输入对象、输出对象、排序对象、循环移动对象、行数据存储对象、解决方案2:面向对象的样式、line storage obbleAlphabetizer object负责对循环移位后获取的数据进行排序。58
9、,解决方案2:面向对象的样式,Output object在对输出进行排序后控制数据主控制对象(控制从其他对象调用方法的顺序,59,控制主控制程序,输入对象,输出对象,排序对象,Output object)解决方案2:面向对象的样式;解决方案2:面向对象的样式;构建主对象KWIC 5个对象实例line storage lines=new line storage();Input Input=new Input();circular shifter=new circular shifter();alphabetizer alphabetizer=new alphabetizer();Output Output=new Output();然后,它调用这五个对象实例的部分方法input.parse(file,lines)。shifter . setup(lines)
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年南宁市事业单位考试真题及答案
- 2025年下半年教师资格证《小学教育教学知识与能力》真题及答案
- 2026年湖北省黄冈市民营企业职称评审测试(电气)训练题及答案
- 2026年法考缔约过失责任题库(含答案)
- 2025年天津普法考试题目和答案
- 急症患者入院考核试题及答案解析
- 河南省2026年度一级造价工程师职业资格考试安装工程复习题库及答案
- 国际陆港可行性研究报告
- 费用和利润试题及参考答案
- 山东房产可行性研究报告
- 养老护理服务标准流程
- 护理急性胰腺炎课件
- 汽车标识管理办法
- 136号文深度解读及案例解析培训
- 马文蔚《大学物理学》
- 无人机科普教育
- 常用避孕方法及护理PART课件
- 关爱生命-急救与自救技能知到智慧树章节测试课后答案2024年秋上海交通大学医学院
- 全国驾驶员考试(科目一)考试题库下载1500道题(中英文对照版本)
- 刑事案件会见笔录(侦查阶段)
- 建筑工程机电安装系统调试方案
评论
0/150
提交评论