第四周小组作业:Wordcount优化

一、源代码地址

  https://github.com/Fish2333333/WordCountPro

 

二、PSP表格

 

 三、模块编写

  本次作业我的工作主要是输入控制,同时将结果保存起来。先对输入进行有效性判断,识别并处理无效输入,获取有效数据,然后将单词按词频排好序,并将结果输出到log.txt文件中。代码如下:

 1 BufferedReader br = new BufferedReader(new FileReader("E:/test.txt"));    
 2         List<String> lists = new ArrayList<String>();  //存储过滤后单词的列表    
 3         String readLine = null;  
 4         while((readLine = br.readLine()) != null){    
 5             String[] wordsArr1 = readLine.split("[^a-zA-Z]");  //过滤出只含有字母的    
 6             for (String word : wordsArr1) {    
 7                 if(word.length() != 0){  //去除长度为0的行    
 8                     lists.add(word);    
 9                 }    
10             }    
11         }    

 

四、测试用例设计

 

五、小组评价得分

本次小组成员通力合作,大家都做出了应有的贡献。通过这次实验,本人也对测试用例的编写有了更深的认识,小组最终评分0.25

posted @ 2018-04-08 17:43  Ez1o  阅读(172)  评论(1)    收藏  举报