中南軟件配置管理實(shí)驗(yàn)二_第1頁(yè)
中南軟件配置管理實(shí)驗(yàn)二_第2頁(yè)
中南軟件配置管理實(shí)驗(yàn)二_第3頁(yè)
中南軟件配置管理實(shí)驗(yàn)二_第4頁(yè)
中南軟件配置管理實(shí)驗(yàn)二_第5頁(yè)
已閱讀5頁(yè),還剩26頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、軟件配置管理實(shí)驗(yàn)報(bào)告項(xiàng)目名稱 代碼味道及重構(gòu)試驗(yàn) 專業(yè)班級(jí) 學(xué) 號(hào) 姓 名 實(shí)驗(yàn)成績(jī):批閱教師:2016年 04月 20日實(shí)驗(yàn)二 代碼味道及重構(gòu)實(shí)驗(yàn)實(shí)驗(yàn)學(xué)時(shí): 4 每組人數(shù): 1 實(shí)驗(yàn)類型: 2 (1:基礎(chǔ)性 2:綜合性 3:設(shè)計(jì)性 4:研究性)實(shí)驗(yàn)要求: 1 (1:必修 2:選修 3:其它)實(shí)驗(yàn)類別: 3 (1:基礎(chǔ) 2:專業(yè)基礎(chǔ) 3:專業(yè) 4:其它)一、實(shí)驗(yàn)?zāi)康?. 熟悉常見代碼味道的涵義和特征;2. 熟悉常用的代碼重構(gòu)手段;3. 學(xué)會(huì)使用常用重構(gòu)手段對(duì)常見代碼味道進(jìn)行重構(gòu);4. 學(xué)會(huì)使用常用設(shè)計(jì)模式來(lái)對(duì)代碼進(jìn)行重構(gòu);5. 掌握一種代碼味道識(shí)別工具(CSDT);6. 熟悉Eclipse重構(gòu)

2、菜單;7. 學(xué)會(huì)使用Eclipse AST來(lái)解析Java源代碼;8. 設(shè)計(jì)并實(shí)現(xiàn)一種代碼味道的自動(dòng)識(shí)別方法;9*. 設(shè)計(jì)并實(shí)現(xiàn)一種代碼味道的自動(dòng)重構(gòu)方法。二、實(shí)驗(yàn)內(nèi)容1. 根據(jù)常見代碼味道的特點(diǎn),選取合適的重構(gòu)手段對(duì)它們進(jìn)行重構(gòu),填寫相應(yīng)的表格;2. 選取三種設(shè)計(jì)模式,分析這些設(shè)計(jì)模式可以消除的代碼味道以及在重構(gòu)到設(shè)計(jì)模式的過(guò)程中所使用的重構(gòu)手段,填寫相應(yīng)的表格;3. 掌握一款代碼味道識(shí)別工具,并使用該工具對(duì)至少一個(gè)實(shí)驗(yàn)項(xiàng)目進(jìn)行代碼味道識(shí)別,尋找存在代碼味道的類和代碼片段;【參考資料:七款代碼味道識(shí)別工具4. 學(xué)習(xí)使用Eclipse重構(gòu)(Refactor)菜單,從實(shí)驗(yàn)項(xiàng)目中選取合適的代碼進(jìn)行重

3、構(gòu)操作;5. 自學(xué)Eclipse AST,包括獲取、訪問(wèn)、創(chuàng)建和修改AST等操作,使用Eclipse AST設(shè)計(jì)并實(shí)現(xiàn)一個(gè)類信息統(tǒng)計(jì)小程序;【Eclipse AST學(xué)習(xí)資料: 】6. 選取一種代碼味道,設(shè)計(jì)并實(shí)現(xiàn)相應(yīng)的代碼味道識(shí)別方法,選取至少一個(gè)實(shí)驗(yàn)項(xiàng)目進(jìn)行測(cè)試;7*(選做). 結(jié)合Eclipse AST,選取一種代碼味道,設(shè)計(jì)并實(shí)現(xiàn)一種代碼味道的自動(dòng)重構(gòu)方法,至少提供兩個(gè)重構(gòu)測(cè)試用例,并對(duì)重構(gòu)前后的代碼進(jìn)行分析。補(bǔ)充:實(shí)驗(yàn)素材及相關(guān)資料(1) Eclipse AST所需jar包下載地址:(2) ASTView下載地址:(3) 5個(gè)實(shí)驗(yàn)項(xiàng)目下載地址:(4) 10個(gè)補(bǔ)充實(shí)驗(yàn)項(xiàng)目下載地址:三、實(shí)

