Fetches the next batch of entries from the cluster.

@param position the position from which to fetch the next batch
@return the next batch of entries from the cluster
976630
private CompletableFuture<IteratorBatch<T>> fetch(int position) {
    return openFuture.thenCompose(initialBatch -> {
      if (!initialBatch.complete()) {
        return client.applyOn(partitionId, service -> nextFunction.next(service, initialBatch.id(), position))
            .thenCompose(nextBatch -> {
              if (nextBatch == null) {
                return close().thenApply(v -> null);
              }
              return CompletableFuture.completedFuture(nextBatch);
            });
      }
      return CompletableFuture.completedFuture(null);
    });
  }
641408
public int[] getPositions() {
    int[] list;
    if (assumeSinglePosition) {
      list = new int[1];
      list[0] = super.startPosition();
      return list;
    } else {
      try {
        processEncodedPayload();
        list = mtasPosition.getPositions();
        if (list != null) {
          return mtasPosition.getPositions();
        }
      } catch (IOException e) {
        log.debug(e);
        // do nothing
      }
      int start = super.startPosition();
      int end = super.endPosition();
      list = new int[end - start];
      for (int i = start; i < end; i++)
        list[i - start] = i;
      return list;
    }
  }
366952
public int readNextToTarget(int iTargetPosition, int iRelPosition) throws DBException
    {
        int iRecordStatus = DBConstants.RECORD_NORMAL;
        boolean bMore = true;
        ResultSet resultSet = (ResultSet)this.getResultSet();
        while (m_iRow < iTargetPosition)
        {   // Spin until you get to the row or hit EOF
            try   {
                bMore = resultSet.next();
                if (!bMore)
                {
                    m_iEOFRow = m_iRow;   // Last physical row = this row - 1.
                    break;  // Hit EOF
                }
                m_iRow++; // Current row
            } catch (SQLException e)    {
                DBException dbEx = this.getDatabase().convertError(e);
                int iErrorCode = dbEx.getErrorCode();
                if ((iRelPosition == DBConstants.FIRST_RECORD) || ((iRelPosition == DBConstants.LAST_RECORD)))
                    if (iErrorCode == DBConstants.INVALID_RECORD)
                        return (DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF);    // Move first - no records
                throw dbEx;
            }
        }
        if ((m_iRow == -1) || (iTargetPosition == -1))
            iRecordStatus |= DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF;
        if (!bMore)
        {
            iRecordStatus |= DBConstants.RECORD_AT_EOF;
            int iEOFRow = m_iEOFRow;   // Save for a sec
            this.setResultSet(null, DBConstants.SQL_SELECT_TYPE);  // Can't use anymore
            m_iEOFRow = iEOFRow;       // I do know the EOF
        }
        return iRecordStatus;
    }
595441
MemoEntry getMemo(String production, int position) {
	Map<String, MemoEntry> map = memo.get(position);
	if (map == null)
	    return null;
	MemoEntry memo = map.get(production);
	if (memo == null)
	    return null;
	return memo;
    }
869874
private void seekToRestartPosition(int restartPosition)
    {
        checkPositionIndex(restartPosition, restartCount, "restartPosition");

        // seek data readIndex to the beginning of the restart block
        int offset = restartPositions.getInt(restartPosition * SIZE_OF_INT);
        data.setPosition(offset);

        // clear the entries to assure key is not prefixed
        nextEntry = null;

        // read the entry
        nextEntry = readEntry(data, null);
    }
4460
public int getMinStartPosition(int docId, int position) throws IOException {
    if (ignoreSpans != null && docId == currentDocId) {
      if (position < minimumPosition) {
        throw new IOException(
            "Unexpected position, should be >= " + minimumPosition + "!");
      } else {
        computeFullStartPositionMinimum(position);
        if (minFullStartPosition.containsKey(position)) {
          return minFullStartPosition.get(position);
        } else {
          return 0;
        }
      }
    } else {
      return 0;
    }
  }
1181688
long getValueAtPosition(final int pos) {
    if (itemsSeen_ == 0) {
      throw new SketchesArgumentException("Requested element from empty reservoir.");
    } else if ((pos < 0) || (pos >= getNumSamples())) {
      throw new SketchesArgumentException("Requested position must be between 0 and "
          + (getNumSamples() - 1) + ", inclusive. Received: " + pos);
    }

    return data_[pos];
  }
