Change the underlying type of IntentId

- Change the type from String to long
- Change the argument of the constructor of Intent
- Adapt PacketConnectivityIntent and OpticalConnectivityIntent
  for these change

Change-Id: Iec7154c7d87c3a598fb5b55d886fa9775b3ddef0
diff --git a/src/main/java/net/onrc/onos/api/intent/IntentId.java b/src/main/java/net/onrc/onos/api/intent/IntentId.java
index d488183..4ec3e6a 100644
--- a/src/main/java/net/onrc/onos/api/intent/IntentId.java
+++ b/src/main/java/net/onrc/onos/api/intent/IntentId.java
@@ -2,29 +2,46 @@
 
 import net.onrc.onos.api.batchoperation.BatchOperationTargetId;
 
-public class IntentId extends BatchOperationTargetId {
-    private final String value;
+/**
+ * The class representing intent's ID.
+ *
+ * This class is immutable.
+ */
+public final class IntentId extends BatchOperationTargetId {
+    private final long id;
 
-    public IntentId(String id) {
-        value = id;
-    }
-
-    @Override
-    public String toString() {
-        return value;
+    /**
+     * Constructs the ID corresponding to a given long value.
+     *
+     * In the future, this constructor will not be exposed to avoid misuses.
+     *
+     * @param id the underlay value of this ID.
+     */
+    public IntentId(long id) {
+        this.id = id;
     }
 
     @Override
     public int hashCode() {
-        return value.hashCode();
+        return (int) (id ^ (id >>> 32));
     }
 
     @Override
     public boolean equals(Object obj) {
-        if (obj instanceof IntentId) {
-            IntentId other = (IntentId) obj;
-            return (this.value.equals(other.value));
+        if (obj == this) {
+            return true;
         }
-        return false;
+
+        if (!(obj instanceof IntentId)) {
+            return false;
+        }
+
+        IntentId that = (IntentId) obj;
+        return this.id == that.id;
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Long.toHexString(id);
     }
 }