Add an agent, connecting it to the previous node.
965459
def add_node(self, node):
        """"""
        other_nodes = [n for n in self.nodes() if n.id != node.id]

        if isinstance(node, Source) and other_nodes:
            raise(Exception("Chain network already has a nodes, "
                            "can't add a source."))

        if other_nodes:
            parent = max(other_nodes, key=attrgetter('creation_time'))
            parent.connect(whom=node)
126983
def add_nodes(self, nodes):
        '''
        '''
        new_nodes, master_map = self._add_nodes_as_master(nodes)

        for n in new_nodes:
            if n.name not in master_map:
                continue
            master_name = master_map[n.name]
            target = self.get_node(master_name)
            if not target:
                raise NodeNotFound(master_name)
            n.replicate(target.name)
            n.flush_cache()
            target.flush_cache()
572631
private void addAgent(AsteriskAgentImpl agent)
    {
        synchronized (agents)
        {
            agents.put(agent.getAgentId(), agent);
        }
        server.fireNewAgent(agent);
    }
1164705
def add_child(self, child):
        '''
        '''
        if not isinstance(child, Node):
            raise TypeError("child must be a Node")
        self.children.append(child); child.parent = self
673337
private void add(int previous, int index, Trie.Node node) {

        if (!node.getChildren().isEmpty() && node.hasSinglePath()
                        && node.getChildren().get(0).getKey() != TERMINATING_CHARACTER) { // If node has only one path, put the rest in tail array
            baseBuffer.put(index, tailIndex); // current index of tail array
            addToTail(node.getChildren().get(0));
            checkBuffer.put(index, previous);
            return; // No more child to process
        }

        int startIndex = (compact ? 0 : index);
        int base = findBase(startIndex, node.getChildren());

        baseBuffer.put(index, base);

        if (previous >= 0) {
            checkBuffer.put(index, previous); // Set check value
        }

        for (Trie.Node child : node.getChildren()) { // For each child to double array trie
            if (compact) {
                add(index, base + child.getKey(), child);
            } else {
                add(index, index + base + child.getKey(), child);
            }
        }

    }
127208
def add_child(self, node):
        """"""
        node._parent = self
        self._children.append(node)
845709
public void insertAsNext(BasicDoubleLinkedNode<V> node) {

    BasicDoubleLinkedNode<V> next = getNext();
    if (next != null) {
      next.previous = node;
      node.setNext(next);
    }
    node.previous = this;
    setNext(node);
  }
1222503
def _add_nodes(self):
        """"""
        for n, atom in enumerate(self.ast.select('atom')):
            self.add_node(n, atom=atom)
            self._atom_indices[id(atom)] = n
519192
def update_agent(self, agent, body=None):
        """"""
        return self.put(self.agent_path % (agent), body=body)
915076
def add_node(self, node):
        """"""
        nodes = sorted(
            self.nodes(),
            key=attrgetter('creation_time'), reverse=True)

        other_nodes = [n for n in nodes if n.id != node.id]

        connecting_nodes = other_nodes[0:(self.n - 1)]

        for n in connecting_nodes:
            n.connect(whom=node)
399230
def node_insert_after(self, node, new_node):
        """"""

        assert(not self.node_is_on_list(new_node))
        assert(node is not new_node)

        next = self.node_next(node)
        assert(next is not None)
        self.node_set_next(node, new_node)
        self.node_set_prev(new_node, node)

        self.node_set_next(new_node, next)
        self.node_set_prev(next, new_node)
1204107
def add_node_connection(self, link, nodes):
        
        # Description
        src_desc = 'connected to %s on port %s' % \
                   (self.get_node_name_from_id(link['destination_node_id'],
                                               nodes),
                    self.get_port_name_from_id(link['destination_node_id'],
                                               link['destination_port_id'],
                                               nodes))
        dest_desc = 'connected to %s on port %s' % \
                    (self.get_node_name_from_id(link['source_node_id'],
                                                nodes),
                     self.get_port_name_from_id(link['source_node_id'],
                                                link['source_port_id'],
                                                nodes))
        # Add source connections
        for node in nodes:
            if node['id'] == link['source_node_id']:
                for port in node['ports']:
                    if port['id'] == link['source_port_id']:
                        port['link_id'] = link['id']
                        port['description'] = src_desc
                        break
            elif node['id'] == link['destination_node_id']:
                for port in node['ports']:
                    if port['id'] == link['destination_port_id']:
                        port['link_id'] = link['id']
                        port['description'] = dest_desc
                        break
228551
def add(self, root):
        
        node = Element('import', ns=self.xsdns)
        node.set('namespace', self.ns)
        if self.location is not None:
            node.set('schemaLocation', self.location)
        log.debug('%s inserted', node)
        root.insert(node)
1310672
def add_node(self, node):
        """"""
        self.nodes.append(node)

        # add node_ids
        try:
            if node.node_id != b"$stats":
                self.node_ids.append(node.node_id)
        except NotImplementedError:
            raise
        except Exception:
            print("ERROR: getting Node")
39441
def add_node(self, node, adapter_number, port_number, label=None, dump=True):
        

        port = node.get_port(adapter_number, port_number)
        if port is None:
            raise aiohttp.web.HTTPNotFound(text="Port {}/{} for {} not found".format(adapter_number, port_number, node.name))
        if port.link is not None:
            raise aiohttp.web.HTTPConflict(text="Port is already used")

        self._link_type = port.link_type

        for other_node in self._nodes:
            if other_node["node"] == node:
                raise aiohttp.web.HTTPConflict(text="Cannot connect to itself")

            if node.node_type in ["nat", "cloud"]:
                if other_node["node"].node_type in ["nat", "cloud"]:
                    raise aiohttp.web.HTTPConflict(text="It's not allowed to connect a {} to a {}".format(other_node["node"].node_type, node.node_type))

            # Check if user is not connecting serial => ethernet
            other_port = other_node["node"].get_port(other_node["adapter_number"], other_node["port_number"])
            if other_port is None:
                raise aiohttp.web.HTTPNotFound(text="Port {}/{} for {} not found".format(other_node["adapter_number"], other_node["port_number"], other_node["node"].name))
            if port.link_type != other_port.link_type:
                raise aiohttp.web.HTTPConflict(text="It's not allowed to connect a {} to a {}".format(other_port.link_type, port.link_type))

        if label is None:
            label = {
                "x": -10,
                "y": -10,
                "rotation": 0,
                "text": html.escape("{}/{}".format(adapter_number, port_number)),
                "style": "font-size: 10; font-style: Verdana"
            }

        self._nodes.append({
            "node": node,
            "adapter_number": adapter_number,
            "port_number": port_number,
            "port": port,
            "label": label
        })

        if len(self._nodes) == 2:
            yield from self.create()
            for n in self._nodes:
                n["node"].add_link(self)
                n["port"].link = self
            self._created = True
            self._project.controller.notification.emit("link.created", self.__json__())

        if dump:
            self._project.dump()
477247
def agent_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/agents"
        return self.call(api_path, method="POST", data=data, **kwargs)
663128
def create_node(self, network, participant):
        """"""
        return self.models.RogersAgent(network=network, participant=participant)