Homework-4.1-1-Iterator-pattern

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

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

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

资源描述

哈尔滨工业大学(威海)实验报告用纸第1页ReportofSoftwareArchitectureHomework4.1-1:IteratorpatternBasicinformationTeamname:_______________________________Classnumber:__________________________Department/school:Teammemberswithstudentnumbers:_______________________Instructor’scommentsandscorecomments:score:signatureoftheinstructor:Yearmonthdate哈尔滨工业大学(威海)实验报告用纸第页作业要求:1)runtheprogrambeforeyougoanyfurthertoseehowitworks2)Intheexample10.1inchapter10,twoiteratorsOddNumIteratorandCircularIteratorthattraverseaMatrixaredesignedandimplemented.Theclassdiagramisasbelow.NowyouarerequiredtoaddanotheriteratornamedDiagonalIterator.javatotraversethematrixdiagonally.Forexample,forthematrixbelow,01020304051112131415212223242531323334354142434445thetraverseresultshouldbeasbelow01021103122104132231051423324115243342253443354445Inthegraphicaluserinterfaceclass,addnecessarycodetomakethe“traversediagonally”anoptionforuserstoselectandaddsomecodeinthebuttonlistenertomaketheprogramworkwhentheuserschoosethenewfunctionality“traversediagonally”.SearchGUIinterfaceAggregate+createOddNumIterator()+createCircularIterator()Matrix+getMatrixData()+createOddNumIterator()+createCircularIterator()interfaceNumberIterator+booleanhasNext()+next()+remove()+getNumOfItems()OddNumIterator+booleanhasNext()+next()+remove()+getNumOfItems()CircularIterator+booleanhasNext()+next()+remove()+getNumOfItems()哈尔滨工业大学(威海)实验报告用纸第1页1.Whatclasseshavebeenaddedtotheexistingclasshierarchy?DiagonalIterator.java2.Drawyournewclassdiagram3.Whenyouaddthenewclass,whatexistingclasseshavebeenmodifiedandwhatclassesremainunchanged?Specifythem.Aggregate.java:改变哈尔滨工业大学(威海)实验报告用纸第页Matrix.java:改变SearchGUI.java:改变CircularIterator.java,EvenNumlterator.java,NumberIterator.java,OddNumIterator.java:不变哈尔滨工业大学(威海)实验报告用纸第1页4.Whenauserchoosesfunctionality“traversediagonally”,whatmethodshavebeencalledsequentially?Listthemincorrectorder.先是SearchGUI的各个方法然后就是matrix的createDiagonalitator,Diagonalitator的Diagonalitator5.Typicalinputandoutputfromrunningyourprogram

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

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

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

×
保存成功