Replaced Equals/HashcodeBuilder for DatapacketListener 20/420/1
authorEd Warnicke <eaw@cisco.com>
Sun, 2 Jun 2013 22:47:53 +0000 (17:47 -0500)
committerEd Warnicke <eaw@cisco.com>
Sun, 2 Jun 2013 22:47:53 +0000 (17:47 -0500)
Change-Id: I7e1bcf6937e503bb6b63bbb949bcbf8d3092f413
Signed-off-by: Ed Warnicke <eaw@cisco.com>
opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/DataPacketService.java

index 7741945..29d1c71 100644 (file)
@@ -28,8 +28,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.match.Match;
@@ -109,24 +107,35 @@ public class DataPacketService implements IPluginOutDataPacketService,
 
         @Override
         public boolean equals(Object obj) {
-            if (obj == null) {
-                return false;
-            }
-            if (obj == this) {
+            if (this == obj)
                 return true;
-            }
-            if (obj.getClass() != getClass()) {
+            if (obj == null)
                 return false;
-            }
-            DataPacketListener rhs = (DataPacketListener) obj;
-            return new EqualsBuilder().append(this.listenerName,
-                    rhs.listenerName).isEquals();
+            if (getClass() != obj.getClass())
+                return false;
+            DataPacketListener other = (DataPacketListener) obj;
+            if (!getOuterType().equals(other.getOuterType()))
+                return false;
+            if (listenerName == null) {
+                if (other.listenerName != null)
+                    return false;
+            } else if (!listenerName.equals(other.listenerName))
+                return false;
+            return true;
         }
 
         @Override
         public int hashCode() {
-            return new HashCodeBuilder(13, 31).append(listenerName)
-                    .toHashCode();
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result
+                    + ((listenerName == null) ? 0 : listenerName.hashCode());
+            return result;
+        }
+
+        private DataPacketService getOuterType() {
+            return DataPacketService.this;
         }
     }