Use ITmfEvent in a couple more places
authorAlexandre Montplaisir <alexandre.montplaisir@gmail.com>
Wed, 14 Mar 2012 20:34:44 +0000 (16:34 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Mon, 19 Mar 2012 21:43:43 +0000 (17:43 -0400)
org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngExperiment.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/experiment/TmfExperiment.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/experiment/TmfExperimentContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/TmfRawEventViewer.java

index 040530d90a85cd140937a031fc2de5676196297f..b62fd58af6db69a5d69f2c93c974e683fefafaed 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 
@@ -128,7 +129,7 @@ public class LTTngExperiment<T extends ITmfEvent> extends TmfExperiment<T> {
         // If an event was consumed previously, get the next one from that trace
         int lastTrace = expContext.getLastTrace();
         if (lastTrace != TmfExperimentContext.NO_TRACE) {
-            TmfContext traceContext = expContext.getContexts()[lastTrace];
+            ITmfContext traceContext = expContext.getContexts()[lastTrace];
             expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].getNextEvent(traceContext);
             expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
         }
@@ -163,9 +164,9 @@ public class LTTngExperiment<T extends ITmfEvent> extends TmfExperiment<T> {
         if (trace != TmfExperimentContext.NO_TRACE) {
 //             updateIndex(expContext, timestamp);
 
-            TmfContext traceContext = expContext.getContexts()[trace];
+            ITmfContext traceContext = expContext.getContexts()[trace];
             TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation();
-            expLocation.getLocation().locations[trace] = traceContext.getLocation();
+            expLocation.getLocation().locations[trace] = (ITmfLocation<? extends Comparable<?>>) traceContext.getLocation();
 
             updateIndex(expContext, timestamp);
 
index e612c74b0b9ee83c95ce1890e932eda3f31ea483..dd153575983e0a1c3a602d62e99102c2723c5b96 100644 (file)
@@ -400,7 +400,9 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> impl
             rank += traceRank;
 
             // Set the trace location and read the corresponding event
-            expLocation.getLocation().locations[i] = context.getContexts()[i].getLocation().clone();
+            /* The (TmfContext) cast should be safe since we created 'context'
+             * ourselves higher up. */
+            expLocation.getLocation().locations[i] = ((TmfContext) context.getContexts()[i]).getLocation().clone();
             context.getEvents()[i] = fTraces[i].getNextEvent(context.getContexts()[i]);
         }
 
@@ -580,7 +582,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> impl
         // If an event was consumed previously, get the next one from that trace
         int lastTrace = expContext.getLastTrace();
         if (lastTrace != TmfExperimentContext.NO_TRACE) {
-            TmfContext traceContext = expContext.getContexts()[lastTrace];
+            ITmfContext traceContext = expContext.getContexts()[lastTrace];
             expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].getNextEvent(traceContext);
             expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
         }
@@ -614,10 +616,10 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> impl
         if (trace != TmfExperimentContext.NO_TRACE) {
             updateIndex(expContext, timestamp);
 
-            TmfContext traceContext = expContext.getContexts()[trace];
+            ITmfContext traceContext = expContext.getContexts()[trace];
             TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation();
 //             expLocation.getLocation()[trace] = traceContext.getLocation().clone();
-            expLocation.getLocation().locations[trace] = traceContext.getLocation().clone();
+            expLocation.getLocation().locations[trace] = (ITmfLocation<? extends Comparable<?>>) traceContext.getLocation().clone();
 
 //             updateIndex(expContext, timestamp);
 
@@ -676,7 +678,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> impl
         // If an event was consumed previously, get the next one from that trace
         int lastTrace = expContext.getLastTrace();
         if (lastTrace != TmfExperimentContext.NO_TRACE) {
-            TmfContext traceContext = expContext.getContexts()[lastTrace];
+            ITmfContext traceContext = expContext.getContexts()[lastTrace];
             expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].getNextEvent(traceContext);
             expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
             fExperimentContext = (TmfExperimentContext) context;
index 0dbc2836cd91a87b5f9b6efd2d058709486a1215..785f6ac82994f5feb31fc344dc0d654b0d3cec6a 100644 (file)
@@ -13,6 +13,7 @@
 package org.eclipse.linuxtools.tmf.core.experiment;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
@@ -102,7 +103,7 @@ public class TmfExperimentContext extends TmfContext {
                return fTraces;
        }
 
-       public TmfContext[] getContexts() {
+       public ITmfContext[] getContexts() {
                return fContexts;
        }
 
index b9d0e2ad28ac91dafdedbf61c30e1ce785e16534..2b5cf66beb74438d157ac72d404946dcf1b32469 100644 (file)
@@ -86,11 +86,11 @@ public interface ITmfTrace<T extends ITmfEvent> extends ITmfComponent {
      * @param rank
      * @return a context object for subsequent reads
      */
-    public TmfContext seekLocation(ITmfLocation<?> location);
+    public ITmfContext seekLocation(ITmfLocation<?> location);
 
-    public TmfContext seekEvent(ITmfTimestamp timestamp);
+    public ITmfContext seekEvent(ITmfTimestamp timestamp);
 
-    public TmfContext seekEvent(long rank);
+    public ITmfContext seekEvent(long rank);
 
     /**
      * Positions the trace at the event located at the specified ratio.
@@ -101,7 +101,7 @@ public interface ITmfTrace<T extends ITmfEvent> extends ITmfComponent {
      *            a floating-point number between 0.0 (beginning) and 1.0 (end)
      * @return a context object for subsequent reads
      */
-    public TmfContext seekLocation(double ratio);
+    public ITmfContext seekLocation(double ratio);
 
     /**
      * Returns the ratio corresponding to the specified location.
index bf8f0d7bde22527a046570bdc860faef2cc26077..8023d1b60ebc9a743cad35af5d889d50095c113a 100644 (file)
@@ -319,6 +319,9 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
     // ITmfTrace
     // ------------------------------------------------------------------------
 
+    @Override
+    public abstract TmfContext seekLocation(ITmfLocation<?> location);
+    
     /* (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools.tmf.event.TmfTimestamp)
      */
index 076c233f30532882e4240c97a076a0aa2324592b..ecf87309e3c0a66018a14ad79570c781fb85b3c8 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;\r
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;\r
 import org.eclipse.linuxtools.tmf.ui.editors.ITmfTraceEditor;\r
@@ -157,7 +158,7 @@ public class TimeChartView extends TmfView implements ITmfTimeScaleSelectionList
         if (decorationProvider == null) {\r
             return; // the trace has been closed\r
         }\r
-        TmfContext context = null;\r
+        ITmfContext context = null;\r
         // TmfTimestamp lastTimestamp = null;\r
         boolean done = false;\r
         while (!done) {\r
@@ -339,7 +340,7 @@ public class TimeChartView extends TmfView implements ITmfTimeScaleSelectionList
         private volatile boolean interrupted = false;\r
         private final TimeChartAnalysisEntry fTimeAnalysisEntry;\r
         private final TimeChartDecorationProvider fDecorationProvider;\r
-        private TmfContext fContext;\r
+        private ITmfContext fContext;\r
         private int fCount = 0;\r
 \r
         private DecorateThread(TimeChartAnalysisEntry timeAnalysisEntry) {\r
index b9cdc4cc2fd5fa75583f3a0f1daf27751c336811..7869f7d8f14d5f6a6af84fff4de2d2138a1182a8 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.linuxtools.tmf.ui.widgets;
 import java.util.ArrayList;\r
 \r
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;\r
@@ -70,7 +71,7 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
     private static final int SLIDER_MAX = 1000000;\r
 \r
     private ITmfTrace<?> fTrace;\r
-    private TmfContext fBottomContext;\r
+    private ITmfContext fBottomContext;\r
     \r
     private ScrolledComposite fScrolledComposite;\r
     private Composite fTextArea;\r
@@ -382,7 +383,7 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
                 while (fTopLineIndex < 0) {\r
                     ITmfLocation<?> endLocation = fLines.get(0).location;\r
                     firstRatio = Math.max(0, firstRatio - delta);\r
-                    TmfContext context = fTrace.seekLocation(firstRatio);\r
+                    ITmfContext context = fTrace.seekLocation(firstRatio);\r
                     ITmfLocation<?> location;\r
                     int index = 0;\r
                     long rank = 0;\r
This page took 0.031701 seconds and 5 git commands to generate.