Class Board

  • Direct Known Subclasses:
    CachedBoard

    public class Board
    extends java.lang.Object
    configuration and state of a game board
    • Constructor Summary

      Constructors 
      Constructor Description
      Board​(int rows, int columns)
      creates and initializes the board object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Board copy()
      creates a deep copy of the board
      boolean equals​(java.lang.Object o)  
      BoardSquare getSquareSafe​(Turn.Coordinate coordinate)
      gets the square at the given coordinate and returning ARROW when the coordinate is not on the board (out of Bound)
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • rows

        @SerializedName("gameSizeRows")
        public int rows
      • columns

        @SerializedName("gameSizeColumns")
        public int columns
      • squares

        @SerializedName("squares")
        public BoardSquare[][] squares
    • Constructor Detail

      • Board

        public Board​(int rows,
                     int columns)
        creates and initializes the board object. note that the squares of the board get initialized with 'null'
        Parameters:
        rows - how many rows the board should have
        columns - how many columns the board should have
    • Method Detail

      • getSquareSafe

        public BoardSquare getSquareSafe​(Turn.Coordinate coordinate)
        gets the square at the given coordinate and returning ARROW when the coordinate is not on the board (out of Bound)
        Parameters:
        coordinate - the coordinate at which the square should be examined
        Returns:
        which square is considered to be on the board at the coordinate
      • copy

        public Board copy()
        creates a deep copy of the board
        Returns:
        new board
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object