// The trace resource
private IResource fResource;
- /*
- * Since in TMF, "traces" can read events, this trace here will have its own
- * iterator. The user can instantiate extra iterator if they want to seek at
- * many places at the same time.
- */
- protected CtfIterator iterator;
-
/* Reference to the state system assigned to this trace */
protected IStateSystemQuerier ss = null;
* @throws TmfTraceException
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#initTrace(IResource, String, Class<CtfTmfEvent>)
*/
- @SuppressWarnings("unused")
@Override
public void initTrace(final IResource resource, final String path, final Class<CtfTmfEvent> eventType)
throws TmfTraceException {
*/
throw new TmfTraceException(e.getMessage());
}
- this.iterator = new CtfIterator(this, 0, 0);
+ CtfIterator iterator = new CtfIterator(this, 0, 0);
setStartTime(TmfTimestamp.BIG_BANG);
- if( !this.iterator.getLocation().equals(CtfIterator.nullLocation)) {
+ if( !iterator.getLocation().equals(CtfIterator.NULL_LOCATION)) {
setStartTime(iterator.getCurrentEvent().getTimestamp());
}
TmfSignalManager.register(this);
* @return boolean
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(IProject, String)
*/
- @SuppressWarnings("unused")
@Override
public boolean validate(final IProject project, final String path) {
try {
}
/**
- * Method getCurrentLocation.
- * @return ITmfLocation<?>
+ * Method getCurrentLocation. This is not applicable in CTF
+ * @return null, since the trace has no knowledge of the current location
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
*/
@Override
public ITmfLocation<?> getCurrentLocation() {
- return iterator.getLocation();
+ return null;
}
// ------------------------------------------------------------------------
if (currentLocation == null) {
currentLocation = new CtfLocation(0L);
}
- if( !iterator.getLocation().equals(CtfIterator.nullLocation)) {
- iterator.setLocation(currentLocation);
- }
- return iterator;
+ CtfIterator context = new CtfIterator(this);
+ context.setLocation(currentLocation);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
}
/**
@Override
public double getLocationRatio(final ITmfLocation<?> location) {
final CtfLocation curLocation = (CtfLocation) location;
+ CtfIterator iterator = new CtfIterator(this);
iterator.seek(curLocation.getLocation());
return ((double) iterator.getCurrentEvent().getTimestampValue() - iterator
.getStartTime())
*/
@Override
public ITmfContext seekEvent(final ITmfTimestamp timestamp) {
- iterator.seek(timestamp.getValue());
- return iterator;
+ CtfIterator context = new CtfIterator(this);
+ context.seek(timestamp.getValue());
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
}
/**
*/
@Override
public ITmfContext seekEvent(final long rank) {
- iterator.setRank(rank);
- return iterator;
+ CtfIterator context = new CtfIterator(this);
+ context.seekRank(rank);
+ context.setRank(rank);
+ return context;
}
/**
*/
@Override
public ITmfContext seekEvent(final double ratio) {
- iterator.seek((long) (this.fNbEvents * ratio));
- return iterator;
+ CtfIterator context = new CtfIterator(this);
+ context.seek((long) (this.fNbEvents * ratio));
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
}
/**
* @return CtfTmfEvent
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#readNextEvent(ITmfContext)
*/
- @SuppressWarnings("unused")
@Override
public CtfTmfEvent readNextEvent(final ITmfContext context) {
- CtfTmfEvent event = iterator.getCurrentEvent();
- iterator.advance();
+ CtfTmfEvent event = null;
+ if (context instanceof CtfIterator) {
+ CtfIterator ctfIterator = (CtfIterator) context;
+ event = ctfIterator.getCurrentEvent();
+ ctfIterator.advance();
+ }
return event;
}
* sub-classes.
* @throws TmfTraceException
*/
- @SuppressWarnings({ "unused", "static-method" })
protected void buildStateSystem() throws TmfTraceException {
/*
* Nothing is done in the basic implementation, please specify