network lock equality, for the future

This commit is contained in:
Ellpeck 2020-05-09 01:16:45 +02:00
parent ccc981fee3
commit 58558781eb

View file

@ -1,5 +1,7 @@
package de.ellpeck.prettypipes.network;
import java.util.Objects;
public class NetworkLock {
public final NetworkLocation location;
@ -11,4 +13,18 @@ public class NetworkLock {
this.slot = slot;
this.amount = amount;
}
@Override
public boolean equals(Object o) {
if (o instanceof NetworkLock) {
NetworkLock that = (NetworkLock) o;
return this.slot == that.slot && this.amount == that.amount && this.location.equals(that.location);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(this.location, this.slot, this.amount);
}
}