Internal
Updates the right values of managed nodes

@param int $first first right value to shift
@param int $last last right value to shift, or 0
@param int $delta offset to shift by
@param mixed $rootVal the root value of entities to act upon
192261
public function updateRightValues($first, $last, $delta, $rootVal=null)
    {
        $hasManyRoots = $this->getConfiguration()->hasManyRoots();

        foreach($this->wrappers as $wrapper)
        {
            if(!$hasManyRoots || ($wrapper->getRootValue() == $rootVal))
            {
                if($wrapper->getRightValue() >= $first && ($last === 0 || $wrapper->getRightValue() <= $last))
                {
                    $wrapper->setRightValue($wrapper->getRightValue() + $delta);
                    $wrapper->invalidate();
                }
            }
        }
    }
1249786
public function setFirstResult($firstResult)
    {
        $this->firstResult = $firstResult;
        $this->state       = self::STATE_DIRTY;

        return $this;
    }
232547
private function setPositionOfLastToken(
        AttributeAwarePhpDocNode $attributeAwarePhpDocNode
    ): AttributeAwarePhpDocNode {
        if ($attributeAwarePhpDocNode->children === []) {
            return $attributeAwarePhpDocNode;
        }

        /** @var AttributeAwareNodeInterface $lastChildNode */
        $phpDocChildNodes = $attributeAwarePhpDocNode->children;
        $lastChildNode = array_pop($phpDocChildNodes);
        $phpDocNodeInfo = $lastChildNode->getAttribute(Attribute::PHP_DOC_NODE_INFO);

        if ($phpDocNodeInfo !== null) {
            $attributeAwarePhpDocNode->setAttribute(Attribute::LAST_TOKEN_POSITION, $phpDocNodeInfo->getEnd());
        }

        return $attributeAwarePhpDocNode;
    }
1315651
private function _updateFirstLastKeys()
    {
        end($this->_storage);
        $this->_lastKey = key($this->_storage);
        reset($this->_storage);
        $this->_firstKey = key($this->_storage);

        $this->_modified = false;
    }
193084
private Node<T> removeMax(Node<T> h, boolean updateLast) { 
        if (h.left != null && h.left.red)
            h = rotateRight(h);

        if (h.right == null)
            return null;

        if (!h.right.red && (h.right.left == null || !h.right.left.red))
            h = moveRedRight(h);

        h.right = removeMax(h.right, updateLast);
        if (h.right == null && updateLast)
        	last = h;
        return balance(h);
    }
996029
public void setDateRangeLimits(LocalDate firstAllowedDate, LocalDate lastAllowedDate) {
        if (firstAllowedDate == null && lastAllowedDate == null) {
            throw new RuntimeException("DateVetoPolicyMinimumMaximumDate.setDateRangeLimits(),"
                    + "The variable firstAllowedDate can be null, or lastAllowedDate can be null, "
                    + "but both values cannot be null at the same time. "
                    + "If you wish to clear the veto policy, then call the function: "
                    + "'DatePickerSettings.setVetoPolicy(null)'.");
        }
        if (firstAllowedDate != null && lastAllowedDate != null
                && lastAllowedDate.isBefore(firstAllowedDate)) {
            throw new RuntimeException("\"DateVetoPolicyMinimumMaximumDate.setDateRangeLimits(),"
                    + "The lastAllowedDate must be greater than or equal to the firstAllowedDate.");
        }
        this.firstAllowedDate = firstAllowedDate;
        this.lastAllowedDate = lastAllowedDate;
    }
424796
function(data){
      if (this.delegate)
        return this.root.update(data);

      if (data)
      {
        var delta = {};
        var changed = false;

        for (var prop in data)
          if (this.data[prop] !== data[prop])
          {
            changed = true;
            delta[prop] = this.data[prop];
            this.data[prop] = data[prop];
          }

        if (changed)
        {
          this.emit_update(delta);
          return delta;
        }
      }

      return false;
    }
