aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimothée Floure2016-03-01 16:26:40 +0100
committerTimothée Floure2016-03-01 16:26:40 +0100
commitb25cee830238c64c08a2e3733bbed0730d20a734 (patch)
tree5f4d0a6d8c69f0373db313a442d0e969d3228e07 /src
parent55e19228a2b9119f136f62b050421ac91cdecf53 (diff)
downloadxblast-b25cee830238c64c08a2e3733bbed0730d20a734.tar.gz
Add the blocksAt() and blockAt() methods to the Board class
Diffstat (limited to 'src')
-rw-r--r--src/ch/epfl/xblast/server/Board.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java
index 5e899f6..2cbf380 100644
--- a/src/ch/epfl/xblast/server/Board.java
+++ b/src/ch/epfl/xblast/server/Board.java
@@ -2,6 +2,7 @@ package ch.epfl.xblast.server;
2 2
3import ch.epfl.cs108.Sq; 3import ch.epfl.cs108.Sq;
4import ch.epfl.xblast.Lists; 4import ch.epfl.xblast.Lists;
5import ch.epfl.xblast.Cell;
5 6
6import java.util.ArrayList; 7import java.util.ArrayList;
7import java.util.List; 8import java.util.List;
@@ -123,4 +124,23 @@ public final class Board {
123 return ofInnerBlocksWalled(rowsList); 124 return ofInnerBlocksWalled(rowsList);
124 } 125 }
125 126
127 /**
128 * Return the sequence of blocks related to the given cell.
129 *
130 * @param c cell
131 * @return the sequence of blocks related to the given cell.
132 */
133 public Sq<Block> blocksAt(Cell c) {
134 return blocks.get(c.rowMajorIndex());
135 }
136
137 /**
138 * Returns the block related to the given cell.
139 *
140 * @param c cell
141 * @return the first block of the sequence related to the given cell
142 */
143 public Block blockAt(Cell c) {
144 return blocksAt(c).head();
145 }
126} 146}