Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc112778

Browse files
committed
Improved array generation
1 parent8435706 commitc112778

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

‎src/main/java/generatejavadoc/Main.java‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
publicclassMain {
1414
privatestaticfinalPatternPATTERN =Pattern.compile("\\r?\\n");
1515

16+
privateenumType {
17+
JAVA,
18+
KOTLIN
19+
}
20+
1621
privatestaticvoidfillFilesRecursively(Pathdirectory,finalList<File>resultFiles)
1722
throwsIOException {
1823
Files.walkFileTree(
@@ -58,7 +63,7 @@ public static void main(String[] args) throws IOException {
5863
"\n- [",
5964
" board = [[",
6065
" grid = [[",
61-
" =[[",
66+
"[[",
6267
"**,",
6368
"**]",
6469
"(**",
@@ -86,7 +91,7 @@ public static void main(String[] args) throws IOException {
8691
"\n-\\[",
8792
" board = [ [",
8893
" grid = [ [",
89-
" =\\[\\[",
94+
"\\[\\[",
9095
"** ,",
9196
"** ]",
9297
"( **",
@@ -108,6 +113,12 @@ public static void main(String[] args) throws IOException {
108113
"<code>","</code>","<sub>","</sub>","<sup>","</sup>","<ins>",
109114
"</ins>",
110115
};
116+
Typetype =
117+
(javaFile.getAbsolutePath().endsWith(".java")
118+
?Type.JAVA
119+
:javaFile.getAbsolutePath().endsWith(".kt")
120+
?Type.KOTLIN
121+
:null);
111122
StringreadmeMdJavadoc =
112123
"/**\n"
113124
+StringUtils.replaceEach(
@@ -117,7 +128,8 @@ public static void main(String[] args) throws IOException {
117128
line ->
118129
getString(
119130
line,
120-
index))
131+
index,
132+
type))
121133
.collect(
122134
Collectors.joining(
123135
"\n")),
@@ -145,8 +157,8 @@ public static void main(String[] args) throws IOException {
145157
}
146158
}
147159

148-
privatestaticStringgetString(Stringline,int[]index) {
149-
StringfirstLine =line.replace("\\."," -") +"\\.";
160+
privatestaticStringgetString(Stringline,int[]index,Typetype) {
161+
StringfirstLine =line.replace("\\."," -") +(type ==Type.JAVA ?"\\." :".");
150162
Stringstr =index[0]++ ==0 ?firstLine :line;
151163
returnline.isEmpty() ?" *" :" * " +str;
152164
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp