項目 | 內容 |
---|---|
次做業所屬課程 | 軟件工程 |
做業要求 | 做業要求內容 |
課程學習目標 | 熟悉軟件開發總體流程,提高自身能力 |
本次做業在哪一個具體方面幫助咱們實現目標 | 第一次體驗一個完整的工程 |
點評心得:閱讀完這位同窗的博文以後,讓我意識到個人博文總體還不是很美觀,應該更少地使用截圖的形式。html
String path = firstPanel.textField.getText(); try { FileInputStream fis = new FileInputStream(path); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); String temp=""; long startTime=System.currentTimeMillis(); startTime1=System.currentTimeMillis(); while((temp = br.readLine())!=null) { stmplength1+=temp.length(); String[] str = temp.split("([^a-zA-Z])"); //過濾出只含有字母的 stmplength++; for(int i=0;i<str.length;i++) { String word = str[i].trim(); if(word.length()!=0) //去除長度爲0的行 staff.put(word, staff.getOrDefault(word, 0)+1); } } br.close(); endTime1=System.currentTimeMillis(); //System.out.println("Total time is:"+ (endTime-startTime) ); rank();//按值排序 long endTime=System.currentTimeMillis(); //System.out.println("文件讀入成功!請繼續..."); JOptionPane.showMessageDialog(null, "文件讀入成功! \n 耗時:"+(endTime-startTime)+"ms");//提示登陸成功 }catch(Exception e) { //System.out.println("文件不存在!!!請從新確認!"); JOptionPane.showMessageDialog(null, "文件讀入出錯!"); }
按值排序java
public static void rank()//按值排序 { Set<Entry<String,Integer>> mapEntries = staff.entrySet(); aList = new ArrayList<Entry<String,Integer>>(mapEntries); Collections.sort(aList, new Comparator<Entry<String,Integer>>() { @Override public int compare(Entry<String, Integer> ele1, Entry<String, Integer> ele2) { return ele2.getValue().compareTo(ele1.getValue()); } }); /* for(Entry<String,Integer> entry: aList) { System.out.println(entry.getKey() + " : " + entry.getValue()); } */ }
統計文本中除冠詞、代詞、介詞以外的高頻詞git
for(int i=0;i<k;i++)//10 { boolean ok=false; if(flag) textArea.append(function.aList.get(i).getKey()+"\t"+function.aList.get(i).getValue()+"\n"); else { for(int j=0;j<function.stop.size();j++) { if(function.aList.get(i).getKey().toLowerCase().equals(function.stop.get(j))) { k++; ok=true; break; } } if(!ok) textArea.append(function.aList.get(i).getKey()+"\t"+function.aList.get(i).getValue()+"\n"); } }
4.運行程序
登錄(nwnu,2019)
讀入文件
主運行界面
指定單詞詞頻統計及柱狀圖
前k個高頻詞彙統計
統計文本中除冠詞、代詞、介詞以外的高頻詞
輸出到文件
統計行數及字符數
github
5.結對編程
編程
6.PSPapp
任務內容 | 計劃完成時間(min) | 實際完成時間(min) |
---|---|---|
計劃 | 10 | 8 |
估計這個任務須要多長時間,並規劃大體工做步驟 | 5 | 6 |
開發 | 110 | 130 |
需求分析(包括學習新技術) | 8 | 6 |
生成設計文檔 | 5 | 8 |
設計複審(和同事審覈設計文檔) | 5 | 4 |
代碼規範(爲當前的開發制定合適的規範) | 4 | 3 |
具體設計 | 15 | 10 |
具體編碼 | 150 | 200 |
代碼複審 | 5 | 6 |
測試(自我測試、修改代碼、提交修改) | 15 | 12 |
報告 | 9 | 5 |
測試報告 | 5 | 3 |
計算工做量 | 3 | 2 |
過後總結,並提出工程改進計劃 | 5 | 3 |
7.小結感覺
經過這次的結對項目編程,讓我感覺到了合做的利與弊,誠然,合做編程能提高整個過程的效率,但若是沒有好的交流共通,加上對彼此代碼風格的不適應,反而會下降團隊的效率。ide