Skip to content

Commit 6efd2cf

Browse files
committed
comment
1 parent e7f8c71 commit 6efd2cf

File tree

13 files changed

+282
-30
lines changed

13 files changed

+282
-30
lines changed

core/src/main/java/info/xiaomo/core/constant/FileConst.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package info.xiaomo.core.constant;
22

3+
/**
4+
* @author qq
5+
*/
6+
37
public enum FileConst {
48
/**
59
* JEPG.
@@ -219,7 +223,7 @@ public enum FileConst {
219223
*
220224
* @param value
221225
*/
222-
private FileConst(String value) {
226+
FileConst(String value) {
223227
this.value = value;
224228
}
225229

core/src/main/java/info/xiaomo/core/untils/FileUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ public static boolean pathValidate(String path) {
511511
for (String anArraypath : arraypath) {
512512
tmppath += "/" + anArraypath;
513513
File d = new File(tmppath.substring(1));
514-
if (!d.exists()) { //检查Sub目录是否存在
514+
//检查Sub目录是否存在
515+
if (!d.exists()) {
515516
System.out.println(tmppath.substring(1));
516517
if (!d.mkdir()) {
517518
return false;
@@ -543,7 +544,8 @@ public static boolean genModuleTpl(String path, String modulecontent) throws IOE
543544
return false;
544545
}
545546
}
546-
FileWriter fw = new FileWriter(path); //建立FileWriter对象,并实例化fw
547+
//建立FileWriter对象,并实例化fw
548+
FileWriter fw = new FileWriter(path);
547549
//将字符串写入文件
548550
fw.write(modulecontent);
549551
fw.close();

core/src/main/java/info/xiaomo/core/untils/HtmlUtil.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,20 @@ public static String delHTMLTag(String htmlStr) {
149149

150150
Pattern pScript = Pattern.compile(regexScript, Pattern.CASE_INSENSITIVE);
151151
Matcher mScript = pScript.matcher(htmlStr);
152-
htmlStr = mScript.replaceAll(""); //过滤script标签
152+
//过滤script标签
153+
htmlStr = mScript.replaceAll("");
153154

154155
Pattern pStyle = Pattern.compile(regexStyle, Pattern.CASE_INSENSITIVE);
155156
Matcher mStyle = pStyle.matcher(htmlStr);
156-
htmlStr = mStyle.replaceAll(""); //过滤style标签
157+
//过滤style标签
158+
htmlStr = mStyle.replaceAll("");
157159

158160
Pattern pHtml = Pattern.compile(regexHtml, Pattern.CASE_INSENSITIVE);
159161
Matcher mHtml = pHtml.matcher(htmlStr);
160-
htmlStr = mHtml.replaceAll(""); //过滤html标签
161-
162-
return htmlStr.trim(); //返回文本字符串
162+
//过滤html标签
163+
htmlStr = mHtml.replaceAll("");
164+
//返回文本字符串
165+
return htmlStr.trim();
163166
}
164167

165168
}

core/src/main/java/info/xiaomo/core/untils/HttpUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
*/
2727
public class HttpUtil {
2828

29-
private static final String DEFAULT_CHARSET = "UTF-8"; // 默认字符集
29+
private static final String DEFAULT_CHARSET = "UTF-8";
3030

31-
private static final String GET = "GET"; // GET
32-
private static final String POST = "POST";// POST
31+
private static final String GET = "GET";
32+
private static final String POST = "POST";
3333

3434
private final static String USER_COOKIE_KEY = "uid";
3535
private final static String USER_COOKIE_SECRET = "&#%!&*";

core/src/main/java/info/xiaomo/core/untils/LunarCalendarUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ public static final int[] solarToLunar(int year, int month, int monthDay) {
226226

227227
// 农历年份
228228
lunarDate[0] = iYear;
229-
230-
int leapMonth = leapMonth(iYear); // 闰哪个月,1-12
229+
// 闰哪个月,1-12
230+
int leapMonth = leapMonth(iYear);
231231
boolean isLeap = false;
232232
// 用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天
233233
int iMonth, daysOfMonth = 0;

core/src/main/java/info/xiaomo/core/untils/RandomUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public static int randomIndexByProb(List<Integer> probs) {
120120
return -1;
121121
}
122122
int totalProb = newProbs.getLast();
123-
if (totalProb == 0) {// 总概率为0
123+
// 总概率为0
124+
if (totalProb == 0) {
124125
return -1;
125126
}
126127
int random = random(0, totalProb - 1);

core/src/main/java/info/xiaomo/core/untils/StringUtil.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ public static String replace(String strSrc, String strOld, String strNew) {
490490
}
491491

492492
int i = 0;
493-
494-
if (strOld.equals(strNew)) //避免新旧字符一样产生死循环
493+
//避免新旧字符一样产生死循环
494+
if (strOld.equals(strNew))
495495
{
496496
return strSrc;
497497
}
@@ -893,7 +893,8 @@ public static StringBuffer decodeUnicode(final String dataStr) {
893893
} else {
894894
charStr = dataStr.substring(start + 2, end);
895895
}
896-
char letter = (char) Integer.parseInt(charStr, 16); // 16进制parse整形字符串。
896+
// 16进制parse整形字符串。
897+
char letter = (char) Integer.parseInt(charStr, 16);
897898
buffer.append(Character.toString(letter));
898899
start = end;
899900
}

core/src/main/java/info/xiaomo/core/untils/TimeUtil.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ public static String date2Str(String pattern, Date aDate) {
119119
public static Date convertStringToDate(String datePattern, String strDate) {
120120
SimpleDateFormat df;
121121
Date date;
122-
if (strDate.split(SymbolConst.HENGXIAN).length < 2) {//传入的时间是以 / 分割
122+
//传入的时间是以 / 分割
123+
if (strDate.split(SymbolConst.HENGXIAN).length < 2) {
123124
strDate = strDate.replace(SymbolConst.ZHENGXIEXIAN, SymbolConst.HENGXIAN);
124125
}
125126
if (strDate.split(SymbolConst.SPACE).length > 1) {
@@ -141,7 +142,8 @@ public static Date convertStringToDate(String datePattern, String strDate) {
141142
*/
142143
public static Date convertStringToDate(String strDate) {
143144
Date aDate;
144-
if (strDate.split(SymbolConst.HENGXIAN).length < 2) {//传入的时间是以 / 分割
145+
//传入的时间是以 / 分割
146+
if (strDate.split(SymbolConst.HENGXIAN).length < 2) {
145147
strDate = strDate.replace(SymbolConst.ZHENGXIEXIAN, SymbolConst.HENGXIAN);
146148
}
147149
aDate = convertStringToDate(DATE_PATTERN_WITH_HENGXIAN, strDate);
@@ -731,32 +733,41 @@ public static long getTimeFromString(String timeStr, String format) {
731733
*/
732734
public static String getLeftTimeString(long leftTime) {
733735
StringBuilder sb = new StringBuilder();
734-
int leftSecond = (int) (leftTime / 1000);// 剩余秒数
735-
int second = leftSecond % 60;// 秒数
736+
// 剩余秒数
737+
int leftSecond = (int) (leftTime / 1000);
738+
// 秒数
739+
int second = leftSecond % 60;
736740
if (second > 0) {
737741
sb.insert(0, second + "秒");
738742
}
739-
int leftMinute = leftSecond / 60;// 剩余分钟数
740-
int minute = leftMinute % 60;// 分钟数
743+
// 剩余分钟数
744+
int leftMinute = leftSecond / 60;
745+
// 分钟数
746+
int minute = leftMinute % 60;
741747
if (minute > 0) {
742748
sb.insert(0, minute + "分");
743749
}
744-
int leftHour = leftMinute / 60;// 剩余小时
750+
// 剩余小时
751+
int leftHour = leftMinute / 60;
745752
int hour = leftHour % 24;
746753
if (hour > 0) {
747754
sb.insert(0, hour + "小时");
748755
}
749-
int leftDay = leftHour / 24;// 剩余天数
756+
// 剩余天数
757+
int leftDay = leftHour / 24;
750758
if (leftDay > 0) {
751759
sb.insert(0, leftDay + "天");
752760
}
753-
int day = (int) (leftTime / ONE_DAY_IN_MILLISECONDS);// 获取剩余天数
754-
if (day > 0) {// 1天及以上的显示剩余天
761+
// 获取剩余天数
762+
int day = (int) (leftTime / ONE_DAY_IN_MILLISECONDS);
763+
// 1天及以上的显示剩余天
764+
if (day > 0) {
755765
sb.append(day).append("天");
756766
leftTime -= (day * ONE_DAY_IN_MILLISECONDS);
757767
}
758768
hour = (int) (leftTime / ONE_HOUR_IN_MILLISECONDS);
759-
if (hour > 0 || sb.length() > 0) {// 1小时及以上或者前面显示了天数则后面需要小时
769+
// 1小时及以上或者前面显示了天数则后面需要小时
770+
if (hour > 0 || sb.length() > 0) {
760771
sb.append(hour).append("小时");
761772
leftTime -= (hour * ONE_HOUR_IN_MILLISECONDS);
762773
}

core/src/main/java/info/xiaomo/core/untils/XmlUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public static void modifyDocument(File inputXml, String nodes, String attributeN
9595
}
9696
}
9797
XMLWriter output;
98-
if (outXml != null) { //指定输出文件
98+
//指定输出文件
99+
if (outXml != null) {
99100
output = new XMLWriter(new FileWriter(new File(outXml)));
100101
} else { //输出文件为原文件
101102
output = new XMLWriter(new FileWriter(inputXml));

0 commit comments

Comments
 (0)