Overridden equals method comparing PegSolitaire objects. @param other Another PegSolitaire object to compare @return boolean Returns true if two objects are equal, otherwise false
(PegSolitaire other)
| 185 | * @return boolean Returns true if two objects are equal, otherwise false |
| 186 | */ |
| 187 | public boolean equals(PegSolitaire other){ |
| 188 | var flag = true; |
| 189 | |
| 190 | if (size!=other.size || boardType!=other.boardType || score!=other.score || toggle!=other.toggle) flag = false; |
| 191 | if (board.length != other.board.length) flag = false; |
| 192 | for (int i=0; i<board.length;++i) |
| 193 | for (int j=0; j<board[0].length; ++j) |
| 194 | if (board[i][j].getBackground() != other.board[i][j].getBackground()) flag = false; |
| 195 | if (grid.getRows()!=other.grid.getRows() || grid.getColumns()!=other.grid.getColumns() || |
| 196 | grid.getVgap()!=other.grid.getVgap() || grid.getHgap()!=other.grid.getHgap()) flag = false; |
| 197 | |
| 198 | return flag; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Returns the hash code value. |
no outgoing calls
no test coverage detected