Generalize ITmfTrace API (part 1)
authorFrancois Chouinard <fchouinard@gmail.com>
Thu, 8 Mar 2012 22:52:16 +0000 (17:52 -0500)
committerFrancois Chouinard <fchouinard@gmail.com>
Thu, 8 Mar 2012 22:52:16 +0000 (17:52 -0500)
15 files changed:
org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/lttng/core/trace/LTTngExperiment.java
org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/lttng/core/trace/LTTngTextTrace.java
org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/lttng/core/trace/LTTngTrace.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/LTTngEventParserStub.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/LTTngTraceStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/stubs/trace/TmfEventParserStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/stubs/trace/TmfTraceStub.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/parser/ITmfEventParser.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfContext.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.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/parsers/custom/CustomTxtTrace.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/parsers/custom/CustomXmlTrace.java

index 9eb3f036ff8d95dd25236974e080190dead8aece..c56ec33e1ee543a251cc63507a2e9c8fd4fbd80f 100644 (file)
@@ -29,6 +29,7 @@ import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 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.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 
@@ -108,7 +109,7 @@ public class LTTngExperiment<T extends ITmfEvent> extends TmfExperiment<T> {
     // ------------------------------------------------------------------------
 
     @Override
-    public synchronized ITmfEvent getNextEvent(TmfContext context) {
+    public synchronized ITmfEvent getNextEvent(ITmfContext context) {
 
         // Validate the context
         if (!(context instanceof TmfExperimentContext)) {
index 29f884c46baee0181e31f44fc2b96775e6e5a63b..0691a7521d153a342932db034324b787fb5e4a6a 100644 (file)
@@ -24,6 +24,7 @@ import org.eclipse.linuxtools.lttng.core.event.LttngEventType;
 import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp;
 import org.eclipse.linuxtools.lttng.jni.JniEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
@@ -201,7 +202,7 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> {
         return 0;
     }
 
-    private LttngEvent parseMyNextEvent(TmfContext context) {
+    private LttngEvent parseMyNextEvent(ITmfContext context) {
        
        // All parsing variables declared here so to be able to print them into the catch if needed
        String tmpContent = null;
@@ -428,7 +429,7 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> {
     }
     
        @Override
-       public LttngEvent parseEvent(TmfContext context) {
+       public LttngEvent parseEvent(ITmfContext context) {
                context = seekLocation(context.getLocation());
                return parseMyNextEvent(context);
                
index 1c3ec8f7fc31381f32181effafb890224843343d..5e0dea352786ceb77e98c7981d28af9c491acb5d 100644 (file)
@@ -648,7 +648,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
     public int nbEventsRead = 0;
 
     @Override
-    public synchronized LttngEvent getNextEvent(TmfContext context) {
+    public synchronized LttngEvent getNextEvent(ITmfContext context) {
 
         if (PrintDebug) {
             System.out.println("getNextEvent(context) context.getLocation() -> " //$NON-NLS-1$
@@ -706,7 +706,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
     }
 
     // this method was extracted for profiling purposes
-    private void setPreviousAndCurrentTimes(TmfContext context, LttngEvent returnedEvent, LttngLocation curLocation) {
+    private void setPreviousAndCurrentTimes(ITmfContext context, LttngEvent returnedEvent, LttngLocation curLocation) {
 
         ITmfTimestamp eventTimestamp = returnedEvent.getTimestamp();
         // long eventTime = eventTimestamp.getValue();
@@ -758,7 +758,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
     }
 
     // this method was extracted for profiling purposes
-    private LttngLocation getCurrentLocation(TmfContext context) {
+    private LttngLocation getCurrentLocation(ITmfContext context) {
         LttngLocation curLocation;
         curLocation = new LttngLocation();
         context.setLocation(curLocation);
@@ -779,7 +779,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
      * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext
      */
     @Override
-    public synchronized LttngEvent parseEvent(TmfContext context) {
+    public synchronized LttngEvent parseEvent(ITmfContext context) {
 
         if (PrintDebug) {
             System.out.println("parseEvent(context) context.getLocation() -> " //$NON-NLS-1$
index 19cdb761f9ad0db8fa94ed00d2350270163de951..fa02e933d9fad6d37e4563aa2914cb6ba6359a0c 100644 (file)
@@ -17,8 +17,8 @@ import java.io.IOException;
 import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 
 /**
  * <b><u>TmfEventParserStub</u></b>
@@ -31,7 +31,7 @@ public class LTTngEventParserStub implements ITmfEventParser<LttngEvent> {
      * @see org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser#parseNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfTrace, org.eclipse.linuxtools.tmf.core.trace.TmfContext)
      */
     @Override
-    public ITmfEvent parseNextEvent(ITmfTrace<LttngEvent> stream, TmfContext context)
+    public ITmfEvent parseNextEvent(ITmfTrace<LttngEvent> stream, ITmfContext context)
                     throws IOException {
         // TODO Auto-generated method stub
         return null;
index 34545326de0462d0ba3223000755b3696e211594..8612fffff8f9f9d0d964e6ac0236882e5b2d93d9 100644 (file)
@@ -19,6 +19,7 @@ import java.io.RandomAccessFile;
 import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser;
+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;
@@ -145,7 +146,7 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> {
         * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#parseEvent()
         */
        @Override
-       public ITmfEvent parseEvent(TmfContext context) {
+       public ITmfEvent parseEvent(ITmfContext context) {
                try {
                        // paserNextEvent updates the context
                    LttngEvent event = (LttngEvent) fParser.parseNextEvent(this, context);
index a6a81289846c8b6865d576f74e153db72b964e82..ea246f00c2dcdf5d6eec27af0b222c117a429e3f 100644 (file)
@@ -24,8 +24,8 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
 
 /**
@@ -68,7 +68,7 @@ public class TmfEventParserStub implements ITmfEventParser<TmfEvent> {
     static final String typePrefix = "Type-";
     @Override
        @SuppressWarnings("unchecked")
-       public ITmfEvent parseNextEvent(ITmfTrace<TmfEvent> eventStream, TmfContext context) throws IOException {
+       public ITmfEvent parseNextEvent(ITmfTrace<TmfEvent> eventStream, ITmfContext context) throws IOException {
 
         if (! (eventStream instanceof TmfTraceStub)) {
             return null;
index df3c312067d43788706dff9babd97f111a99b532..47750f8e4dcbbfafd95f55a425a101db6187cb49 100644 (file)
@@ -223,7 +223,7 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> {
     }
 
        @Override
-       public ITmfEvent parseEvent(TmfContext context) {
+       public ITmfEvent parseEvent(ITmfContext context) {
            fLock.lock();
                try {
                        // parseNextEvent will update the context
index b7197a3034454364d148909975335675d28a2a33..864cd9c03c315880b249fd3553b6c4ab42fdedf0 100644 (file)
@@ -557,7 +557,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> impl
 //     }
 
     @Override
-    public synchronized ITmfEvent getNextEvent(TmfContext context) {
+    public synchronized ITmfEvent getNextEvent(ITmfContext context) {
 
         // Validate the context
         if (!(context instanceof TmfExperimentContext)) {
@@ -655,7 +655,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfEventProvider<T> impl
      * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#parseEvent(org.eclipse.linuxtools .tmf.trace.TmfContext)
      */
     @Override
-    public ITmfEvent parseEvent(TmfContext context) {
+    public ITmfEvent parseEvent(ITmfContext context) {
 
         // Validate the context
         if (!(context instanceof TmfExperimentContext)) {
index 6c955d97cdcfccf4138d2d2a2a707b7a9b60afd3..0ba4f3180bbc78f65b535c4429ae420a3828b731 100644 (file)
@@ -15,8 +15,8 @@ package org.eclipse.linuxtools.tmf.core.parser;
 import java.io.IOException;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 
 /**
  * <b><u>ITmfEventParser</u></b>
@@ -29,5 +29,5 @@ public interface ITmfEventParser<T extends ITmfEvent> {
      * @return
      * @throws IOException 
      */
-       public ITmfEvent parseNextEvent(ITmfTrace<T> stream, TmfContext context) throws IOException;
+       public ITmfEvent parseNextEvent(ITmfTrace<T> stream, ITmfContext context) throws IOException;
 }
index caca47b86b0970fc84528dfc18828a39b7948b1d..4606ef1eebcd93c91a491b4bd739a695843106b9 100644 (file)
@@ -17,7 +17,7 @@ package org.eclipse.linuxtools.tmf.core.trace;
  * <p>
  * This is a place-holder for the context objects.
  */
-public interface ITmfContext {
+public interface ITmfContext extends Cloneable {
 
     public long UNKNOWN_RANK = -2L;
     public long INITIAL_RANK = -1L;
@@ -36,4 +36,7 @@ public interface ITmfContext {
     public void updateRank(int rank);
 
     public boolean isValidRank();
+
+    public ITmfContext clone();
+
 }
index c79e215600c10886512feba5434d9b0b442605c3..d798b1ba732ee1dabff4d6aaa4ef93c3358b58d3 100644 (file)
@@ -128,13 +128,13 @@ public interface ITmfTrace<T extends ITmfEvent> extends ITmfComponent {
      * 
      * @return the next event in the stream
      */
-    public ITmfEvent getNextEvent(TmfContext context);
+    public ITmfEvent getNextEvent(ITmfContext context);
 
     /**
      * Return the event pointed by the supplied context (or null if no event left) and *does not* update the context.
      * 
      * @return the next event in the stream
      */
-    public ITmfEvent parseEvent(TmfContext context);
+    public ITmfEvent parseEvent(ITmfContext context);
 
 }
index caa07fca9c59e43430e195e537543ba037d80f74..25a662f58f685d06b42a3ffb6ec4997c4a2e7f5f 100644 (file)
@@ -408,7 +408,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
      * linuxtools.tmf.trace.ITmfTrace.TraceContext)
      */
     @Override
-    public synchronized ITmfEvent getNextEvent(TmfContext context) {
+    public synchronized ITmfEvent getNextEvent(ITmfContext context) {
         // parseEvent() does not update the context
         ITmfEvent event = parseEvent(context);
         if (event != null) {
index 98b6e6dc2307d934ee1b627ce83577c1f91b8ee3..a0df87c85507857e0a547316fd9adf3d6bb17b99 100644 (file)
@@ -21,8 +21,8 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
 import org.eclipse.linuxtools.tmf.stubs.trace.TmfTraceStub;
 
@@ -30,7 +30,7 @@ public class TmfUml2SDTestTrace implements ITmfEventParser<TmfEvent> {
     
     @Override
     @SuppressWarnings({ "unchecked", "nls" })    
-    public TmfEvent parseNextEvent(ITmfTrace<TmfEvent> eventStream, TmfContext context) throws IOException {
+    public TmfEvent parseNextEvent(ITmfTrace<TmfEvent> eventStream, ITmfContext context) throws IOException {
         if (! (eventStream instanceof TmfTraceStub)) {
             return null;
         }
index 63f4876e09914e73601996388c5430d644371e55..7f4a0b3424bcaa4bf586c6a75f879c74f4bd1d50 100644 (file)
@@ -147,7 +147,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
     }\r
 \r
     @Override\r
-    public synchronized TmfEvent getNextEvent(TmfContext context) {\r
+    public synchronized TmfEvent getNextEvent(ITmfContext context) {\r
         ITmfContext savedContext = context.clone();\r
         TmfEvent event = parseEvent(context);\r
         if (event != null) {\r
@@ -158,7 +158,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
     }\r
 \r
     @Override\r
-    public TmfEvent parseEvent(TmfContext tmfContext) {\r
+    public TmfEvent parseEvent(ITmfContext tmfContext) {\r
         if (!(tmfContext instanceof CustomTxtTraceContext)) {\r
             return null;\r
         }\r
index 5db345859521231ed567fb320212e7931575cc3e..9c5ec541d73be054d54eb1934aa27486ef2ba0cc 100644 (file)
@@ -157,7 +157,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> {
     }\r
 \r
     @Override\r
-    public synchronized TmfEvent getNextEvent(TmfContext context) {\r
+    public synchronized TmfEvent getNextEvent(ITmfContext context) {\r
         ITmfContext savedContext = context.clone();\r
         TmfEvent event = parseEvent(context);\r
         if (event != null) {\r
@@ -168,7 +168,7 @@ public class CustomXmlTrace extends TmfTrace<CustomXmlEvent> {
     }\r
 \r
     @Override\r
-    public TmfEvent parseEvent(TmfContext tmfContext) {\r
+    public TmfEvent parseEvent(ITmfContext tmfContext) {\r
         if (!(tmfContext instanceof CustomXmlTraceContext)) {\r
             return null;\r
         }\r
This page took 0.042073 seconds and 5 git commands to generate.