# BUAA_OO_2022_第一单元总结

OO第一单元作业主题为表达式拆括号，三次作业分别为基本多项式拆括号，引入三角函数、自定义函数和求和函数，引入三角函数嵌套和自定义函数嵌套，下面我分享一下我在本单元的学习心得和作业完成情况。

## 第一次作业

### 整体结构分析及架构设计体验

$$BigDecimal[i]*x**i$$

### 基于度量的代码结构分析

Method Metrics:

methodCogCev(G)iv(G)v(G)
MainClass.toString(BigDecimal[]) 7.0 3.0 5.0 6.0
MainClass.stringJoint(String, BigDecimal, int) 19.0 1.0 8.0 15.0
MainClass.main(String[]) 2.0 1.0 2.0 2.0
Item.setPoly(String) 16.0 1.0 9.0 9.0
Item.Item() 0.0 1.0 1.0 1.0
Item.isFactor(String) 10.0 2.0 4.0 9.0
Item.indexJudge(String) 29.0 1.0 9.0 9.0
Item.calculate() 18.0 1.0 7.0 10.0
Factor.setPoly(String) 6.0 1.0 4.0 5.0
Factor.calculate() 11.0 1.0 6.0 6.0
Expression.setPoly(String) 8.0 1.0 6.0 6.0
Expression.isItem(String) 10.0 2.0 4.0 9.0
Expression.Expression() 0.0 1.0 1.0 1.0
Expression.calculate() 4.0 1.0 3.0 4.0

Class Metrics:

classOCAvgOCMaxWMC
Expression 3.75 5.0 15.0
Factor 5.5 6.0 11.0
Item 6.8 10.0 34.0
MainClass 7.0 13.0 21.0
Total     81.0

## 第二次作业

### 整体结构分析及架构设计体验

$$ExpressionInfo = \sum ItemInfo\\ ItemInfo = \sum (PowerFuncInfo*\prod TriFunc)\\ PowerFuncInfo = coefficient * x ** index\\ TriFunc = sin(coefficientIn * x ** indexIn)**indexOut\\ or\\ cos(coefficientIn * x ** indexIn)**indexOut$$

#### 关于字符串替换

$$f(y) = y**2\\ f(1) = (1)**2$$

### 基于度量的代码结构分析

Method Metrics:

