Add the equals function

Change-Id: I5840740da18f96f2aa5c2ec9bb28a1660b7d507a
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyEvent.java b/src/main/java/net/onrc/onos/core/topology/TopologyEvent.java
index f9a9f7b..9d9b573 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyEvent.java
@@ -1,5 +1,8 @@
 package net.onrc.onos.core.topology;
 
+import java.util.Objects;
+
+
 /**
  * Self-contained Topology event Object
  * <p/>
@@ -56,6 +59,36 @@
     }
 
     /**
+     * Check if all events contained are equal.
+     * @param object.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj == null) {
+            return false;
+        }
+
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        TopologyEvent other = (TopologyEvent) obj;
+        return Objects.equals(switchEvent, other.switchEvent) &&
+                Objects.equals(portEvent, other.portEvent) &&
+                Objects.equals(linkEvent, other.linkEvent) &&
+                Objects.equals(hostEvent, other.hostEvent);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(switchEvent, portEvent, linkEvent, hostEvent);
+    }
+
+    /**
      * Get the string representation of the event.
      *
      * @return the string representation of the event.