Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / request / TmfEventRequest.java
index 678125cf36e6c17670d6515d4ccb587bd06647eb..f5375a3bf80f62ced0a530eee9cb942753a55d53 100644 (file)
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
  * <p>
  * Implement me. Please.
  */
-public class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest<T> {
+public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest<T> implements ITmfEventRequest<T> {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -35,23 +35,35 @@ public class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest<T> {
     /**
      * @param range
      */
-    public TmfEventRequest(Class<? extends TmfEvent> dataType) {
-        this(dataType, TmfTimeRange.Eternity, ALL_DATA, DEFAULT_BLOCK_SIZE);
+    public TmfEventRequest(Class<T> dataType) {
+        this(dataType, TmfTimeRange.Eternity, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
+    }
+
+    public TmfEventRequest(Class<T> dataType, ExecutionType execType) {
+        this(dataType, TmfTimeRange.Eternity, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, execType);
     }
 
     /**
      * @param range
      */
-    public TmfEventRequest(Class<? extends TmfEvent> dataType, TmfTimeRange range) {
-        this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE);
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range) {
+        this(dataType, range, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
+    }
+
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range, ExecutionType execType) {
+        this(dataType, range, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, execType);
     }
 
     /**
      * @param range
      * @param nbRequested
      */
-    public TmfEventRequest(Class<? extends TmfEvent> dataType, TmfTimeRange range, int nbRequested) {
-        this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE);
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested) {
+        this(dataType, range, 0, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
+    }
+    
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, ExecutionType execType) {
+        this(dataType, range, 0, nbRequested, DEFAULT_BLOCK_SIZE, execType);
     }
     
     /**
@@ -59,8 +71,16 @@ public class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest<T> {
      * @param nbRequested
      * @param blockSize Size of the largest blocks expected
      */
-    public TmfEventRequest(Class<? extends TmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
-       super(dataType, 0, nbRequested, blockSize);
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
+       this(dataType, range, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
+    }
+
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, int blockSize, ExecutionType execType) {
+       this(dataType, range, 0, nbRequested, blockSize, execType);
+    }
+
+    public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int index, int nbRequested, int blockSize, ExecutionType execType) {
+       super(dataType, index, nbRequested, blockSize, execType);
        fRange = range;
     }
 
@@ -71,8 +91,49 @@ public class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest<T> {
     /**
      * @return the requested time range
      */
-    public TmfTimeRange getRange() {
+    @Override
+       public TmfTimeRange getRange() {
         return fRange;
     }
 
+    // ------------------------------------------------------------------------
+    // Setters
+    // ------------------------------------------------------------------------
+
+    /**
+     * this method is called by the event provider to set the index corresponding
+     * to the time range start time once it is known
+     * @param index the start time index
+     */
+    @Override
+       public void setStartIndex(int index) {
+       setIndex(index);
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    // All requests have a unique id
+    public int hashCode() {
+       return getRequestId();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+       if (other instanceof TmfEventRequest<?>) {
+               TmfEventRequest<?> request = (TmfEventRequest<?>) other;
+               return super.equals(other) && request.fRange.equals(fRange);
+       }
+       return false;
+    }
+
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+               return "[TmfEventRequest(" + getRequestId() + "," + getDataType().getSimpleName() 
+                       + "," + getRange() + "," + getIndex() + "," + getNbRequested() + "," + getBlockSize() + ")]";
+    }
+
 }
This page took 0.029093 seconds and 5 git commands to generate.