This method is responsible for preventing nodes with lower precedence from being located to
the left (lower sibling order) of nodes having a higher precedence and moveAllowed="false".
547268
static void applyLowerPrecedence(List<NodeInfo> order) {
        for (int i = 0; i < order.size(); i++) {
            NodeInfo ni = order.get(i);
            if (ni.getNode().getAttribute(Constants.ATT_MOVE_ALLOWED).equals("false")) {
                for (int j = 0; j < i; j++) {
                    NodeInfo lefty = order.get(j);
                    if (lefty.getPrecedence() == null
                            || lefty.getPrecedence().isLessThan(ni.getPrecedence())) {
                        order.remove(j);
                        order.add(i, lefty);
                    }
                }
            }
        }
    }
1206240
private boolean watchNextLowerNode() throws KeeperException, InterruptedException {
        /*
         * Iterate through the sorted list of children and find the given node,
         * then setup a electionWatcher on the previous node if it exists, otherwise the
         * previous of the previous...until we reach the beginning, then we are
         * the lowest node.
         */
        List<String> children = zk.getChildren(dir, false);
        Collections.sort(children);
        ListIterator<String> iter = children.listIterator();
        String me = null;
        //Go till I find myself.
        while (iter.hasNext()) {
            me = ZKUtil.joinZKPath(dir, iter.next());
            if (me.equals(node)) {
                break;
            }
        }
        assert (me != null);
        //Back on me
        iter.previous();
        //Until we have previous nodes and we set a watch on previous node.
        while (iter.hasPrevious()) {
            //Proess my lower nodes and put a watch on whats live
            String previous = ZKUtil.joinZKPath(dir, iter.previous());
            if (zk.exists(previous, electionWatcher) != null) {
                return false;
            }
        }
        return true;
    }
687969
static void bottomTwoColumns(NodeInfo first, NodeInfo second, List<NodeInfo> column0, List<NodeInfo> column1) {
		column0.add(first);
		column0.add(second);

		NodeInfo a = selectClosestN(first,second);
		if( a == null ) {
			return;
		}
		a.marked = true;
		column1.add(a);
		NodeInfo b = second;

		while( true ) {
			NodeInfo t = selectClosestN(a,b);
			if( t == null ) break;
			t.marked = true;
			column1.add(t);

			a = t;
			t = selectClosestN(a,b);
			if( t == null ) break;
			t.marked = true;
			column0.add(t);
			b = t;
		}
	}
942131
@GuardedBy("evictionLock")
  void reorderProbation(Node<K, V> node) {
    if (!accessOrderProbationDeque().contains(node)) {
      // Ignore stale accesses for an entry that is no longer present
      return;
    } else if (node.getPolicyWeight() > mainProtectedMaximum()) {
      return;
    }

    // If the protected space exceeds its maximum, the LRU items are demoted to the probation space.
    // This is deferred to the adaption phase at the end of the maintenance cycle.
    setMainProtectedWeightedSize(mainProtectedWeightedSize() + node.getPolicyWeight());
    accessOrderProbationDeque().remove(node);
    accessOrderProtectedDeque().add(node);
    node.makeMainProtected();
  }
1160729
private Node tryFoldAssignment(Node subtree) {
    checkState(subtree.isAssign());
    Node left = subtree.getFirstChild();
    Node right = subtree.getLastChild();
    if (left.isName()
        && right.isName()
        && left.getString().equals(right.getString())) {
      // Only names
      subtree.replaceWith(right.detach());
      reportChangeToEnclosingScope(right);
      return right;
    } else if (left.isDestructuringPattern() && !left.hasChildren()) {
      // `[] = <expr>` becomes `<expr>`
      // Note that this does potentially change behavior. If `<expr>` is not iterable and this
      // code originally threw, it will no longer throw.
      subtree.replaceWith(right.detach());
      reportChangeToEnclosingScope(right);
      return right;
    }
    return subtree;
  }
659681
private void comparatorDecreaseKey(Node<K, V> n, K newKey) {
        int c = comparator.compare(newKey, n.key);
        if (c > 0) {
            throw new IllegalArgumentException("Keys can only be decreased!");
        }
        n.key = newKey;
        if (c == 0) {
            return;
        }

        if (n.next == null) {
            throw new IllegalArgumentException("Invalid handle!");
        }

        // if not root and heap order violation
        Node<K, V> y = n.parent;
        if (y != null && comparator.compare(n.key, y.key) < 0) {
            cut(n, y);
            root.mark = false;
            cascadingRankChange(y);
            if (comparator.compare(n.key, root.key) < 0) {
                root = link(root, n);
            } else {
                link(n, root);
            }
        }
    }