methodCogCev(G)iv(G)v(G)
Expression.calculate() 1.0 1.0 2.0 2.0
Expression.Expression() 0.0 1.0 1.0 1.0
Expression.isItem(String) 10.0 2.0 4.0 9.0
Expression.setPoly(String, HashMap) 8.0 1.0 6.0 6.0
ExpressionInfo.ExpressionInfo() 0.0 1.0 1.0 1.0
ExpressionInfo.multiply(ExpressionInfo) 3.0 1.0 3.0 3.0
ExpressionInfo.negative() 1.0 1.0 2.0 2.0
ExpressionInfo.powerFuncSetting(BigDecimal, BigDecimal) 0.0 1.0 1.0 1.0
ExpressionInfo.settle() 23.0 1.0 9.0 10.0
ExpressionInfo.toString() 1.0 1.0 2.0 2.0
ExpressionInfo.triFuncSetting(TriFunc) 0.0 1.0 1.0 1.0
Factor.calculate() 4.0 1.0 4.0 4.0
Factor.isZero(String) 4.0 1.0 6.0 7.0
Factor.setCustomFunction(String) 12.0 3.0 7.0 8.0
Factor.setPoly(String, HashMap) 11.0 1.0 11.0 11.0
Factor.setSumFunc(String) 11.0 1.0 8.0 9.0
Factor.setTriFunc(String) 5.0 1.0 5.0 5.0
Item.calculate() 2.0 1.0 3.0 3.0
Item.indexJudge(String, HashMap) 29.0 1.0 9.0 9.0
Item.isFactor(String) 10.0 2.0 4.0 9.0
Item.Item() 0.0 1.0 1.0 1.0
Item.setPoly(String, HashMap) 16.0 1.0 9.0 9.0
ItemInfo.getOriginPowerFunc() 0.0 1.0 1.0 1.0
ItemInfo.getPowerFunctions() 0.0 1.0 1.0 1.0
ItemInfo.getTriFunctions() 0.0 1.0 1.0 1.0
ItemInfo.ItemInfo() 0.0 1.0 1.0 1.0
ItemInfo.multiply(ItemInfo) 17.0 1.0 9.0 10.0
ItemInfo.negative() 1.0 1.0 2.0 2.0
ItemInfo.powerFuncSetting(BigDecimal, BigDecimal) 0.0 1.0 1.0 1.0
ItemInfo.sameTriFunc(ItemInfo) 14.0 4.0 4.0 6.0
ItemInfo.setOriginPowerFunc(ArrayList) 0.0 1.0 1.0 1.0
ItemInfo.setPowerFunctions(ArrayList) 0.0 1.0 1.0 1.0
ItemInfo.settle() 12.0 1.0 6.0 7.0
ItemInfo.setTriFunctions(ArrayList) 0.0 1.0 1.0 1.0
ItemInfo.toString() 31.0 1.0 12.0 13.0
ItemInfo.triFuncSetting(TriFunc) 0.0 1.0 1.0 1.0
MainClass.main(String[]) 15.0 1.0 8.0 8.0
PowerFuncInfo.getCoefficient() 0.0 1.0 1.0 1.0
PowerFuncInfo.getIndex() 0.0 1.0 1.0 1.0
PowerFuncInfo.multiply(PowerFuncInfo) 0.0 1.0 1.0 1.0
PowerFuncInfo.negative() 0.0 1.0 1.0 1.0
PowerFuncInfo.PowerFuncInfo(BigDecimal, BigDecimal) 0.0 1.0 1.0 1.0
PowerFuncInfo.setCoefficient(BigDecimal) 0.0 1.0 1.0 1.0
PowerFuncInfo.setIndex(BigDecimal) 0.0 1.0 1.0 1.0
PowerFuncInfo.toString() 18.0 1.0 12.0 12.0
TriFunc.allSame(TriFunc) 1.0 1.0 4.0 4.0
TriFunc.getCoefficientIn() 0.0 1.0 1.0 1.0
TriFunc.getIndexIn() 0.0 1.0 1.0 1.0
TriFunc.getIndexOut() 0.0 1.0 1.0 1.0
TriFunc.isSin() 0.0 1.0 1.0 1.0
TriFunc.sameTo(TriFunc) 1.0 1.0 3.0 3.0
TriFunc.setCoefficientIn(BigDecimal) 0.0 1.0 1.0 1.0
TriFunc.setIndexIn(BigDecimal) 0.0 1.0 1.0 1.0
TriFunc.setIndexOut(BigDecimal) 0.0 1.0 1.0 1.0
TriFunc.setSin(boolean) 0.0 1.0 1.0 1.0
TriFunc.setTriFunc(String) 23.0 1.0 10.0 12.0

Class Metrics:

classOCAvgOCMaxWMC
Expression 3.25 5.0 13.0
ExpressionInfo 2.75 9.0 22.0
Factor 5.5 8.0 33.0
Item 5.4 9.0 27.0
ItemInfo 3.142857142857143 11.0 44.0
MainClass 7.0 7.0 7.0
PowerFuncInfo 2.375 12.0 19.0
TriFunc 2.076923076923077 11.0 27.0
Total     192.0
Average 3.2542372881355934 9.0 24.0

## 第三次作业

### 整体结构分析及架构设计体验

$$TriFunc = sin((ExpressionInfo))**indexOut\\ or\\ cos((ExpressionInfo))**indexOut$$

### 基于度量的代码结构分析

Method Metrics:

