Re-structure LTTng sub-project as per the Linux Tools guidelines
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui.tests / stubs / org / eclipse / linuxtools / lttng / stubs / LTTngTraceStub.java
index 9bcc8a1862af2de24fb43658ab57ead3783fad66..63b096b1d165eb50b2f69a7303e691d1f842300e 100644 (file)
@@ -16,19 +16,21 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 
-import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.parser.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.trace.TmfLocation;
-import org.eclipse.linuxtools.tmf.trace.TmfTrace;
+import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+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.core.trace.TmfTrace;
 
 /**
  * <b><u>LTTngTraceStub</u></b>
  * <p>
  * Dummy test trace. Use in conjunction with LTTngEventParserStub.
  */
+@SuppressWarnings("nls")
 public class LTTngTraceStub extends TmfTrace<LttngEvent> {
 
     // ========================================================================
@@ -51,7 +53,7 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> {
      * @throws FileNotFoundException
      */
     public LTTngTraceStub(String filename) throws FileNotFoundException {
-        this(filename, DEFAULT_CACHE_SIZE);
+        this(filename, DEFAULT_INDEX_PAGE_SIZE);
     }
 
     /**
@@ -61,12 +63,24 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> {
      * @throws FileNotFoundException
      */
     public LTTngTraceStub(String filename, int cacheSize) throws FileNotFoundException {
-        super(LttngEvent.class, filename, cacheSize);
+        super(filename, LttngEvent.class, filename, cacheSize);
         fTrace = new RandomAccessFile(filename, "r");
        fParser = new LTTngEventParserStub();
-       indexTrace(true);
+//     indexTrace(true);
     }
-
+    
+       @Override
+       public ITmfTrace<LttngEvent> copy() {
+               ITmfTrace<LttngEvent> returnedValue = null;
+               try {
+                       returnedValue = new LTTngTraceStub(this.getName());
+               }
+               catch (FileNotFoundException e) {
+                       e.printStackTrace();
+               }
+               return returnedValue;
+       }
+    
     // ========================================================================
     // Accessors
     // ========================================================================
@@ -82,12 +96,13 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> {
     /* (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.eventlog.ITmfStreamLocator#seekLocation(java.lang.Object)
      */
+       @Override
        @SuppressWarnings("unchecked")
-       public TmfContext seekLocation(ITmfLocation location) {
+       public TmfContext seekLocation(ITmfLocation<?> location) {
         TmfContext context = null;
                try {
                        synchronized(fTrace) {
-                       fTrace.seek((location != null) ? ((TmfLocation<Long>) location).getValue() : 0);
+                       fTrace.seek((location != null) ? ((TmfLocation<Long>) location).getLocation() : 0);
                        context = new TmfContext(getCurrentLocation(), 0);
 //                     TmfTraceContext context2 = new TmfTraceContext(getCurrentLocation(), 0);
 //                     TmfEvent event = parseEvent(context2);
@@ -100,11 +115,23 @@ public class LTTngTraceStub extends TmfTrace<LttngEvent> {
         return context;
     }
 
+    @Override
+    public TmfContext seekLocation(double ratio) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public double getLocationRatio(ITmfLocation<?> location) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
     /* (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.eventlog.ITmfStreamLocator#getCurrentLocation()
      */
     @Override
-       public ITmfLocation getCurrentLocation() {
+       public ITmfLocation<?> getCurrentLocation() {
                try {
                        return new TmfLocation<Long>(fTrace.getFilePointer());
                } catch (IOException e) {
This page took 0.025241 seconds and 5 git commands to generate.