mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 12:03:02 +00:00
Remove equals and hashCode from computer details
This commit is contained in:
parent
c0e95ea18b
commit
c2cdb1264d
@ -22,6 +22,17 @@ public class ComputerDetails {
|
|||||||
public String macAddress;
|
public String macAddress;
|
||||||
public int runningGameId;
|
public int runningGameId;
|
||||||
|
|
||||||
|
public ComputerDetails() {
|
||||||
|
// Use defaults
|
||||||
|
state = State.UNKNOWN;
|
||||||
|
reachability = Reachability.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComputerDetails(ComputerDetails details) {
|
||||||
|
// Copy details from the other computer
|
||||||
|
update(details);
|
||||||
|
}
|
||||||
|
|
||||||
public void update(ComputerDetails details) {
|
public void update(ComputerDetails details) {
|
||||||
this.state = details.state;
|
this.state = details.state;
|
||||||
this.reachability = details.reachability;
|
this.reachability = details.reachability;
|
||||||
@ -34,29 +45,6 @@ public class ComputerDetails {
|
|||||||
this.runningGameId = details.runningGameId;
|
this.runningGameId = details.runningGameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (o instanceof ComputerDetails) {
|
|
||||||
ComputerDetails other = (ComputerDetails)o;
|
|
||||||
|
|
||||||
// Use UUIDs if they both have them
|
|
||||||
if (other.uuid != null && this.uuid != null)
|
|
||||||
{
|
|
||||||
return other.uuid.equals(this.uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise use local IP
|
|
||||||
return other.localIp.equals(this.localIp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return localIp.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user