MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / equals

Method equals

Programs/Games/peg-solitaire/PegSolitaire.java:187–199  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 7

p_holderMethod · 0.80
buildTreeMethod · 0.80
actionPerformedMethod · 0.80
addMethod · 0.80
deleteMethod · 0.80
printMethod · 0.80
actionPerformedMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected