* TmfCheckpointIndexer (default). In this case, the trace cache size will be
* used as checkpoint interval.
*
- * @param <T> The trace event type
- *
* @version 1.0
* @author Francois Chouinard
*
* @see ITmfTraceIndexer
* @see ITmfEventParser
*/
-public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T> implements ITmfTrace<T> {
+public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
// ------------------------------------------------------------------------
// Attributes
private long fStreamingInterval = 0;
// The trace indexer
- private ITmfTraceIndexer<ITmfTrace<ITmfEvent>> fIndexer;
+ private ITmfTraceIndexer fIndexer;
// The trace parser
- private ITmfEventParser<T> fParser;
+ private ITmfEventParser fParser;
// ------------------------------------------------------------------------
// Construction
* @param cacheSize the trace cache size
* @throws TmfTraceException
*/
- protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize) throws TmfTraceException {
+ protected TmfTrace(final IResource resource, final Class<? extends ITmfEvent> type, final String path, final int cacheSize) throws TmfTraceException {
this(resource, type, path, cacheSize, 0);
}
* @param interval the trace streaming interval
* @throws TmfTraceException
*/
- protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize, final long interval) throws TmfTraceException {
+ protected TmfTrace(final IResource resource, final Class<? extends ITmfEvent> type, final String path, final int cacheSize, final long interval) throws TmfTraceException {
this(resource, type, path, cacheSize, interval, null);
}
* @param indexer the trace indexer
* @throws TmfTraceException
*/
- protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize,
- final long interval, final ITmfTraceIndexer<?> indexer) throws TmfTraceException {
+ protected TmfTrace(final IResource resource, final Class<? extends ITmfEvent> type, final String path, final int cacheSize,
+ final long interval, final ITmfTraceIndexer indexer) throws TmfTraceException {
this(resource, type, path, cacheSize, interval, indexer, null);
}
* @param parser the trace event parser
* @throws TmfTraceException
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected TmfTrace(final IResource resource, final Class<T> type, final String path, final int cacheSize,
- final long interval, final ITmfTraceIndexer<?> indexer, final ITmfEventParser<T> parser) throws TmfTraceException {
+ protected TmfTrace(final IResource resource, final Class<? extends ITmfEvent> type, final String path, final int cacheSize,
+ final long interval, final ITmfTraceIndexer indexer, final ITmfEventParser parser) throws TmfTraceException {
super();
fCacheSize = (cacheSize > 0) ? cacheSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE;
fStreamingInterval = interval;
* @param trace the original trace
* @throws TmfTraceException Should not happen usually
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public TmfTrace(final TmfTrace<T> trace) throws TmfTraceException {
+ public TmfTrace(final TmfTrace trace) throws TmfTraceException {
super();
if (trace == null) {
throw new IllegalArgumentException();
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#initTrace(org.eclipse.core.resources.IResource, java.lang.String, java.lang.Class)
*/
@Override
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public void initTrace(final IResource resource, final String path, final Class<T> type) throws TmfTraceException {
+ public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type) throws TmfTraceException {
fIndexer = new TmfCheckpointIndexer(this, fCacheSize);
initialize(resource, path, type);
}
*
* @throws TmfTraceException
*/
- @SuppressWarnings("unchecked")
- protected void initialize(final IResource resource, final String path, final Class<T> type) throws TmfTraceException {
+ protected void initialize(final IResource resource, final String path, final Class<? extends ITmfEvent> type) throws TmfTraceException {
if (path == null) {
throw new TmfTraceException("Invalid trace path"); //$NON-NLS-1$
}
}
if (fParser == null) {
if (this instanceof ITmfEventParser) {
- fParser = (ITmfEventParser<T>) this;
+ fParser = (ITmfEventParser) this;
} else {
throw new TmfTraceException("Invalid trace parser"); //$NON-NLS-1$
}
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getEventType()
*/
@Override
- public Class<T> getEventType() {
- return (Class<T>) super.getType();
+ public Class<ITmfEvent> getEventType() {
+ return (Class<ITmfEvent>) super.getType();
}
/* (non-Javadoc)
/**
* @return the trace indexer
*/
- protected ITmfTraceIndexer<ITmfTrace<ITmfEvent>> getIndexer() {
+ protected ITmfTraceIndexer getIndexer() {
return fIndexer;
}
/**
* @return the trace parser
*/
- protected ITmfEventParser<T> getParser() {
+ protected ITmfEventParser getParser() {
return fParser;
}
*
* @param indexer the trace indexer
*/
- protected void setIndexer(final ITmfTraceIndexer<ITmfTrace<ITmfEvent>> indexer) {
+ protected void setIndexer(final ITmfTraceIndexer indexer) {
fIndexer = indexer;
}
*
* @param parser the new trace parser
*/
- protected void setParser(final ITmfEventParser<T> parser) {
+ protected void setParser(final ITmfEventParser parser) {
fParser = parser;
}
// A rank <= 0 indicates to seek the first event
if (rank <= 0) {
- ITmfContext context = seekEvent((ITmfLocation<?>) null);
+ ITmfContext context = seekEvent((ITmfLocation) null);
context.setRank(0);
return context;
}
// A null timestamp indicates to seek the first event
if (timestamp == null) {
- ITmfContext context = seekEvent((ITmfLocation<?>) null);
+ ITmfContext context = seekEvent((ITmfLocation) null);
context.setRank(0);
return context;
}
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#readNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
*/
@Override
- public synchronized T getNext(final ITmfContext context) {
+ public synchronized ITmfEvent getNext(final ITmfContext context) {
// parseEvent() does not update the context
- final T event = fParser.parseEvent(context);
+ final ITmfEvent event = fParser.parseEvent(context);
if (event != null) {
updateAttributes(context, event.getTimestamp());
context.setLocation(getCurrentLocation());
* @see org.eclipse.linuxtools.tmf.core.component.TmfDataProvider#armRequest(org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest)
*/
@Override
- protected ITmfContext armRequest(final ITmfDataRequest<T> request) {
- if ((request instanceof ITmfEventRequest<?>)
- && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest<T>) request).getRange().getStartTime())
+ protected ITmfContext armRequest(final ITmfDataRequest request) {
+ if ((request instanceof ITmfEventRequest)
+ && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest) request).getRange().getStartTime())
&& (request.getIndex() == 0))
{
- final ITmfContext context = seekEvent(((ITmfEventRequest<T>) request).getRange().getStartTime());
- ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank());
+ final ITmfContext context = seekEvent(((ITmfEventRequest) request).getRange().getStartTime());
+ ((ITmfEventRequest) request).setStartIndex((int) context.getRank());
return context;
}