From a728036bf15d3af28864a2455c6ffd594387e759 Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Fri, 3 Feb 2012 01:37:25 +0000 Subject: [PATCH] Added hashcode & equals based on digest. Added simple toString. --- .../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 3245eb158..1c6e22549 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 + "]"; + } }