From 6ec0bbf3b3ca7e724430fd6037dfd6e2f1b9b983 Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 10 Jan 2018 18:49:04 +0100 Subject: Document more Signed-off-by: pacien --- src/main/java/fr/umlv/java/wallj/board/Board.java | 2 ++ src/main/java/fr/umlv/java/wallj/board/BoardParser.java | 14 +++++++++++++- src/main/java/fr/umlv/java/wallj/board/TileVec2.java | 2 ++ src/main/java/fr/umlv/java/wallj/utils/Matrix.java | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/main/java/fr') diff --git a/src/main/java/fr/umlv/java/wallj/board/Board.java b/src/main/java/fr/umlv/java/wallj/board/Board.java index fbe6ad9..c697cc2 100644 --- a/src/main/java/fr/umlv/java/wallj/board/Board.java +++ b/src/main/java/fr/umlv/java/wallj/board/Board.java @@ -5,6 +5,8 @@ import fr.umlv.java.wallj.utils.Matrix; /** * An immutable BlockType matrix. + * + * @author Pacien TRAN-GIRARD */ public final class Board { diff --git a/src/main/java/fr/umlv/java/wallj/board/BoardParser.java b/src/main/java/fr/umlv/java/wallj/board/BoardParser.java index b7db602..3d8386a 100644 --- a/src/main/java/fr/umlv/java/wallj/board/BoardParser.java +++ b/src/main/java/fr/umlv/java/wallj/board/BoardParser.java @@ -10,6 +10,11 @@ import java.util.List; import java.util.ListIterator; import java.util.stream.Collectors; +/** + * Board deserializer. + * + * @author Pacien TRAN-GIRARD + */ public final class BoardParser { private static Board buildBoard(List> map) { @@ -28,7 +33,7 @@ public final class BoardParser { case ' ': return BlockType.FREE; case 'W': - return BlockType.wALL; + return BlockType.WALL; case 'T': return BlockType.TRASH; case 'G': @@ -44,6 +49,13 @@ public final class BoardParser { .collect(Collectors.toList()); } + /** + * Parses a block from a file. + * + * @param filePath path to the map file + * @return the parsed Board + * @throws IOException any IO exception that happened while reading the file + */ public static Board parse(Path filePath) throws IOException { return buildBoard(Files.lines(filePath) .filter(s -> !s.isEmpty()) diff --git a/src/main/java/fr/umlv/java/wallj/board/TileVec2.java b/src/main/java/fr/umlv/java/wallj/board/TileVec2.java index ac28b6d..6ccd116 100644 --- a/src/main/java/fr/umlv/java/wallj/board/TileVec2.java +++ b/src/main/java/fr/umlv/java/wallj/board/TileVec2.java @@ -6,6 +6,8 @@ import java.util.Objects; /** * A typed immutable tile coordinate vector containing the coordinates of a Tile in a Board. + * + * @author Pacien TRAN-GIRARD */ public final class TileVec2 { diff --git a/src/main/java/fr/umlv/java/wallj/utils/Matrix.java b/src/main/java/fr/umlv/java/wallj/utils/Matrix.java index e3702bf..83dfc11 100644 --- a/src/main/java/fr/umlv/java/wallj/utils/Matrix.java +++ b/src/main/java/fr/umlv/java/wallj/utils/Matrix.java @@ -4,6 +4,8 @@ import java.util.List; /** * Utility functions for two dimension arrays and lists. + * + * @author Pacien TRAN-GIRARD */ public final class Matrix { -- cgit v1.2.3