Retrieves the rank for a key in a subtree

@param mixed             $key  The key
@param RedBlackNode|null $node The subtree root

@return int
192740
protected function nodeRank($key, ?RedBlackNode $node): int
    {
        if ($node === null) {
            return 0;
        }

        $comp = $this->comparator->compare($key, $node->key());

        if ($comp < 0) {
            return $this->nodeRank($key, $node->left());
        }
        if ($comp > 0) {
            return 1 + $this->nodeSize($node->left()) + $this->nodeRank($key, $node->right());
        }

        return $this->nodeSize($node->left());
    }
119959
protected function nodeMin(RedBlackNode $node): RedBlackNode
    {
        if ($node->left() === null) {
            return $node;
        }

        return $this->nodeMin($node->left());
    }
589935
public function getSiblingNode($key)
    {
        return isset($this->siblingNode[$key][$this->currentDepth]) ? $this->siblingNode[$key][$this->currentDepth] : false;
    }
1011420
private RedBlackTreeNode<Key, Value> deleteMin(RedBlackTreeNode<Key, Value> h) {
	if (h.getLeft() == null)
	    return null;

	if (!isRed(h.getLeft()) && !isRed(h.getLeft().getLeft()))
	    h = moveRedLeft(h);

	h.setLeft(deleteMin(h.getLeft()));
	return balance(h);
    }
1093247
def get_node(self, key):
        
        self._check_if_open()
        try:
            if not key.startswith('/'):
                key = '/' + key
            return self._handle.get_node(self.root, key)
        except _table_mod.exceptions.NoSuchNodeError:
            return None
879732
public Key select(int k) {
	if (k < 0 || k >= size(root))
	    throw new IllegalArgumentException();
	RedBlackTreeNode<Key, Value> x = select(root, k);
	return x.getKey();
    }
1277330
public function getChildKeyList($key = null)
    {
        $child = $this->get($key);
        $list  = [];
        $n     = 0;
        foreach ($child as $k => $v) {
            $list[$n++] = $k;
        }
        return $list;
    }
1062575
protected function nodeRemoveLeft($key, RedBlackNode $node): RedBlackNode
    {
        if (!$this->isRed($node->left()) && !$this->isRed($node->left()->left())) {
            $node = $this->moveRedLeft($node);
        }
        $node->setLeft($this->nodeRemove($key, $node->left()));

        return $node;
    }
201726
final public function hget($key, $hkey=null) {
		$res = $this->connection->hget($key, $hkey);
		self::$logger->info(sprintf(
			"Redis: hget %s.%s: '%s'.", $key, $hkey, $res));
		return $res;
	}
1218426
public function getkey($key, $cb = null)
    {
        $this->redis->get($this->config->redisprefix->value . $key, $cb);
    }
969856
def get_node(self, key):
        """"""
        pos = self._get_node_pos(key)
        if pos is None:
            return None
        return self._hashring[self._sorted_keys[pos]]
308632
protected function rotateLeft(RedBlackNode $node): RedBlackNode
    {
        $link = $node->right();
        $node->setRight($link->left());
        $link->setLeft($node);
        $link->setColor($node->color());
        $node->setColor(RedBlackNode::RED);
        $link->setSize($node->size());
        $node->setSize(1 + $this->nodeSize($node->left()) + $this->nodeSize($node->right()));

        return $link;
    }
1308412
public function getRank(string $member, $order = 'desc')
        {
                $method = $order === 'desc' ? 'zrevrank' : 'zrank';
                $response = $this->_redis->$method($this->_key, $member);

                return $response !== null ? $response+1 : null;
        }
868662
protected function getSortkeyValue(Node $node) {
    // if no role is defined for a or b, the sortkey is
    // determined from the type of the reference node
    $defaultRole = $this->referenceNode->getType();
    $referenceMapper = $this->referenceNode->getMapper();
    $mapper = $node->getMapper();

    if ($referenceMapper && $mapper) {

      $referenceRole = $defaultRole;
      // get the sortkey of the node for the relation to the reference node,
      // if a role is defined
      $oidStr = $node->getOID()->__toString();
      if (isset($this->oidRoleMap[$oidStr])) {
        $nodeRole = $this->oidRoleMap[$oidStr];
        $relationDesc = $referenceMapper->getRelation($nodeRole);
        $referenceRole = $relationDesc->getThisRole();
      }
      $sortkeyDef = $mapper->getSortkey($referenceRole);
      return $node->getValue($sortkeyDef['sortFieldName']);
    }
    return 0;
  }
1217361
private function cleanKey($node, $key)
    {
        if ($key === '') {
            $key = $node ? (string) count($node) : 0;
            // Found a [] key, so track this to ensure that we disable numeric
            // indexing of keys in the resolved query aggregator.
            $this->numericIndices = false;
        }

        return $key;
    }
130489
public function addChild(Node $node, $key = null)
    {
        if ($key === null) {
            $this->children[] = $node;
        } else {
            $this->children[ $key ] = $node;
        }

        return $node;
    }
928717
private function getTopNodeByScore(array $nodes): ?Element {
        $topNode = null;
        $topNodeScore = 0;

        foreach ($nodes as $node) {
            $score = $this->getScore($node);

            if ($score > $topNodeScore) {
                $topNode = $node;
                $topNodeScore = $score;
            }

            if ($topNode === false) {
                $topNode = $node;
            }
        }

        if ($topNode && $this->getScore($topNode) < 20) {
            return null;
        }

        return $topNode;
    }