Delete node p, and then re-balance the tree.

@param p
node to delete
@return
337006
OMVRBTreeEntry<K, V> deleteEntry(OMVRBTreeEntry<K, V> p) {
    setSizeDelta(-1);
    modCount++;
    if (pageIndex > -1) {
      // DELETE INSIDE THE NODE
      p.remove();

      if (p.getSize() > 0)
        return p;
    }

    final OMVRBTreeEntry<K, V> next = successor(p);
    // DELETE THE ENTIRE NODE, RE-BUILDING THE STRUCTURE
    removeNode(p);

    // RETURN NEXT NODE
    return next;
  }
455123
void unlink(Node<E> p, Node<E> trail) {
        // assert isFullyLocked();
        // p.next is not changed, to allow iterators that are
        // traversing p to maintain their weak-consistency guarantee.
        p.item = null;
        trail.next = p.next;
        if (last == p)
            last = trail;
        if (count.getAndDecrement() == capacity)
            notFull.signal();
    }
654528
public final V remove(Object key) {
	
	if(key == null) return null;

	int key_hash_code = key.hashCode();
	BinTreeNode<K,V> prev = null;
	int son = 0;
	BinTreeNode<K,V> node = root;

	while(node != null) {
	    if(key_hash_code < node.keyHashCode) {
		prev = node;
		node = node.left;
		son  = 0;
	    }
	    else {
		if((key_hash_code > node.keyHashCode) || !node.key.equals(key)) {
		    prev = node;
		    node = node.right;
		    son  = 1;
		}
		else {
		    size--;
		    cachedHashCode -= node.hashCode();
		    return remove_node(node, prev, son);
		}
	    }
	}
	return null;
    }
854137
@Override
    public R visitArrayAccess(ArrayAccessTree node, P p) {
        R r = scan(node.getExpression(), p);
        r = scanAndReduce(node.getIndex(), p, r);
        return r;
    }
204264
public Set<ClusterNode.GrantId> deleteNode(String nodeName) {
    ClusterNode node = nameToNode.get(nodeName);
    if (node == null) {
      LOG.warn("Trying to delete non-existent node: " + nodeName);
      return null;
    }
    return deleteNode(node);
  }
96371
protected boolean removeRecursive(final K key, final int nodeid) {
		if (nodeid == Node.NULL_ID) {
			return false;  // NOT FOUND
		}
		Node<K, V> nodeDelete = getNode(nodeid);
		if (log.isDebugEnabled()) {
			log.debug("trying removeRecursive nodeDelete=" + nodeDelete + " key=" + key);
		}
		int slot = nodeDelete.findSlotByKey(key);
		if (nodeDelete.isLeaf()) {
			if (slot < 0) {
				if (log.isDebugEnabled()) {
					log.debug("NOT FOUND nodeDelete=" + nodeDelete + " key=" + key);
				}
				return false; // NOT FOUND
			}
			nodeDelete.remove(slot);
			putNode(nodeDelete);
			return true;
		}
		slot = ((slot < 0) ? (-slot) - 1 : slot + 1);
		final InternalNode<K, V> nodeDeleteInternal = (InternalNode<K, V>) nodeDelete;
		if (removeRecursive(key, nodeDeleteInternal.childs[slot])) {
			nodeDeleteInternal.checkUnderflow(slot);
			return true;
		}
		return false;
	}
697408
@Override
    public R visitTypeParameter(TypeParameterTree node, P p) {
        R r = scan(node.getAnnotations(), p);
        r = scanAndReduce(node.getBounds(), p, r);
        return r;
    }
942444
private UpdateResult delete(long key, Node node) {
        UpdateResult result;
        if (node == null) {
            // Item not found.
            result = new UpdateResult();
        } else {
            long itemKey = node.item.key();
            if (key < itemKey) {
                // Given key is smaller than the current node's item key; proceed to the node's left child.
                result = delete(key, node.left);
                node.left = result.node;
            } else if (key > itemKey) {
                // Given key is larger than the current node's item key; proceed to the node's right child.
                result = delete(key, node.right);
                node.right = result.node;
            } else {
                // Found the node. Remember it's item.
                result = new UpdateResult();
                result.updatedItem = node.item;
                if (node.left != null && node.right != null) {
                    // The node has two children. Replace the node's item with its in-order successor, and then remove
                    // that successor's node.
                    node.item = findSmallest(node.right);
                    node.right = delete(node.item.key(), node.right).node;
                } else {
                    // The node has just one child. Replace it with that child.
                    node = (node.left != null) ? node.left : node.right;
                    this.size--;
                    this.modCount++;
                }
            }

            // Rebalance the sub-tree, if necessary.
            result.node = balance(node);
        }

        return result;
    }
