* <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
/**
* @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);
}
/**
* @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;
}
/**
* @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() + ")]";
+ }
+
}