From 7a8115a3a5f3f9b115013ba58b3dfe2285573e11 Mon Sep 17 00:00:00 2001
From: Thomas Oster <thomas.oster@rwth-aachen.de>
Date: Sun, 20 Jan 2013 12:12:26 +0100
Subject: [PATCH] hashCode and equals improvements

---
 .../t_oster/liblasercut/dithering/DitheringAlgorithm.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/com/t_oster/liblasercut/dithering/DitheringAlgorithm.java b/src/com/t_oster/liblasercut/dithering/DitheringAlgorithm.java
index b46f060..e1e7652 100644
--- a/src/com/t_oster/liblasercut/dithering/DitheringAlgorithm.java
+++ b/src/com/t_oster/liblasercut/dithering/DitheringAlgorithm.java
@@ -86,6 +86,10 @@ public abstract class DitheringAlgorithm extends TimeIntensiveOperation implemen
   @Override
   public boolean equals(Object o)
   {
+    if (this == o)
+    {
+      return true;
+    }
     if (o == null || !getClass().equals(o.getClass()))
     {
       return false;
@@ -111,8 +115,10 @@ public abstract class DitheringAlgorithm extends TimeIntensiveOperation implemen
   @Override
   public int hashCode() {
     int hash = 7;
+    hash += this.getClass().hashCode();
     for (String key : this.getPropertyKeys())
     {
+      hash += key.hashCode();
       hash += this.getProperty(key).hashCode();
     }
     return hash;
-- 
GitLab