Positions the current slot right before the first index record that matches
the specified search range.
358608
private void moveSlotBefore() {
		/*
		 * int slot = 0; while (slot < currentPage.getNumRecords() &&
		 * searchRange.largerThan(getKey(currentPage, slot))) slot++;
		 * 
		 * currentSlot = slot - 1;
		 */
		// Optimization: Use binary search rather than sequential search
		int startSlot = 0, endSlot = currentPage.getNumRecords() - 1;
		int middleSlot = (startSlot + endSlot) / 2;
		SearchKey searchMin = searchRange.getMin();

		if (endSlot >= 0) {
			while (middleSlot != startSlot) {
				if (searchMin.compareTo(
						getKey(currentPage, middleSlot, keyType.length())) > 0)
					startSlot = middleSlot;
				else
					endSlot = middleSlot;

				middleSlot = (startSlot + endSlot) / 2;
			}
			
			if (searchMin.compareTo(
					getKey(currentPage, endSlot, keyType.length())) > 0)
				currentSlot = endSlot;
			else if (searchMin.compareTo(
					getKey(currentPage, startSlot, keyType.length())) > 0)
				currentSlot = startSlot;
			else
				currentSlot = startSlot - 1;
		} else
			currentSlot = -1;
	}
1236235
def position_before(self, instr):
        
        self._block = instr.parent
        self._anchor = self._block.instructions.index(instr)
343970
private int startIndex(Date start) {
        int lastIndex = ranges.size();

        for (int i = 0; i < ranges.size(); i++) {
            Range r = ranges.get(i);
            if (start.before(r.start)) {
                break;
            }
            lastIndex = i;
        }
        return lastIndex;
    }
946913
def previous_row(self):
        """"""
        row = self.currentIndex().row()
        rows = self.proxy_model.rowCount()
        if row == 0:
            row = rows
        self.selectRow(row - 1)
1039944
def _next_page(self, offset):
        """"""
        self._log.debug("Iterator c_record={}".format(self.c_record))
        page_size = self.page_size
        if (offset + page_size) > self.max_records:
            page_size = self.max_records - offset
        param_dict = self.query_dict.copy()
        param_dict.update(
            {
                'start': str(offset),
                'rows': str(page_size),
                'explainOther': '',
                'hl.fl': '',
            }
        )
        self.res = self.client.search(**param_dict)
        self._num_hits = int(self.res['response']['numFound'])
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;
    }
  }
675474
function updateNewIndicesAfterSlot(slot, indexDelta) {
                    // Adjust all the indexNews after this slot
                    for (slot = slot.next; slot; slot = slot.next) {
                        if (slot.firstInSequence) {
                            var indexNew = (slot.indexNew !== undefined ? slot.indexNew : slot.index);
                            if (indexNew !== undefined) {
                                slot.indexNew = indexNew + indexDelta;
                            }
                        }
                    }

                    // Adjust the overall count
                    countDelta += indexDelta;

                    indexUpdateDeferred = true;

                    // Increment currentRefreshID so any outstanding fetches don't cause trouble.  If a refresh is in progress,
                    // restart it (which will also increment currentRefreshID).
                    if (refreshInProgress) {
                        beginRefresh();
                    } else {
                        currentRefreshID++;
                    }
                }
520901
protected void seekToPresentRow(long currentRow) throws IOException {
    if (currentRow != previousPresentRow + 1) {
      long rowInStripe = currentRow - rowBaseInStripe - 1;
      int rowIndexEntry = computeRowIndexEntry(currentRow);
      if (rowIndexEntry != computeRowIndexEntry(previousPresentRow) ||
          currentRow < previousPresentRow) {
        // Since we're resetting numNulls we need to seek to the appropriate row not just in the
        // present stream, but in all streams for the column
        seek(rowIndexEntry, currentRow < previousPresentRow);
        numNonNulls = countNonNulls(rowInStripe - (rowIndexEntry * rowIndexStride));
      } else {
        numNonNulls += countNonNulls(currentRow - previousPresentRow - 1);
      }
    }

    // If this is the first row in a row index stride update the number of non-null values to 0
    if ((currentRow - rowBaseInStripe - 1) % rowIndexStride == 0) {
      numNonNulls = 0;
    }

    previousPresentRow = currentRow;
  }
531880
private int sequentialFindDelete(
    int              lower,
    int              upper,
    Object           delKey)
  {
    java.util.Comparator comp = deleteComparator();
    int xcc;                       /* Current compare result                */
    int idx = -1;                  /* The returned index (-1 if not found)  */
    for (int i = lower; i <= upper; i++)
    {
      xcc = comp.compare(delKey, _nodeKey[i]);
      if (xcc == 0)                /* Found a match                         */
        {
          idx = i;                 /* Remember current point                */
          break;
        }
    }
    return idx;
  }
573128
function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) {
            if (rowIndex === _startPoint.rowPos && _startPoint.colPos >= cell.cellIndex && cell.cellIndex <= cellIndex && !isSelectedCell) {
                _startPoint.colPos++;
            }
        }
699495
function isAtStart(string, index) {
  const before = string.substring(0, index).trim();

  return before.length === 0 || before.search(/[({,]$/) !== -1;
}
1195024
private void prefetch(long storageIndex) {
        long startIndex = storageIndex / BYTES_IN_DATA;
        // Inc to next bucket
        startIndex += 128;

        if (mPrefetchedBuckets.contains(startIndex)) {
            mPrefetchedBuckets.remove(startIndex);
            return;
        }

        for (int i = 0; i < BUCKETS_TO_PREFETCH; i++) {
            if ((startIndex + i) > (mNodeNumbers / 128)) {
                return;
            }

            mRtx.moveTo(startIndex);
            startIndex += 128;
        }
    }
926310
def preceded_by(former)
      matches = SearchAtom.new
      latter = ActiveSupport::OrderedHash.new
      former.record_ids.each do |rid|
        latter[rid] = @records[rid] if @records[rid]
      end
      # Iterate over each record in latter.
      latter.each do |record_id,pos|

        # Iterate over each position.
        pos.each do |p|
          # Check if previous position is in former.
          if former.include_position?(record_id,p-1)
            matches.add_record(record_id) unless matches.include_record?(record_id)
            matches.add_position(record_id,p)
          end
        end

      end
      matches
    end
722911
public S setBefore(int rightIndex) {
		return set(Indexer.of(delegate.get()).before(rightIndex));
	}
577156
public function setStartIndex(int $startIndex): self
    {
        if ($startIndex < 1) {
            throw new \RangeException('The start index must be 1 or greater.');
        }

        $this->startIndex = $startIndex;

        return $this;
    }
589555
public void seekToRecord(int n) {
        if (!canSeek()) {
            throw new DbfException("Seeking is not supported.");
        }
        if (n < 0 || n >= header.getNumberOfRecords()) {
            throw new DbfException(String.format("Record index out of range [0, %d]: %d",
                    header.getNumberOfRecords(), n));
        }
        long position = header.getHeaderLength() + n * header.getRecordLength();
        try {
            ((RandomAccessFile) dataInput).seek(position);
        } catch (IOException e) {
            throw new DbfException(
                    String.format("Failed to seek to record %d of %d", n, header.getNumberOfRecords()), e);
        }
    }
164880
private void positionX(int secondX) {

        if (secondX < m_firstX) {
            setSelectPositionX(secondX, m_firstX - secondX);
        } else {
            setSelectWidth(secondX - m_firstX);
        }
    }