|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object erland.game.tetris.BlockContainerData
Class that keeps track of the color and state on all squares in a game area
Field Summary | |
protected java.awt.Color[][] |
colorMatrix
Matrix that keeps track of the colour of all squares |
protected boolean[][] |
matrix
Matrix that keeps track of the state of all squares |
Constructor Summary | |
(package private) |
BlockContainerData(int sizeX,
int sizeY)
Create a new instance |
Method Summary | |
void |
clear()
Reset the states on all squares |
void |
clearRow(int y)
Reset the states on all squares in a row |
void |
fromString(java.lang.String data)
|
java.awt.Color |
getColor(int x,
int y)
Get the color of a specific square |
int |
getHeight()
Get the number of vertical squares in the container |
int |
getWidth()
Get the number of horisontal squares in the container |
boolean |
isUsed(int x,
int y)
Checks if a specific square is active or not |
void |
setUnused(int x,
int y)
Change the state to not active for a specific square |
void |
setUsed(int x,
int y,
java.awt.Color c)
Change the state to active for a specific square |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean[][] matrix
protected java.awt.Color[][] colorMatrix
Constructor Detail |
BlockContainerData(int sizeX, int sizeY)
sizeX
- Number of horizontal squaressizeY
- Number of vertical squaresMethod Detail |
public void clear()
public void clearRow(int y)
y
- Vertical row that should be cleared, 0 is the top rowpublic java.awt.Color getColor(int x, int y)
BlockMatrix
getColor
in interface BlockMatrix
x
- The x position of the squarey
- The y position of the square
public int getWidth()
BlockMatrix
getWidth
in interface BlockMatrix
public int getHeight()
BlockMatrix
getHeight
in interface BlockMatrix
public boolean isUsed(int x, int y)
BlockMatrix
isUsed
in interface BlockMatrix
x
- The x position of the squarey
- The y position of the square
public void setUsed(int x, int y, java.awt.Color c)
BlockMatrix
setUsed
in interface BlockMatrix
x
- The x position of the squarey
- The y position of the squarec
- The colour of the squarepublic void setUnused(int x, int y)
BlockMatrix
setUnused
in interface BlockMatrix
x
- The x position of the squarey
- The y position of the squarepublic void fromString(java.lang.String data)
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |