From c2cdb1264d4f9a418ee021b82481cf8bb5721a05 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 17 Nov 2014 19:00:07 -0800 Subject: [PATCH] Remove equals and hashCode from computer details --- .../nvstream/http/ComputerDetails.java | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/moonlight-common/src/com/limelight/nvstream/http/ComputerDetails.java b/moonlight-common/src/com/limelight/nvstream/http/ComputerDetails.java index 6a48f3a1..512f99dc 100644 --- a/moonlight-common/src/com/limelight/nvstream/http/ComputerDetails.java +++ b/moonlight-common/src/com/limelight/nvstream/http/ComputerDetails.java @@ -22,6 +22,17 @@ public class ComputerDetails { public String macAddress; 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) { this.state = details.state; this.reachability = details.reachability; @@ -34,29 +45,6 @@ public class ComputerDetails { 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 public String toString() { StringBuilder str = new StringBuilder();