GUI -- Enhanced DefaultCellComparator to utilize Comparable implementation if available on the objects being compared, defaulting to string comparison otherwise.
- Deleted obsolete comparators.

Change-Id: Ifeb74c05f73bd974d1afb3dc27527a5c7ad1bc12
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java b/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java
index 238116a..093a20d 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java
@@ -20,7 +20,11 @@
 import org.onosproject.ui.table.CellComparator;
 
 /**
- * A default cell comparator. Implements a lexicographical compare function
+ * A default cell comparator.
+ * <p>
+ * Verifies that the objects being compared are the same class.
+ * Looks to see if the objects being compared implement comparable and, if so,
+ * delegates to that; otherwise, implements a lexicographical compare function
  * (i.e. string sorting). Uses the objects' toString() method and then
  * compares the resulting strings. Note that null values are acceptable and
  * are considered "smaller" than any non-null value.
@@ -31,7 +35,13 @@
     private DefaultCellComparator() { }
 
     @Override
+    @SuppressWarnings("unchecked")
     protected int nonNullCompare(Object o1, Object o2) {
+        if (o1 instanceof Comparable) {
+            // if o2 is not the same class as o1, then compareTo will
+            // throw ClassCastException for us
+            return ((Comparable) o1).compareTo(o2);
+        }
         return o1.toString().compareTo(o2.toString());
     }