methodCogCev(G)iv(G)v(G)
TriFunc.toString() 4.0 1.0 2.0 4.0
TriFunc.setTriFuncInfo(ExpressionInfo) 0.0 1.0 1.0 1.0
TriFunc.setTriFunc(String, HashMap) 2.0 1.0 1.0 2.0
TriFunc.setSin(boolean) 0.0 1.0 1.0 1.0
TriFunc.setParentheses(Polynomial) 0.0 1.0 1.0 1.0
TriFunc.setIndexOut(BigDecimal) 0.0 1.0 1.0 1.0
TriFunc.sameTo(TriFunc) 1.0 1.0 2.0 2.0
TriFunc.isSin() 0.0 1.0 1.0 1.0
TriFunc.getTriFuncInfo() 0.0 1.0 1.0 1.0
TriFunc.getParentheses() 0.0 1.0 1.0 1.0
TriFunc.getIndexOut() 0.0 1.0 1.0 1.0
TriFunc.allSame(TriFunc) 1.0 1.0 3.0 3.0
PowerFuncInfo.toString() 18.0 1.0 12.0 12.0
PowerFuncInfo.setIndex(BigDecimal) 0.0 1.0 1.0 1.0
PowerFuncInfo.setCoefficient(BigDecimal) 0.0 1.0 1.0 1.0
PowerFuncInfo.PowerFuncInfo(BigDecimal, BigDecimal) 0.0 1.0 1.0 1.0
PowerFuncInfo.negative() 0.0 1.0 1.0 1.0
PowerFuncInfo.multiply(PowerFuncInfo) 0.0 1.0 1.0 1.0
PowerFuncInfo.getIndex() 0.0 1.0 1.0 1.0
PowerFuncInfo.getCoefficient() 0.0 1.0 1.0 1.0
MainClass.main(String[]) 15.0 1.0 8.0 8.0
ItemInfo.triFuncSetting(TriFunc) 0.0 1.0 1.0 1.0
ItemInfo.toString() 31.0 1.0 12.0 13.0
ItemInfo.setTriFunctions(ArrayList) 0.0 1.0 1.0 1.0
ItemInfo.settle() 12.0 1.0 6.0 7.0
ItemInfo.setPowerFunctions(ArrayList) 0.0 1.0 1.0 1.0
ItemInfo.setOriginPowerFunc(ArrayList) 0.0 1.0 1.0 1.0
ItemInfo.sameTriFunc(ItemInfo) 26.0 6.0 6.0 10.0
ItemInfo.powerFuncSetting(BigDecimal, BigDecimal) 0.0 1.0 1.0 1.0
ItemInfo.negative() 1.0 1.0 2.0 2.0
ItemInfo.multiply(ItemInfo) 17.0 1.0 9.0 10.0
ItemInfo.ItemInfo() 0.0 1.0 1.0 1.0
ItemInfo.getTriFunctions() 0.0 1.0 1.0 1.0
ItemInfo.getPowerFunctions() 0.0 1.0 1.0 1.0
ItemInfo.getOriginPowerFunc() 0.0 1.0 1.0 1.0
ItemInfo.equals(ItemInfo) 21.0 1.0 10.0 14.0
Item.setPoly(String, HashMap) 16.0 1.0 9.0 9.0
Item.Item() 0.0 1.0 1.0 1.0
Item.isFactor(String) 10.0 2.0 4.0 9.0
Item.indexJudge(String, HashMap) 29.0 1.0 9.0 9.0
Item.calculate() 2.0 1.0 3.0 3.0
Factor.setTriFunc(String, HashMap) 5.0 1.0 5.0 5.0
Factor.setSumFunc(String) 12.0 1.0 9.0 10.0
Factor.setPoly(String, HashMap) 11.0 1.0 11.0 11.0
Factor.setCustomFunction(String) 13.0 3.0 8.0 9.0
Factor.parenthesesNum(String, int) 4.0 1.0 3.0 4.0
Factor.isZero(String) 4.0 1.0 6.0 7.0
Factor.calculate() 4.0 1.0 4.0 4.0
ExpressionInfo.triFuncSetting(TriFunc) 0.0 1.0 1.0 1.0
ExpressionInfo.toString() 1.0 1.0 2.0 2.0
ExpressionInfo.settle() 23.0 1.0 9.0 10.0
ExpressionInfo.powerFuncSetting(BigDecimal, BigDecimal) 0.0 1.0 1.0 1.0
ExpressionInfo.negative() 1.0 1.0 2.0 2.0
ExpressionInfo.multiply(ExpressionInfo) 3.0 1.0 3.0 3.0
ExpressionInfo.ExpressionInfo() 0.0 1.0 1.0 1.0
ExpressionInfo.equals(ExpressionInfo) 16.0 1.0 5.0 9.0
Expression.setPoly(String, HashMap) 8.0 1.0 6.0 6.0
Expression.isItem(String) 10.0 2.0 4.0 9.0
Expression.Expression() 0.0 1.0 1.0 1.0

class Metrics:

classOCAvgOCMaxWMC
Expression 3.25 5.0 13.0
ExpressionInfo 3.4444444444444446 9.0 31.0
Factor 5.285714285714286 8.0 37.0
Item 5.4 9.0 27.0
ItemInfo 3.933333333333333 11.0 59.0
MainClass 7.0 7.0 7.0
PowerFuncInfo 2.375 12.0 19.0
TriFunc 1.3076923076923077 4.0 17.0
Total     210.0

## 心得体会

P.S: 下个月要与新主楼电梯为伴了（笑）

posted @ 2022-03-26 15:21  hdd1211  阅读(10)  评论(0编辑  收藏  举报