@@ -164,17 +164,55 @@ public static String generateREADME(File[] listOfFiles) {
164164 "有问题可以给我写邮件(wangdeve@gmail.com), 或者在GitHub上发issue给我.\n \n " +
165165 "| Squence | Problem | Level | Language | Video Tutorial|\n " +
166166 "|:-------:|:--------------|:------:|:---------:|:-------------:|\n " ;
167+ final List <TableRow > tableRows = getTableRows (listOfFiles );
168+ for (int i = 0 ; i < tableRows .size (); i ++) {
169+ outputContent += "|" + i + tableRows .get (i ).getTableComposedLine ();
170+ }
171+ return outputContent ;
172+ }
173+
174+ /*
175+ Generate Review Page contents
176+ Review Page content:
177+ 1. Sequence
178+ 2. Name
179+ 3. Difficulty
180+ 4. Summary of solution, key points.
181+ */
182+ public static String generateReviewPage (File [] listOfFiles ) {
183+ //Assemble output
184+ String outputContent = "# Review Page\n \n " +
185+ "This page summarize the solutions of all problems. For thoughts,ideas written in English, refer to deach individual solution. \n " +
186+ "New problems will be automatically updated once added.\n \n " ;
187+
188+ final List <TableRow > tableRows = getTableRows (listOfFiles );
189+ int count = 0 ;
190+ for (TableRow tableRow : tableRows ) {
191+ outputContent += "**" + count + ". [" + tableRow .getFileName ()
192+ + "](https://github.com/awangdev/LintCode/blob/master/Java/"
193+ + tableRow .getFileName ().replace (" " , "%20" ) +")**" ;
194+
195+ outputContent += " Level: " + tableRow .getLevel () + "\n " ;
196+ outputContent += " " + tableRow .getTutorialLink () + "\n " ;
197+ outputContent += tableRow .getNote () + "\n " ;
198+ outputContent += "\n ---\n " ;
199+ outputContent += "\n ---\n " ;
200+ count ++;
201+ }
202+ return outputContent ;
203+ }
204+
205+
206+
207+ private static List <TableRow > getTableRows (File [] listOfFiles ) {
167208 final ArrayList <TableRow > tableRows = new ArrayList <>();
168209 for (File file : listOfFiles ) {
169210 if (file .getName ().contains (".java" )) {
170211 tableRows .add (getTableRow (file .getName ()));
171212 }
172213 }
173214 Collections .sort (tableRows , Comparator .comparing (TableRow ::getDate ));
174- for (int i = 0 ; i < tableRows .size (); i ++) {
175- outputContent += "|" + i + tableRows .get (i ).getTableComposedLine ();
176- }
177- return outputContent ;
215+ return tableRows ;
178216 }
179217
180218 private static TableRow getTableRow (String fileName ) {
@@ -222,38 +260,6 @@ private static TableRow getTableRow(String fileName) {
222260 return tableRow ;
223261 }
224262
225- /*
226- Generate Review Page contents
227- Review Page content:
228- 1. Sequence
229- 2. Name
230- 3. Difficulty
231- 4. Summary of solution, key points.
232- */
233- public static String generateReviewPage (File [] listOfFiles ) {
234- //Assemble output
235- String outputContent = "# Review Page\n \n " +
236- "This page summarize the solutions of all problems. For thoughts,ideas written in English, refer to deach individual solution. \n " +
237- "New problems will be automatically updated once added.\n \n " ;
238-
239- int count = 0 ;
240- for (File file : listOfFiles ) {
241- if (file .getName ().contains (".java" )) {
242- String convertedFileName = file .getName ().replace (" " , "%20" );
243- outputContent += "**" + count + ". [" + file .getName () + "](https://github.com/awangdev/LintCode/blob/master/Java/" + convertedFileName +")**" ;
244- final TableRow tableRow = getTableRow (file .getName ());
245-
246- outputContent += " Level: " + tableRow .getLevel () + "\n " ;
247- outputContent += " " + tableRow .getTutorialLink () + "\n " ;
248- outputContent += tableRow .getNote () + "\n " ;
249- outputContent += "\n ---\n " ;
250- outputContent += "\n ---\n " ;
251- count ++;
252- }
253- }
254- return outputContent ;
255- }
256-
257263 private static String calculateLevel (final String level ) {
258264 switch (level ) {
259265 case "N" :
0 commit comments