Package net.royalur.model.shape
Class BoardShape
java.lang.Object
net.royalur.model.shape.BoardShape
- Direct Known Subclasses:
AsebBoardShape,StandardBoardShape
A type of board shape available for the Royal Game of Ur.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whethertilefalls within this board shape.booleancontainsAll(Collection<Tile> tiles) Determines whether all tiles intilesare included in this board shape.booleancontainsIndices(int ix, int iy) Determines whether the tile at indices (ix,iy), 0-based, falls within the bounds of this shape of board.booleanintgetArea()Gets the number of tiles contained in this board shape.Gets the type of this board.intGets the height of the board shape.getID()Gets the ID of this board shape.getName()Gets the name of this board.Gets the set of tiles that represent rosette tiles in this board shape.getTiles()Gets the set of tiles that fall within the bounds of this board shape.The tiles that fall within the bounds of this board shape, ordered by ascending column number, and then ascending row number.Returns the tiles that fall within the bounds of this board shape, ordered by ascending row number, and then ascending column number.intgetWidth()Gets the width of the board shape.booleanGets whether this board has an associated board type.booleanisCompatible(PathPair paths) Determines whetherpathscan be used on this shape of board.booleanisEquivalent(BoardShape other) Determines whether this board shape covers the same tiles, and has the same rosettes, asother.booleanDetermines whethertileis a rosette tile in this board shape.booleanisRosetteIndices(int ix, int iy) Determines whether the tile at the indices (ix,iy), 0-based, is a rosette tile in this board shape.
-
Constructor Details
-
BoardShape
Instantiates a board shape withtilesrepresenting the tiles on the board.- Parameters:
id- The ID of this board shape.tiles- The set of tiles that fall within this board shape.rosettes- The set of tiles that represent rosettes in this board shape.
-
-
Method Details
-
getID
Gets the ID of this board shape.- Returns:
- The ID of this board shape.
-
hasBoardType
public boolean hasBoardType()Gets whether this board has an associated board type. Custom board may not have an associated board type.- Returns:
- Whether this board has an associated board type.
-
getBoardType
Gets the type of this board.- Returns:
- The type of this board.
-
getName
Gets the name of this board.- Returns:
- The name of this board.
-
getTiles
Gets the set of tiles that fall within the bounds of this board shape.- Returns:
- The set of tiles that fall within the bounds of this board shape.
-
getRosetteTiles
Gets the set of tiles that represent rosette tiles in this board shape.- Returns:
- The set of tiles that represent rosette tiles in this board shape.
-
getWidth
public int getWidth()Gets the width of the board shape.- Returns:
- The number of x-coordinates that exist in this board shape.
-
getHeight
public int getHeight()Gets the height of the board shape.- Returns:
- The number of y-coordinates that exist in this board shape.
-
getArea
public int getArea()Gets the number of tiles contained in this board shape.- Returns:
- The number of tiles contained in this board shape.
-
getTilesByRow
Returns the tiles that fall within the bounds of this board shape, ordered by ascending row number, and then ascending column number.- Returns:
- The tiles of this board ordered by ascending row, and then ascending column number.
-
getTilesByColumn
The tiles that fall within the bounds of this board shape, ordered by ascending column number, and then ascending row number.- Returns:
- The tiles of this board ordered by ascending column, and then ascending row.
-
contains
Determines whethertilefalls within this board shape.- Parameters:
tile- The tile to be bounds-checked.- Returns:
- Whether the given tile falls within this board shape.
-
containsIndices
public boolean containsIndices(int ix, int iy) Determines whether the tile at indices (ix,iy), 0-based, falls within the bounds of this shape of board.- Parameters:
ix- The x-index of the tile to be bounds-checked. This coordinate is 0-based.iy- The y-index of the tile to be bounds-checked. This coordinate is 0-based.- Returns:
- Whether the given tile falls within the bounds of this shape of board.
-
containsAll
Determines whether all tiles intilesare included in this board shape.- Parameters:
tiles- The tiles to check for.- Returns:
- Whether all of
tilesexist on this board shape.
-
isRosette
Determines whethertileis a rosette tile in this board shape.- Parameters:
tile- The tile to check if it is a rosette.- Returns:
- Whether the given tile is a rosette tile on this board.
-
isRosetteIndices
public boolean isRosetteIndices(int ix, int iy) Determines whether the tile at the indices (ix,iy), 0-based, is a rosette tile in this board shape.- Parameters:
ix- The x-index of the tile to be checked for being a rosette. This coordinate is 0-based.iy- The y-index of the tile to be checked for being a rosette. This coordinate is 0-based.- Returns:
- Whether the given tile is a rosette tile on this board.
-
isCompatible
Determines whetherpathscan be used on this shape of board.- Parameters:
paths- The pair of paths.- Returns:
- Whether the pair of paths could be used on this shape of board.
-
isEquivalent
Determines whether this board shape covers the same tiles, and has the same rosettes, asother.- Parameters:
other- The board shape to compare with for equivalence.- Returns:
- Whether this board shape is equivalent to .
-
equals
-