X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosuilib%2FAltosUSBDevice.java;h=16a0e7709dd5be7c3793bd3eb42c86c481164d6c;hb=22005da598921ef6fe1a7f1bb5e56e41f44fe12f;hp=f4906a73662c4f8f0140c0152ad5e4935f726f78;hpb=cef3be371cb3a9e481c2bd6abdf22c51953773f1;p=fw%2Faltos diff --git a/altosuilib/AltosUSBDevice.java b/altosuilib/AltosUSBDevice.java index f4906a73..16a0e770 100644 --- a/altosuilib/AltosUSBDevice.java +++ b/altosuilib/AltosUSBDevice.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,7 +16,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_3; +package org.altusmetrum.altosuilib_13; import java.util.*; import libaltosJNI.*; @@ -93,6 +94,23 @@ public class AltosUSBDevice extends altos_device implements AltosDevice { return false; } + public int hashCode() { + return getVendor() ^ getProduct() ^ getSerial(); + } + + 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(); + } + static public java.util.List list(int product) { if (!AltosUILib.load_library()) return null;