个人项目
作业所属课程 | https://edu.cnblogs.com/campus/gdgy/networkengineering1934-Softwareengineering?filter=homework |
---|---|
这个作业要求在哪里 | https://edu.cnblogs.com/campus/gdgy/networkengineering1934-Softwareengineering/homework/12137 |
作业目标 | 学习论文查重算法,深入学习github,性能分析测试代码 |
github地址
https://github.com/bubble-blase/3219005353
PSP
PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) |
---|---|---|---|
Planning | 计划 | 90 | 120 |
·Estimate | ·估计这个任务需要多少时间 | 60 | 28 |
Development | 开发 | 480 | 640 |
· Analysis | · 需求分析 (包括学习新技术) | 60 | 120 |
· Design Spec | · 生成设计文档 | 60 | 60 |
· Design Review | · 设计复审 | 60 | 60 |
· Coding Standard | · 代码规范 (为目前的开发制定合适的规范) | 20 | 20 |
· Design | · 具体设计 | 20 | 20 |
· Coding | · 具体编码 | 180 | 300 |
· Code Review | · 代码复审 | 60 | 80 |
· Test | · 测试(自我测试,修改代码,提交修改) | 60 | 120 |
Reporting | 报告 | 60 | 60 |
· Test Repor | · 测试报告 | 60 | 120 |
· Size Measurement | · 计算工作量 | 60 | 60 |
· Postmortem & Process Improvement Plan | · 事后总结, 并提出过程改进计划 | 10 | 20 |
· 合计 | 1260 | 1720 |
1、计算模板块接口的设计和实现过程
文件读写类
文件读写类为了增加开发效率,我引入了糊涂工具包,引用了里面的FileReader,然后对异常进行了封装
分词与计算类
分词部分也是引入了糊涂工具包的TokenizerEngine,并通过hankcs当作引擎来进行分词处理
自定义类
2、程序流程图
3、测试
主要代码
public void sameTest(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_add.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_add.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void addTest(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_add.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void delTest(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_del.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void disTest(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_dis_1.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void dis10Test(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_dis_10.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void dis15Test(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_dis_15.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void Test(){
String path = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig.txt";
String path2 = "C:\Deskstop\大三上\软件工程\3219005353-cjb\orig_0.8_dis_15.txt";
Map<String, List
Map<String, List
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\Deskstop\大三上\软件工程\3219005353-cjb\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void NullpointTest(){
String path = "";
String path2 = "";
Map<String, List<Integer>> stringListMap = TokenizerUtil.CountWord(path);
Map<String, List<Integer>> stringListMap2 = TokenizerUtil.CountWord(path2);
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\\Deskstop\\大三上\\软件工程\\3219005353-cjb\\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
@Test
public void DIYpointTest(){
String path = "C:\\Deskstop\\大三上\\软件工程\\3219005353-cjb\\1000.txt";
String path2 = "C:\\Deskstop\\大三上\\软件工程\\3219005353-cjb\\4.txt";
Map<String, List<Integer>> stringListMap = TokenizerUtil.CountWord(path);
Map<String, List<Integer>> stringListMap2 = TokenizerUtil.CountWord(path2);
Double aDouble = TokenizerUtil.CountCos(stringListMap, stringListMap2);
FileUtil.writeFile("C:\\Deskstop\\大三上\\软件工程\\3219005353-cjb\\res.txt",String.valueOf(aDouble));
System.out.println(aDouble);
}
}
JProfiler> Protocol version 63
JProfiler> Java 11 detected.
JProfiler> 64-bit library
JProfiler> Listening on port: 34227.
JProfiler> Enabling native methods instrumentation.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Retransforming 122 base class files.
JProfiler> Base classes instrumented.
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> Using sampling (5 ms)
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
0.804067893296461
0.6575365154781483
0.8695990639733713
文件为空
null
0.6575365154781483
0.7498838191640381
0.9206491294709916
文件路径为空
文件路径为空
null
1.0
Process finished with exit code 0
覆盖率
总方法覆盖率为77%,主要原因是自定义异常中只用到一个方法,但是line覆盖率达到了93%
FileUtil中没有覆盖到的地方是还没能测试到输出结果文件异常的部分。但是这个异常我已经做了处理,初步想的是在linux中会有文件读写权限,这时可以覆盖到。
覆盖率
4、总结
第一次尝试自己做,花的时间有点长,也有很多不会的地方,希望以后自己可以多学习多进步~