+ /*
+ * The rank is set to 0 if the iterator seeks the beginning. If not, it
+ * will be set to UNKNOWN_RANK, since CTF traces don't support seeking
+ * by rank for now.
+ */
+ if (currentLocation == null) {
+ currentLocation = new CtfLocation(new CtfLocationInfo(0L, 0L));
+ context.setRank(0);
+ }
+ if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
+ currentLocation = new CtfLocation(getEndTime().getValue() + 1, 0L);
+ }
+ context.setLocation(currentLocation);
+ if (location == null) {
+ CtfTmfEvent event = getIterator(this, context).getCurrentEvent();
+ if (event != null) {
+ currentLocation = new CtfLocation(event.getTimestamp().getValue(), 0);
+ }
+ }
+ if (context.getRank() != 0) {
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ }
+ return context;