Remove the generic location (replace by Comparable)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomTxtTrace.java
index b224a92b529d034658431f6f1446ce8ef7c3a1d4..c12031e5afc8033edc481497be587827658516d9 100644 (file)
@@ -32,12 +32,12 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 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.TmfLongLocation;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;\r
 \r
 public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {\r
 \r
-    private static final TmfLocation<Long> NULL_LOCATION = new TmfLocation<Long>((Long) null);\r
+    private static final TmfLongLocation NULL_LOCATION = new TmfLongLocation((Long) null);\r
     private static final int DEFAULT_CACHE_SIZE = 100;\r
 \r
     private final CustomTxtTraceDefinition fDefinition;\r
@@ -81,7 +81,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
     }\r
 \r
     @Override\r
-    public synchronized TmfContext seekEvent(final ITmfLocation<?> location) {\r
+    public synchronized TmfContext seekEvent(final ITmfLocation location) {\r
         final CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         if (NULL_LOCATION.equals(location) || fFile == null) {\r
             return context;\r
@@ -89,8 +89,8 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
         try {\r
             if (location == null) {\r
                 fFile.seek(0);\r
-            } else if (location.getLocation() instanceof Long) {\r
-                fFile.seek((Long) location.getLocation());\r
+            } else if (location.getLocationData() instanceof Long) {\r
+                fFile.seek((Long) location.getLocationData());\r
             }\r
             String line;\r
             long rawPos = fFile.getFilePointer();\r
@@ -98,7 +98,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
                 for (final InputLine input : getFirstLines()) {\r
                     final Matcher matcher = input.getPattern().matcher(line);\r
                     if (matcher.find()) {\r
-                        context.setLocation(new TmfLocation<Long>(rawPos));\r
+                        context.setLocation(new TmfLongLocation(rawPos));\r
                         context.firstLineMatcher = matcher;\r
                         context.firstLine = line;\r
                         context.nextLineLocation = fFile.getFilePointer();\r
@@ -133,7 +133,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
                 }\r
                 pos--;\r
             }\r
-            final ITmfLocation<?> location = new TmfLocation<Long>(pos);\r
+            final ITmfLocation location = new TmfLongLocation(pos);\r
             final TmfContext context = seekEvent(location);\r
             context.setRank(ITmfContext.UNKNOWN_RANK);\r
             return context;\r
@@ -144,13 +144,13 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
     }\r
 \r
     @Override\r
-    public synchronized double getLocationRatio(final ITmfLocation<?> location) {\r
+    public synchronized double getLocationRatio(final ITmfLocation location) {\r
         if (fFile == null) {\r
             return 0;\r
         }\r
         try {\r
-            if (location.getLocation() instanceof Long) {\r
-                return (double) ((Long) location.getLocation()) / fFile.length();\r
+            if (location.getLocationData() instanceof Long) {\r
+                return (double) ((Long) location.getLocationData()) / fFile.length();\r
             }\r
         } catch (final IOException e) {\r
             Activator.getDefault().logError("Error seeking event. File: " + getPath(), e); //$NON-NLS-1$\r
@@ -159,7 +159,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
     }\r
 \r
     @Override\r
-    public ITmfLocation<?> getCurrentLocation() {\r
+    public ITmfLocation getCurrentLocation() {\r
         // TODO Auto-generated method stub\r
         return null;\r
     }\r
@@ -190,7 +190,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
         }\r
 \r
         final CustomTxtTraceContext context = (CustomTxtTraceContext) tmfContext;\r
-        if (!(context.getLocation().getLocation() instanceof Long) || NULL_LOCATION.equals(context.getLocation())) {\r
+        if (!(context.getLocation().getLocationData() instanceof Long) || NULL_LOCATION.equals(context.getLocation())) {\r
             return null;\r
         }\r
 \r
@@ -215,7 +215,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
                     for (final InputLine input : getFirstLines()) {\r
                         final Matcher matcher = input.getPattern().matcher(line);\r
                         if (matcher.find()) {\r
-                            context.setLocation(new TmfLocation<Long>(rawPos));\r
+                            context.setLocation(new TmfLongLocation(rawPos));\r
                             context.firstLineMatcher = matcher;\r
                             context.firstLine = line;\r
                             context.nextLineLocation = fFile.getFilePointer();\r
@@ -230,7 +230,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {
                             for (final InputLine input : getFirstLines()) {\r
                                 final Matcher matcher = input.getPattern().matcher(line);\r
                                 if (matcher.find()) {\r
-                                    context.setLocation(new TmfLocation<Long>(rawPos));\r
+                                    context.setLocation(new TmfLongLocation(rawPos));\r
                                     context.firstLineMatcher = matcher;\r
                                     context.firstLine = line;\r
                                     context.nextLineLocation = fFile.getFilePointer();\r
This page took 0.026084 seconds and 5 git commands to generate.