PSP2.1
| PSP阶段 | 预估耗时 (分钟)
| 实际耗时 (分钟)
|
Planning | 计划 | 20 | 20 |
Estimate | 估计这个任务需要多少时间 | 60 | 70 |
Development | 开发 | 60 | 60 |
Analysis | 需求分析 (包括学习新技术) | 30 | 20 |
Design Spec | 生成设计文档 | 20 | 20 |
Design Review | 设计复审 (和同事审核设计文档) | 15 | 20 |
Coding Standard | 代码规范 (为目前的开发制定合适的规范) | 10 | 10 |
Design | 具体设计 | 20 | 30 |
Coding | 具体编码 | 40 | 60 |
Code Review | 代码复审 | 30 | 20 |
Test | 测试(自我测试,修改代码,提交修改) | 20 | 10 |
Reporting | 报告 | 10 | 10 |
Test Report | 测试报告 | 10 | 10 |
Size Measurement | 计算工作量 | 20 | 10 |
Postmortem & Process Improvement Plan | 事后总结, 并提出过程改进计划 | 20 | 25 |
| 合计 | 385 | 395 |
代码说明: //取出输出文件名 public static String getOutFileName(String canshu){ boolean isNewFile = canshu.contains(" -O"); String fileName = null; if(isNewFile){ fileName = canshu.substring(canshu.indexOf("-O")+3);} return fileName; } //文件操作,将信息写入文件 public static void writeFile(String fileName,int data){ File file = new File(fileName);// 要写入的文件路径 if (!file.exists()) {// 判断文件是否存在 try { file.createNewFile();// 如果文件不存在创建文件 System.out.println("文件"+file.getName()+"不存在已为您创建!"); } catch (IOException e) { System.out.println("创建文件异常!"); e.printStackTrace(); } } else { System.out.println("文件"+file.getName()+"已存在!"); } FileOutputStream fos = null; PrintStream ps = null; try { fos = new FileOutputStream(file,true);// 文件输出流 追加 ps = new PrintStream(fos); } catch (FileNotFoundException e) { e.printStackTrace(); } String string = data+"\r\n";// +换行 ps.print(string); // 执行写操作 ps.close(); // 关闭流 System.out.println("文件写入完毕!"); } //参数分析 public Parameter getParameter() { String para[] = Tools.getParameters(this.string); Parameter parameter = new Parameter(); for(String opt : para){ switch (opt){ case "-c": parameter.setShowCharCount(true); break; case "-W": parameter.setShowStringCount(true); break; case "-l": parameter.setShowlineCount(true); break; case "-O": parameter.setOutFileName(Tools.getOutFileName(this.string).replace(" ","")); break; default: if(!parameter.getOutFileName().equals(opt)){ parameter.setFileName(opt); System.out.println(parameter.getOutFileName()+":"+opt);} } } return parameter; } //这两个一个是写入文件,另外一个是对参数进行分析。
思路:直接用java的一些函数实现
类:主要有参数类Parameter,结果保存类Result,另外一个工具类Tool,还有个wordCounter类
测试过程:简单测试重要的函数,解析参数,文件读取,与文件写入
说明:这次主要是简单实现基础功能