• 第一次个人编程作业


    第一次个人编程作业

    一、GitHub 仓库地址

    https://github.com/tidalchui/031702624

    二、PSP 表格

    PSP2.1 Personal Software
    Process Stages
    预估耗时(min) 实际耗时(min)
    Planning 计划 60 30
    Estimate 估计这个任务需要多少时间 50 30
    Development 开发 240 300
    Analysis 需求分析(包括学习新技术) 120 180
    Design Spec 生成设计文档 60 30
    Design Review 设计复审 30 20
    Coding Standard 代码规范(为开发制定合适的规范) 30 20
    Design 具体设计 60 60
    Coding 具体编码 240 180
    Code Review 代码复审 180 120
    Test 测试(自我测试,修改,提交修改) 180 180
    Reporting 报告 60 60
    Test Report 测试报告 20 20
    Size Measurement 计算工作量 10 10
    Postmortem & Process Improvement Plan 事后总结并提出过程改进计划 30 30
    合计 1370 1270

    三、计算模块接口的设计与实现过程

    思路

    先用split从感叹号分开字符串,可以得到等级。然后通过逗号获得姓名。之后用正则匹配五级地址,再根据等级加入结果中:若是五级则直接加入,七级就用正则匹配将第五级再分为三级后加入。

    Main.java

    函数

    public static ArrayList getMatchesAddress(String level, String addr) //分析地址

    public static Map<String, Object> getJson(ArrayList arrayList, String name, String num) //输出为JSON

    四、计算模块接口部分的性能改进

    开始我将1与2的匹配完全分开,但是后来我发现这后者的匹配可以基于前者,于是修改了代码。

    五、计算模块部分单元测试展示

    测试数据:

    1!时多,天津市河东区向13948448457阳楼街道翠阜新村翠韵里4栋.
    1!朱溅,上海15274130332市徐汇区漕河泾街道三江路88弄嘉萱苑.
    1!雍厂赏,江苏省连云港市赣榆区海头镇204国道海后幼15578766416儿园.
    1!乜吨铡,安徽省15646257573合肥市瑶海区长淮街道胜利路.
    2!弓贵想,内蒙古自治区乌海15107496618市海勃湾区新华西街道滨水佳园8号楼.
    2!邬圣垒,福建省14752864795莆田市仙游县园庄镇园庄村文化街299号园庄中学.
    2!茅参,上海市嘉定区马13347914736陆镇嘉新公路1157号樊家村1256号楼.
    3!夹谷抡枯,甘肃城关区皋兰路街道皋兰18795320124路210号郑家台小区.
    3!柏雅蚜,长宁区周家桥街道武夷路718号武夷13757741271花园722号楼.
    3!宿冕,辽宁省沙河口区兴工街14777396416道如意街46号大连罗斯福广场A座.198号合肥元一希尔顿酒店.

    输出:

    [{"姓名":"时多","手机":"13948448457","地址":["","天津市","河东区","向阳楼街道","","","翠阜新村翠韵里4栋"]},{"姓名":"朱溅","手机":"15274130332","地址":["","上海市","徐汇区","漕河泾街道","三江路88弄嘉萱苑"]},{"姓名":"雍厂赏","手机":"15578766416","地址":["江苏省","连云港市","赣榆区","海头镇","204国道海后幼儿园"]},{"姓名":"乜吨铡","手机":"15646257573","地址":["安徽省","合肥市","瑶海区","长淮街道","胜利路"]},{"姓名":"弓贵想","手机":"15107496618","地址":["内蒙古自治区","乌海市","海勃湾区","新华西街道","","滨水佳园8号","楼"]},{"姓名":"邬圣垒","手机":"14752864795","地址":["福建省","莆田市","仙游县","园庄镇","园庄村文化街","299号","园庄中学"]},{"姓名":"茅参","手机":"13347914736","地址":["","上海市","嘉定区","马陆镇","嘉新公路","1157号","樊家村1256号楼"]},{"姓名":"夹谷抡枯","手机":"18795320124","地址":["","","甘肃城关区","皋兰路街道","皋兰路","210号","郑家台小区"]},{"姓名":"柏雅蚜","手机":"13757741271","地址":["","","长宁区","周家桥街道","武夷路","718号","武夷花园722号楼"]},{"姓名":"宿冕","手机":"14777396416","地址":["辽宁省","","沙河口区","兴工街道","如意街","46号","大连罗斯福广场A座198号合肥元一希尔顿酒店"]}]

    六、计算模块部分异常处理说明

    异常处理主要是读写时的异常以及正则匹配时的异常。

    例如:

    if(mname.find())
    				{
    					name = mname.group(0);
    					addr = addr.replaceAll(name, "");
    					name = name.replaceAll(",","");
    				}
    

    将mname.find写在if语句中,若找不到相应的子串则不执行括号中的语句。

    七、总结

    开始想了很久无从入手,还是从面向对象的作业中想到了用正则匹配。但是缺少省市的还是没法处理。3!的情况也没法处理。而且评测工具还一直评测不出来。可能只能手动评测了。

  • 相关阅读:
    安装tomcat
    sed
    a'w'k
    dwr??
    tomcat-性能?
    windows清理命令
    markdown超链接怎么写?
    ※剑指offer系列19:二叉搜索树与双向链表
    剑指offer系列17:二叉搜索树的后序遍历序列
    剑指offer系列18:二叉树中和为某一值得路径
  • 原文地址:https://www.cnblogs.com/tidalchui/p/11600063.html
Copyright © 2020-2023  润新知