821268
function DOMPostOrder(root, visitFunc) {
	let node = root;
	while (true) {
		// Find leftmost (grand)child, and visit that first.
		while (node.firstChild) {
			node = node.firstChild;
		}
		visitFunc(node);
		while (true) {
			if (node === root) {
				return; // Visiting the root is the last thing we do.
			}
			/* Look for right sibling to continue traversal. */
			if (node.nextSibling) {
				node = node.nextSibling;
				/* Loop back and visit its leftmost (grand)child first. */
				break;
			}
			/* Visit parent only after we've run out of right siblings. */
			node = node.parentNode;
			visitFunc(node);
		}
	}
}
1004814
protected function updateNode($destLeft)
    {
        $left = $this->getLeftValue();
        $right = $this->getRightValue();
        $root = $this->hasManyRoots() ? $this->getRootValue() : null;

        $treeSize = $right - $left + 1;

        // Make room in the new branch
        $this->shiftRLRange($destLeft, 0, $treeSize, $root);

        if($left >= $destLeft)
        {
            // src was shifted too
            $left += $treeSize;
            $right += $treeSize;
        }

        // Now there's enough room next to target to move the subtree
        $this->shiftRLRange($left, $right, $destLeft - $left, $root);

        // Correct values after source (close gap in old tree)
        $this->shiftRLRange($right + 1, 0, -$treeSize, $root);
    }
1133832
function () {
        // Find the root node which transform needs update;
        var rootNodeIsDirty = this;
        while (rootNodeIsDirty && rootNodeIsDirty.getParent()
            && rootNodeIsDirty.getParent().transformNeedsUpdate()
        ) {
            rootNodeIsDirty = rootNodeIsDirty.getParent();
        }
        rootNodeIsDirty.update();
    }
1035607
public void moveLastChild( Row newParent )
	{
		if( this == newParent )
			return;

		// remove from its current position
		Row parentItem = m_parent;
		if( parentItem == null )
			parentItem = this.treeTable.m_rootItem;
		parentItem.getChilds().remove( this );
		// DOM.removeChild( m_body, m_tr );

		if( newParent == null )
			newParent = this.treeTable.m_rootItem;

		// insert at the end of the current parent

		// DOM add
		Row lastLeaf = newParent.getLastLeaf();
		Element trToInsertAfter = lastLeaf.m_tr;
		if( trToInsertAfter != null )
		{
			int after = DOM.getChildIndex( this.treeTable.m_body, trToInsertAfter );
			int before = after + 1;

			DOM.insertChild( this.treeTable.m_body, m_tr, before );
		}
		else
		{
			DOM.appendChild( this.treeTable.m_body, m_tr );
		}

		parentItem.getChilds().add( this );

		// take care of the left padding
		Element firstTd = DOM.getChild( m_tr, 0 );
		firstTd.getStyle().setPaddingLeft( getLevel() * this.treeTable.treePadding, Unit.PX );
	}
918726
public function text($val=null)
    {
        if ($val !== null) { // set node value for all nodes
            foreach ($this->nodes as $node) {
                $node->nodeValue = $val;
            }

            return $this;
        }
        if ($node = $this->getFirstElmNode()) { // get value for first node
            return $node->nodeValue;
        }
    }
1009128
public void last(String name, float value) {
		Counter counter = get(name, CounterType.LastValue);
		counter.setLast(value);
		update();
	}
384799
private function shiftLeftRight($key, $delta, $root, $data)
    {
        foreach (['lft', 'rgt'] as $attribute) {
            $this
                ->filter([
                    $attribute.'__gte' => $key,
                    'root' => $root,
                ])
                ->update([
                    $attribute => new Expression($attribute.sprintf('%+d', $delta)),
                ]);

            foreach ($data as &$item) {
                if ($item[$attribute] >= $key) {
                    $item[$attribute] += $delta;
                }
            }
        }

        return $data;
    }
1320746
public void addFirstAndLast(final CalendarDay first, final CalendarDay last) {
    list.clear();
    list.add(first);
    list.add(last);
  }
781483
protected int newestStamp(int first, int last, int bestStampSoFar) {
        int bestStamp = bestStampSoFar;
        for (int i=first; i<=last; ++i) {
            if (stamp[i] > bestStamp) {
                bestStamp = stamp[i];
            }
        }
        return bestStamp;
    }
520752
function(node) {
      if (node === undefined)
        return undefined;

      node.maxHighLeft = this.updateHighValues_(node.leftNode);
      node.maxHighRight = this.updateHighValues_(node.rightNode);

      return max(max(node.maxHighLeft, node.highValue), node.maxHighRight);
    }