Add the child item IDs for one item object and their children.
486296
def _get_id2children(id2children, item_id, item_obj):
    """"""
    if item_id in id2children:
        return id2children[item_id]
    child_ids = set()
    for child_obj in item_obj.children:
        child_id = child_obj.item_id
        child_ids.add(child_id)
        child_ids |= _get_id2children(id2children, child_id, child_obj)
    id2children[item_id] = child_ids
    return child_ids
1019447
def child_added(self, child):
        
        super(AbstractItemView, self).child_added(child)
        self.get_member('_items').reset(self)
1174093
public void addOrUpdateItem(int parentId, MenuItem item) {
        synchronized (subMenuItems) {
            getSubMenuById(parentId).ifPresent(subMenu-> {
                if(getMenuItems(subMenu).stream().anyMatch(it-> it.getId() == item.getId())) {
                    replaceMenuById(asSubMenu(subMenu), item);
                }
                else {
                    addMenuItem(asSubMenu(subMenu), item);
                }
            });
        }
    }
1099473
private void addChildElements() {
        for (Node node : nodes) {
        	if(node instanceof NestableNode) {
	            List<Node> nl = ((NestableNode) node).getChildren();
	            for (Node n : nl) {
	                if (!(n instanceof Element)) {
	                    continue;
	                }
	                
	                String tag = selector.getTagName();
	                if (tagEquals(tag, ((Element)n).getNormalizedName()) || tag.equals(Selector.UNIVERSAL_TAG)) {
	                    result.add(n);
	                }
	            }
        	}
        }
    }
301589
private void updateChildrenInfo(Map myChild) {
        if (myChild != null) {
            Iterator values = myChild.values().iterator();
            while (values.hasNext()) {
                ModuleItem childMI = (ModuleItem) values.next();
                if (childMI.getInstance() instanceof PmiModuleAggregate) {
                    // no op                    
                } else {
                    ((PmiModuleAggregate) this.instance).add(childMI.getInstance());
                    ((PmiAbstractModule) this.instance).updateDataList();
                }
                updateChildrenInfo(childMI.children);
            }
        }
    }
229508
def populate_tree(self, parentItem, children_list):
        """"""
        for child_key in children_list:
            self.item_depth += 1
            (filename, line_number, function_name, file_and_line, node_type
             ) = self.function_info(child_key)

            ((total_calls, total_calls_dif), (loc_time, loc_time_dif), (cum_time,
             cum_time_dif)) = self.format_output(child_key)

            child_item = TreeWidgetItem(parentItem)
            self.item_list.append(child_item)
            self.set_item_data(child_item, filename, line_number)

            # FIXME: indexes to data should be defined by a dictionary on init
            child_item.setToolTip(0, _('Function or module name'))
            child_item.setData(0, Qt.DisplayRole, function_name)
            child_item.setIcon(0, self.icon_list[node_type])

            child_item.setToolTip(1, _('Time in function '\
                                       '(including sub-functions)'))
            child_item.setData(1, Qt.DisplayRole, cum_time)
            child_item.setTextAlignment(1, Qt.AlignRight)
            
            child_item.setData(2, Qt.DisplayRole, cum_time_dif[0])
            child_item.setForeground(2, QColor(cum_time_dif[1]))
            child_item.setTextAlignment(2, Qt.AlignLeft)

            child_item.setToolTip(3, _('Local time in function '\
                                      '(not in sub-functions)'))

            child_item.setData(3, Qt.DisplayRole, loc_time)
            child_item.setTextAlignment(3, Qt.AlignRight)
            
            child_item.setData(4, Qt.DisplayRole, loc_time_dif[0])
            child_item.setForeground(4, QColor(loc_time_dif[1]))
            child_item.setTextAlignment(4, Qt.AlignLeft)

            child_item.setToolTip(5, _('Total number of calls '\
                                       '(including recursion)'))

            child_item.setData(5, Qt.DisplayRole, total_calls)
            child_item.setTextAlignment(5, Qt.AlignRight)
            
            child_item.setData(6, Qt.DisplayRole, total_calls_dif[0])
            child_item.setForeground(6, QColor(total_calls_dif[1]))
            child_item.setTextAlignment(6, Qt.AlignLeft)

            child_item.setToolTip(7, _('File:line '\
                                       'where function is defined'))
            child_item.setData(7, Qt.DisplayRole, file_and_line)
            #child_item.setExpanded(True)
            if self.is_recursive(child_item):
                child_item.setData(7, Qt.DisplayRole, '(%s)' % _('recursion'))
                child_item.setDisabled(True)
            else:
                callees = self.find_callees(child_key)
                if self.item_depth < 3:
                    self.populate_tree(child_item, callees)
                elif callees:
                    child_item.setChildIndicatorPolicy(child_item.ShowIndicator)
                    self.items_to_be_shown[id(child_item)] = callees
            self.item_depth -= 1
