Finds an element in the treap and returns its node or -1.
322856
public int search(int data, int treap) {
		int cur = getRoot(treap);
		while (cur != nullNode()) {
			int res = m_comparator.compare(this, data, cur);
			if (res == 0)
				return cur;
			else if (res < 0)
				cur = getLeft(cur);
			else
				cur = getRight(cur);
		}

		m_comparator.onEndSearchImpl_(data);
		return nullNode();
	}
489047
public int findElement(Object bookmark, int iHandleType)
    {
        if (bookmark == null)
            return -1;
        int iTargetPosition = m_gridBuffer.findElement(bookmark, iHandleType);
        if (iTargetPosition == -1)
            iTargetPosition = m_gridList.findElement(bookmark, iHandleType);
        return iTargetPosition;   // Not found
    }
903973
function (element) {
    return this._someNode(element.childNodes, function(node) {
      return this.DIV_TO_P_ELEMS.indexOf(node.tagName) !== -1 ||
             this._hasChildBlockElement(node);
    });
  }
1011430
function findToken(node, test) {
    let find = null
    traverse(node, {
        enter(child) {
            if (test(child)) {
                find = child
                this.break()
            }
        },
    })
    return find
}
719707
final Node<K,V> getNode(int hash, Object key) {
        Node<K,V>[] tab; Node<K,V> first, e; int n; K k;
        if ((tab = table) != null && (n = tab.length) > 0 &&
            (first = tab[(n - 1) & hash]) != null) {
            if (first.hash == hash && // always check first node
                ((k = first.key) == key || (key != null && key.equals(k))))
                return first;
            if ((e = first.next) != null) {
                if (first instanceof TreeNode)
                    return ((TreeNode<K,V>)first).getTreeNode(hash, key);
                do {
                    if (e.hash == hash &&
                        ((k = e.key) == key || (key != null && key.equals(k))))
                        return e;
                } while ((e = e.next) != null);
            }
        }
        return null;
    }
1184251
public int addElement(int element, int treap) {
		int treap_;
		if (treap == -1) {
			if (m_defaultTreap == nullNode())
				m_defaultTreap = createTreap(-1);
			treap_ = m_defaultTreap;
		} else {
			treap_ = treap;
		}

		return addElement_(element, 0, treap_);
	}
696196
def find(C, node, path, namespaces=None, extensions=None, smart_strings=True, **args):
        """"""
        xp = node.xpath(
            path,
            namespaces=namespaces or C.NS,
            extensions=extensions,
            smart_strings=smart_strings,
            **args
        )
        if len(xp) > 0:
            return xp[0]
1001217
def get_first_of_element(element, sub, contype=None):
    
    content = element.xpath(sub)
    return list_or_empty(content, contype)
1205104
@Override
	int compare(Treap treap, int left, int node) {
		// Compares two segments on a sweep line passing through m_sweep_y,
		// m_sweep_x.
		if (m_b_intersection_detected)
			return -1;

		int right = treap.getElement(node);
		m_current_node = node;
		return compareSegments(left, left, right, right);
	}
443909
def find(node):
    
    if node.parent is None:
        return node
    root = node
    while root.parent is not None:
        root = root.parent
    parent = node
    while parent.parent is not root:
        grandparent = parent.parent
        parent.parent = root
        parent = grandparent
    return root
843941
def Element(self, elem, **params):
        """"""
        res = self.__call__(deepcopy(elem), **params)
        if len(res) > 0: 
            return res[0]
        else:
            return None
390795
public int getPreviousNode(XPathContext xctxt, int pos)
          throws TransformerException
  {

    XPath countMatchPattern = getCountMatchPattern(xctxt, pos);
    DTM dtm = xctxt.getDTM(pos);

    if (Constants.NUMBERLEVEL_ANY == m_level)
    {
      XPath fromMatchPattern = m_fromMatchPattern;

      // Do a backwards document-order walk 'till a node is found that matches 
      // the 'from' pattern, or a node is found that matches the 'count' pattern, 
      // or the top of the tree is found.
      while (DTM.NULL != pos)
      {

        // Get the previous sibling, if there is no previous sibling, 
        // then count the parent, but if there is a previous sibling, 
        // dive down to the lowest right-hand (last) child of that sibling.
        int next = dtm.getPreviousSibling(pos);

        if (DTM.NULL == next)
        {
          next = dtm.getParent(pos);

          if ((DTM.NULL != next) && ((((null != fromMatchPattern) && (fromMatchPattern.getMatchScore(
                  xctxt, next) != XPath.MATCH_SCORE_NONE))) 
              || (dtm.getNodeType(next) == DTM.DOCUMENT_NODE)))
          {
            pos = DTM.NULL;  // return null from function.

            break;  // from while loop
          }
        }
        else
        {

          // dive down to the lowest right child.
          int child = next;

          while (DTM.NULL != child)
          {
            child = dtm.getLastChild(next);

            if (DTM.NULL != child)
              next = child;
          }
        }

        pos = next;

        if ((DTM.NULL != pos)
                && ((null == countMatchPattern)
                    || (countMatchPattern.getMatchScore(xctxt, pos)
                        != XPath.MATCH_SCORE_NONE)))
        {
          break;
        }
      }
    }
    else  // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE
    {
      while (DTM.NULL != pos)
      {
        pos = dtm.getPreviousSibling(pos);

        if ((DTM.NULL != pos)
                && ((null == countMatchPattern)
                    || (countMatchPattern.getMatchScore(xctxt, pos)
                        != XPath.MATCH_SCORE_NONE)))
        {
          break;
        }
      }
    }

    return pos;
  }
468583
function findChild(node, name, position) {
  for (node = node.firstChild ; node ; node = node.nextSibling) {
    if (nodeName(node) === name && --position === 0) break
  }
  return node
}
96662
function(element) {
			var result = 0;
			var parent = element.parentNode;
			if (parent) {
				var node = parent.firstElementChild;
				while (node) {
					if (node === element) {
						break;
					} else {
						node = node.nextElementSibling;
						result++;
					}
				}
			}
			return result;
		}
969060
private V findSmallest(Node node) {
        if (node == null) {
            return null;
        }

        while (node.left != null) {
            node = node.left;
        }

        return node.item;
    }
884510
function findPrevNode(firstNode, item, comparer) {
    let ret;
    let prevNode = firstNode;
    // while item > prevNode.value
    while (prevNode != undefined && comparer(prevNode.value, item) > 0) {
        ret = prevNode;
        prevNode = prevNode.next;
    }
    return ret;
}
906345
def _get_next_slot(self, tag):
        '''
        
        '''
        slot = self._n.suplast(tag)
        if slot is None or slot == idaapi.BADNODE:
            return 0
        else:
            return slot + 1