Get the next cell, from left to right, top to bottom. Returns null if last element in array reached.
485848
function nextCell(elt) {
    if (elt.c + 1 < actionInfo[elt.r].length) {
      return {r: elt.r, c: elt.c + 1};
    } else if (elt.r + 1 < actionInfo.length) {
      return {r: elt.r + 1, c: 0};
    }
    return null;
  }
54145
private int findRow(int rangeStart) {
        int index = 0;

        // check the vicinity of the last-seen row (start
        // searching with an unrolled loop)

        index = prevRow * columns;
        if (rangeStart >= v[index]) {
            if (rangeStart < v[index + 1]) {
                // same row as last seen
                return index;
            } else {
                index += columns;
                if (rangeStart < v[index + 1]) {
                    ++prevRow;
                    return index;
                } else {
                    index += columns;
                    if (rangeStart < v[index + 1]) {
                        prevRow += 2;
                        return index;
                    } else if ((rangeStart - v[index + 1]) < 10) {
                        // we are close, continue looping
                        prevRow += 2;
                        do {
                            ++prevRow;
                            index += columns;
                        } while (rangeStart >= v[index + 1]);
                        return index;
                    }
                }
            }
        } else if (rangeStart < v[1]) {
            // the very first row
            prevRow = 0;
            return 0;
        }

        // do a binary search for the start of the range
        int start = 0;
        int mid = 0;
        int limit = rows;
        while (start < limit - 1) {
            mid = (start + limit) / 2;
            index = columns * mid;
            if (rangeStart < v[index]) {
                limit = mid;
            } else if (rangeStart < v[index + 1]) {
                prevRow = mid;
                return index;
            } else {
                start = mid;
            }
        }

        // must be found because all ranges together always cover
        // all of Unicode
        prevRow = start;
        index = start * columns;
        return index;
    }
259823
void cell(Cell cell) {
        int left = cell.getLeft();
        int right = cell.getRight();
        // first see if we've got a cell past the last col
        if (right > realColumnCount) {
            // are we past last col entirely?
            if (left == realColumnCount) {
                // single col?
                if (left + 1 != right) {
                    appendColumnRange(new ColumnRange(cell.elementName(), cell, left + 1, right));
                }
                realColumnCount = right;
                return;
            } else {
                // not past entirely
                appendColumnRange(new ColumnRange(cell.elementName(), cell, realColumnCount, right));                
                realColumnCount = right;
            }
        }
        while (currentColRange != null) {
            int hit = currentColRange.hits(left);
            if (hit == 0) {
                ColumnRange newRange = currentColRange.removeColumn(left);
                if (newRange == null) {
                    // zap a list item
                    if (previousColRange != null) {
                        previousColRange.setNext(currentColRange.getNext());
                    }
                    if (first == currentColRange) {
                        first = currentColRange.getNext();
                    }
                    if (last == currentColRange) {
                        last = previousColRange;
                    }
                    currentColRange = currentColRange.getNext();
                } else {
                    if (last == currentColRange) {
                        last = newRange;
                    }
                    currentColRange = newRange;
                }
                return;
            } else if (hit == -1) {
                return;
            } else if (hit == 1) {
                previousColRange = currentColRange;
                currentColRange = currentColRange.getNext();                                
            }
        }
    }
395626
function getRows (items) {
  const data = {}
  const rows = [[]]

  data.stacks = true

  for (var i = 0; i < items.length; i++) {
    const el = items[i]
    const dim = el.getBoundingClientRect()

    if (!dim.height) {
      continue
    }

    for (var j = rows.length - 1; j >= 0; j--) {
      const row = rows[j]

      if (!row[0]) {
        row.push(el)
        break
      }

      var leftDim = row[0].getBoundingClientRect()

      if (dim.top >= Math.floor(leftDim.bottom)) {
        rows.push([el])
        break
      }

      if (Math.floor(dim.bottom) > leftDim.top) {
        data.stacks = false

        if (dim.left < leftDim.left && !isRtl) {
          row.unshift(el)
          break
        }

        row.push(el)
        break
      }

      if (j === 0) {
        rows.unshift([el])
        break
      }
    }
  }

  data.rows = rows

  return data
}
930830
function last(array) {

  var n,
    getter,
    args,
    reversed;

  if(!isArray(array)) {
    return array;
  }

  //cuz reverse change our src array
  //and we don't want side effects
  reversed = array.slice();

  args = Array.prototype.slice.call(arguments, 1);
  n = (isNumber(args[0])) ? args[0] : 1;
  getter = (!isNumber(args[0]))  ? args[0] : (!isNumber(args[1])) ? args[1] : undefined;

  return (args.length)
    //send reversed array as arguments, and reverse it back as result
    ? getFirstMatches(reversed.reverse(), n,(getter) ? $parse(getter) : getter).reverse()
    //get the last element
    : reversed[reversed.length-1];
}
1095719
def get_t(self):
        """"""

        cell_above = CellBorders(self.cell_attributes,
                                 *self.cell.get_above_key_rect())
        return cell_above.get_b()