383172
def add_object(self, obj):
        
        self.objects[obj.id] = obj
        self.all_objects[obj.id] = obj
        child_stack = list(obj.children)
        while child_stack:
            child = child_stack.pop()
            self.all_objects[child.id] = child
            child_stack.extend(getattr(child, "children", ()))
1126978
def get_id2children(objs):
    """"""
    id2children = {}
    for obj in objs:
        _get_id2children(id2children, obj.item_id, obj)
    return id2children
526677
public void addChildren(List<? extends Tree> kids) {
		for (int i = 0; i < kids.size(); i++) {
			Tree t = kids.get(i);
			addChild(t);
		}
	}
1366370
def child_set(self, child, **kwargs):
        """"""

        for name, value in kwargs.items():
            name = name.replace('_', '-')
            self.child_set_property(child, name, value)
285997
def add_child(self, child):
        
        assert child != self
        child.parent = self
        child.ranks = self.ranks
        child.index = self.index
        assert child.tax_id not in self.index
        self.index[child.tax_id] = child
        self.children.add(child)
332556
def __insert_child(self, parent_tree_node, index, tree_node):
        
        # manage the item model
        parent_item = self.__mapping[id(parent_tree_node)]
        self.item_model_controller.begin_insert(index, index, parent_item.row, parent_item.id)
        properties = {
            "display": self.__display_for_tree_node(tree_node),
            "tree_node": tree_node  # used for removal and other lookup
        }
        item = self.item_model_controller.create_item(properties)
        parent_item.insert_child(index, item)
        self.__mapping[id(tree_node)] = item
        self.item_model_controller.end_insert()
207378
public void addChildren( Iterable<PlanNode> otherChildren ) {
        assert otherChildren != null;
        for (PlanNode planNode : otherChildren) {
            this.addLastChild(planNode);
        }
    }
1367274
def add_child(self, widget):
        
        li_itm = _li(id=self.id + str(self._count))
        li_itm.add_child(widget)

        super(List, self).add_child(li_itm)
        self._items.append((widget, li_itm))
        self._count += 1
988473
def get_item_ids(self):
        """"""
        item_ids = []
        if self.has_items():
            for idstr in self._my_map['itemIds']:
                item_ids.append(idstr)
        return IdList(item_ids)
247114
protected function updateChildren()
    {
        $children = $this->manager->getChildren($this->item->name);
        $childrenNames = array_keys($children);

        if (is_array($this->children)) {
            // remove children that
            foreach (array_diff($childrenNames, $this->children) as $item) {
                $this->manager->removeChild($this->item, $children[$item]);
            }
            // add new children
            foreach (array_diff($this->children, $childrenNames) as $item) {
                $this->manager->addChild($this->item, $this->manager->getItem($item));
            }
        } else {
            $this->manager->removeChildren($this->item);
        }
    }
383203
def _init_children(self, parent):
        

        for dir_name in self.get_children_paths(parent.full_path):
            child = Node(name=dir_name, parent=parent)
            parent.children.append(child)
            self._init_children(child)