mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Overkjører equals metoden til Position for lettere likhetssjekking
This commit is contained in:
parent
427bddc0ae
commit
ce21e368b5
@ -33,4 +33,16 @@ public class Position {
|
||||
public int getYCoordinate() {
|
||||
return yCoordinate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj.getClass() != Position.class) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
return this.xCoordinate == ((Position) obj).xCoordinate &&
|
||||
this.yCoordinate == ((Position) obj).yCoordinate;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user