mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-17 15:55:02 +02:00
Update hashCode() and equals()
This commit is contained in:
parent
685bac0c57
commit
dee25eff4c
@ -5,6 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
package main.java.com.djrapitops.plan.data;
|
package main.java.com.djrapitops.plan.data;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class containing single datapoint of TPS / Players online / CPU Usage / Used Memory / Entity Count / Chunks loaded.
|
* Class containing single datapoint of TPS / Players online / CPU Usage / Used Memory / Entity Count / Chunks loaded.
|
||||||
*
|
*
|
||||||
@ -106,33 +108,22 @@ public class TPS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public boolean equals(Object o) {
|
||||||
int hash = 3;
|
if (this == o) return true;
|
||||||
hash = 97 * hash + (int) (this.date ^ (this.date >>> 32));
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
hash = 97 * hash + (int) (Double.doubleToLongBits(this.ticksPerSecond) ^ (Double.doubleToLongBits(this.ticksPerSecond) >>> 32));
|
TPS tps = (TPS) o;
|
||||||
hash = 97 * hash + this.players;
|
return date == tps.date &&
|
||||||
return hash;
|
Double.compare(tps.ticksPerSecond, ticksPerSecond) == 0 &&
|
||||||
|
players == tps.players &&
|
||||||
|
Double.compare(tps.cpuUsage, cpuUsage) == 0 &&
|
||||||
|
usedMemory == tps.usedMemory &&
|
||||||
|
entityCount == tps.entityCount &&
|
||||||
|
chunksLoaded == tps.chunksLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public int hashCode() {
|
||||||
if (this == obj) {
|
return Objects.hashCode(date, ticksPerSecond, players, cpuUsage, usedMemory, entityCount, chunksLoaded);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TPS other = (TPS) obj;
|
|
||||||
return date == other.date
|
|
||||||
&& Double.compare(this.ticksPerSecond, other.ticksPerSecond) == 0
|
|
||||||
&& this.players == other.players
|
|
||||||
&& Double.compare(cpuUsage, other.cpuUsage) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user