4、驗(yàn)要求1. 針對(duì)常見的代碼味道,選擇合適的重構(gòu)手段,填寫相應(yīng)的表格,要求表格需填寫完整;2. 選取三種常用的設(shè)計(jì)模式,分析這些設(shè)計(jì)模式可以消除的代碼味道以及在重構(gòu)到設(shè)計(jì)模式的過(guò)程中所使用的重構(gòu)手段,填寫相應(yīng)的表格,要求表格需填寫完整;3. 選取一款代碼味道識(shí)別工具,記錄對(duì)實(shí)驗(yàn)項(xiàng)目的代碼味道識(shí)別結(jié)果,包括識(shí)別到的類名和代碼片段;4. 使用Eclipse重構(gòu)(Refactor)菜單對(duì)實(shí)驗(yàn)項(xiàng)目中的代碼進(jìn)行重構(gòu)(自行選取合適的代碼),要求提供重構(gòu)前后的代碼【至少需使用10種重構(gòu)手段】;5. 學(xué)習(xí)Eclipse AST,要求通過(guò)Eclipse AST設(shè)計(jì)一個(gè)類信息統(tǒng)計(jì)小程序,可以統(tǒng)計(jì)一個(gè)類中方法的個(gè)數(shù)、

5、屬性的個(gè)數(shù)、源代碼行數(shù)、代碼行最多的方法名以及代碼行數(shù)、參數(shù)個(gè)數(shù)最多的方法名及其參數(shù)的個(gè)數(shù)等信息;6. 針對(duì)一種代碼味道,設(shè)計(jì)并實(shí)現(xiàn)相應(yīng)的識(shí)別方法,要求對(duì)方法原理進(jìn)行說(shuō)明,需提供文字介紹(可包含流程圖)、核心代碼以及相應(yīng)的測(cè)試結(jié)果和分析;7*(選做). 針對(duì)一種代碼味道,設(shè)計(jì)并實(shí)現(xiàn)相應(yīng)的重構(gòu)方法,要求對(duì)重構(gòu)流程進(jìn)行說(shuō)明,需提供文字介紹(可包含流程圖)、核心代碼以及相應(yīng)的測(cè)試結(jié)果和分析。四、實(shí)驗(yàn)步驟1. 填寫代碼味道和重構(gòu)手段表格;2. 填寫設(shè)計(jì)模式、代碼味道和重構(gòu)手段表格;3. 選取一種代碼味道識(shí)別工具,對(duì)常見代碼味道進(jìn)行識(shí)別,記錄識(shí)別結(jié)果;4. 學(xué)習(xí)使用Eclipse Refactor菜單,

6、熟悉至少10種常用的重構(gòu)操作;5. 學(xué)習(xí)Eclipse AST,使用AST設(shè)計(jì)并實(shí)現(xiàn)一個(gè)類信息統(tǒng)計(jì)小程序;6. 設(shè)計(jì)并實(shí)現(xiàn)一種代碼味道識(shí)別方法,對(duì)已有項(xiàng)目進(jìn)行測(cè)試,記錄與分析實(shí)驗(yàn)結(jié)果;7*(選做). 設(shè)計(jì)并實(shí)現(xiàn)一種代碼味道重構(gòu)方法,對(duì)測(cè)試用例進(jìn)行實(shí)驗(yàn),記錄與分析實(shí)驗(yàn)結(jié)果。五、實(shí)驗(yàn)結(jié)果1. 針對(duì)22種常見的代碼味道,選擇合適的重構(gòu)手段,填寫如下表格:代碼味道名稱常用重構(gòu)手段過(guò)長(zhǎng)方法(Long Method)抽取函數(shù)(Extract Method)以查詢?nèi)〈R時(shí)變量(Replace Temp With Query)引入?yún)?shù)對(duì)象(Introduce Parameter Object)保持對(duì)象完整(P

7、reserve Whole Object)以函數(shù)對(duì)象取代函數(shù)(Replace Method with Method Object)分解條件表達(dá)式(Decompose Conditional)過(guò)大類(Large Class)提煉類(Extract Class)提煉子類(Extract Subclass)提煉接口(Extract Interface)復(fù)制“被監(jiān)視數(shù)據(jù)”(Duplicate Observed Data)過(guò)長(zhǎng)參數(shù)列(Long Parameter List)以函數(shù)取代參數(shù)(Replace Parameter with Method)引入?yún)?shù)對(duì)象(Introduce Parameter O

8、bject)保持對(duì)象完整(Preserve Whole Object)過(guò)多的注釋(Comments)提煉函數(shù)(Extract Method)函數(shù)改名(Rename Method)引入斷言(Introduce Assertion)夸夸其談的未來(lái)性(Speculative Generality)折疊繼承體系(Collapse Hierarchy)將類內(nèi)聯(lián)化(Inline Class)移除參數(shù)(Remove Parameter)函數(shù)改名(Rename Method)內(nèi)聯(lián)函數(shù)(Inline Method)移除函數(shù)(Remove Method)重復(fù)代碼(Duplicated Code)提煉函數(shù)(Extr

9、act Method)函數(shù)上移(Pull Up Method)塑造模板函數(shù)(Form Template Method)提煉類(Extract Class)異曲同工的類(Alternative Classes with Different Interfaces)函數(shù)改名(Rename Method)搬移函數(shù)(Move Method)提煉超類(Extract Superclass)Switch驚悚現(xiàn)身(Switch Statement)提煉函數(shù)(Extract Method)、搬移函數(shù)(Move Method)、以多態(tài)取代條件表達(dá)式(Replace Conditional with Polymor

10、phism)、以子類取代類型碼(Replace Type Code with Subclass)、以State/Strategy取代類型碼(Replace Type Code with State/Strategy)以明確函數(shù)取代參數(shù)(Replace Parameter with Explicit Methods)引入Null對(duì)象(Introduce Null Object)基本類型偏執(zhí)(Primitive Obsession)以對(duì)象取代數(shù)據(jù)值(Replace Data Value with Object)以類取代類型碼(Replace Type Code with Class)以子類取代類型

