您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 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
本文标题:Homework-4.1-1-Iterator-pattern
链接地址:https://www.777doc.com/doc-7853306 .html