removes all useless nodes in the tree represented by this node as a root
502000
private void removeUseless() {
    Set<Map.Entry<String, PropertyNode>> entries = _children.entrySet();
    for (Iterator<Map.Entry<String, PropertyNode>> it = entries.iterator(); it.hasNext(); ) {
      Map.Entry<String, PropertyNode> entry = it.next();
      PropertyNode child = entry.getValue();
      child.removeUseless();
      if (child.isUseless()) {
        it.remove();
      }
    }
  }
824101
def remove_node(self, node):
        
        try:
            self._nodes.remove(node)
            del self._weights[node]
        except (KeyError, ValueError):
            pass
        self._hashring = dict()
        self._sorted_keys = []

        self._build_circle()
532303
def clear(self):
        ''''''
        self._size = 0
        self._level = 1
        self._head = Node('HEAD', None,
                          [None]*SKIPLIST_MAXLEVEL,
                          [1]*SKIPLIST_MAXLEVEL)
547099
def pop(self):
        
        node = self.nodes.pop()
        self.__keys.remove(node.key)
423029
private boolean removeConvertedNodes(AbstractNode node) {
    boolean nodeRemoved = false;
    Iterator<AbstractNode> it = node.getChildren().iterator();
    while (it.hasNext()) {
      FilterJoinNode child = (FilterJoinNode) it.next();
      if (child.getState().equals(FilterJoinNode.State.CONVERTED)) {
        it.remove();
        nodeRemoved |= true;
      }
      else {
        nodeRemoved |= this.removeConvertedNodes(child) ? true : false;
      }
    }
    return nodeRemoved;
  }
1119984
public void removeSubtree( Tree<T> subtree )
    {
        if ( children.remove( subtree ) )
        {
            subtree.parent = null;
        }
    }
947610
def clear(self):
		'''
		
		'''
		for node in self.dli():
			node.empty = True
			node.key = None
			node.value = None
		
		self.head = _dlnode()
		self.head.next = self.head
		self.head.prev = self.head
		self.listSize = 1
		
		self.table.clear()
		
		# status var
		self.hit_cnt = 0 
		self.miss_cnt = 0
		self.remove_cnt = 0
234676
def clean(self):
        
        super(CTENode, self).clean()
        if self.parent and self.pk in getattr(self.parent, self._cte_node_path):
            raise ValidationError(_("A node cannot be made a descendant of itself."))
112452
protected void cancelLaterNodes() {
        // Go up the tree, cancel right siblings of this node and all parents
        for (@SuppressWarnings("unchecked") K parent = getParent(), node = (K) this;
             parent != null;
             node = parent, parent = parent.getParent()) {
            // If node is a left child of parent, then has a right sibling
            if (parent.leftChild == node) {
                K rightSibling = parent.rightChild;
                if (!rightSibling.canceled)
                    rightSibling.cancel();
            }
        }
    }
226469
function detree(items, children, parent_id) {

		var item,
		    i;

		for (i = 0; i < children.length; i++) {

			item = children[i];

			if (parent_id) {
				item.parent = parent_id;
			}

			items.push(item);

			if (item.children) {
				detree(items, item.children, item.id);
			}

			delete item.children;
		}
	}
603570
def _delete_subtree(self, nodes):
        
        nodes = nodes if isinstance(nodes, list) else [nodes]
        iobj = [
            (self._db[node]["parent"], node)
            for node in nodes
            if self._node_name_in_tree(node)
        ]
        for parent, node in iobj:
            # Delete link to parent (if not root node)
            del_list = self._get_subtree(node)
            if parent:
                self._db[parent]["children"].remove(node)
            # Delete children (sub-tree)
            for child in del_list:
                del self._db[child]
            if self._empty_tree():
                self._root = None
                self._root_hierarchy_length = None
