diff --git a/src/main/java/fr/u_paris/gla/project/io/NetworkFormat.java b/src/main/java/fr/u_paris/gla/project/io/NetworkFormat.java index 0113744..11663dd 100644 --- a/src/main/java/fr/u_paris/gla/project/io/NetworkFormat.java +++ b/src/main/java/fr/u_paris/gla/project/io/NetworkFormat.java @@ -45,11 +45,19 @@ public final class NetworkFormat { // Tool class } + /** Convert a {@link java.lang.String} into a {@link java.time.Duration} + * @param duration the {@link java.lang.String} + * @return the {@link java.time.Duration} object + */ public static Duration parseDuration(String duration) { LocalTime time = LocalTime.parse("00:" + duration, DURATION_FORMATTER); return Duration.between(time, ZERO); } + /** Format a {@link java.time.Duration} into a {@link java.lang.String} + * @param duration an object of type {@link java.time.Duration} + * @return a String that depicts the duration in format MM:SS + */ public static String formatDuration(Duration duration) { return DURATION_INDIVIDUAL_FORMATTER.format(duration.toMinutes()) + ":" + DURATION_INDIVIDUAL_FORMATTER.format(duration.toSecondsPart()); diff --git a/src/main/java/fr/u_paris/gla/project/io/ScheduleFormat.java b/src/main/java/fr/u_paris/gla/project/io/ScheduleFormat.java index 8a86594..c97b233 100644 --- a/src/main/java/fr/u_paris/gla/project/io/ScheduleFormat.java +++ b/src/main/java/fr/u_paris/gla/project/io/ScheduleFormat.java @@ -41,6 +41,9 @@ public final class ScheduleFormat { } + /** Create a {@link java.time.format.DateTimeFormatter} object used to format Dates + * @return the formatter + */ public static DateTimeFormatter getTimeFormatter() { return DateTimeFormatter.ofPattern("HH:mm").withResolverStyle(ResolverStyle.LENIENT); } diff --git a/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java b/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java index b3194f9..5332a41 100644 --- a/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java +++ b/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java @@ -32,6 +32,11 @@ public final class CSVTools { // Tool class } + /** get a CSV file from a URL, download and parse it, and keep values in memory + * @param url the address of the CSV file + * @param contentLineConsumer the variable used to store the data + * @throws IOException if it's impossible to download the file + */ public static void readCSVFromURL(String url, Consumer contentLineConsumer) throws IOException { ICSVParser parser = new CSVParserBuilder().withSeparator(';').build(); @@ -52,6 +57,11 @@ public final class CSVTools { } } + /** Save our current CSV variable's data into an actual file + * @param filename the saved file's name and path + * @param contentLineConsumer our data variable + * @throws IOException if we can't write the data into the file + */ public static void writeCSVToFile(String filename, Stream contentLineConsumer) throws IOException { try (FileWriter writer = new FileWriter(filename, StandardCharsets.UTF_8)) {