404300
@Nullable
    String next() {
        if( lastIdx >= selector.length() ) {
            return null;
        }
        LOOP: do {
            if( ++idx == selector.length() ) {
                break LOOP;
            }
            switch( selector.charAt( idx ) ) {
                case '.':
                case '#':
                case ':':
                case '[':
                    break LOOP;
            }
        } while( true );
        String str = selector.substring( lastIdx, idx ).trim();
        lastIdx = idx;
        return str;
    }
791062
@Override
    public void findNext(String str) {
        int startLine = getLine();
        int startColumn = getColumn();
        highLight(str);
        delegate.findNext(str);
        int targetLine = getLine();
        int targetColumn = getColumn();
        //Rest the actual pointer
        delegate.move(startLine, startColumn);
        int verticalOffset = targetLine - getLine();
        moveVertical(verticalOffset);
        int horizontalOffset = targetColumn - getColumn();
        moveHorizontally(horizontalOffset);
        redrawText();

    }
1183631
function (startCell, endCell, callback) {
      var result = {
        index: [], // list of cell index: A1, A2, A3
        value: []  // list of cell value
      };

      var cols = {
        start: 0,
        end: 0
      };

      if (endCell.col >= startCell.col) {
        cols = {
          start: startCell.col,
          end: endCell.col
        };
      } else {
        cols = {
          start: endCell.col,
          end: startCell.col
        };
      }

      var rows = {
        start: 0,
        end: 0
      };

      if (endCell.row >= startCell.row) {
        rows = {
          start: startCell.row,
          end: endCell.row
        };
      } else {
        rows = {
          start: endCell.row,
          end: startCell.row
        };
      }

      for (var column = cols.start; column <= cols.end; column++) {
        for (var row = rows.start; row <= rows.end; row++) {
          var cellIndex = instance.utils.toChar(column) + (row + 1),
              cellValue = instance.helper.cellValue.call(this, cellIndex);

          result.index.push(cellIndex);
          result.value.push(cellValue);
        }
      }

      if (instance.utils.isFunction(callback)) {
        return callback.apply(callback, [result]);
      } else {
        return result;
      }
    }
182560
function getNextRange(ranges, anchor) {
	for (let i = 0; i < ranges.length; i++) {
		if (anchor.isEqual(ranges[i])) {
			// NB may return `undefined`, which is totally fine and means that
			// we should move to next element
			return ranges[i + 1];
		}
	}

	// Keep ranges which are not on the left of given selection
	ranges = ranges.filter(r => anchor.end.isLessThanOrEqual(r.start));

	return ranges[0];
}
1043134
def get_l(self):
        """"""

        cell_left = CellBorders(self.cell_attributes,
                                *self.cell.get_left_key_rect())
        return cell_left.get_r()
1325550
@Override
    public boolean advanceNextPosition()
    {
        boolean needNextRows = !started || !nextRows.hasNext();

        if (!started) {
            started = true;
            nanoStart = System.nanoTime();
        }

        if (needNextRows) {
            currentRow = null;
            try {
                do {
                    if (!scanner.hasMoreRows()) {
                        return false;
                    }

                    nextRows = scanner.nextRows();
                }
                while (!nextRows.hasNext());
                log.debug("Fetched " + nextRows.getNumRows() + " rows");
            }
            catch (KuduException e) {
                throw new RuntimeException(e);
            }
        }

        currentRow = nextRows.next();
        totalBytes += getRowLength();
        return true;
    }
897342
public int[] next()
    {
        boolean hasNewPerm = false;

        escape:while( level >= 0) {
//            boolean foundZero = false;
            for( int i = iter[level]; i < data.length; i = iter[level] ) {
                iter[level]++;

                if( data[i] == -1 ) {
                    level++;
                    data[i] = level-1;

                    if( level >= data.length ) {
                        // a new permutation has been created return the results.
                        hasNewPerm = true;
                        System.arraycopy(data,0,ret,0,ret.length);
                        level = level-1;
                        data[i] = -1;
                        break escape;
                    } else {
                        valk[level] = i;
                    }
                }
            }

            data[valk[level]] = -1;
            iter[level] = 0;
            level = level-1;

        }

        if( hasNewPerm )
            return ret;
        return null;
    }
667534
protected int getNextNode()
  {
    if (m_foundLast)
      return DTM.NULL;

    int next = m_iterator.next();
    
    if (m_isFresh)
      m_isFresh = false;

    if (DTM.NULL == next)
      this.m_foundLast = true;

    return next;
  }
660358
def _get_last_td(el):
    
    if not el:
        return None

    if type(el) in [list, tuple, set]:
        el = el[0]

    last = el.find("td")

    if not last:
        return None

    return last[-1]
612536
def goto_next_selection
      return if selected_rows().length == 0 
      row = selected_rows().sort.find { |i| i > @obj.current_index }
      row ||= @obj.current_index
      #@obj.current_index = row
      @obj.goto_line row
    end
998428
function getRangeInformation(range, selectionMgr) {
  const $selectedCells = selectionMgr.getSelectedCells();
  let rangeInformation, startCell;

  if ($selectedCells.length) {
    rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0),
      $selectedCells.last().get(0));
  } else {
    const {startContainer} = range;
    startCell = domUtil.isTextNode(startContainer) ? $(startContainer).parent('td,th')[0] : startContainer;
    rangeInformation = selectionMgr.getSelectionRangeFromTable(startCell, startCell);
  }

  return rangeInformation;
}