| 这个作业属于哪个课程 | <2023软件工程-双学位 (广东工业大学 - 计算机学院)> | 
|---|---|
| gitcode链接 | https://gitcode.net/JustechoZ/3120001649 | 
| 这个作业要求在哪里 | <个人项目作业-论文查重> | 
| 这个作业的目标 | 编写论文查重的代码、学习使用gitcode、建立PSP表格 | 
目录
1.gitcode链接
https://gitcode.net/JustechoZ/3120001649
2.PSP表格
| PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 
|---|---|---|
| Planning | 计划 | 60 | 
| Estimate | 估计这个任务需要多少时间 | 30 | 
| Development | 开发 | 360 | 
| Analysis | 需求分析 (包括学习新技术) | 240 | 
| Design Spec | 生成设计文档 | 30 | 
| Design Review | 设计复审 | 30 | 
| Coding Standard | 代码规范 (为目前的开发制定合适的规范) | 30 | 
| Design | 具体设计 | 30 | 
| Coding | 具体编码 | 240 | 
| Code Review | 代码复审 | 30 | 
| Test | 测试(自我测试,修改代码,提交修改) | 60 | 
| Reporting | 报告 | 60 | 
| Test Report | 测试报告 | 60 | 
| Size Measurement | 计算工作量 | 30 | 
| Postmortem & Process Improvement Plan | 事后总结, 并提出过程改进计划 | 30 | 
| 合计 | 1320 | 
3.计算模块接口的设计与实现过程
1.1 文本转变为字符串类
读取文件路径,将保留文本汉字,返回字符串

1.2 流程类
输入文件路径,调用 simhash 获取重复率,输出至答案文件路径。

1.3 异常类
用于各种异常的编写。如,若文本为空,则抛出异常。

1.4 simhash 算法类

4.计算模块接口部分的性能改进
Overview

Live Memory

消耗最大的函数是 SimHash
5.计算模块部分单元测试展示
测试代码
package org.example;
import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
public class test
{
    @Test
    public void addTest() {
        String []s = {"text\\orig.txt", "text\\orig_0.8_add.txt", "text\\ans.txt"};
        try {
            File file = new File(s[2]);
            if (!file.exists()) {
                boolean flag = file.createNewFile();
                if (!flag) throw new Exception();
            }
            FileWriter fileWriter = new FileWriter(file.getAbsoluteFile(), true);
            fileWriter.write("与orig_0.8_add.txt重复率: ");
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Main.main(s);
    }
    @Test
    public void delTest() {
        String []s = {"text\\orig.txt", "text\\orig_0.8_del.txt", "text\\ans.txt"};
        try {
            File file = new File(s[2]);
            if (!file.exists()) {
                boolean flag = file.createNewFile();
                if (!flag) throw new Exception();
            }
            FileWriter fileWriter = new FileWriter(file.getAbsoluteFile(), true);
            fileWriter.write("与orig_0.8_del.txt重复率: ");
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Main.main(s);
    }
    @Test
    public void dis_1Test() {
        String []s = {"text\\orig.txt", "text\\orig_0.8_dis_1.txt", "text\\ans.txt"};
        try {
            File file = new File(s[2]);
            if (!file.exists()) {
                boolean flag = file.createNewFile();
                if (!flag) throw new Exception();
            }
            FileWriter fileWriter = new FileWriter(file.getAbsoluteFile(), true);
            fileWriter.write("与orig_0.8_dis_1.txt重复率: ");
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Main.main(s);
    }
    @Test
    public void dis_10Test() {
        String []s = {"text\\orig.txt", "text\\orig_0.8_dis_10.txt", "text\\ans.txt"};
        try {
            File file = new File(s[2]);
            if (!file.exists()) {
                boolean flag = file.createNewFile();
                if (!flag) throw new Exception();
            }
            FileWriter fileWriter = new FileWriter(file.getAbsoluteFile(), true);
            fileWriter.write("与orig_0.8_dis_10.txt重复率: ");
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Main.main(s);
    }
    @Test
    public void dis_15Test() {
        String []s = {"text\\orig.txt", "text\\orig_0.8_dis_15.txt", "text\\ans.txt"};
        try {
            File file = new File(s[2]);
            if (!file.exists()) {
                boolean flag = file.createNewFile();
                if (!flag) throw new Exception();
            }
            FileWriter fileWriter = new FileWriter(file.getAbsoluteFile(), true);
            fileWriter.write("与orig_0.8_dis_15.txt重复率: ");
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Main.main(s);
    }
    @Test
    public void sameTest() {
        String []s = {"text\\orig.txt", "text\\orig.txt", "text\\ans.txt"};
        try {
            File file = new File(s[2]);
            if (!file.exists()) {
                boolean flag = file.createNewFile();
                if (!flag) throw new Exception();
            }
            FileWriter fileWriter = new FileWriter(file.getAbsoluteFile(), true);
            fileWriter.write("与orig.txt的重复率: ");
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Main.main(s);
    }
    @Test
    public void emptyTest() {
        String s = "text\\orig.txt";
        String t = "text\\empty.txt";
        String ansPath = "text\\ans.txt";
        Solve.solve(s, t, ansPath);
    }
    @Test
    public void filePathTest() {
        String s = "text\\orig.tx";
        String t = "text\\o.txt";
        String ansPath = "text\\ans.txt";
        Solve.solve(s, t, ansPath);
    }
}
测试结果:

测试覆盖率:


6. 计算模块部分异常处理说明
设计异常信息传递类
public class MyException extends Exception {
    public MyException(String s) {
        super(s);
    }
}
测试样例
空文本

文件路径错误

7. PSP表格记录下你在程序的各个模块上实际花费的时间
| PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) | 
|---|---|---|---|
| Planning | 计划 | 60 | 60 | 
| Estimate | 估计这个任务需要多少时间 | 30 | 30 | 
| Development | 开发 | 360 | 400 | 
| Analysis | 需求分析 (包括学习新技术) | 240 | 250 | 
| Design Spec | 生成设计文档 | 30 | 30 | 
| Design Review | 设计复审 | 30 | 20 | 
| Coding Standard | 代码规范 (为目前的开发制定合适的规范) | 30 | 20 | 
| Design | 具体设计 | 30 | 20 | 
| Coding | 具体编码 | 240 | 200 | 
| Code Review | 代码复审 | 30 | 30 | 
| Test | 测试(自我测试,修改代码,提交修改) | 60 | 60 | 
| Reporting | 报告 | 60 | 40 | 
| Test Report | 测试报告 | 60 | 40 | 
| Size Measurement | 计算工作量 | 30 | 30 | 
| Postmortem & Process Improvement Plan | 事后总结, 并提出过程改进计划 | 30 | 40 | 
| 合计 | 1320 | 1280 | 
 
                    
                     
                    
                 
                    
                 
 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号