标签:步骤 编写 结果 NPU bar gpo 编号 cin static
| 
 PSP2.1  | 
 PSP阶段  | 
 预估耗时(分钟)  | 
 实际耗时(分钟)  | 
| 
 Planning  | 
 计划  | 
 15  | 
 15  | 
| 
 Estimate  | 
 估计任务需要多少时间  | 
 25  | 
 30  | 
| 
 Development  | 
 开发  | 
 100  | 
 100  | 
| 
 Analysis  | 
 需求分析  | 
 20  | 
 20  | 
| 
 Design Spec  | 
 生成设计文档  | 
 20  | 
 15  | 
| 
 Design Review  | 
 设计复审  | 
 20  | 
 15  | 
| 
 Coding Standard  | 
 代码规范  | 
 20  | 
 15  | 
| 
 Design  | 
 具体设计  | 
 20  | 
 25  | 
| 
 Coding  | 
 具体编码  | 
 60  | 
 60  | 
| 
 Code Review  | 
 代码复审  | 
 20  | 
 30  | 
| 
 Test  | 
 测试  | 
 60  | 
 80  | 
| 
 Reporting  | 
 报告  | 
 80  | 
 95  | 
| 
 Test Report  | 
 测试报告  | 
 30  | 
 50  | 
| 
 Size Measurement  | 
 计算工作量  | 
 30  | 
 25  | 
| 
 Postmortem  | 
 总结  | 
 20  | 
 20  | 
| 
 
  | 
 合计  | 
 530  | 
 560  | 
我主要负责将排序后的单词和词频输出到文件。代码实现:
public class Output {
    public static void output(ArrayList<Entry<String, Integer>> list, File outputFile) throws IOException{
          if(outputFile==null){
             outputFile=new File("result.txt");
             }
            //FileWriter fW=new FileWriter(outputFile,true);
          FileWriter fW=new FileWriter(outputFile);
             BufferedWriter bw=new BufferedWriter(fW);
        bw.close();
    }
}
测试用例设计:
| 
 Test Case ID测试用例编号  | 
 Test Item 测试项(即功能模块或函数)  | 
 Test Case Title 测试用例标题  | 
 Test Criticality重要级别  | 
 Pre-condition预置条件  | 
 Input 输入  | 
 Procedure 操作步骤  | 
 Output预期结果  | 
 Result实际结果  | 
 Status是否通过  | 
 Remark备注(在此描述使用的测试方法)  | 
| 
 1-5  | 
 输出控制模块  | 
 单词种类<=5,词频<=10  | 
 H  | 
 无  | 
 wcPro.exe  | 
 无  | 
 参数数量错误  | 
 参数数量错误  | 
 是  | 
 黑盒测试  | 
| 
 6-10  | 
 输出控制模块  | 
 单词种类<=5,词频不定  | 
 H  | 
 无  | 
 wcPro.exe -a test.txt  | 
 无  | 
 参数数量错误  | 
 参数数量错误  | 
 是  | 
 黑盒测试  | 
| 
 11-15  | 
 输出控制模块  | 
 单词种类>=6,词频<=10  | 
 H  | 
 无  | 
 wcPro.exe -a  | 
 无  | 
 参数数量错误  | 
 参数数量错误  | 
 是  | 
 黑盒测试  | 
| 
 16-20  | 
 输出控制模块  | 
 单词种类>=6,词频不定  | 
 H  | 
 无  | 
 wcPro.exe test.c  | 
 无  | 
 输入格式错误  | 
 输入格式错误  | 
 是  | 
 黑盒测试  | 
单元测试运行结果:

小组贡献:因为编程能力不够,只完成了控制输出的部分,贡献率为0.13.
选择刘博谦(17070)的代码进行分析
// 词频排序
    public static ArrayList<String> sort(HashMap<String, Integer> map) {
        // 以Key进行排序
        TreeMap treemap = new TreeMap(map);
        // 以value进行排序
        ArrayList<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>(
                treemap.entrySet());
        Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
            public int compare(Map.Entry<String, Integer> o1,
                    Map.Entry<String, Integer> o2) {
                // 降序
                return o2.getValue() - o1.getValue();
                // 升序 o1.getValue() - o2.getValue())
            }
        });
        ArrayList<String> str = new ArrayList<String>();
        int i = 0;
        for (Map.Entry<String, Integer> string : list) {
            // 排除-与空格
            if (!(string.getKey().equals("")) && !(string.getKey().equals("-"))) {
                str.add(string.getKey());
                str.add(string.getValue().toString());
                // 输出前1000个单词
                if (i > 1000)
                    break;
                i++;
            }
        }
        return str;
    }
刘博谦的代码遵守了《阿里巴巴Java开发手册》第二条的强制规定,代码命名规范,无需改进。
开发规范
阿里巴巴Java开发规范手册
参考资料:
《阿里巴巴JAVA开发手册》
https://wenku.baidu.com/view/87c4d56c7e21af45b307a88d.html
标签:步骤 编写 结果 NPU bar gpo 编号 cin static
原文地址:https://www.cnblogs.com/hddddd/p/8747542.html