116921
private void tryRemoveDeadAssignments(NodeTraversal t,
      ControlFlowGraph<Node> cfg,
      Map<String, Var> allVarsInFn) {
    Iterable<DiGraphNode<Node, Branch>> nodes = cfg.getDirectedGraphNodes();

    for (DiGraphNode<Node, Branch> cfgNode : nodes) {
      FlowState<LiveVariableLattice> state =
          cfgNode.getAnnotation();
      Node n = cfgNode.getValue();
      if (n == null) {
        continue;
      }
      switch (n.getToken()) {
        case IF:
        case WHILE:
        case DO:
          tryRemoveAssignment(t, NodeUtil.getConditionExpression(n), state, allVarsInFn);
          continue;
        case FOR:
        case FOR_IN:
        case FOR_OF:
        case FOR_AWAIT_OF:
          if (n.isVanillaFor()) {
            tryRemoveAssignment(t, NodeUtil.getConditionExpression(n), state, allVarsInFn);
          }
          continue;
        case SWITCH:
        case CASE:
        case RETURN:
          if (n.hasChildren()) {
            tryRemoveAssignment(t, n.getFirstChild(), state, allVarsInFn);
          }
          continue;
          // TODO(user): case VAR: Remove var a=1;a=2;.....
        default:
          break;
      }

      tryRemoveAssignment(t, n, state, allVarsInFn);
    }
  }
790943
private static void exportAllowedMovements(Xml root, Collection<MovementTile> movements)
    {
        for (final MovementTile movement : movements)
        {
            final Xml node = root.createChild(NODE_MOVEMENT);
            node.setText(movement.name());
        }
    }
1047844
def suppress_deg_one_node(self, to_par_edge, nd_id, to_child_edge):
        """"""
        # circumvent the node with nd_id
        to_child_edge_id = to_child_edge['@id']
        par = to_par_edge['@source']
        self._edge_by_source[par][to_child_edge_id] = to_child_edge
        to_child_edge['@source'] = par
        # make it a tip...
        del self._edge_by_source[nd_id]
        # delete it
        self._del_tip(nd_id)
260768
def bsp_left(node: tcod.bsp.BSP) -> Optional[tcod.bsp.BSP]:
    
    return None if not node.children else node.children[0]
1078803
private void forceDecreaseKeyToMinimum(Node<K, V> n) {
        Node<K, V> y = n.parent;
        if (y != null) {
            cut(n, y);
            root.mark = false;
            cascadingRankChange(y);
            root = link(root, n);
        }
    }
838159
protected void removeNeighborFromOrdering(TrustGraphNodeId neighbor) {
        ListIterator<TrustGraphNodeId> i = orderedNeighbors.listIterator();
        while (i.hasNext()) {
            TrustGraphNodeId cur = i.next();
            if (cur.equals(neighbor)) {
                i.remove();
            }
        }
    }
1196277
def fix_schema_node_ordering(parent):
        
        children = parent.getchildren()
        i_nodes = [node for node in children if node.tag == 'IndicatorItem']
        ii_nodes = [node for node in children if node.tag == 'Indicator']
        if not ii_nodes:
            return
        # Remove all the children
        for node in children:
            parent.remove(node)
        # Add the Indicator nodes back
        for node in i_nodes:
            parent.append(node)
        # Now add the IndicatorItem nodes back
        for node in ii_nodes:
            parent.append(node)
        # Now recurse
        for node in ii_nodes:
            fix_schema_node_ordering(node)
311367
protected void moveUp(int pos)
  {
//    if (tc.isEntryEnabled())
//      SibTr.entry(tc, "moveUp", new Integer(pos));

    PriorityQueueNode node = elements[pos];
    long priority = node.priority;

    while ((pos > 0) && (elements[parent(pos)].priority > priority))
    {
      setElement(elements[parent(pos)], pos);
      pos = parent(pos);
    }

    setElement(node, pos);

//    if (tc.isEntryEnabled())
//      SibTr.exit(tc, "moveUp");
  }
950333
function checkPositionAndRule( nodeA, nodeB, def, posBitFlags ) {
		return ( nodeA.getPosition( nodeB ) | posBitFlags ) == posBitFlags &&
			( !def.childRule || def.childRule( nodeA ) );
	}
3196
private void setCurrentLocationToNextValidPosition(Point aLocation)    {
        // set latest location to next valid position
        int i, j;
        i = aLocation.x;
        j = aLocation.y;
        do {
            if ( (j + 1)  == columns ) {    // goto next row
                i++;
                j = 0;
            }
            else {
                j++;
            }
        }
        while (
        (i < rows.size()) && (j < columns) && (((Row) rows.get(i)).isReserved(j))
        );
        curPosition = new Point(i, j);
    }
967013
private static <I, D> void moveIncoming(AbstractBaseDTNode<I, D> newNode,
                                            AbstractBaseDTNode<I, D> oldNode,
                                            D label) {
        newNode.getIncoming().insertAllIncoming(oldNode.getSplitData().getIncoming(label));
    }