Homework-4.3-1--Command-Pattern

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

哈尔滨工业大学(威海)实验报告用纸第1页ReportofSoftwareArchitectureHomework4.3-1:CommandPatternBasicinformationTeamname:_______________________________Classnumber:___________________________Department/school:Teammemberswithstudentnumbers:_______________________Instructor’scommentsandscorecomments:score:signatureoftheinstructor:Yearmonthdate(威海)哈尔滨工业大学(威海)实验报告用纸第页Homeworkdescriptions:Seethediagrambelowforexample11.2designedbyusingtheCommandpattern.Runthesourcecodebeforeyoudoanything.Homeworkrequirement:ifyourteamleaderasksyoutocanceltheInvokerclassfromtheclassdiagramintheabovedesignandmergesitintotheClientUIclassandyouarenotallowedtochangeanyoftheotherclasses.Allthefunctionalitiesshouldbethesameastheoriginalsoftware.Youpleaseredesigntheprogramandimplementyournewdesign.Hint:ConsiderputtingtheInvokerclassintoClientUIasaninnerclass.interfaceCommandexecute()Invoker+callCommand()调用者类ClientUIcreatesusesGFan+startRotate()+stopRotate()usescreatesGWindow+open()+close()FanOnCmdexecute()FanOffCmdexecute()WindowOpenCmdexecute()WindowCloseCmdexecute()哈尔滨工业大学(威海)实验报告用纸第1页ReportPart.1.Drawyournewdesignclassdiagram2.Describeyournewdesign:a)Whatclasseshavebeencanceledfromtheexistingclasshierarchy?Invoker.java被取消了b)WhatpartoftheClientUIclasshasbeenchanged?clientUI中增添了内部类Invoker.javainterfaceCommandexecute()Invoker+callCommand()调用者类ClientUIcreatesusesGFan+startRotate()+stopRotate()usescreatesGWindow+open()+close()FanOnCmdexecute()FanOffCmdexecute()WindowOpenCmdexecute()WindowCloseCmdexecute()哈尔滨工业大学(威海)实验报告用纸第页3.Ifauserclickonthebutton“StartFan”,whatmethodsinthisprogramhavebeencalled?Listthemincorrectorder.先调用ClientUI.java中的setUpChoicePanel()方法,然后调用监听器的actionPerformed()方法,然后是Invoker的Invoker()方法,最后是FanOnCmd类的execute()方法。4.Typicalinputandoutputfromrunningyourprogram

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功