1304749
public void remove(Node<T> node) {
    	if (first == node) {
    		removeMin();
    		return;
    	}
    	if (last == node) {
    		removeMax();
    		return;
    	}
    	// if both children of root are black, set root to red
    	if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red))
            root.red = true;

        root = remove(root, node);
        if (root != null) root.red = false;
        else first = last = null;
    }
1091268
protected Node removeNode( Node node )
    {
        // Remove node.
        node.previous.next = node.next;
        node.next.previous = node.previous;
        node.removed = true;
        return node;
    }
537113
public static boolean deletePathRecursive(Tree<ResourceMeta> tree, Path path){
        if(tree.hasResource(path)) {
            //delete just this resource
            return tree.deleteResource(path);
        }else if (tree.hasDirectory(path)) {
            //list resources and delete
            Set<Resource<ResourceMeta>> resources = tree.listDirectory(path);
            boolean failed=false;
            for (Resource<ResourceMeta> resource : resources) {
                if(resource.isDirectory()){
                    if(!deletePathRecursive(tree,resource.getPath())){
                        failed=true;
                    }
                }else {
                    if(!tree.deleteResource(resource.getPath())){
                        failed=true;
                    }
                }
            }
            return !failed;
        }else{
            return true;
        }
    }
409596
public void remove(int p) {
        npoints--;
        int q = index[p];
        index[points[q] = points[npoints]] = q;

        for (int i = 0; i < npoints; i++) {
            if (neighbor[points[i]] == p) {
                findNeighbor(points[i]);
            }
        }
    }
710413
protected final PrcEntityPbDelete<RS, IPersistableBase>
    createPutPrcEntityPbDelete() throws Exception {
    PrcEntityPbDelete<RS, IPersistableBase> proc =
      new PrcEntityPbDelete<RS, IPersistableBase>();
    proc.setSrvOrm(getSrvOrm());
    //assigning fully initialized object:
    this.processorsMap
      .put(PrcEntityPbDelete.class.getSimpleName(), proc);
    return proc;
  }
624091
private final V finish_removal(BinTreeNode<K,V> node, BinTreeNode<K,V> prev,
				   int son, BinTreeNode<K,V> m) {
	if(m != null) { // set up the links for m
	    m.left  = node.left;
	    m.right = node.right;
	}
	if(prev == null)
	    root = m;
	else {
	    if(son == 0)
		prev.left = m;
	    else
		prev.right = m;
	}

	return node.value;
    }
181234
@Override
    public R visitValue(ValueTree node, P p) {
        return scan(node.getReference(), p);
    }
566181
public boolean remove(Node<E> e) {

        mPutLock.lock();
        mPollLock.lock();
        try {
            if (e == null)
                return false;
    
            if (e.mRemoved)
                return false;
    
            if (mSize.get() == 0)
                return false;

            if (e == mTail) {
                removeTail();
                return true;
            }
            if (e == mHead.mNext) {
                removeHead();
                return true;
            }
            if (mSize.get() < 3)
                return false;

            if (e.mPrev == null || e.mNext == null)
                return false;

            e.mPrev.mNext = e.mNext;
            e.mNext.mPrev = e.mPrev;
            e.mRemoved = true;
            mSize.decrementAndGet();
            mNodePool.returnNode(e);
            return true;
        }
        finally {
            mPollLock.unlock();
            mPutLock.unlock();
        }
    }
88667
public OMVRBTreeEntryPersistent<K, V> delete() throws IOException {
    if (dataProvider != null) {
      pTree.removeNodeFromMemory(this);
      pTree.removeEntry(dataProvider.getIdentity());

      // EARLY LOAD LEFT AND DELETE IT RECURSIVELY
      if (getLeft() != null)
        ((OMVRBTreeEntryPersistent<K, V>) getLeft()).delete();

      // EARLY LOAD RIGHT AND DELETE IT RECURSIVELY
      if (getRight() != null)
        ((OMVRBTreeEntryPersistent<K, V>) getRight()).delete();

      // DELETE MYSELF
      dataProvider.removeIdentityChangedListener(this);
      dataProvider.delete();
      clear();
    }

    return this;
  }