From e912b44043e79494c7a513f755bd3a66da5b6f63 Mon Sep 17 00:00:00 2001 From: kruland2607 Date: Fri, 3 Feb 2012 01:37:25 +0000 Subject: [PATCH] Added hashcode & equals based on digest. Added simple toString. git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@385 180e2498-e6e9-4542-8430-84ac67f01cd8 --- .../motor/ThrustCurveMotorPlaceholder.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java index 3245eb15..1c6e2254 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java @@ -107,6 +107,36 @@ public class ThrustCurveMotorPlaceholder implements Motor { public double getTotalImpulseEstimate() { return Double.NaN; } - + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((digest == null) ? 0 : digest.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ThrustCurveMotorPlaceholder other = (ThrustCurveMotorPlaceholder) obj; + if (digest == null) { + if (other.digest != null) + return false; + } else if (!digest.equals(other.digest)) + return false; + return true; + } + + @Override + public String toString() { + return "ThrustCurveMotorPlaceholder [manufacturer=" + manufacturer + + ", designation=" + designation + "]"; + } } -- 2.47.2