analysis.lami: correctly handle Number (double, long etc.) type graphing
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.lami.core / src / org / eclipse / tracecompass / internal / provisional / analysis / lami / core / aspect / LamiProcessTIDAspect.java
index 5fea94a78b565eb4b7c13f91398b6e190cd704f6..74c38b369cbda1714a603fe21b4c14fddb06abd7 100644 (file)
@@ -65,16 +65,11 @@ public class LamiProcessTIDAspect extends LamiTableEntryAspect {
     }
 
     @Override
-    public @Nullable Double  resolveDouble(LamiTableEntry entry) {
+    public @Nullable Number resolveNumber(LamiTableEntry entry) {
         LamiData data = entry.getValue(fColIndex);
         if (data instanceof LamiProcess) {
             Long tid = ((LamiProcess) data).getTID();
-
-            if (tid == null) {
-                return null;
-            }
-
-            return Double.valueOf(tid);
+            return tid;
         }
 
         return null;
@@ -83,13 +78,21 @@ public class LamiProcessTIDAspect extends LamiTableEntryAspect {
     @Override
     public Comparator<LamiTableEntry> getComparator() {
         return (o1, o2) -> {
-            Double dO1 = resolveDouble(o1);
-            Double dO2 = resolveDouble(o2);
-            if (dO1 == null || dO2 == null) {
+            Number d1 = resolveNumber(o1);
+            Number d2 = resolveNumber(o2);
+
+            if (d1 == null && d2 == null) {
                 return 0;
             }
+            if (d1 == null) {
+                return 1;
+            }
+
+            if (d2 == null) {
+                return -1;
+            }
 
-            return dO1.compareTo(dO2);
+            return Long.compare(d1.longValue(), d2.longValue());
         };
     }
 }
This page took 0.027275 seconds and 5 git commands to generate.