Suppress unnecessary PathIntent operations when rerouting

Change-Id: If06fc6937d5a69f4f5ff829dbff5103b0fa1736d
diff --git a/src/main/java/net/onrc/onos/core/intent/PathIntent.java b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
index 4312075..3a668bb 100644
--- a/src/main/java/net/onrc/onos/core/intent/PathIntent.java
+++ b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
@@ -1,5 +1,6 @@
 package net.onrc.onos.core.intent;
 
+import java.util.Objects;
 
 /**
  * @author Toshio Koide (t-koide@onlab.us)
@@ -50,6 +51,26 @@
         return parentIntent;
     }
 
+    /**
+     * Checks the specified PathIntent have the same fields of
+     * path, bandwidth and parentIntent's id with this PathIntent.
+     *
+     * @param target target PathIntent instance
+     * @return true if the specified intent has the same fields, otherwise false
+     */
+    public boolean hasSameFields(PathIntent target) {
+        if (target == null) {
+            return false;
+        }
+        if (!Objects.equals(getPath(), target.getPath())) {
+            return false;
+        }
+        if (getBandwidth() != target.getBandwidth()) {
+            return false;
+        }
+        return Objects.equals(getParentIntent(), target.getParentIntent());
+    }
+
     @Override
     public int hashCode() {
         // TODO: Is this the intended behavior?