1 package erland.game.tetris;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import java.awt.Color;
22
23 /***
24 * Represents a container with squares, where each square may
25 * be (active/not active) and each square also has a colour
26 * @author Erland Isaksson
27 */
28 interface BlockMatrix
29 {
30 /***
31 * Get the number of horisontal squares in the container
32 * @return Number of horisontal squares
33 */
34 public int getWidth();
35
36 /***
37 * Get the number of vertical squares in the container
38 * @return Number of vertical squares
39 */
40 public int getHeight();
41
42 /***
43 * Get the color of a specific square
44 * @param x The x position of the square
45 * @param y The y position of the square
46 * @return The color of the square, Color.black if it is outside the container
47 */
48 public Color getColor(int x, int y);
49
50 /***
51 * Checks if a specific square is active or not
52 * @param x The x position of the square
53 * @param y The y position of the square
54 * @return true/false (active/not active)
55 */
56 public boolean isUsed(int x, int y);
57
58 /***
59 * Change the state to active for a specific square
60 * @param x The x position of the square
61 * @param y The y position of the square
62 * @param c The colour of the square
63 */
64 public void setUsed(int x, int y, Color c);
65
66 /***
67 * Change the state to not active for a specific square
68 * @param x The x position of the square
69 * @param y The y position of the square
70 */
71 public void setUnused(int x, int y);
72 }