Refactor TmfTrace and dependencies - move parseEvent to ITmfEventParser
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomTxtTrace.java
index 11d435a96b97f015806b9bc26cbd0340d76ea34e..f1a2cc53570c58a29c5f85903aa7d80fd39d5224 100644 (file)
@@ -27,12 +27,13 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;\r
 import org.eclipse.linuxtools.tmf.core.io.BufferedRandomAccessFile;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;\r
 \r
-public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {\r
+public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> implements ITmfEventParser<CustomTxtEvent> {\r
 \r
     private static final TmfLocation<Long> NULL_LOCATION = new TmfLocation<Long>((Long) null);\r
     private static final int DEFAULT_CACHE_SIZE = 100;\r
@@ -57,7 +58,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
     }\r
 \r
     @Override\r
-    public TmfContext seekLocation(final ITmfLocation<?> location) {\r
+    public TmfContext seekEvent(final ITmfLocation<?> location) {\r
         final CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
         if (NULL_LOCATION.equals(location) || !new File(getPath()).isFile())\r
             return context;\r
@@ -103,7 +104,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
     }\r
 \r
     @Override\r
-    public TmfContext seekLocation(final double ratio) {\r
+    public TmfContext seekEvent(final double ratio) {\r
         BufferedRandomAccessFile raFile = null;\r
         try {\r
             raFile = new BufferedRandomAccessFile(getPath(), "r"); //$NON-NLS-1$\r
@@ -116,7 +117,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
                 pos--;\r
             }\r
             final ITmfLocation<?> location = new TmfLocation<Long>(pos);\r
-            final TmfContext context = seekLocation(location);\r
+            final TmfContext context = seekEvent(location);\r
             context.setRank(ITmfContext.UNKNOWN_RANK);\r
             return context;\r
         } catch (final FileNotFoundException e) {\r
@@ -165,7 +166,7 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
     }\r
 \r
     @Override\r
-    public synchronized TmfEvent getNextEvent(final ITmfContext context) {\r
+    public synchronized TmfEvent readEvent(final ITmfContext context) {\r
         final ITmfContext savedContext = context.clone();\r
         final TmfEvent event = parseEvent(context);\r
         if (event != null) {\r
This page took 0.024759 seconds and 5 git commands to generate.