Package com.takenoko.layers.tile
Class TileLayer
java.lang.Object
com.takenoko.layers.tile.TileLayer
The TileLayer class is used to manage the tiles on the board.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final HashSet<PositionVector>
(package private) final HashMap<PositionVector,
Tile> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyImprovement
(ImprovementType improvementType, PositionVector positionVector, Board board) copy()
boolean
Get the positions where an improvement can be placed.Get the available tiles.Get the available tiles.getTileAt
(PositionVector positionVector) Return the tile at the given position.getTiles()
Get the tiles on the board.Get the tile placed on the board but without the pond.int
hashCode()
private boolean
isPositionAvailable
(PositionVector position) Check if a position is available.boolean
isTile
(PositionVector position) Check if there is a tile at the given position.placeTile
(Tile tile, PositionVector position, Board board) Place a tile on the board.private void
updateAvailableTilePositions
(PositionVector position) Update the available tile positions after placing a tile.
-
Field Details
-
tiles
-
availableTilePositions
-
-
Constructor Details
-
TileLayer
public TileLayer()Create a new TileLayer. -
TileLayer
-
-
Method Details
-
placeTile
Place a tile on the board. and update the available tiles and the available tile positions.- Parameters:
tile
- the tile to add to the boardposition
- the position of the tileboard
- the board- Returns:
- the LayerBambooStack at the position of the tile
-
updateAvailableTilePositions
Update the available tile positions after placing a tile.- Parameters:
position
- the position of the tile to remove
-
isPositionAvailable
Check if a position is available. A position is available if: - it is not already occupied by a tile - it has at least 2 neighbors or 1 neighbor is a pond- Parameters:
position
- the position to check
-
getTiles
Get the tiles on the board.- Returns:
- the tiles on the board
-
getAvailableTilePositions
Get the available tiles.- Returns:
- the available tiles
-
getAvailableTiles
Get the available tiles.- Returns:
- the list of available tiles
-
getAvailableImprovementPositions
Get the positions where an improvement can be placed.- Returns:
- the positions where an improvement can be placed
-
getTilesWithoutPond
Get the tile placed on the board but without the pond.- Returns:
- the tile placed on the board but without the pond.
-
isTile
Check if there is a tile at the given position.- Parameters:
position
- the position of the tile- Returns:
- if there is a tile at the position
-
getTileAt
Return the tile at the given position.- Parameters:
positionVector
- the position of the tile- Returns:
- the tile at the given position
-
copy
-
equals
-
hashCode
public int hashCode() -
applyImprovement
public void applyImprovement(ImprovementType improvementType, PositionVector positionVector, Board board)
-