// ------------------------------------------------------------------------
  // TmfProvider
  // ------------------------------------------------------------------------
  @Override
  public ITmfContext armRequest(ITmfDataRequest<T> request) {
    //		Tracer.trace("Ctx: Arming request - start");
    TmfTimestamp timestamp =
        (request instanceof ITmfEventRequest<?>)
            ? ((ITmfEventRequest<T>) request).getRange().getStartTime()
            : null;

    if (TmfTimestamp.BigBang.equals(timestamp) || request.getIndex() > 0) {
      timestamp = null; // use request index
    }

    TmfExperimentContext context = null;
    if (timestamp != null) {
      // seek by timestamp
      context = seekEvent(timestamp);
      ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank());
    } else {
      // Seek by rank
      if ((fExperimentContext != null) && fExperimentContext.getRank() == request.getIndex()) {
        // We are already at the right context -> no need to seek
        context = fExperimentContext;
      } else {
        context = seekEvent(request.getIndex());
      }
    }
    //		Tracer.trace("Ctx: Arming request - done");
    return context;
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#seekEvent(long)
   */
  @Override
  public synchronized TmfExperimentContext seekEvent(long rank) {

    //		Tracer.trace("Ctx: seekEvent(rank) - start");

    // Position the stream at the previous checkpoint
    int index = (int) rank / fIndexPageSize;
    ITmfLocation<?> location;
    synchronized (fCheckpoints) {
      if (fCheckpoints.size() == 0) {
        location = null;
      } else {
        if (index >= fCheckpoints.size()) {
          index = fCheckpoints.size() - 1;
        }
        location = fCheckpoints.elementAt(index).getLocation();
      }
    }

    TmfExperimentContext context = seekLocation(location);
    context.setRank((long) index * fIndexPageSize);

    // And locate the event
    TmfEvent event = parseEvent(context);
    long pos = context.getRank();
    while (event != null && pos++ < rank) {
      getNextEvent(context);
      event = parseEvent(context);
    }

    if (event == null) {
      context.setLocation(null);
      context.setRank(ITmfContext.UNKNOWN_RANK);
    }

    return context;
  }
 /**
  * Returns the rank of the first event with the requested timestamp. If none, returns the index of
  * the next event (if any).
  *
  * @param timestamp
  * @return
  */
 @Override
 public long getRank(TmfTimestamp timestamp) {
   TmfExperimentContext context = seekEvent(timestamp);
   return context.getRank();
 }