Remove any previous children and add
given node via. addChild.

@see removeChildrenOfType
@see addChild

@param AbstractNode $node

@return AbstractNode
194565
public function setChild(self $node)
    {
        $this->removeChildrenOfType($node->getNodeType());

        return $this->addChild($node);
    }
1273021
protected function prependChild(Node $node) {
    if ($this->head === NULL) {
      $this->childCount++;
      $node->parent = $this;
      $node->previous = NULL;
      $node->next = NULL;
      $this->head = $this->tail = $node;
    }
    else {
      $this->insertBeforeChild($this->head, $node);
      $this->head = $node;
    }
    return $this;
  }
1165412
public function addToObjectNode(string $key, AbstractNode $node): QueryBuilderInterface
    {
        if (!$this->node instanceof ObjectNode) {
            throw new \Exception(sprintf('You cannot call %s on node type: %s', __FUNCTION__, get_class($this->node)));
        }

        $this->node->add($key, $node);
        $this->reassignParent($node);

        return $this;
    }
130489
public function addChild(Node $node, $key = null)
    {
        if ($key === null) {
            $this->children[] = $node;
        } else {
            $this->children[ $key ] = $node;
        }

        return $node;
    }
1269396
public function addNode(Node $node)
    {
        if (isset($this->idList[$node->id])) {
            /**
             * @todo -> fix this behavior so the get last is working again
             */
            $node->setId($this->getNextPossibleIdInContext($node));
        }

        // add to the keylist for iterations
        if (isset($this->keyList[$node->key])) {
            $this->keyList[$node->key]->push($node);
        } else {
            $this->keyList[$node->key] = new \SplDoublyLinkedList();
            $this->keyList[$node->key]->push($node);
        }

        $this->list[$node->key]  = $node;
        $this->idList[$node->id] = $node;

        return $this;
    }
551708
public function apply(AbstractNode $node): void
    {
        if (!$this->isFacade($node)) {
            return;
        }

        $this->applyRule($node);
    }
519276
public function append(Node $node)
    {

        if (!is_array($this->_children)) {
            $this->_children = [];
        }

        $this->_children[] = $node;
        return $this;
    }
1020235
public function addNode(\Ydle\HubBundle\Entity\Node $node)
    {
        $this->nodes[] = $node;

        return $this;
    }
1245339
public function addChild(AbstractNode $child)
    {
        $key = null;

        // check integrity
        if ($this->isAncestor($child->id())) {
            throw new CircularException('Can not add child. It is my ancestor.');
        }

        // check if child is itself
        if ($child->id() == $this->id) {
            throw new CircularException('Can not set itself as a child.');
        }

        if ($this->hasChildren()) {
            if (isset($this->children[$child->id()])) {
                // we already have this child
                return false;
            }
            $sibling                      = $this->lastChild();
            $key                          = $sibling->id();
            $this->children[$key]['next'] = $child->id();
        }

        // add the child
        $this->children[$child->id()] = [
            'node' => $child,
            'next' => null,
            'prev' => $key,
        ];

        // tell child I am the new parent
        $child->setParent($this);

        //clear any cache
        $this->clear();

        return true;
    }
1115462
public function remove(Node $node)
    {

        // Collect the parentId to correct the positions of its old ancestors
        $parentId = $node->getParentId();
        $position = $node->getPosition();

        $this->performRemove($node);

        if($parentId){
            $this->decrementOrderAfter($parentId, $position);
        }

        return $this;
    }
952052
public function removeNode(Node $node)
    {
        $node->setNavigation(null);
        $this->nodes->removeElement($node);
    }
529060
public function addChild(PolicyNode $node): self
    {
        $id = spl_object_hash($node);
        $node->_parent = $this;
        $this->_children[$id] = $node;
        return $this;
    }
228738
public function apply(AbstractNode $node)
    {
        if (preg_match('#[A-Za-z0-9]+Constants$#', $node->getName()) === 0 ||
            preg_match('#\\\\Shared\\\\#', $node->getNamespaceName()) !== 0) {
            return;
        }

        $message = sprintf(
            'The environment configuration is not lie in "Shared" layer. That violates the rule "%s"',
            static::RULE
        );

        $this->addViolation($node, [$message]);
    }
1091268
protected Node removeNode( Node node )
    {
        // Remove node.
        node.previous.next = node.next;
        node.next.previous = node.previous;
        node.removed = true;
        return node;
    }
390815
public function apply(AbstractNode $node): void
    {
        if (!$this->isPlugin($node)) {
            return;
        }

        $classNodeInterfaces = $node->getInterfaces();

        if (!$classNodeInterfaces->count()) {
            $message = sprintf(
                'The Plugin `%s` doesn\'t have any interfaces.',
                $node->getName()
            );
            $this->addViolation($node, [$message]);

            return;
        }

        $firstInterface = $classNodeInterfaces[0];

        if ($firstInterface === null) {
            return;
        }

        $interfaceReflection = new ReflectionClass($firstInterface->getNamespacedName());

        $this->verifyInterface($node, $interfaceReflection);
    }
745157
function remove(node) {
    var next = node.nextSibling || node.parentNode;

    node.parentNode.removeChild(node);

    return next;
}
1234562
public static function remove_node($node) {
		if (
			! \is_a($node, 'DOMElement') &&
			! \is_a($node, 'DOMNode')
		) {
			return false;
		}

		$node->parentNode->removeChild($node);

		return true;
	}