diff options
Diffstat (limited to 'src/ch/epfl/xblast/Cell.java')
-rw-r--r-- | src/ch/epfl/xblast/Cell.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ch/epfl/xblast/Cell.java b/src/ch/epfl/xblast/Cell.java index d31a889..06dfdbb 100644 --- a/src/ch/epfl/xblast/Cell.java +++ b/src/ch/epfl/xblast/Cell.java | |||
@@ -171,7 +171,17 @@ public final class Cell { | |||
171 | if (that == null) return false; | 171 | if (that == null) return false; |
172 | if (that == this) return true; | 172 | if (that == this) return true; |
173 | if (!(that instanceof Cell)) return false; | 173 | if (!(that instanceof Cell)) return false; |
174 | return (((Cell) that).x == this.x && ((Cell) that).y == this.y); | 174 | return (((Cell) that).rowMajorIndex() == this.rowMajorIndex()); |
175 | } | ||
176 | |||
177 | /** | ||
178 | * Returns the hash code for this Cell, given by its row-major index. | ||
179 | * | ||
180 | * @return the hash code | ||
181 | */ | ||
182 | @Override | ||
183 | public int hashCode() { | ||
184 | return this.rowMajorIndex(); | ||
175 | } | 185 | } |
176 | 186 | ||
177 | /** | 187 | /** |