Searches for an immediate child node and if found removes it from the linked-list of children.

@param node Node to be searched for and removed if found.
515162
public boolean removeChild(Node node) throws ChildNodeException {
    Node currNode = getFirstChild();
    boolean rc = false;

    if (!allowChildren) {
      throw new ChildNodeException();
    }

    if (node != null && !isLeaf()) {
      // Is this the first and only child
      if (node == currNode && node == currNode.getNextSibling()) {
        setFirstChild(null);
        rc = true;
      } else {
        // Verify that this Node is a child here
        do {
          if (currNode == node) {
            // Remove this child
            if (node.getPrevSibling() != null) {
              node.getPrevSibling().setNextSibling(node.getNextSibling());
            }
            if (node == getFirstChild()) {
              setFirstChild(node.getNextSibling());
            }

            rc = true;

            // do not release. Item.resolve expects the 
            // pointers to be intact after a remove
            //node.release();
            break;
          }
          currNode = currNode.getNextSibling();
        } while (currNode != getFirstChild());
      }
    }

    return rc;
  }
809487
public void swap(Tree<T> node) {
    Tree<T> thisParent = this.parent;
    List<Tree<T>> thisChildren = new ArrayList<>(this.children);

    this.removeFromParent();
    if (node.parent != null) {
      node.parent.add(this);
    }
    node.children.forEach(this::add);

    node.removeFromParent();
    if (thisParent != null) {
      thisParent.add(node);
    }
    thisChildren.forEach(node::add);
  }
77929
public void removeMember(String childName) {
        assert isMap() : "'removeMember' allowed only for MAP nodes";
        if (m_childNodeMap != null) {
            // Remove from child name map and then list if found.
            UNode removeNode = m_childNodeMap.remove(childName);
            if (removeNode != null) {
                m_children.remove(removeNode);
            }
        }
    }
681235
public void removeChild(String child)
    {
        final Xml node = getChild(child);
        root.removeChild(node.getElement());
    }
212494
public void removeChild(DirectedAcyclicGraphNode<T> child) {
    Preconditions.checkState(mChildren.contains(child));
    mChildren.remove(child);
  }
846781
protected void appendNode(Node n)
    {
        if (mRootNode != null) {
            mRootNode.appendChild(n);
        } else {
            mElement.appendChild(n);
        }
    }
1259661
public void remove(Node node) {
    if (node==null) return;
    if( node instanceof InnerNode ) {
      throw new IllegalArgumentException(
        "Not allow to remove an inner node: "+NodeBase.getPath(node));
    }
    LOG.info("Removing a node: "+NodeBase.getPath(node));
    netlock.writeLock().lock();
    try {
      String currentRackName = node.getNetworkLocation();
      if (clusterMap.remove(node)) {
        InnerNode rack = (InnerNode)getNode(node.getNetworkLocation());
        if (rack == null) {
          if (!racks.remove(currentRackName)) {
            LOG.error("Discrepancy between network topology and list of racks. "
                + "Removed rack "
                + currentRackName
                + " was not in the rack list.");
          }
        }
      }
      LOG.debug("NetworkTopology became:\n" + this.toString());
    } finally {
      netlock.writeLock().unlock();
    }
  }
912871
public void add(final ObjectSinkNode node) {
        if ( this.firstNode == null ) {
            this.firstNode = node;
            this.lastNode = node;
        } else {
            this.lastNode.setNextObjectSinkNode( node );
            node.setPreviousObjectSinkNode( this.lastNode );
            this.lastNode = node;
        }
        this.size++;
    }
1338500
public void addChild(Node node) throws ChildNodeException {
    if (node != null) {
      if (!allowChildren) {
        throw new ChildNodeException();
      }

      if (getFirstChild() == null) {
        setFirstChild(node);
        getFirstChild().setPrevSibling(firstChild);
        getFirstChild().setNextSibling(firstChild);
      } else {    // Add it to the end of the list
        Node lastChild = getFirstChild().getPrevSibling();
        if (lastChild != null) {
          lastChild.setNextSibling(node);
        }
        node.setNextSibling(getFirstChild());
      }
      node.setParent(this);
    }
  }
301645
function empty(node) {
		while (node && node.hasChildNodes()) {
			var child = node.firstChild;
			node.removeChild(child);
		}
	}
554727
@Override
    protected void nodeRecovered(Node node) {
        NodeStatus nodeStatus = getNodeStatus(node);

        synchronized(nodeStatus) {
            nodeStatus.resetCounters(getConfig().getTime().getMilliseconds());
            super.nodeRecovered(node);
        }
    }
538671
public void addChild(final DiffNode node)
	{
		if (node == this)
		{
			throw new IllegalArgumentException("Detected attempt to add a node to itself. " +
					"This would cause inifite loops and must never happen.");
		}
		else if (node.isRootNode())
		{
			throw new IllegalArgumentException("Detected attempt to add root node as child. " +
					"This is not allowed and must be a mistake.");
		}
		else if (node.getParentNode() != null && node.getParentNode() != this)
		{
			throw new IllegalArgumentException("Detected attempt to add child node that is already the " +
					"child of another node. Adding nodes multiple times is not allowed, since it could " +
					"cause infinite loops.");
		}
		if (node.getParentNode() == null)
		{
			node.setParentNode(this);
		}
		children.put(node.getElementSelector(), node);
		if (state == State.UNTOUCHED && node.hasChanges())
		{
			state = State.CHANGED;
		}
	}
962765
public static void deleteNode(Node n, AbstractCompiler compiler) {
    Node parent = n.getParent();
    NodeUtil.markFunctionsDeleted(n, compiler);
    n.detach();
    compiler.reportChangeToEnclosingScope(parent);
  }
857855
public void lockNode(final NodeId node) {
		Lockable<SharedBufferNode> sharedBufferNode = sharedBuffer.getEntry(node);
		if (sharedBufferNode != null) {
			sharedBufferNode.lock();
			sharedBuffer.upsertEntry(node, sharedBufferNode);
		}
	}
813582
public boolean remove(Tree<T> node) {
    return getChild(node)
        .map(function(n -> n.parent = null))
        .map(children::remove)
        .orElse(false);
  }
1027596
public boolean contains(Node node) {
    if (node == null) return false;
    netlock.readLock().lock();
    try {
      Node parent = node.getParent();
      for(int level=node.getLevel(); parent!=null&&level>0;
          parent=parent.getParent(), level--) {
        if (parent == clusterMap)
          return true;
      }
    } finally {
      netlock.readLock().unlock();
    }
    return false; 
  }
233712
static <K extends Comparable<K>> void checkNode(Node<K> node) {
        node.checkNode(null, null);
    }