11、碼( Replace Type Code with Subclass)、以State/Strategy取代類型碼 (Replace Type Code with State/Strategy)提煉函數(shù)(Extract Class)引入?yún)?shù)對(duì)象(Introduce Parameter Object)以對(duì)象取代數(shù)組(Replace Array with Object) 純稚的數(shù)據(jù)類(Data Class) 封裝字段(Encapsulate Field)封裝集合(Encapsulate Collection)移除設(shè)值函數(shù)(Remove Setting Method)搬移函數(shù)(Move Method)

12、提煉函數(shù)(Extract Method)隱藏函數(shù)(Hide Method)數(shù)據(jù)泥團(tuán)(Data Clumps)提煉類(Extract Class)引入?yún)?shù)對(duì)象(Introduce Parameter Object)、保持對(duì)象完整(Preserve Whole Object)令人迷惑的暫時(shí)字段(Temporary Field)提煉類(Extract Class)引入Null對(duì)象(Introduce Null Object)被拒絕的遺贈(zèng)(Refused Bequest)提煉子類(Extract Subclass)、函數(shù)下移(Push Down Method)、字段下移(Push Down Field

13、)以委托取代繼承(Replace Inheritance with Delegation)狎昵關(guān)系(Inappropriate Intimacy)搬移函數(shù)(Move Method)、搬移字段(Move Field)、將雙向關(guān)聯(lián)改為單向關(guān)聯(lián)(Change Bidirectional Association to Unidirectional)提煉類(Extract Class)、隱藏“委托關(guān)系”(Hide Delegate )以委托取代繼承(Replace Inheritance with Delegation)冗贅類(Lazy Class)將類內(nèi)聯(lián)化(Inline Class)折疊繼承體系(C

14、ollapse Hierarchy)依戀情結(jié)(Feature Envy)搬移函數(shù)(Move Method)、搬移字段(Move Field)提煉函數(shù)(Extract Method)、搬移函數(shù)(Move Method)判斷哪個(gè)類擁有最多被此函數(shù)使用的數(shù)據(jù),然后就把這個(gè)函數(shù)和那些數(shù)據(jù)放在一起 過(guò)度耦合的消息鏈(Message Chains)隱藏“委托關(guān)系”(Hide Delegate)中間人(Middle Man)移除中間人(Remove Middle Man)內(nèi)聯(lián)函數(shù)(Inline Method)以繼承取代委托(Replace Delegation with Inheritance)發(fā)散式變化(

15、Divergent Change)提煉類(Extract Class)霰彈式修改(Shotgun Surgery)搬移函數(shù)(Move Method)、搬移字段(Move Field)將類內(nèi)聯(lián)化(Inline Class)平行繼承體系(Parallel Inheritance Hierarchies)不完美的庫(kù)類(Incomplete Library Class)搬移函數(shù)(Move Method)、搬移字段(Move Field)引入外加函數(shù)(Introduce Foreign Method)引入本地?cái)U(kuò)展(Introduce Local Extension)2. 選取三種常用的設(shè)計(jì)模式,分析這些

16、設(shè)計(jì)模式可以消除的代碼味道以及在重構(gòu)到設(shè)計(jì)模式的過(guò)程中所使用的重構(gòu)手段,填寫如下表格:設(shè)計(jì)模式可消除代碼味道重構(gòu)手段模板方法模式重復(fù)代碼抽取函數(shù)(Extract Method) 橋接模式發(fā)散式變化提煉類(Extract Class)策略模式Switch驚悚現(xiàn)身提煉函數(shù)(Extract Method)、搬移函數(shù)(Move Method)、以多態(tài)取代條件表達(dá)式(Replace Conditional with Polymorphism)、以子類取代類型碼(Replace Type Code with Subclass)、以State/Strategy取代類型碼(Replace Type Code

17、with State/Strategy)以明確函數(shù)取代參數(shù)(Replace Parameter with Explicit Methods)引入Null對(duì)象(Introduce Null Object)3. 選取一款代碼味道識(shí)別工具和實(shí)驗(yàn)項(xiàng)目進(jìn)行代碼味道識(shí)別實(shí)驗(yàn),記錄如下信息:(1) 代碼味道檢測(cè)工具名稱:checkStyle(2) 實(shí)驗(yàn)項(xiàng)目名稱【至少1個(gè)】:(3) 實(shí)驗(yàn)結(jié)果:代碼味道名稱代碼味道數(shù)量代碼味道實(shí)例【類名或者代碼片段,如果存在該代碼味道的話至少需提供1個(gè)實(shí)例】過(guò)長(zhǎng)參數(shù)列表10java.awt.Graphics public Boolean drawImage (Image ima

18、ge, int x1Dest, int y1Dest, int x2Dest, int y2Dest, int x1Source, int y1Source, int x2Source, int y2Source, Color color, ImageObserver obs)過(guò)大類5javax.swing.JTable過(guò)多的注釋3/ 啟動(dòng)聊天頁(yè)面信息刷新線程Thread thread = new Thread(this);thread.start();/ Icon log=new ImageIcon("imageschat.jpg");/ lblBack = new JL

19、abel(log);/ lblBack.setBounds(1, 1, 600,420);/ pnlChat.add(lblBack);/*scrnsize = toolkit.getScreenSize();frmChat.setLocation(scrnsize.width / 2 - frmChat.getWidth() / 2,scrnsize.height / 2 - frmChat.getHeight() / 2);*/Image img = toolkit.getImage("appico.jpg");frmChat.setIconImage(img);4.

20、使用Eclipse Refactor菜單,掌握一些常用的重構(gòu)操作,并在實(shí)驗(yàn)項(xiàng)目中選取合適的代碼實(shí)施重構(gòu),填寫如下表格:重構(gòu)名稱重構(gòu)之前代碼重構(gòu)之后代碼Renameimport java.util.Scanner;public class shuzifanzhuan public static void main(String args)Scanner input = new Scanner(System.in);int a = input.nextInt();int b = input.nextInt();int resultA=0;int resultB=0;while(a>10)re

21、sultA = resultA*10+a%10;a=a/10;resultA = resultA*10+a%10;while(b>10)resultB = resultB*10+b%10;b=b/10;resultB = resultB*10+b%10;System.out.println(resultA+resultB);import java.util.Scanner;public class digitalFlip public static void main(String args)Scanner input = new Scanner(System.in);int a = i

