MCPcopy Create free account
hub / github.com/MolinDeng/Princeton-algs4 / equals

Method equals

04Lab-8Puzzle/Board.java:86–93  ·  view source on GitHub ↗
(Object y)

Source from the content-addressed store, hash-verified

84
85 // does this board equal y?
86 public boolean equals(Object y) {
87 if (y == this) return true;
88 if (y == null) return false;
89 if (y.getClass() != this.getClass()) return false;
90 Board that = (Board) y;
91 if (this.n != that.n) return false;
92 return Arrays.deepEquals(this.tiles, that.tiles);
93 }
94
95 private boolean isSwapable(int row, int col) {
96 return row >= 0 && row < n && col >= 0 && col < n;

Callers 3

mainMethod · 0.95
SolverMethod · 0.45
LineSegmentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected