Returns the first item currently in the RecyclerView that is not obscured by a header.

@param parent Recyclerview containing all the list items
@return first item that is fully beneath a header
15431
private View getFirstViewUnobscuredByHeader(RecyclerView parent, View firstHeader) {
        boolean isReverseLayout = mOrientationProvider.isReverseLayout(parent);
        int step = isReverseLayout ? -1 : 1;
        int from = isReverseLayout ? parent.getChildCount() - 1 : 0;
        for (int i = from; i >= 0 && i <= parent.getChildCount() - 1; i += step) {
            View child = parent.getChildAt(i);
            if (!itemIsObscuredByHeader(parent, child, firstHeader, mOrientationProvider.getOrientation(parent))) {
                return child;
            }
        }
        return null;
    }
1273371
protected void recycleChildren(RecyclerView.Recycler recycler, int startIndex, int endIndex) {
        if (startIndex == endIndex) {
            return;
        }
        if (DEBUG) {
            Log.d(TAG, "Recycling " + Math.abs(startIndex - endIndex) + " items");
        }
        if (endIndex > startIndex) {
            for (int i = endIndex - 1; i >= startIndex; i--) {
                removeAndRecycleViewAt(i, recycler);
            }
        } else {
            for (int i = startIndex; i > endIndex; i--) {
                removeAndRecycleViewAt(i, recycler);
            }
        }
    }
160615
public CmsContainerBean getParentContainer() {

        CmsContainerBean result = null;
        if ((getContainer() != null) && (getContainer().getParentInstanceId() != null)) {
            result = m_parentContainers.get(getContainer().getParentInstanceId());
        }
        return result;
    }
798485
def get_tree(cls, parent=None):
        
        cls = get_result_class(cls)

        if parent is None:
            # return the entire tree
            return cls.objects.all()
        if parent.is_leaf():
            return cls.objects.filter(pk=parent.pk)
        return cls.objects.filter(
            path__startswith=parent.path,
            depth__gte=parent.depth
        ).order_by(
            'path'
        )
1204968
public NodeData parentData() throws RepositoryException
   {
      checkValid();
      NodeData parent = (NodeData)dataManager.getItemData(getData().getParentIdentifier());
      if (parent == null)
      {
         throw new ItemNotFoundException("FATAL: Parent is null for " + getPath() + " parent UUID: "
            + getData().getParentIdentifier());
      }

      return parent;
   }
418136
private TreeNode getParentTreeNode(TreeNode child) {
        TreeNode parentTreeNode = parentIndex.get(child);

        if (parentTreeNode == null)
            return null;

        // Makes sure the parent node is still present in the tree
        else if (contains(parentTreeNode.getQueryNode()))
            return parentTreeNode;
        else
            throw new RuntimeException("Internal error: points to a parent that is not (anymore) in the tree");
    }
1236118
private void drawDividerDrawable(Canvas c, RecyclerView parent) {
        int headersCount = 0;
        int footerCount = 0;
        int itemViewCount;

        FamiliarRecyclerView curFamiliarRecyclerView = null;
        if (parent instanceof FamiliarRecyclerView) {
            curFamiliarRecyclerView = (FamiliarRecyclerView) parent;
            headersCount = curFamiliarRecyclerView.getHeaderViewsCount();
            footerCount = curFamiliarRecyclerView.getFooterViewsCount();
            itemViewCount = curFamiliarRecyclerView.getAdapter().getItemCount() - headersCount - footerCount;
        } else {
            itemViewCount = parent.getAdapter().getItemCount();
        }

        final int parentLeft = parent.getPaddingLeft();
        final int parentRight = parent.getWidth() - parent.getPaddingRight();
        final int parentTop = parent.getPaddingTop();
        final int parentBottom = parent.getHeight() - parent.getPaddingBottom();
        boolean isGridItemLayoutLastRow, isGridItemLayoutFirstRow, isGridItemLayoutLastColumn;
        boolean isGridLayoutLastNum = false;

        for (int i = 0; i < parent.getChildCount(); i++) {
            View childView = parent.getChildAt(i);
            RecyclerView.LayoutParams childViewParams = (RecyclerView.LayoutParams) childView.getLayoutParams();
            int position = childViewParams.getViewAdapterPosition();

            // intercept filter
            if (position < 0 || isInterceptFilter(position, headersCount, footerCount, itemViewCount)) {
                continue;
            }

            if (mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_LINEAR
                    && (!isHeaderDividersEnabled || headersCount == 0) && position - headersCount == 0) {
                continue;
            }

            int traX = (int) (childView.getTranslationX());
            int traY = (int) (childView.getTranslationY());

            boolean isEmptyView = isEmptyView(curFamiliarRecyclerView, position, headersCount);

            // head or footer or empty
            if (isHeadViewPos(headersCount, position) || isFooterViewPos(headersCount, footerCount, itemViewCount, position) || isEmptyView) {
                if (isEmptyView && (!isHeaderDividersEnabled || headersCount == 0)) {
                    continue;
                }

                if (mOrientation == OrientationHelper.HORIZONTAL) {
                    final int left = childView.getLeft() - childViewParams.leftMargin - mVerticalDividerDrawableHeight;
                    final int right = left + mVerticalDividerDrawableHeight;
                    mVerticalDividerDrawable.setBounds(left + traX, parentTop + traY, right + traX, parentBottom + traY);
                    mVerticalDividerDrawable.draw(c);
                } else {
                    final int top = childView.getTop() - childViewParams.topMargin - mHorizontalDividerDrawableHeight;
                    final int bottom = top + mHorizontalDividerDrawableHeight;
                    mHorizontalDividerDrawable.setBounds(parentLeft + traX, top + traY, parentRight + traX, bottom + traY);
                    mHorizontalDividerDrawable.draw(c);
                }
                continue;
            }

            boolean isHeaderView = position - headersCount <= 0;
            switch (mLayoutManagerType) {
                case FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_LINEAR:
                    // LinearLayoutManager
                    if (mOrientation == OrientationHelper.VERTICAL) {
                        int left = parentLeft;
                        int right = parentRight;
                        if (mItemViewBothSidesMargin > 0 && position - headersCount > 0) {
                            left += mItemViewBothSidesMargin;
                            right -= mItemViewBothSidesMargin;
                        }
                        final int top = childView.getTop() - childViewParams.topMargin - mHorizontalDividerDrawableHeight;
                        final int bottom = top + mHorizontalDividerDrawableHeight;
                        int tempLeftMargin = isHeaderView ? 0 : mHorizontalDividerLeftMargin;
                        int tempRightMargin = isHeaderView ? 0 : mHorizontalDividerRightMargin;
                        mHorizontalDividerDrawable.setBounds(left + traX + tempLeftMargin, top + traY, right + traX - tempRightMargin, bottom + traY);
                        mHorizontalDividerDrawable.draw(c);
                    } else {
                        int top = parentTop;
                        int bottom = parentBottom;
                        if (mItemViewBothSidesMargin > 0 && position - headersCount > 0) {
                            top += mItemViewBothSidesMargin;
                            bottom -= mItemViewBothSidesMargin;
                        }

                        final int left = childView.getLeft() - childViewParams.leftMargin - mVerticalDividerDrawableHeight;
                        final int right = left + mVerticalDividerDrawableHeight;
                        int tempTopMargin = isHeaderView ? 0 : mVerticalDividerTopMargin;
                        int tempBottomMargin = isHeaderView ? 0 : mVerticalDividerBottomMargin;
                        mVerticalDividerDrawable.setBounds(left + traX, top + traY + tempTopMargin, right + traX, bottom + traY - tempBottomMargin);
                        mVerticalDividerDrawable.draw(c);
                    }
                    break;
                case FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_GRID:
                case FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_STAGGERED_GRID:
                    // GridLayoutManager or StaggeredGridLayoutManager
                    isGridItemLayoutLastRow = isGridItemLayoutLastRow(position, itemViewCount, headersCount);
                    isGridItemLayoutLastColumn = isGridItemLayoutLastColumn(position, headersCount, childView);
                    isGridItemLayoutFirstRow = isGridItemLayoutFirstRow(position, headersCount);

                    if (mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_GRID && position == (itemViewCount + headersCount - 1)) {
                        isGridLayoutLastNum = true;
                    }

                    if (mOrientation == OrientationHelper.HORIZONTAL) {
                        // horizontal draw divider
                        if (!isNotShowGridEndDivider || (!isGridLayoutLastNum && !isGridItemLayoutLastColumn)) {
                            int horizontalLeft = childView.getLeft() - childViewParams.leftMargin;
                            int horizontalTop = childView.getBottom() + childViewParams.bottomMargin;
                            int horizontalRight = childView.getRight() + childViewParams.rightMargin;
                            int horizontalBottom = horizontalTop + mHorizontalDividerDrawableHeight;
                            if (mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_STAGGERED_GRID && !isGridItemLayoutLastRow && mHorizontalDividerRightMargin <= 0) {
                                horizontalRight += mVerticalDividerDrawableHeight;
                            }
                            mHorizontalDividerDrawable.setBounds(horizontalLeft + traX + mHorizontalDividerLeftMargin, horizontalTop + traY, horizontalRight + traX - mHorizontalDividerRightMargin, horizontalBottom + traY);
                            mHorizontalDividerDrawable.draw(c);
                        }

                        if ((!isHeaderDividersEnabled || headersCount == 0) && isGridItemLayoutFirstRow) {
                            continue;
                        }

                        int verticalTop;
                        int verticalBottom;
                        if (isGridItemLayoutFirstRow) {
                            // Only draw the first line of the first grid
                            if (position - headersCount == 0) {
                                verticalTop = parent.getTop();
                                verticalBottom = parent.getBottom();
                            } else {
                                continue;
                            }
                        } else {
                            verticalTop = childView.getTop() - childViewParams.topMargin;
                            verticalBottom = childView.getBottom() + childViewParams.bottomMargin;
                            if (mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_GRID && !isGridItemLayoutLastColumn && mVerticalDividerBottomMargin <= 0) {
                                verticalBottom += mHorizontalDividerDrawableHeight;
                            }
                        }

                        int verticalLeft = childView.getLeft() - childViewParams.leftMargin - mVerticalDividerDrawableHeight;
                        int verticalRight = verticalLeft + mVerticalDividerDrawableHeight;

                        int tempTopMargin = isHeaderView ? 0 : mVerticalDividerTopMargin;
                        int tempBottomMargin = isHeaderView ? 0 : mVerticalDividerBottomMargin;
                        mVerticalDividerDrawable.setBounds(verticalLeft + traX, verticalTop + traY + tempTopMargin, verticalRight + traX, verticalBottom + traY - tempBottomMargin);
                        mVerticalDividerDrawable.draw(c);
                    } else {
                        // draw vertical divider
                        if (!isNotShowGridEndDivider || (!isGridItemLayoutLastColumn
                                && ((mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_GRID && !isGridLayoutLastNum)
                                || mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_STAGGERED_GRID))) {
                            int verticalLeft = childView.getRight() + childViewParams.rightMargin;
                            int verticalTop = childView.getTop() - childViewParams.topMargin;
                            int verticalRight = verticalLeft + mVerticalDividerDrawableHeight;
                            int verticalBottom = childView.getBottom() + childViewParams.bottomMargin;
                            if (mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_STAGGERED_GRID && !isGridItemLayoutLastRow && mVerticalDividerBottomMargin <= 0) {
                                verticalBottom += mHorizontalDividerDrawableHeight;
                            }
                            mVerticalDividerDrawable.setBounds(verticalLeft + traX, verticalTop + traY + mVerticalDividerTopMargin, verticalRight + traX, verticalBottom + traY - mVerticalDividerBottomMargin);
                            mVerticalDividerDrawable.draw(c);
                        }

                        if ((!isHeaderDividersEnabled || headersCount == 0) && isGridItemLayoutFirstRow) {
                            continue;
                        }

                        int horizontalLeft;
                        int horizontalRight;

                        if (isGridItemLayoutFirstRow) {
                            // Only draw the first line of the first grid
                            if (position - headersCount == 0) {
                                horizontalLeft = parent.getLeft();
                                horizontalRight = parent.getRight();
                            } else {
                                continue;
                            }
                        } else {
                            horizontalLeft = childView.getLeft() - childViewParams.leftMargin;
                            horizontalRight = childView.getRight() + childViewParams.rightMargin;
                            if (mLayoutManagerType == FamiliarRecyclerView.LAYOUT_MANAGER_TYPE_GRID && !isGridItemLayoutLastColumn && mHorizontalDividerRightMargin <= 0) {
                                horizontalRight += mVerticalDividerDrawableHeight;
                            }
                        }

                        int horizontalTop = childView.getTop() - childViewParams.topMargin - mHorizontalDividerDrawableHeight;
                        int horizontalBottom = horizontalTop + mHorizontalDividerDrawableHeight;
                        int tempLeftMargin = isHeaderView ? 0 : mHorizontalDividerLeftMargin;
                        int tempRightMargin = isHeaderView ? 0 : mHorizontalDividerRightMargin;
                        mHorizontalDividerDrawable.setBounds(horizontalLeft + traX + tempLeftMargin, horizontalTop + traY, horizontalRight + traX - tempRightMargin, horizontalBottom + traY);
                        mHorizontalDividerDrawable.draw(c);
                    }
                    break;
            }
        }
    }
1337038
@Nullable
    public Item getItem(RecyclerView.ViewHolder viewHolder) {
        FastAdapter<Item> adapter = getFastAdapter(viewHolder);
        if (adapter == null) {
            return null;
        }
        //we get the adapterPosition from the viewHolder
        int pos = adapter.getHolderAdapterPosition(viewHolder);
        //make sure the click was done on a valid item
        if (pos != RecyclerView.NO_POSITION) {
            //we update our item with the changed property
            return adapter.getItem(pos);
        }
        return null;
    }
1034403
def get_parent(self):
        """"""
        if not self.has_cached_parent:
            if self.parent is not None:
                self._parent_block = self.runtime.get_block(self.parent)
            else:
                self._parent_block = None
            self._parent_block_id = self.parent
        return self._parent_block
495696
private Element getChildElement(Element parent) {
	NodeList list = parent.getChildNodes();
	int len = list.getLength();
	for (int i = 0; i < len; i++) {
	    Node node = list.item(i);
	    if (node instanceof Element) {
		return (Element) node;
	    }
	}
	return null;
    }
346489
def get_parent(self):
        
        if not self._parent:
            self._parent = yield self.parent_resource.get(self.parent_id)

        raise Return(self._parent)
1162868
public Node firstChild() {

		if (currentNode == null)
			return null;

		Node node = getFirstChild(currentNode);

		if (node != null)
			currentNode = node;

		return node;
	}
62282
public Object depthFirst(NodeVisitor nodeVisitor, Node root) {
        return depthFirst(nodeVisitor, Collections.singleton(root));
    }
370189
private int getPerPage(Context context) {
        //fixed item size in recyclerview. Adding 3 enables recyclerview scrolling.
        return (context.getResources().getDisplayMetrics().heightPixels
                / context.getResources().getDimensionPixelSize(R.dimen.repo_item_height)) + 3;
    }
298777
public Tree findHead(Tree parentNode) {
        Tree cursor = parentNode.getType().equals("TOP") ? parentNode.firstChild() : parentNode;

        while (cursor.children() != null && !cursor.children().isEmpty())
            cursor = findHead2(cursor);

        return cursor;
    }
281673
public static int getCenterXChildPosition(RecyclerView recyclerView) {
        int childCount = recyclerView.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = recyclerView.getChildAt(i);
            if (isChildInCenterX(recyclerView, child)) {
                return recyclerView.getChildAdapterPosition(child);
            }
        }
        return childCount;
    }
1059095
public static View getCenterYChild(RecyclerView recyclerView) {
        int childCount = recyclerView.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = recyclerView.getChildAt(i);
            if (isChildInCenterY(recyclerView, child)) {
                return child;
            }
        }
        return null;
    }