Finds the item number. Currently this correspond to the number of list-item boxes before this box
within the parent box.
166739
private int findItemNumber() 
    {
        ElementBox parent = getParent();
        int cnt = 0;
        for (int i = parent.getStartChild(); i < parent.getEndChild(); i++)
        {
            Box child = parent.getSubBox(i);
            if (child instanceof ListItemBox)
                cnt++;
            if (child == this)
                return cnt;
        }
        return 1;
    }
799909
function indexOf(items, item) {
    var len = items.length, i;
    for (i = 0; i < len; i++) {
      if (items[i] === item) {
        return i;
      }
    }
    return -1;
  }
795477
def return_item_count_on_page(self, page=1, total_items=1):
        
        up_to_page = ((page - 1) * self.page_items)
        #   Number of items up to the page in question

        if total_items > up_to_page:
            #   Remove all the items up to the page in question
            #
            count = total_items - up_to_page

        if count >= self.page_items:
            # The remaining items are greater than the items per page
            # so the answer is a full page
            return self.page_items
        else:
            #   There are less items than a full page,
            #
            return count
353865
public ValidationData findListParent() {
        if (!this.listChild) {
            return null;
        }

        ValidationData parent = this.parent;
        while (parent != null && !parent.isList()) {
            parent = parent.parent;
        }
        return parent;
    }
860243
function getListForItem(opts: Options, value: Value, item: Block): ?Block {
    const { document } = value;
    const parent = document.getParent(item.key);
    return parent && isList(opts, parent) ? parent : null;
}
1213893
def find_previous(element, l):
    
    length = len(l)
    for index, current in enumerate(l):
        # current is the last element
        if length - 1 == index:
            return current

        # current is the first element
        if index == 0:
            if element < current:
                return None

        if current <= element < l[index+1]:
            return current
97639
def find_by_name(self, item_name, items_list, name_list=None):
        
        if not name_list:
            names = [item.name for item in items_list if item]
        else:
            names = name_list
        if item_name in names:
            ind = names.index(item_name)
            return items_list[ind]
        return False
1094905
function() {
      /*
       * For the sake of explanations below, we're going to pretend we are scrolling
       * vertically: Items are laid out with primarySize being height,
       * secondarySize being width.
       */
      var primaryPos = 0;
      var secondaryPos = 0;
      var secondaryScrollSize = this.secondaryScrollSize();
      var previousItem;

      this.dataSource.beforeSiblings && this.dataSource.beforeSiblings.forEach(calculateSize, this);
      var beforeSize = primaryPos + (previousItem ? previousItem.primarySize : 0);

      primaryPos = secondaryPos = 0;
      previousItem = null;

      var dimensions = this.dataSource.dimensions.map(calculateSize, this);
      var totalSize = primaryPos + (previousItem ? previousItem.primarySize : 0);

      return {
        beforeSize: beforeSize,
        totalSize: totalSize,
        dimensions: dimensions
      };

      function calculateSize(dim) {

        //Each dimension is an object {width: Number, height: Number} provided by
        //the dataSource
        var rect = {
          //Get the height out of the dimension object
          primarySize: this.primaryDimension(dim),
          //Max out the item's width to the width of the scrollview
          secondarySize: Math.min(this.secondaryDimension(dim), secondaryScrollSize)
        };

        //If this isn't the first item
        if (previousItem) {
          //Move the item's x position over by the width of the previous item
          secondaryPos += previousItem.secondarySize;
          //If the y position is the same as the previous item and
          //the x position is bigger than the scroller's width
          if (previousItem.primaryPos === primaryPos &&
              secondaryPos + rect.secondarySize > secondaryScrollSize) {
            //Then go to the next row, with x position 0
            secondaryPos = 0;
            primaryPos += previousItem.primarySize;
          }
        }

        rect.primaryPos = primaryPos;
        rect.secondaryPos = secondaryPos;

        previousItem = rect;
        return rect;
      }
    }
1237235
def item_at_line(root_item, line):
    
    previous_item = root_item
    item = root_item
    for item in get_item_children(root_item):
        if item.line > line:
            return previous_item
        previous_item = item
    else:
        return item
1304522
def next(self):
        """"""
        item = six.next(self._item_iter)
        result = self._item_to_value(self._parent, item)
        # Since we've successfully got the next value from the
        # iterator, we update the number of remaining.
        self._remaining -= 1
        return result
1158990
function(items) {
            var hasRelativePositioning = hasNumberProperty(items, 'relativePosition');

            for(var i = 0; i < items.length; i++) {
                if(i == items.length - 1)
                    items[i].diffWithNextRelativePos = undefined;
                else
                    items[i].diffWithNextRelativePos = items[i + 1].relativePosition - items[i].relativePosition;
            }
        }
522388
public int findItemOnlyIdx(JQMListItem item) {
        if (item == null) return -1;
        List<JQMListItem> items = getItems();
        if (items == null) return -1;
        int i = items.indexOf(item);
        if (i == -1) return -1;
        int j = 0;
        for (JQMListItem k : items) {
            if (k == null) continue;
            if (k == item) return j;
            j++;
        }
        return -1;
    }
519013
function find(items, pred) {
  var len = items.length,
      i = -1;

  while(++i < len) {
    if (pred(items[i], i)) {
      return items[i];
    }
  }

  return null;
}
759042
def getCountLT(self, item):
        """"""
        index = bisect.bisect_left(self._list, item)
        return index
1338840
def get_item_name(self, item, parent):
        
        names = self.get_name_elements(item)
        if not names:
            raise MissingNameElementError

        name = names[0].text
        prefix = self.item_name_prefix(parent)
        if prefix:
            name = prefix + name

        return name
160791
public function previous()
    {
        $this->_itemValid = true;

        if (!prev($this->_items)) {
            $this->_itemValid = false;
        } else {
            $this->_itemPosition--;
        }
    }
1234553
function getLastVisibleItem() {
                        for (var i = lastIndexDisplayed; i >= firstIndexDisplayed; i--) {
                            if (that.items.itemAt(i)) {
                                return that.items.itemAt(i);
                            }
                        }
                        return null;
                    }