Remove PortEvent.SwitchPort

- JSON format of util.SwitchPort has changed to match PortEvent.SwitchPort.
  (not sure if it was currently used in public API)
- Note: SwitchPort#toString() format is different. Log messages, etc. may have changed.
   PortEvent.SwitchPort : "(dpid@number)" both decimal
   util.SwitchPort : "00:00:...:01/number" dpid as HexString, number as decimal

- Part of ONOS-1564

Change-Id: I19ea06de7a701f0f7aaae0a7ed6f0726c0133a91
diff --git a/src/main/java/net/onrc/onos/core/topology/PortEvent.java b/src/main/java/net/onrc/onos/core/topology/PortEvent.java
index 5c63de7..8d3c945 100644
--- a/src/main/java/net/onrc/onos/core/topology/PortEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/PortEvent.java
@@ -1,12 +1,10 @@
 package net.onrc.onos.core.topology;
 
-import net.onrc.onos.core.topology.web.serializers.SwitchPortSerializer;
 import net.onrc.onos.core.util.Dpid;
 import net.onrc.onos.core.util.PortNumber;
+import net.onrc.onos.core.util.SwitchPort;
 
 import org.apache.commons.lang.Validate;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
 import java.nio.ByteBuffer;
 import java.util.Objects;
 
@@ -17,83 +15,6 @@
  */
 public class PortEvent {
 
-    // TODO eliminate this class and use util.SwitchPort if possible
-    @JsonSerialize(using = SwitchPortSerializer.class)
-    public static class SwitchPort {
-        public final Long dpid;
-        public final Long number;
-
-        /**
-         * Default constructor for Serializer to use.
-         */
-        @Deprecated
-        public SwitchPort() {
-            dpid = null;
-            number = null;
-        }
-
-        public SwitchPort(Long dpid, Long number) {
-            this.dpid = dpid;
-            this.number = number;
-        }
-
-        public SwitchPort(Dpid dpid, PortNumber number) {
-            this(dpid.value(), (long) number.value());
-        }
-
-        public Dpid getDpid() {
-            return new Dpid(dpid);
-        }
-
-        public PortNumber getNumber() {
-            return new PortNumber(number.shortValue());
-        }
-
-        @Override
-        public String toString() {
-            return "(" + Long.toHexString(dpid) + "@" + number + ")";
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + ((dpid == null) ? 0 : dpid.hashCode());
-            result = prime * result
-                    + ((number == null) ? 0 : number.hashCode());
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            SwitchPort other = (SwitchPort) obj;
-            if (dpid == null) {
-                if (other.dpid != null) {
-                    return false;
-                }
-            } else if (!dpid.equals(other.dpid)) {
-                return false;
-            }
-            if (number == null) {
-                if (other.number != null) {
-                    return false;
-                }
-            } else if (!number.equals(other.number)) {
-                return false;
-            }
-            return true;
-        }
-    }
-
     protected final SwitchPort id;
     // TODO Add Hardware Address
     // TODO Add Description
@@ -102,18 +23,22 @@
      * Default constructor for Serializer to use.
      */
     @Deprecated
-    public PortEvent() {
+    protected PortEvent() {
         id = null;
     }
 
-    public PortEvent(Long dpid, Long number) {
-        this.id = new SwitchPort(dpid, number);
+    public PortEvent(SwitchPort switchPort) {
+        this.id = switchPort;
     }
 
     public PortEvent(Dpid dpid, PortNumber number) {
         this.id = new SwitchPort(dpid, number);
     }
 
+    public PortEvent(Long dpid, Long number) {
+        this.id = new SwitchPort(dpid, number);
+    }
+
     public Dpid getDpid() {
         return id.getDpid();
     }
@@ -143,7 +68,7 @@
 
     @Override
     public String toString() {
-        return "[PortEvent 0x" + Long.toHexString(id.dpid) + "@" + id.number + "]";
+        return "[PortEvent 0x" + getDpid() + "@" + getNumber() + "]";
     }
 
     public static final int PORTID_BYTES = SwitchEvent.SWITCHID_BYTES + 2 + 8;
@@ -166,10 +91,11 @@
     }
 
     public byte[] getID() {
-        return getPortID(getDpid(), getNumber()).array();
+        return getIDasByteBuffer().array();
     }
 
     public ByteBuffer getIDasByteBuffer() {
         return getPortID(getDpid(), getNumber());
     }
+
 }