xml: remove dead store of value in XmlPresentationProvider.java
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 19 Jan 2016 15:00:21 +0000 (10:00 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 27 Jan 2016 00:45:05 +0000 (19:45 -0500)
Change-Id: I50bf309c3aa38b8bf4d09ada185cb4be52708410
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/64702
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlPresentationProvider.java

index 8c88a9456ebfc57f0a74bf6681315ba5dad460ac..f8985ad10ce35d3c573426b25c47076bf8e99016 100644 (file)
@@ -141,16 +141,7 @@ public class XmlPresentationProvider extends TimeGraphPresentationProvider {
                 return;
             }
 
-            RGB colorRGB = new RGB(255, 0, 0);
-            if (color.startsWith(TmfXmlStrings.COLOR_PREFIX)) {
-                Integer hex = Integer.parseInt(color.substring(1), 16);
-                int hex1 = hex.intValue() % 256;
-                int hex2 = (hex.intValue() / 256) % 256;
-                int hex3 = (hex.intValue() / (256 * 256)) % 256;
-                colorRGB = new RGB(hex3, hex2, hex1);
-            } else {
-                colorRGB = calcColor(value);
-            }
+            final RGB colorRGB = (color.startsWith(TmfXmlStrings.COLOR_PREFIX)) ? parseColor(color) : calcColor(value);
 
             StateItem item = new StateItem(colorRGB, name);
 
@@ -172,6 +163,16 @@ public class XmlPresentationProvider extends TimeGraphPresentationProvider {
         });
     }
 
+    private static RGB parseColor(String color) {
+        RGB colorRGB;
+        Integer hex = Integer.parseInt(color.substring(1), 16);
+        int hex1 = hex.intValue() % 256;
+        int hex2 = (hex.intValue() / 256) % 256;
+        int hex3 = (hex.intValue() / (256 * 256)) % 256;
+        colorRGB = new RGB(hex3, hex2, hex1);
+        return colorRGB;
+    }
+
     private static RGB calcColor(int value) {
         int x = (value * 97) % 1530;
         int r = 0, g = 0, b = 0;
This page took 0.026299 seconds and 5 git commands to generate.