Rotates Tree.
@access		private
@return		void
968827
private function rotateLL()
	{
		$value_before		=& $this->value;
		$right_before		=& $this->right;
		$this->value		=& $this->left->value;
		$this->right		=& $this->left;
		$this->left			=& $this->left->left;
		$this->right->left	=& $this->right->right;
		$this->right->right	=& $right_before;
		$this->right->value	=& $value_before;
	}
762837
def aux_moveTree(offset, tree):
	""""""
	if tree.x1 != None and tree.x2 != None :
		tree.x1, tree.x2 = tree.x1+offset, tree.x2+offset
		
	for c in tree.children:
		aux_moveTree(offset, c)
681270
public function rewind() {
    $this->nodeIterator->rewind();
    $this->currentAttributes = $this->nodeIterator->current()->getValueNames(false);
    $this->currentAttribute = current($this->currentAttributes);
    $this->end = (sizeof($this->currentAttributes) == 0);
  }
136237
public function detachRight() : void
    {
        if ($this->right) {
            $this->right->setParent(null);

            $this->right = null;
        }
    }
286491
public function rotate($resetTimer = true)
    {
        if (!$this->config["blocking"]) {
            while (!empty($this->asyncBuffer)) {
                $this->flush();
            }
        }

        if ($resetTimer) {
            $this->lastRotationTime = time();
        }

        $this->log(self::INFO, "Rotating log file...");
        fclose($this->destinationHandler);
        $this->createFileHandler();
    }
1180201
private void rotateLeft(int n) {
        final int r = right(n);
        final int lr = left(r);
        right(n, lr);
        if (lr != NIL) {
            parent(lr, n);
        }
        final int p = parent(n);
        parent(r, p);
        if (p == NIL) {
            root = r;
        } else if (left(p) == n) {
            left(p, r);
        } else {
            assert right(p) == n;
            right(p, r);
        }
        left(r, n);
        parent(n, r);
        fixAggregates(n);
        fixAggregates(parent(n));
    }
845483
public function rotate()
	{
		// update the session id rotation timer
		if ($this->rotationInterval)
		{
			$this->rotationTimer = time() + $this->rotationInterval;
		}

		// regenerate the session id
		$this->driver->regenerate($this);
	}
288152
public function breadthFirst($tree = [], \Closure $callback = null)
    {
        if (!$tree) {
            $tree = $this->tree;
        }
        $children = [];
        foreach ($tree as $node) {
            if ($callback) {
                call_user_func_array($callback, ['node' => $node]);
            }
            $nodeChildren = $node['children'];
            if ($nodeChildren) {
                $children = array_merge($children, $nodeChildren);
            }
        }
        if ($children) {
            $this->breadthFirst($children);
        }
    }
1236305
function _doRotate() {
    _this.rotate(file, options, function(err, rotated) {
      if (err) {
        _this.emit('error', err);
        return;
      }
      if (rotated) {
        _this.emit('rotate', file);
      }
    });
  }
1196945
public function update()
    {
        $sync = !empty($this->request->query['sync']) ? true : false;
        if (AcoManager::buildAcos(null, $sync)) {
            $this->Flash->success(__d('user', 'Permissions tree was successfully updated!'));
        } else {
            $this->Flash->danger(__d('user', 'Some errors occur while updating permissions tree.'));
        }

        $this->title(__d('user', 'Update Permissions'));
        $this->redirect($this->referer());
    }
227596
protected function rotateFiles()
    {
        // update filename
        // $filename = $this->getFilename();
        $path = $this->getLogPath();

        // skip GC of old logs if files are unlimited
        if (0 === $this->maxFiles) {
            return;
        }

        $logFiles = glob($path . "{$this->name}*.log");
        if ($this->maxFiles >= \count($logFiles)) {
            // no files to remove
            return;
        }

        // Sorting the files by name to remove the older ones
        usort($logFiles, function ($a, $b) {
            return strcmp($b, $a);
        });

        foreach (\array_slice($logFiles, $this->maxFiles) as $file) {
            if (is_writable($file)) {
                // suppress errors here as unlink() might fail if two processes
                // are cleaning up/rotating at the same time
                set_error_handler(function ($errno, $errstr, $errfile, $errline) {
                });
                unlink($file);
                restore_error_handler();
            }
        }

        // $this->mustRotate = false;
    }
552818
function () {
            var self = this;
            self.renderChildren.apply(self, arguments);    // only sync child sub tree at root node
            // only sync child sub tree at root node
            if (self === self.get('tree')) {
                updateSubTreeStatus(self, self, -1, 0);
            }
        }
464386
public function rebuildTree()
    {
        $em = $this->getEntityManager();

        // Reset tree...
        $sql = 'UPDATE kuma_folders SET lvl=NULL,lft=NULL,rgt=NULL';
        $stmt = $em->getConnection()->prepare($sql);
        $stmt->execute();

        $folders = $this->findBy(array(), array('parent' => 'ASC', 'name' => 'asc'));

        $rootFolder = $folders[0];
        $first = true;
        foreach ($folders as $folder) {
            // Force parent load
            $parent = $folder->getParent();
            if (is_null($parent)) {
                $folder->setLevel(0);
                if ($first) {
                    $this->persistAsFirstChild($folder);
                    $first = false;
                } else {
                    $this->persistAsNextSiblingOf($folder, $rootFolder);
                }
            } else {
                $folder->setLevel($parent->getLevel() + 1);
                $this->persistAsLastChildOf($folder, $parent);
            }
        }
        $em->flush();
    }
694604
protected void rotate() {
    for (RotatingMap map : spoutTasksToRotatingMap.values()) {
      map.rotate();
    }

    Runnable r = new Runnable() {
      @Override
      public void run() {
        rotate();
      }
    };
    looper.registerTimerEvent(rotateInterval, r);
  }
5543
def re_balance(self):
        
        self.update_heights(recursive=False)
        self.update_balances(False)

        while self.balance < -1 or self.balance > 1:
            if self.balance > 1:
                if self.node.left.balance < 0:
                    self.node.left.rotate_left()
                    self.update_heights()
                    self.update_balances()
                self.rotate_right()
                self.update_heights()
                self.update_balances()

            if self.balance < -1:
                if self.node.right.balance > 0:
                    self.node.right.rotate_right()
                    self.update_heights()
                    self.update_balances()
                self.rotate_left()
                self.update_heights()
                self.update_balances()
1061084
public function rotateAll()
    {
        $pb = $this->prepareProcessBuilder();
        $pb->add('--all');

        $indexer = $pb->getProcess();
        $indexer->run();

        if (strstr($indexer->getOutput(), 'FATAL:') || strstr($indexer->getOutput(), 'ERROR:')) {
            throw new \RuntimeException(sprintf('Error rotating indexes: "%s".', rtrim($indexer->getOutput())));
        }

    }
1324052
public function reverseTree($tree = [])
    {
        if (!$tree) {
            $tree = $this->tree;
        }
        $tempArr = [];
        foreach ($tree as $k => $node) {
            $nodeChild = $node['children'];
            if ($nodeChild) {
                $node['children'] = $this->reverseTree($nodeChild);
            }
            array_unshift($tempArr, $node);
        }
        return $tempArr;
    }