From e546bbc44d742f4f754d8707644b532ffca2b53f Mon Sep 17 00:00:00 2001 From: 221801333lsl <1390476733@qq.com> Date: Sun, 14 Mar 2021 21:45:54 +0800 Subject: [PATCH 1/6] Create codestyle.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提交格式错误,重新提交 --- codestyle.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 codestyle.md diff --git a/codestyle.md b/codestyle.md new file mode 100644 index 00000000..29cac64b --- /dev/null +++ b/codestyle.md @@ -0,0 +1,34 @@ ++ 缩进 + + 同意使用 tab 键缩进 + + 在使用if或while等嵌套结构时,采用 +
+    if()
+    {
+        ···
+    }
+ 的形式 ++ 变量命名 + + 使用小写英文单词命名 + + 单词之间用 "_" 分隔(book_id) + + 如果变量名太长,使用单词前三个字符进行缩写。 ++ 每行最多字符数 + + 每行含缩进不允许超过80个字符 ++ 函数最大行数 + + 80行 ++ 函数、类命名 + + 使用小写英文单词命名 + + 单词之间大小写字母区分(BookSystem) + + 如果变量名太长,使用单词前三个字符进行缩写。 ++ 常量 + + 使用全字母大写英文单词命名 + + 单词之间用 "_" 分隔(BOOK_NUM) + + 不缩写 ++ 空行规则 + + 函数之间必须空一行 ++ 注释规则 + + 在类、函数的定义上方注释 + + 说明清晰且简洁 ++ 操作符前后空格 + + 操作符前后不添加空格,如:a=b*c ++ 其他规则 + + {另起一行 \ No newline at end of file From ce79732f1c83e3f246f460847b6462c5c32ef53a Mon Sep 17 00:00:00 2001 From: 221801333lsl <1390476733@qq.com> Date: Sun, 14 Mar 2021 21:46:21 +0800 Subject: [PATCH 2/6] Delete codestyle.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式错误,重新添加 --- example/codestyle.md | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 example/codestyle.md diff --git a/example/codestyle.md b/example/codestyle.md deleted file mode 100644 index 29cac64b..00000000 --- a/example/codestyle.md +++ /dev/null @@ -1,34 +0,0 @@ -+ 缩进 - + 同意使用 tab 键缩进 - + 在使用if或while等嵌套结构时,采用 -
-    if()
-    {
-        ···
-    }
- 的形式 -+ 变量命名 - + 使用小写英文单词命名 - + 单词之间用 "_" 分隔(book_id) - + 如果变量名太长,使用单词前三个字符进行缩写。 -+ 每行最多字符数 - + 每行含缩进不允许超过80个字符 -+ 函数最大行数 - + 80行 -+ 函数、类命名 - + 使用小写英文单词命名 - + 单词之间大小写字母区分(BookSystem) - + 如果变量名太长,使用单词前三个字符进行缩写。 -+ 常量 - + 使用全字母大写英文单词命名 - + 单词之间用 "_" 分隔(BOOK_NUM) - + 不缩写 -+ 空行规则 - + 函数之间必须空一行 -+ 注释规则 - + 在类、函数的定义上方注释 - + 说明清晰且简洁 -+ 操作符前后空格 - + 操作符前后不添加空格,如:a=b*c -+ 其他规则 - + {另起一行 \ No newline at end of file From 9cf3843b3a89d3fde05677ce134c9de6a911d7d8 Mon Sep 17 00:00:00 2001 From: 221801333lsl <1390476733@qq.com> Date: Sun, 14 Mar 2021 21:46:43 +0800 Subject: [PATCH 3/6] Delete README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式错误,重新添加 --- example/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 example/README.md diff --git a/example/README.md b/example/README.md deleted file mode 100644 index e69de29b..00000000 From 6d7c834d070d7f3a2a343c6ed173690ce1bc1f84 Mon Sep 17 00:00:00 2001 From: 221801333lsl <1390476733@qq.com> Date: Sun, 14 Mar 2021 21:47:03 +0800 Subject: [PATCH 4/6] Delete WordCount.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式错误,重新添加 --- example/src/WordCount.java | 106 ------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 example/src/WordCount.java diff --git a/example/src/WordCount.java b/example/src/WordCount.java deleted file mode 100644 index c620a47b..00000000 --- a/example/src/WordCount.java +++ /dev/null @@ -1,106 +0,0 @@ -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.security.KeyStore.Entry; -import java.util.Map; -import java.util.Scanner; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Set; - -public class Count { - static int count_char=0;//ַ - static int count_word=0;// - static int count_line=0;//Ч - static int count_Word_Frequency=10;//Ƶߵĵ - static Map map = new HashMap();//¼ʳֵĴ - static String input; - static String output; - //ʮƵߵĵʲдļ - static void countWordFrequency() throws FileNotFoundException - { - List result = new ArrayList<>(); - List> list = new ArrayList<>(); - list.addAll(map.entrySet()); - Collections.sort(list,new Comparator>() - { //valueбȽ - public int compare(Map.Entrye1,Map.Entrye2) - { - int re = e2.getValue().compareTo(e1.getValue()); - if(re!=0) - return re; - else - return e1.getKey().compareTo(e2.getKey()); - } - }); - //ȽϺĽṹresult - for(int i=0;i Date: Sun, 14 Mar 2021 21:47:25 +0800 Subject: [PATCH 5/6] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式错误,重新添加 --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 099d81f5..e69de29b 100644 --- a/README.md +++ b/README.md @@ -1,2 +0,0 @@ -# PersonalProject-Java -wordcount-Java提交仓库 From 2717f6f5fd2550edaefc9570457dd2f02835167a Mon Sep 17 00:00:00 2001 From: 221801333lsl <1390476733@qq.com> Date: Sun, 14 Mar 2021 21:47:46 +0800 Subject: [PATCH 6/6] Create WordCount.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式错误,重新添加 --- src/WordCount.java | 106 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/WordCount.java diff --git a/src/WordCount.java b/src/WordCount.java new file mode 100644 index 00000000..c620a47b --- /dev/null +++ b/src/WordCount.java @@ -0,0 +1,106 @@ +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.security.KeyStore.Entry; +import java.util.Map; +import java.util.Scanner; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +public class Count { + static int count_char=0;//ַ + static int count_word=0;// + static int count_line=0;//Ч + static int count_Word_Frequency=10;//Ƶߵĵ + static Map map = new HashMap();//¼ʳֵĴ + static String input; + static String output; + //ʮƵߵĵʲдļ + static void countWordFrequency() throws FileNotFoundException + { + List result = new ArrayList<>(); + List> list = new ArrayList<>(); + list.addAll(map.entrySet()); + Collections.sort(list,new Comparator>() + { //valueбȽ + public int compare(Map.Entrye1,Map.Entrye2) + { + int re = e2.getValue().compareTo(e1.getValue()); + if(re!=0) + return re; + else + return e1.getKey().compareTo(e2.getKey()); + } + }); + //ȽϺĽṹresult + for(int i=0;i