Class BoardShape

java.lang.Object
net.royalur.model.shape.BoardShape
Direct Known Subclasses:
AsebBoardShape, StandardBoardShape

public class BoardShape extends Object
A type of board shape available for the Royal Game of Ur.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BoardShape(String id, Set<Tile> tiles, Set<Tile> rosettes)
    Instantiates a board shape with tiles representing the tiles on the board.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Tile tile)
    Determines whether tile falls within this board shape.
    boolean
    Determines whether all tiles in tiles are included in this board shape.
    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.
    boolean
     
    int
    Gets the number of tiles contained in this board shape.
    Gets the type of this board.
    int
    Gets the height of the board shape.
    Gets the ID of this board shape.
    Gets the name of this board.
    Gets the set of tiles that represent rosette tiles in this board shape.
    Gets the set of tiles that fall within the bounds of this board shape.
    final List<Tile>
    The tiles that fall within the bounds of this board shape, ordered by ascending column number, and then ascending row number.
    final List<Tile>
    Returns the tiles that fall within the bounds of this board shape, ordered by ascending row number, and then ascending column number.
    int
    Gets the width of the board shape.
    boolean
    Gets whether this board has an associated board type.
    boolean
    Determines whether paths can be used on this shape of board.
    boolean
    Determines whether this board shape covers the same tiles, and has the same rosettes, as other.
    boolean
    Determines whether tile is a rosette tile in this board shape.
    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.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BoardShape

      public BoardShape(String id, Set<Tile> tiles, Set<Tile> rosettes)
      Instantiates a board shape with tiles representing 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

      public String 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

      public BoardType getBoardType()
      Gets the type of this board.
      Returns:
      The type of this board.
    • getName

      public String getName()
      Gets the name of this board.
      Returns:
      The name of this board.
    • getTiles

      public Set<Tile> 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

      public Set<Tile> 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

      public final List<Tile> 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

      public final List<Tile> 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

      public boolean contains(Tile tile)
      Determines whether tile falls 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

      public boolean containsAll(Collection<Tile> tiles)
      Determines whether all tiles in tiles are included in this board shape.
      Parameters:
      tiles - The tiles to check for.
      Returns:
      Whether all of tiles exist on this board shape.
    • isRosette

      public boolean isRosette(Tile tile)
      Determines whether tile is 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

      public boolean isCompatible(PathPair paths)
      Determines whether paths can 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

      public boolean isEquivalent(BoardShape other)
      Determines whether this board shape covers the same tiles, and has the same rosettes, as other.
      Parameters:
      other - The board shape to compare with for equivalence.
      Returns:
      Whether this board shape is equivalent to .
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object