aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ch/epfl/xblast/server/Board.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java
index bde0ae9..4d2e743 100644
--- a/src/ch/epfl/xblast/server/Board.java
+++ b/src/ch/epfl/xblast/server/Board.java
@@ -1,8 +1,8 @@
1package ch.epfl.xblast.server; 1package ch.epfl.xblast.server;
2 2
3import ch.epfl.cs108.Sq; 3import ch.epfl.cs108.Sq;
4import ch.epfl.xblast.Lists;
5import ch.epfl.xblast.Cell; 4import ch.epfl.xblast.Cell;
5import ch.epfl.xblast.Lists;
6 6
7import java.util.ArrayList; 7import java.util.ArrayList;
8import java.util.List; 8import java.util.List;
@@ -14,6 +14,7 @@ import java.util.List;
14 * @author Timothée FLOURE (257420) 14 * @author Timothée FLOURE (257420)
15 */ 15 */
16public final class Board { 16public final class Board {
17
17 private static final int BLOCKS_LIST_SIZE = 195; 18 private static final int BLOCKS_LIST_SIZE = 195;
18 private static final int BOARD_ROWS = 13; 19 private static final int BOARD_ROWS = 13;
19 private static final int BOARD_COLUMNS = 15; 20 private static final int BOARD_COLUMNS = 15;
@@ -23,10 +24,10 @@ public final class Board {
23 private static final int QUADRANT_COLUMNS = 7; 24 private static final int QUADRANT_COLUMNS = 7;
24 25
25 /** 26 /**
26 * Throw an exeption if the matrix does not have the given number of rows/columns. 27 * Throw an exception if the matrix does not have the given number of rows/columns.
27 * 28 *
28 * @param matrix the tested matrix 29 * @param matrix the tested matrix
29 * @param rows the expected number of rows 30 * @param rows the expected number of rows
30 * @param columns the expected number of columns 31 * @param columns the expected number of columns
31 * @throws IllegalArgumentException if the matrix does not comply with the given sizes. 32 * @throws IllegalArgumentException if the matrix does not comply with the given sizes.
32 */ 33 */
@@ -48,7 +49,7 @@ public final class Board {
48 private List<Sq<Block>> blocks; 49 private List<Sq<Block>> blocks;
49 50
50 /** 51 /**
51 * Instanciates a new Board with the given sequence of blocks. 52 * Instantiates a new Board with the given sequence of blocks.
52 * 53 *
53 * @param blocks sequence containing all the blocks of the Boards 54 * @param blocks sequence containing all the blocks of the Boards
54 * @throws IllegalArgumentException if the blocks is not composed of BLOC_LIST_SIZE elements 55 * @throws IllegalArgumentException if the blocks is not composed of BLOC_LIST_SIZE elements
@@ -85,7 +86,7 @@ public final class Board {
85 * 86 *
86 * @param innerBlocks lists of the internal rows 87 * @param innerBlocks lists of the internal rows
87 * @return a new walled board filled with the given rows 88 * @return a new walled board filled with the given rows
88 * @throws IllegalArgumentException if innerbLocks is not INNER_BOARD_ROWS * INNER_BOARD_COLUMNS 89 * @throws IllegalArgumentException if innerBlocks is not INNER_BOARD_ROWS * INNER_BOARD_COLUMNS
89 */ 90 */
90 public static Board ofInnerBlocksWalled(List<List<Block>> innerBlocks) { 91 public static Board ofInnerBlocksWalled(List<List<Block>> innerBlocks) {
91 checkBlockMatrix(innerBlocks, INNER_BOARD_ROWS, INNER_BOARD_COLUMNS); 92 checkBlockMatrix(innerBlocks, INNER_BOARD_ROWS, INNER_BOARD_COLUMNS);
@@ -147,4 +148,5 @@ public final class Board {
147 public Block blockAt(Cell c) { 148 public Block blockAt(Cell c) {
148 return blocksAt(c).head(); 149 return blocksAt(c).head();
149 } 150 }
151
150} 152}