X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosuilib%2FAltosUSBDevice.java;h=f43d6befda46e57ec9ee26f0d105452308afe9b9;hb=2bcbd39a37cf1fa0002345d5c401869a387dc84f;hp=f7aae38a3ab6bac3468da539217b4393628a3067;hpb=297eb795b24ec31f6599f48bc8c3769557a7ec6f;p=fw%2Faltos diff --git a/altosuilib/AltosUSBDevice.java b/altosuilib/AltosUSBDevice.java index f7aae38a..f43d6bef 100644 --- a/altosuilib/AltosUSBDevice.java +++ b/altosuilib/AltosUSBDevice.java @@ -94,6 +94,24 @@ public class AltosUSBDevice extends altos_device implements AltosDevice { return false; } + public int hashCode() { + return getVendor() ^ getProduct() ^ getSerial() ^ getPath().hashCode(); + } + + public boolean equals(Object o) { + if (o == null) + return false; + + if (!(o instanceof AltosUSBDevice)) + return false; + AltosUSBDevice other = (AltosUSBDevice) o; + + return getVendor() == other.getVendor() && + getProduct() == other.getProduct() && + getSerial() == other.getSerial() && + getPath().equals(other.getPath()); + } + static public java.util.List list(int product) { if (!AltosUILib.load_library()) return null;