Append a new subnode
189294
def append(self, node):
        ""
        if not isinstance(node, self.__class__):
            raise TypeError('Expected Node instance, got %r' % node)
        self.nodes.append(node)
618850
function replaceNodeWith(node, newNode) {
    let done = false;
    const parent = node.$parent;
    const keys = Object.keys(parent);
    keys.forEach(function(key) {
        if (parent[key] === node) {
            parent[key] = newNode;
            done = true;
        }
    });

    if (done) {
        return;
    }

    // second pass, now check arrays
    keys.forEach(function(key) {
        if (Array.isArray(parent[key])) {
            const arr = parent[key];
            for (let i = 0; i < arr.length; i++) {
                if (arr[i] === node) {
                    arr[i] = newNode;
                    done = true;
                }
            }
        }
    });

    assert(done);
}
233493
private void addNthLastChild() {
        for (Node node : nodes) {
            int count = 1;
            Node n = DOMHelper.getNextSiblingElement(node);
            while (n != null) {
                count++;
                n = DOMHelper.getNextSiblingElement(n);
            }
            
            if (specifier.isMatch(count)) {
                result.add(node);
            }
        }
    }
233834
function replaceNode(replacementNode, node) {
  remove(replacementNode)
  node.parentNode.insertBefore(replacementNode, node)
  remove(node)
}
336503
def __addNode(self, name, cls):
        '''
        
        '''
        if name in self.nodes:
            raise Exception("A node by the name {} already exists.  Can't add a duplicate.".format(name))
        self.__nxgraph.add_node(name)
        self.__nxgraph.node[name]['label'] = name
        self.__nxgraph.node[name]['nodeobj'] = cls()
        self.__nxgraph.node[name]['type'] = cls.__name__
38723
def add(node_name, **kwargs):
    
    result = {}
    kwargs = kwargs.copy()
    overwrite = kwargs.pop('overwrite', False)
    node = nago.core.get_node(node_name)
    if not node:
        node = nago.core.Node()
    elif not overwrite:
        result['status'] = 'error'
        result['message'] = "node %s already exists. add argument overwrite=1 to overwrite it." % (node_name)
        return result
    else:
        node.delete()
        node = nago.core.Node()
    node['host_name'] = node_name
    for k, v in kwargs.items():
        node[k] = v
    node.save()
    result['message'] = "node successfully saved"
    result['node_data'] = node.data
    return result
751776
def replace(self, new_node):
        """"""
        cur_node = self.cur_node
        nodestack = self.nodestack
        cur = nodestack.pop()
        prev = nodestack[-1]
        index = prev[-1] - 1
        oldnode, name = prev[-2][index]
        assert cur[0] is cur_node is oldnode, (cur[0], cur_node, prev[-2],
                                               index)
        parent = prev[0]
        if isinstance(parent, list):
            parent[index] = new_node
        else:
            setattr(parent, name, new_node)
1334283
def prepend(self, *nodes: Union[str, AbstractNode]) -> None:
        """"""
        node = _to_node_list(nodes)
        if self.firstChild:
            self.insertBefore(node, self.firstChild)
        else:
            self.appendChild(node)
439423
public void appendNodes(NodeVector nodes)
  {

    if (!m_mutable)
      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");

    super.appendNodes(nodes);
  }
216928
def append_node(type, indent: @indents.length, add: false, value: nil)
      # add necessary stack items to match required indent
      @stacks << @stacks.last.dup while indent >= @stacks.length

      parent = @stacks[indent].last
      node = AST::NodeRegistrator.create(type, @lineno)
      parent.children << node

      node.value = value unless value.nil?

      @stacks[indent] << node if add

      node
    end
497194
def _insert_new_layers(self, new_layers, start_node_id, end_node_id):
        """"""
        new_node_id = self._add_node(deepcopy(self.node_list[end_node_id]))
        temp_output_id = new_node_id
        for layer in new_layers[:-1]:
            temp_output_id = self.add_layer(layer, temp_output_id)

        self._add_edge(new_layers[-1], temp_output_id, end_node_id)
        new_layers[-1].input = self.node_list[temp_output_id]
        new_layers[-1].output = self.node_list[end_node_id]
        self._redirect_edge(start_node_id, end_node_id, new_node_id)
68683
def add(self, node):
        """"""
        if not isinstance(node, Node):
            raise TypeError()
        for i, j in enumerate(self.__nodes):
            if j.node_id == node.node_id:
                self.__nodes[i] = node
                return
        self.__nodes.append(node)
846781
protected void appendNode(Node n)
    {
        if (mRootNode != null) {
            mRootNode.appendChild(n);
        } else {
            mElement.appendChild(n);
        }
    }
51241
def _add_node(self, node):
        
        self.nodes[node.node_id] = node
        logging.info("Added node with id {} containing {} streams".format(node.node_id, len(node.streams)))
409809
function insertNode(p, prev) {
    var node = {
        p: p,
        prev: null,
        next: null,
        minX: 0,
        minY: 0,
        maxX: 0,
        maxY: 0
    };

    if (!prev) {
        node.prev = node;
        node.next = node;

    } else {
        node.next = prev.next;
        node.prev = prev;
        prev.next.prev = node;
        prev.next = node;
    }
    return node;
}
458708
function createNode(src, raw, files, config) {
  var node = new FilesNode(src, raw, config);
  if (node.path || node.src) {
    files.push(node);
  }
}
32691
def add_child(self, node, callback):
        """"""
        if node not in self.children:
            self.children.append(ChildNode(node, callback))