836485
public void removeEmptySubtrees(CmsTreeNode<I_CmsContextMenuItem> root) {

        List<CmsTreeNode<I_CmsContextMenuItem>> children = root.getChildren();
        if ((root.getData() != null) && root.getData().isLeafItem()) {
            children.clear();
        } else {
            Iterator<CmsTreeNode<I_CmsContextMenuItem>> iter = children.iterator();
            while (iter.hasNext()) {
                CmsTreeNode<I_CmsContextMenuItem> node = iter.next();
                removeEmptySubtrees(node);
                if ((node.getData() != null) && !node.getData().isLeafItem() && (node.getChildren().size() == 0)) {
                    iter.remove();
                }
            }
        }
    }
1304311
def delete(self, value, key):
        

        # Base case: The empty tree cannot possibly have the desired value.
        if self is NULL:
            raise KeyError(value)

        direction = cmp(key(value), key(self.value))

        # Because we lean to the left, the left case stands alone.
        if direction < 0:
            if (not self.left.red and
                self.left is not NULL and
                not self.left.left.red):
                self = self.move_red_left()
            # Delete towards the left.
            left = self.left.delete(value, key)
            self = self._replace(left=left)
        else:
            # If we currently lean to the left, lean to the right for now.
            if self.left.red:
                self = self.rotate_right()

            # Best case: The node on our right (which we just rotated there) is a
            # red link and also we were just holding the node to delete. In that
            # case, we just rotated NULL into our current node, and the node to
            # the right is the lone matching node to delete.
            if direction == 0 and self.right is NULL:
                return NULL

            # No? Okay. Move more reds to the right so that we can continue to
            # traverse in that direction. At *this* spot, we do have to confirm
            # that node.right is not NULL...
            if (not self.right.red and
                self.right is not NULL and
                not self.right.left.red):
                self = self.move_red_right()

            if direction > 0:
                # Delete towards the right.
                right = self.right.delete(value, key)
                self = self._replace(right=right)
            else:
                # Annoying case: The current node was the node to delete all
                # along! Use a right-handed minimum deletion. First find the
                # replacement value to rebuild the current node with, then delete
                # the replacement value from the right-side tree. Finally, create
                # the new node with the old value replaced and the replaced value
                # deleted.
                rnode = self.right
                while rnode is not NULL:
                    rnode = rnode.left

                right, replacement = self.right.delete_min()
                self = self._replace(value=replacement, right=right)

        return self.balance()
48656
def clear_all(node=nil)
      if node.nil?
        node = @root_node
        delete_node_storage node
      end

      return if node == BLANK_NODE

      node_type = get_node_type node
      delete_node_storage node

      if NODE_KV_TYPE.include?(node_type)
        value_is_node = node_type == :extension
        clear_all decode_to_node(node[1]) if value_is_node
      elsif node_type == :branch
        16.times do |i|
          clear_all decode_to_node(node[i])
        end
      end
    end
1015939
public void clear() {
        Node<T> node = head.next, next;
        size = 0;
        head.reset(); // Clearing references.
        tail = head;
        iterator.currentNode = head;
        while (node != null) {
            next = node.next;
            node.free(pool);
            node = next;
        }
    }
313024
def clear(self):
        """"""
        node = self._first
        while node is not None:
            next_node = node._next
            node._list = node._prev = node._next = None
            node = next_node
        self._size = 0
174476
protected void delete(Node<K, V> n) {
        if (n == root) {
            deleteMin();
            return;
        }

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

        // disconnect and union children of node
        Node<K, V> childTree = unlinkAndUnionChildren(n);

        // find parent
        Node<K, V> p = getParent(n);

        // link children tree in place of node
        if (childTree == null) {
            // no children, just unlink from parent
            if (p.o_c == n) {
                if (n.y_s == p) {
                    p.o_c = null;
                } else {
                    p.o_c = n.y_s;
                }
            } else {
                p.o_c.y_s = p;
            }
        } else {
            // link children tree to parent
            if (p.o_c == n) {
                childTree.y_s = n.y_s;
                p.o_c = childTree;
            } else {
                p.o_c.y_s = childTree;
                childTree.y_s = p;
            }
        }

        size--;
        n.o_c = null;
        n.y_s = null;
    }