Package webb.client.logic.puzzle
Class CellLogic
java.lang.Object
webb.client.logic.puzzle.CellLogic
This class represents a single cell in the puzzle grid.
Allows us to not deal with coordinates and just use row and col.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCol()Get the column of the cellintgetGroup()Get the group of the cellintgetRow()Get the row of the cellgetType()Get the type of the cellboolean[]getWalls()Get the walls of the cellbooleanCheck if the cell is in the solutionvoidonClick(boolean rightClick) Called when the cell is clickedvoidsetDrawIcon(boolean drawIcon) Set if the cell should draw the iconvoidsetGroup(int group) Set the group of the cellvoidSet the cell as in the solutionvoidSet the type of the cellvoidsetWall(int wall) Set witch side(s) of the cell has a wallbooleanCheck if the cell should draw the icon
-
Field Details
-
NO_GROUP
public static final int NO_GROUP- See Also:
-
WALL_NORTH
public static final int WALL_NORTH- See Also:
-
WALL_EAST
public static final int WALL_EAST- See Also:
-
WALL_SOUTH
public static final int WALL_SOUTH- See Also:
-
WALL_WEST
public static final int WALL_WEST- See Also:
-
-
Constructor Details
-
CellLogic
public CellLogic(int col, int row) Create a new cell- Parameters:
col- Column of the cellrow- Row of the cell
-
-
Method Details
-
getRow
public int getRow()Get the row of the cell- Returns:
- Row of the cell
-
getCol
public int getCol()Get the column of the cell- Returns:
- Column of the cell
-
getType
Get the type of the cell- Returns:
- Type of the cell
-
setType
Set the type of the cell- Parameters:
type- Type of the cell
-
onClick
public void onClick(boolean rightClick) Called when the cell is clicked- Parameters:
rightClick- True if the right mouse button was clicked
-
setGroup
public void setGroup(int group) Set the group of the cell- Parameters:
group- Group of the cell
-
getGroup
public int getGroup()Get the group of the cell- Returns:
- Group of the cell
-
setWall
public void setWall(int wall) Set witch side(s) of the cell has a wall- Parameters:
wall- Side to set the wall on- See Also:
-
getWalls
public boolean[] getWalls()Get the walls of the cell- Returns:
- Array of walls
- See Also:
-
setSolutionStar
public void setSolutionStar()Set the cell as in the solution -
isSolutionStar
public boolean isSolutionStar()Check if the cell is in the solution -
setDrawIcon
public void setDrawIcon(boolean drawIcon) Set if the cell should draw the icon- Parameters:
drawIcon- True if the cell should draw the icon
-
shouldDrawIcon
public boolean shouldDrawIcon()Check if the cell should draw the icon- Returns:
- True if the cell should draw the icon
-