diff options
author | pacien | 2018-01-10 18:49:04 +0100 |
---|---|---|
committer | pacien | 2018-01-10 18:49:19 +0100 |
commit | 6ec0bbf3b3ca7e724430fd6037dfd6e2f1b9b983 (patch) | |
tree | 98d3997a997831cbac2bf9d22e03a00f56c81374 /src/main | |
parent | 4bf5d236f8e0a677643fd551dc605753d3646309 (diff) | |
download | wallj-6ec0bbf3b3ca7e724430fd6037dfd6e2f1b9b983.tar.gz |
Document more
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Diffstat (limited to 'src/main')
4 files changed, 19 insertions, 1 deletions
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; | |||
5 | 5 | ||
6 | /** | 6 | /** |
7 | * An immutable BlockType matrix. | 7 | * An immutable BlockType matrix. |
8 | * | ||
9 | * @author Pacien TRAN-GIRARD | ||
8 | */ | 10 | */ |
9 | public final class Board { | 11 | public final class Board { |
10 | 12 | ||
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; | |||
10 | import java.util.ListIterator; | 10 | import java.util.ListIterator; |
11 | import java.util.stream.Collectors; | 11 | import java.util.stream.Collectors; |
12 | 12 | ||
13 | /** | ||
14 | * Board deserializer. | ||
15 | * | ||
16 | * @author Pacien TRAN-GIRARD | ||
17 | */ | ||
13 | public final class BoardParser { | 18 | public final class BoardParser { |
14 | 19 | ||
15 | private static Board buildBoard(List<List<BlockType>> map) { | 20 | private static Board buildBoard(List<List<BlockType>> map) { |
@@ -28,7 +33,7 @@ public final class BoardParser { | |||
28 | case ' ': | 33 | case ' ': |
29 | return BlockType.FREE; | 34 | return BlockType.FREE; |
30 | case 'W': | 35 | case 'W': |
31 | return BlockType.wALL; | 36 | return BlockType.WALL; |
32 | case 'T': | 37 | case 'T': |
33 | return BlockType.TRASH; | 38 | return BlockType.TRASH; |
34 | case 'G': | 39 | case 'G': |
@@ -44,6 +49,13 @@ public final class BoardParser { | |||
44 | .collect(Collectors.toList()); | 49 | .collect(Collectors.toList()); |
45 | } | 50 | } |
46 | 51 | ||
52 | /** | ||
53 | * Parses a block from a file. | ||
54 | * | ||
55 | * @param filePath path to the map file | ||
56 | * @return the parsed Board | ||
57 | * @throws IOException any IO exception that happened while reading the file | ||
58 | */ | ||
47 | public static Board parse(Path filePath) throws IOException { | 59 | public static Board parse(Path filePath) throws IOException { |
48 | return buildBoard(Files.lines(filePath) | 60 | return buildBoard(Files.lines(filePath) |
49 | .filter(s -> !s.isEmpty()) | 61 | .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; | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * A typed immutable tile coordinate vector containing the coordinates of a Tile in a Board. | 8 | * A typed immutable tile coordinate vector containing the coordinates of a Tile in a Board. |
9 | * | ||
10 | * @author Pacien TRAN-GIRARD | ||
9 | */ | 11 | */ |
10 | public final class TileVec2 { | 12 | public final class TileVec2 { |
11 | 13 | ||
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; | |||
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Utility functions for two dimension arrays and lists. | 6 | * Utility functions for two dimension arrays and lists. |
7 | * | ||
8 | * @author Pacien TRAN-GIRARD | ||
7 | */ | 9 | */ |
8 | public final class Matrix { | 10 | public final class Matrix { |
9 | 11 | ||