Internal
Updates the left values of managed nodes

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

        foreach($this->wrappers as $wrapper)
        {
            if(!$hasManyRoots || ($wrapper->getRootValue() == $rootVal))
            {
                if($wrapper->getLeftValue() >= $first && ($last === 0 || $wrapper->getLeftValue() <= $last))
                {
                    $wrapper->setLeftValue($wrapper->getLeftValue() + $delta);
                    $wrapper->invalidate();
                }
            }
        }
    }
1007786
private static function insertNonFull($value, $btree)
	{
		$i = 0;
		while ($i<$btree->_n && $value->greaterThan($btree->_keys[$i]))
		{
			$i++;
		}
		if (@$btree->_children[$i]==null)
		{		       // Leaf node
			$btree->shiftUp($i, $value);
			$btree->_children[$i+1] = null;
		}
		elseif ($btree->_children[$i]->full())
		{	       // Full child
			$pivot = $btree->_children[$i]->_keys[self::T-1];
			$btree->shiftUp($i, $pivot);
			$btree->_children[$i+1] =  $btree->_children[$i]->split();
			self::insertNonFull($value,  $btree->_children[($value->greaterThan($pivot)) ? ($i+1) : $i]);
		}
		else
		{				       // Non-full child
			self::insertNonFull($value, $btree->_children[$i]);
		}
	}
1319977
function(child, toIndex, lastIndex) {
      // If the index of `child` is less than `lastIndex`, then it needs to
      // be moved. Otherwise, we do not need to move it because a child will be
      // inserted or moved before `child`.
      if (child._mountIndex < lastIndex) {
        enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
      }
    }
188096
protected function calculateFirstAndLastPage()
    {
        $delta = \floor($this->maximumNumberOfLinks / 2);
        $firstPage = $this->currentPage - $delta;
        $lastPage = $this->currentPage + $delta + ($this->maximumNumberOfLinks % 2 === 0 ? 1 : 0);

        if ($firstPage < 1) {
            $lastPage -= $firstPage - 1;
        }
        if ($lastPage > $this->numberOfPages) {
            $firstPage -= ($lastPage - $this->numberOfPages);
        }

        $this->firstPage = \max($firstPage, 1);
        $this->lastPage = \min($lastPage, $this->numberOfPages);
    }
1077643
private int setNoLastRow(int firstComponentCount)
        {
            Arrays.fill(lastRow, Integer.MAX_VALUE);
            return firstComponentCount * generator.clusteringDescendantAverages[0];
        }
162831
function(delta){
      events.childNodesModified.call(this, delta);

      var array;
      if (array = delta.inserted)
      {
        for (var i = 0, child; child = array[i++];)
        {
          child.groupId_ = child.delegate ? child.delegate.basisObjectId : child.data.id;
          this.map_[child.groupId_] = child;
        }

        if (this.dataSource && this.nullGroup.first)
        {
          var parentNode = this.owner;
          var nodes = arrayFrom(this.nullGroup.nodes); // basis.array.from, because nullGroup.nodes may be transformed
          for (var i = nodes.length; i-- > 0;)
            parentNode.insertBefore(nodes[i], nodes[i].nextSibling);
        }
      }
    }
1209207
private function updatePageNodes($nodeUid, $leftnode, $rightnode, $level, $classname)
    {
        $progress = $this->getHelperSet()->get('progress');
        $progress->advance();

        $query = sprintf(
                'UPDATE %s SET %s = ?, %s = ?, %s = ? WHERE %s = ?', 
                $this->em->getClassMetadata($classname)->getTableName(), 
                $this->requiredFields['leftnode'], 
                $this->requiredFields['rightnode'], 
                $this->requiredFields['level'], 
                $this->requiredFields['uid']
        );

        $params = array(
            $leftnode,
            $rightnode,
            $level,
            $nodeUid,
        );
        
        $types = array(
            Type::INTEGER,
            Type::INTEGER,
            Type::INTEGER,
            Type::STRING,
        );

        $this->em->getConnection()->executeUpdate($query, $params, $types);
    }