440078
@Override
    public LogRepositoryBrowser findNext(RepositoryPointerImpl location,
                                         long timelimit) {
        String[] instanceIds = location.getInstanceIds();
        if (instanceIds.length == 0) {
            logger.logp(Level.SEVERE, className, "findNext", "HPEL_NotRepositoryLocation");
            return null;
        }

        return findNext(parseTimeStamp(instanceIds[0]), timelimit);
    }
718975
public Long getRelativePosition(Long position) {
		long relativePosition = 0L;
		for (Location location : locations) {
			if (location instanceof RemoteLocation) {
				relativePosition += location.getLength();
			} else {
				if (position < location.getBeginPosition()
						|| position > location.getEndPosition()) {
					relativePosition += location.getLength();
				} else {
					if (location.isComplement()) {
						relativePosition += (location.getEndPosition()
								- position + 1);
					} else {
						relativePosition += (position
								- location.getBeginPosition() + 1);
					}
					if (isComplement()) {
						relativePosition = getLength() - relativePosition + 1;
					}
					return relativePosition;
				}
			}
		}
		return null;
	}
1077846
private int binarySearch(int position) {
		int[] minSeqIndex = getMinSequenceIndex();
		int[] maxSeqIndex = getMaxSequenceIndex();

		int low = 0;
		int high = minSeqIndex.length - 1;
		while (low <= high) {
			//Go to the mid point in the array
			int mid = (low + high) >>> 1;

			//Get the max position represented by this Sequence
			int midMinPosition = minSeqIndex[mid];
			int midMaxPosition = maxSeqIndex[mid];

			//if current position is greater than the current bounds then
			//increase search space
			if (midMinPosition < position && midMaxPosition < position) {
				low = mid + 1;
			} //if current position is less than current bounds then decrease
			//search space
			else if (midMinPosition > position && midMaxPosition > position) {
				high = mid - 1;
			} else {
				return mid;
			}
		}
		throw new IndexOutOfBoundsException("Given position " + position + " does not map into this Sequence");
	}
485029
public String getSequence(Long beginPosition, Long endPosition)
	{
		byte[] sequenceByte = getSequenceByte(beginPosition, endPosition);
		if (sequenceByte != null)
			return new String(sequenceByte);
		return null;
	}
125654
public E lookahead(int position) {
        int idx = offset + position - 1;
        if (idx < elements.length) {
            return elements[idx];
        }
        return null;
    }
971896
public Page getSingleValuePage(int position)
    {
        Block[] singleValueBlocks = new Block[this.blocks.length];
        for (int i = 0; i < this.blocks.length; i++) {
            singleValueBlocks[i] = this.blocks[i].getSingleValueBlock(position);
        }
        return new Page(1, singleValueBlocks);
    }
631163
@Override
  public int nextStartPosition() throws IOException {
    if (findMatches()) {
      currentMatch = queueMatches.get(0);
      currentPosition = currentMatch.startPosition();
      queueMatches.remove(0);
      return currentMatch.startPosition();
    } else {
      currentMatch = new Match(NO_MORE_POSITIONS, NO_MORE_POSITIONS);
      currentPosition = NO_MORE_POSITIONS;
      return NO_MORE_POSITIONS;
    }
  }
920294
public  MaterialAccount getAccountAtCurrentPosition(int position) {

        if (position < 0 || position >= accountManager.size())
            throw  new RuntimeException("Account Index Overflow");

        return findAccountNumber(position);
    }
44766
public ScreenLocation getNextLocation(short position, short setNewAnchor)
    {
        if (position == ScreenConstants.FIRST_LOCATION)
            position = ScreenConstants.FIRST_FIELD_BUTTON_LOCATION;
        if (position == ScreenConstants.NEXT_LOGICAL)
            position = ScreenConstants.RIGHT_OF_LAST_BUTTON;
        return super.getNextLocation(position, setNewAnchor);
    }
1128475
@Override
    public E next()
    {
        if (fetchSize <= 0 || count > fetchSize || scrollComplete)
        {
            throw new NoSuchElementException("Nothing to scroll further for:" + m.getEntityClazz());
        }
        else
        {
            E objectToReturn = currentObject;
            currentObject = null;
            return objectToReturn;
        }
    }