22、nput.nextInt();int b = input.nextInt();int resultA=0;int resultB=0;while(a>10)resultA = resultA*10+a%10;a=a/10;resultA = resultA*10+a%10;while(b>10)resultB = resultB*10+b%10;b=b/10;resultB = resultB*10+b%10;System.out.println(resultA+resultB);Movepackage movingfeature.movemethod;/* * * author

23、lenovo * move field: * 1. for field _interestRate, Encapsulate Field * 2. copy "private double _interestRate;" and " get/set _interestRate" into class AccountType * 3. rewrite get/set _interestRate to delegate to class AccountType * 4. for get/set _interestRate, Inline * 5. remov

24、e field _interestRate * * move method: * 1. for method interestForAmount_days(), Move method * 2. for method overdraftCharge(), for field _daysOverdrawn, Extract local Variable * 3. for field _daysOverdrawn in method overdraftCharge(), Introduce Parameters * 4. delete "final int daysOverdrawn =

25、 daysOverdrawn;" then Move method */public class Account double overdraftCharge() if (_type.isPremium() double result = 10;if (_daysOverdrawn > 7)result += (_daysOverdrawn - 7) * 0.85;return result; elsereturn _daysOverdrawn * 1.75;double bankCharge() double result = 4.5;if (_daysOverdrawn &

26、gt; 0)result += overdraftCharge();return result;double interestForAmount_days(double amount, int days) return _interestRate * amount * days / 365;private double _interestRate;private AccountType _type;private int _daysOverdrawn;class AccountType public boolean isPremium() return false;package moving

27、feature.movemethod;/* * * author lenovo * move field: * 1. for field _interestRate, Encapsulate Field * 2. copy "private double _interestRate;" and " get/set _interestRate" into class AccountType * 3. rewrite get/set _interestRate to delegate to class AccountType * 4. for get/set

28、 _interestRate, Inline * 5. remove field _interestRate * * move method: * 1. for method interestForAmount_days(), Move method * 2. for method overdraftCharge(), for field _daysOverdrawn, Extract local Variable * 3. for field _daysOverdrawn in method overdraftCharge(), Introduce Parameters * 4. delet

29、e "final int daysOverdrawn = daysOverdrawn;" then Move method */public class Account double bankCharge() double result = 4.5;if (_daysOverdrawn > 0)result += _type.overdraftCharge(_daysOverdrawn);return result;private AccountType _type;private int _daysOverdrawn;package movingfeature.mo

30、vemethod;class AccountType public boolean isPremium() return false;public double get_interestRate() return _interestRate;double interestForAmount_days(double amount, int days) return get_interestRate() * amount * days / 365;double overdraftCharge(int daysOverdrawn) if (isPremium() double result = 10

31、;if (daysOverdrawn > 7)result += (daysOverdrawn - 7) * 0.85;return result; elsereturn daysOverdrawn * 1.75;private double _interestRate;Extract super classpackage generation.extractsuperclass;import java.util.Enumeration;import java.util.Vector;public class Department public Department(String nam

32、e) _name = name;public int getTotalAnnualCost() Enumeration e = getStaff();int result = 0;while (e.hasMoreElements() Employee each = (Employee) e.nextElement();result += each.getAnnualCost();return result;public int getHeadCount() return _staff.size();public Enumeration getStaff() return _staff.elem

33、ents();public void addStaff(Employee arg) _staff.addElement(arg);public String getName() return _name;private String _name;private Vector _staff = new Vector();package generation.extractsuperclass;public class Employee public Employee(String name, String id, int annualCost) _name = name;_id = id;_an

34、nualCost = annualCost;public int getAnnualCost() return _annualCost;public String getId() return _id;public String getName() return _name;private String _name;private int _annualCost;private String _id;package generation.extractsuperclass;import java.util.Enumeration;import java.util.Vector;/* * * a

35、uthor yaoyufei * 1. compare with Employee, getName, getCost could be extracted to superclass * 2. Extract Superclass _name, getName * here, eclipse has a bug. You may need to add "extends Party" manually. * adjust constructor * 3. Rename getTotalAnnualCost to getAnnualCost * Pull up getAnn

36、ualCost * 4. More better, refactor to composite design pattern. (I won't do it here) */public class Department extends Partypublic Department(String name) super(name);Overridepublic int getAnnualCost() Enumeration e = getStaff();int result = 0;while (e.hasMoreElements() Employee each = (Employee

37、) e.nextElement();result += each.getAnnualCost();return result;public int getHeadCount() return _staff.size();public Enumeration getStaff() return _staff.elements();public void addStaff(Party arg) _staff.addElement(arg);public String getName() return _name;private String _name;private Vector _staff

38、= new Vector();package generation.extractsuperclass;public class Employee extends Party public Employee(String name, String id, int annualCost) super(name);_id = id;_annualCost = annualCost;public int getAnnualCost() return _annualCost;public String getId() return _id;private int _annualCost;private

39、 String _id;package generation.extractsuperclass;public abstract class Party protected String _name;public String getName() return _name;public abstract int getAnnualCost();public Party(String _name) super();this._name = _name;5. 使用Eclipse AST設(shè)計(jì)并實(shí)現(xiàn)一個(gè)類信息統(tǒng)計(jì)小程序,可以統(tǒng)計(jì)一個(gè)類中方法的個(gè)數(shù)、屬性的個(gè)數(shù)、源代碼行數(shù)、代碼行最多的方法名以及代碼行數(shù)

40、、參數(shù)個(gè)數(shù)最多的方法名及其參數(shù)的個(gè)數(shù)等信息,并對(duì)實(shí)驗(yàn)項(xiàng)目中的類進(jìn)行測(cè)試。將所實(shí)現(xiàn)程序的代碼粘貼如下:/類信息統(tǒng)計(jì)程序源代碼package test;import java.io.FileReader;import java.util.ArrayList;import java.util.LinkedList;import javax.management.remote.SubjectDelegationPermission;import javax.xml.parsers.ParserConfigurationException;import org.xml.sax.InputSource;i

41、mport org.xml.sax.SAXException;import ru.novosoft.uml.foundation.core.MAttribute;import ru.novosoft.uml.foundation.core.MClass;import ru.novosoft.uml.foundation.core.MGeneralization;import ru.novosoft.uml.foundation.core.MOperation;import ru.novosoft.uml.foundation.core.MParameter;import ru.novosoft

42、.uml.model_management.MModel;import ru.novosoft.uml.model_management.MPackage;import ru.novosoft.uml.xmi.XMIReader;public class Measure extends XMIReaderpublic Measure() throws SAXException, ParserConfigurationException super();/ TODO Auto-generated constructor stubpublic static void main(String arg

43、s) / TODO Auto-generated method stubMModel m_modelCurrent ;Measure measure = null; MPackage rtPackage; MClass rtClass = null; MOperation rtOperations = null; MAttributertAttributes = null; int operationNum=0; int attributNum=0; int noo=0; int noa=0; double si=0; int l=1; int temp=1; try measure = ne

44、w Measure(); catch (SAXException e) / TODO Auto-generated catch blocke.printStackTrace(); catch (ParserConfigurationException e) / TODO Auto-generated catch blocke.printStackTrace();m_modelCurrent=measure.parse("examplesperson.xml");rtPackage=measure.getPackages(m_modelCurrent);for (int i

45、= 0; i < rtPackage.length; i+)rtClass=measure.getClass(rtPackagei);for(int i=0;i<rtClass.length;i+)temp=1;rtOperations=measure.getOperation(rtClassi);rtAttributes=measure.getAttribute(rtClassi);operationNum+=rtOperations.length;attributNum+=rtAttributes.length;/System.out.println(rtClassi+&quo

46、t;泛化關(guān)系"+rtClassi.getGeneralizations();/System.out.println(rtClassi+"關(guān)聯(lián)關(guān)系"+rtClassi.getAssociationEnds();/for(int k=0;k<rtOperations.length;k+)/System.out.println(rtOperationsk+"參數(shù)"+rtOperationsk.getParameters();/MClass children=measure.getChildren(rtClassi); if (children!

47、=null)temp+; if(temp>l) l=temp; for(int j=0;j<children.length;j+)MOperationchildrenOperation=measure.getOperation(childrenj);/boolean added=false;for(int s=0;s<childrenOperation.length;s+)boolean overriden=false;if(childrenOperations.toString().equals(rtOperations0.toString() )MParameterrtP

48、arameters=measure.getParameter(rtOperations0);MParameterchildrenParameters=measure.getParameter(childrenOperations); for(int a=0;a<rtParameters.length;a+) for(int b=0;b<childrenParameters.length;b+) /System.out.println("父類方法參數(shù)"+rtParametersa+"子類方法參數(shù)"+childrenParametersb); i

49、f(!rtParametersa.toString().equals(childrenParametersb.toString() overriden=true; else noa+;if(overriden)noo+=1;/System.out.println("當(dāng)前NOO"+noo); si=(double)(noa*l)/(double)operationNum;System.out.println("-"+m_modelCurrent+"-");System.out.println("一.LK度量結(jié)果如下:"

50、;);System.out.println("1.CS:Operation個(gè)數(shù)為"+operationNum+" Attribute個(gè)數(shù)為"+attributNum); System.out.println("2.NOA="+noa); System.out.println("3.NOO="+noo); System.out.println("4.SI="+si);System.out.println("二.CK度量結(jié)果如下:");System.out.println(&qu

51、ot;1.NOC: ");for(int i=0;i<rtClass.length;i+)MClass children=measure.getChildren(rtClassi); if (children!=null) System.out.print(" NOC("+rtClassi+")="+children.length); else System.out.print(" NOC("+rtClassi+")=0 "); System.out.println("n2.CBO: ");for(int i=0;i<rtClass.length;i+)System.out.print("

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論