72583
public function removeNodes($left, $right, $root=null)
    {
        $hasManyRoots = $this->getConfiguration()->hasManyRoots();

        $removed = array();
        foreach($this->wrappers as $oid => $wrapper)
        {
            if(!$hasManyRoots || ($wrapper->getRootValue() == $root))
            {
                if($wrapper->getLeftValue() >= $left && $wrapper->getRightValue() <= $right)
                {
                    $removed[$oid] = $wrapper;
                }
            }
        }

        foreach($removed as $key => $wrapper)
        {
            unset($this->wrappers[$key]);
            $wrapper->setLeftValue(0);
            $wrapper->setRightValue(0);
            if($hasManyRoots)
            {
                $wrapper->setRootValue(0);
            }
            $this->getEntityManager()->detach($wrapper->getNode());
        }
    }
1204776
public function setTreeLeft($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->tree_left !== $v) {
            $this->tree_left = $v;
            $this->modifiedColumns[CategoryTableMap::COL_TREE_LEFT] = true;
        }

        return $this;
    }
71113
private function updateSectionNodes($sectionUid, $leftNode, $rightNode, $level)
    {
        $this->createQueryBuilder('s')
                ->update()
                ->set('s._leftnode', $leftNode)
                ->set('s._rightnode', $rightNode)
                ->set('s._level', $level)
                ->where('s._uid = :uid')
                ->setParameter('uid', $sectionUid)
                ->getQuery()
                ->execute();

        return $this;
    }
86811
final public void increment(long incVal) {
        if (enabled) { // synchronize the update of lastValue
            lastSampleTime = updateIntegral();
            synchronized (this) {
                current += incVal;
            }
            updateWaterMark();
        } else {
            current += incVal;
        }
    }
984431
void calcFirstPos(RBBINode n) {
           if (n == null) {
               return;
           }
           if (n.fType == RBBINode.leafChar  ||
               n.fType == RBBINode.endMark   ||
               n.fType == RBBINode.lookAhead ||
               n.fType == RBBINode.tag) {
               // These are non-empty leaf node types.
               n.fFirstPosSet.add(n);
               return;
           }

           // The node is not a leaf.
           //  Calculate firstPos on its children.
           calcFirstPos(n.fLeftChild);
           calcFirstPos(n.fRightChild);

           // Apply functions from table 3.40 in Aho
           if (n.fType == RBBINode.opOr) {
               n.fFirstPosSet.addAll(n.fLeftChild.fFirstPosSet);
               n.fFirstPosSet.addAll(n.fRightChild.fFirstPosSet);
           }
           else if (n.fType == RBBINode.opCat) {
               n.fFirstPosSet.addAll(n.fLeftChild.fFirstPosSet);
               if (n.fLeftChild.fNullable) {
                   n.fFirstPosSet.addAll(n.fRightChild.fFirstPosSet);
               }
           }
           else if (n.fType == RBBINode.opStar ||
                    n.fType == RBBINode.opQuestion ||
                    n.fType == RBBINode.opPlus) {
               n.fFirstPosSet.addAll(n.fLeftChild.fFirstPosSet);
           }
       }
46576
protected function recursiveReorder($root, $parentId, $left)
    {
        $right = $left + 1;
        $children = array_get($root, 'children', []);
        foreach ($children as $child) {
            $right = $this->recursiveReorder($child, $root['id'], $right);
        }
        $this->move($root['id'], $parentId, $left, $right);
        $left = $right + 1;

        return $left;
    }
383994
public final void setNewVertexValue(VV newValue) {
		if (setNewVertexValueCalled) {
			throw new IllegalStateException("setNewVertexValue should only be called at most once per updateVertex");
		}
		setNewVertexValueCalled = true;

		outVertex.f1 = newValue;

		out.collect(Either.Left(outVertex));
	}
981137
def set_last_position(self, last_position):
        
        last_position = last_position or {}
        last_position.setdefault('readed_streams', [])
        last_position.setdefault('stream_offset', {})
        self.last_position = last_position
1259279
public function setRegion(int $left, int $top, int $width, int $height) : void
    {
        if ($top < 0 || $left < 0) {
            throw new InvalidArgumentException('Left and top must be non-negative');
        }

        if ($height < 1 || $width < 1) {
            throw new InvalidArgumentException('Width and height must be at least 1');
        }

        $right = $left + $width;
        $bottom = $top + $height;

        if ($bottom > $this->height || $right > $this->width) {
            throw new InvalidArgumentException('The region must fit inside the matrix');
        }

        for ($y = $top; $y < $bottom; ++$y) {
            $offset = $y * $this->rowSize;

            for ($x = $left; $x < $right; ++$x) {
                $index = $offset + ($x >> 5);
                $this->bits[$index] = $this->bits[$index] | (1 << ($x & 0x1f));
            }
        }
    }
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);
		}
	}
}