Change hashCode and equals to use all fields. Older format of ork files did not...
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Fri, 3 Feb 2012 14:49:20 +0000 (14:49 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Fri, 3 Feb 2012 14:49:20 +0000 (14:49 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@388 180e2498-e6e9-4542-8430-84ac67f01cd8

core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java

index 1c6e22549e60de232a1ca14ed006cb7ca69a57d3..db6b112ba08d1fb4f5a32f370e6538eb690af98c 100644 (file)
@@ -112,7 +112,23 @@ public class ThrustCurveMotorPlaceholder implements Motor {
        public int hashCode() {
                final int prime = 31;
                int result = 1;
+               long temp;
+               temp = Double.doubleToLongBits(delay);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
+               result = prime * result
+                               + ((designation == null) ? 0 : designation.hashCode());
+               temp = Double.doubleToLongBits(diameter);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
                result = prime * result + ((digest == null) ? 0 : digest.hashCode());
+               temp = Double.doubleToLongBits(emptyMass);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
+               temp = Double.doubleToLongBits(launchMass);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
+               temp = Double.doubleToLongBits(length);
+               result = prime * result + (int) (temp ^ (temp >>> 32));
+               result = prime * result
+                               + ((manufacturer == null) ? 0 : manufacturer.hashCode());
+               result = prime * result + ((type == null) ? 0 : type.hashCode());
                return result;
        }
 
@@ -125,14 +141,42 @@ public class ThrustCurveMotorPlaceholder implements Motor {
                if (getClass() != obj.getClass())
                        return false;
                ThrustCurveMotorPlaceholder other = (ThrustCurveMotorPlaceholder) obj;
+               if (Double.doubleToLongBits(delay) != Double
+                               .doubleToLongBits(other.delay))
+                       return false;
+               if (designation == null) {
+                       if (other.designation != null)
+                               return false;
+               } else if (!designation.equals(other.designation))
+                       return false;
+               if (Double.doubleToLongBits(diameter) != Double
+                               .doubleToLongBits(other.diameter))
+                       return false;
                if (digest == null) {
                        if (other.digest != null)
                                return false;
                } else if (!digest.equals(other.digest))
                        return false;
+               if (Double.doubleToLongBits(emptyMass) != Double
+                               .doubleToLongBits(other.emptyMass))
+                       return false;
+               if (Double.doubleToLongBits(launchMass) != Double
+                               .doubleToLongBits(other.launchMass))
+                       return false;
+               if (Double.doubleToLongBits(length) != Double
+                               .doubleToLongBits(other.length))
+                       return false;
+               if (manufacturer == null) {
+                       if (other.manufacturer != null)
+                               return false;
+               } else if (!manufacturer.equals(other.manufacturer))
+                       return false;
+               if (type != other.type)
+                       return false;
                return true;
        }
 
+
        @Override
        public String toString() {
                return "ThrustCurveMotorPlaceholder [manufacturer=" + manufacturer