Skip to content

Commit

Permalink
refactor: #81 In PageUrls, extract the common path pattern to a commo…
Browse files Browse the repository at this point in the history
…n method.
  • Loading branch information
dmitry-weirdo committed Nov 22, 2024
1 parent 6c83724 commit 31f308e
Showing 1 changed file with 33 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,97 +96,102 @@ public static String removeLeadingSlash(final String path) {
}

public static String getIndexPageFilePath(final String rootDir) {
return rootDir + "/" + INDEX;
return fullPath(rootDir, INDEX);
}

public static String getTopBySpeedPageFilePath(final String rootDir, final int pageNumber) {
return rootDir + "/" + "stat-top-by-best-speed-page-" + pageNumber + ".html";
String pageFileName = "stat-top-by-best-speed-page-" + pageNumber + ".html";
return fullPath(rootDir, pageFileName);
}
public static String getTopBySpeedAllPagesExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_BEST_SPEED_ALL_PAGES_XLSX;
return fullPath(rootDir, TOP_BY_BEST_SPEED_ALL_PAGES_XLSX);
}
public static String getTopBySpeedAllPagesExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_BEST_SPEED_ALL_PAGES_ZIP;
return fullPath(rootDir, TOP_BY_BEST_SPEED_ALL_PAGES_ZIP);
}

public static String getTopBySpeedLoginToPageFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_BEST_SPEED_LOGIN_TO_PAGE_JS;
return fullPath(rootDir, TOP_BY_BEST_SPEED_LOGIN_TO_PAGE_JS);
}

public static String getTopByTotalRacesCountFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_TOTAL_RACES;
return fullPath(rootDir, TOP_BY_TOTAL_RACES);
}
public static String getTopByTotalRacesCountExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_TOTAL_RACES_XLSX;
return fullPath(rootDir, TOP_BY_TOTAL_RACES_XLSX);
}
public static String getTopByTotalRacesCountExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_TOTAL_RACES_ZIP;
return fullPath(rootDir, TOP_BY_TOTAL_RACES_ZIP);
}

public static String getTopByBestSpeedFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_BEST_SPEED;
return fullPath(rootDir, TOP_BY_BEST_SPEED);
}
public static String getTopByBestSpeedExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_BEST_SPEED_XLSX;
return fullPath(rootDir, TOP_BY_BEST_SPEED_XLSX);
}
public static String getTopByBestSpeedExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_BEST_SPEED_ZIP;
return fullPath(rootDir, TOP_BY_BEST_SPEED_ZIP);
}

public static String getTopByRatingLevelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_RATING_LEVEL;
return fullPath(rootDir, TOP_BY_RATING_LEVEL);
}
public static String getTopByRatingLevelExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_RATING_LEVEL_XLSX;
return fullPath(rootDir, TOP_BY_RATING_LEVEL_XLSX);
}
public static String getTopByRatingLevelExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_RATING_LEVEL_ZIP;
return fullPath(rootDir, TOP_BY_RATING_LEVEL_ZIP);
}

public static String getTopByFriendsCountFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_FRIENDS_COUNT;
return fullPath(rootDir, TOP_BY_FRIENDS_COUNT);
}
public static String getTopByFriendsCountExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_FRIENDS_COUNT_XLSX;
return fullPath(rootDir, TOP_BY_FRIENDS_COUNT_XLSX);
}
public static String getTopByFriendsCountExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_FRIENDS_COUNT_ZIP;
return fullPath(rootDir, TOP_BY_FRIENDS_COUNT_ZIP);
}

public static String getTopByAchievementsCountFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_ACHIEVEMENTS_COUNT;
return fullPath(rootDir, TOP_BY_ACHIEVEMENTS_COUNT);
}
public static String getTopByAchievementsCountExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_ACHIEVEMENTS_COUNT_XLSX;
return fullPath(rootDir, TOP_BY_ACHIEVEMENTS_COUNT_XLSX);
}
public static String getTopByAchievementsCountExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_ACHIEVEMENTS_COUNT_ZIP;
return fullPath(rootDir, TOP_BY_ACHIEVEMENTS_COUNT_ZIP);
}

public static String getTopByVocabulariesCountFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_VOCABULARIES_COUNT;
return fullPath(rootDir, TOP_BY_VOCABULARIES_COUNT);
}
public static String getTopByVocabulariesCountExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_VOCABULARIES_COUNT_XLSX;
return fullPath(rootDir, TOP_BY_VOCABULARIES_COUNT_XLSX);
}
public static String getTopByVocabulariesCountExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_VOCABULARIES_COUNT_ZIP;
return fullPath(rootDir, TOP_BY_VOCABULARIES_COUNT_ZIP);
}

public static String getTopByCarsCountFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_CARS_COUNT;
return fullPath(rootDir, TOP_BY_CARS_COUNT);
}
public static String getTopByCarsCountExcelFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_CARS_COUNT_XLSX;
return fullPath(rootDir, TOP_BY_CARS_COUNT_XLSX);
}
public static String getTopByCarsCountExcelZipFilePath(final String rootDir) {
return rootDir + "/" + TOP_BY_CARS_COUNT_ZIP;
return fullPath(rootDir, TOP_BY_CARS_COUNT_ZIP);
}

public static String getPlayerByRankFilePath(final String rootDir) {
return rootDir + "/" + PLAYER_BY_RANK;
return fullPath(rootDir, PLAYER_BY_RANK);
}
public static String getPlayerByRankDataFilePath(final String rootDir) {
return rootDir + "/" + PLAYERS_BY_RANK_DATA_JS;
return fullPath(rootDir, PLAYERS_BY_RANK_DATA_JS);
}

private static String fullPath(String rootDir, String relativePath) {
return rootDir + "/" + relativePath;
}
}

0 comments on commit 31f308e

Please sign in to comment.