Checks if the provided node is a direct child of this node.

@param child This node must be a direct child of myself.
@throws IllegalStateException If {@code child} isn't a direct child of myself.
184287
protected void ensureParentage(AbstractNode child) throws IllegalStateException {
		if (child.parent == this) return;
		
		throw new IllegalStateException(String.format(
				"Can't disown child of type %s - it isn't my child (I'm a %s)",
				child.getClass().getName(), this.getClass().getName()));
	}
360594
@Override
	public void addChildAt(final int index, final ITreeNode<T> child)
		throws IndexOutOfBoundsException
	{
		if (children != null && children.size() < index)
		{
			children.add(index, child);
		}
		else
		{
			addChild(child);
		}
	}
925228
public boolean removeChild( AstNode child ) {
        boolean result = this.children.remove(child);
        if (result) {
            child.parent = null;
        }
        return result;
    }
558968
protected static boolean isChildOf(String parent, String child) {
        if(parent == null || child == null)
            return false;
        if(!child.startsWith(parent))
            return false;
        if(child.length() <= parent.length())
            return false;
        int from=parent.equals(File.separator)? parent.length() : parent.length() +1;
        //  if(from-1 > child.length())
            // return false;
        String[] comps=Util.components(child.substring(from), File.separator);
        return comps != null && comps.length <= 1;
    }
487797
public final void addChildAfter(Node newChild, @Nullable Node node) {
    checkArgument(newChild.next == null, "The new child node has next siblings.");
    checkArgument(newChild.previous == null, "The new child node has previous siblings.");
    // NOTE: newChild.next remains null
    newChild.previous = newChild;
    addChildrenAfter(newChild, node);
  }
1350470
public void addChild(C child) {
        SharedPreferences prefs = loadSharedPreferences("children");

        List<String> objects = getChildrenList();

        Model toPut = (Model) child;

        if (objects.indexOf(toPut.getId()) != ArrayUtils.INDEX_NOT_FOUND) {
            return;
        }

        objects.add(toPut.getId());

        toPut.save();

        prefs.edit().putString(String.valueOf(getId()), StringUtils.join(objects, ",")).commit();
    }
1103664
public ViewHolder getChildViewHolder(View child) {
        final ViewParent parent = child.getParent();
        if (parent != null && parent != this) {
            throw new IllegalArgumentException("View " + child + " is not a direct child of " +
                    this);
        }
        return getChildViewHolderInt(child);
    }
1205278
@Override
    @SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.NcssCount",
        "PMD.NPathComplexity" })
    public <T extends ComponentType> T attach(T child) {
        synchronized (this) {
            ComponentVertex childNode = componentVertex(child, null);
            List<Channel> attachedAsChannels = new ArrayList<>();
            synchronized (childNode) {
                if (tree != null && tree.isStarted()) {
                    for (TreeIterator itr = new TreeIterator(childNode);
                            itr.hasNext();) {
                        attachedAsChannels.add(itr.next());
                    }
                }
                synchronized (tree()) {
                    if (childNode.tree == null) {
                        // Newly created, stand-alone child node
                        childNode.parent = this;
                        childNode.setTree(tree);
                        children.add(childNode);
                    } else {
                        // Attaching a tree...
                        synchronized (childNode.tree) {
                            if (childNode.parent != null) {
                                throw new IllegalStateException(
                                    "Cannot attach a node with a parent.");
                            }
                            if (childNode.tree.isStarted()) {
                                throw new IllegalStateException(
                                    "Cannot attach a started subtree.");
                            }
                            childNode.parent = this;
                            ComponentTree childTree = childNode.tree;
                            childNode.setTree(tree);
                            children.add(childNode);
                            tree.mergeEvents(childTree);
                        }
                    }
                    tree.clearHandlerCache();
                }
            }
            Channel parentChan = channel();
            if (parentChan == null) {
                parentChan = Channel.BROADCAST;
            }
            Channel childChan = childNode.channel();
            if (childChan == null) {
                parentChan = Channel.BROADCAST;
            }
            Attached evt = new Attached(childNode.component(), component());
            if (parentChan.equals(Channel.BROADCAST)
                || childChan.equals(Channel.BROADCAST)) {
                fire(evt, Channel.BROADCAST);
            } else if (parentChan.equals(childChan)) {
                fire(evt, parentChan);
            } else {
                fire(evt, parentChan, childChan);
            }
            if (!attachedAsChannels.isEmpty()) {
                fire(new Start(), attachedAsChannels.toArray(new Channel[0]));
            }
            return child;
        }
    }
745422
public static boolean isFallbackOf(Locale parent, Locale child) {
        return isFallbackOf(parent.toString(), child.toString());
    }
1014590
public static <T extends MutableTreeNode<T>> void removeChild(T parent, T child) {
        checkArgNotNull(parent, "parent");
        int index = parent.getChildren().indexOf(child);
        checkElementIndex(index, parent.getChildren().size());
        parent.removeChild(index);
    }
765140
public void addToFirstChildren(XmlElement parent,Element child){
        List<Element> elements = parent.getElements();
        elements.add(0,child);
    }
934879
public void addFirstChild( PlanNode child ) {
        assert child != null;
        this.children.addFirst(child);
        child.removeFromParent();
        child.parent = this;
    }
73679
@Override
	protected int addChildToTask (Task<E> child) {
		if (this.rootTask != null) throw new IllegalStateException("A behavior tree cannot have more than one root task");
		this.rootTask = child;
		return 0;
	}
115794
private void registerChildInternal(IgnoreDomainResourceTypeResource child) {
        child.setParent(this);
        children.put(child.getName(), child);
    }
798071
public void extractChild( PlanNode child ) {
        if (child.getChildCount() == 0) {
            removeChild(child);
        } else {
            PlanNode grandChild = child.getFirstChild();
            replaceChild(child, grandChild);
        }
    }
41827
final void checkChildScope(S parent) {
    checkNotNull(parent);
    checkArgument(NodeUtil.createsScope(rootNode), rootNode);
    checkArgument(
        rootNode != parent.getRootNode(),
        "rootNode should not be the parent's root node: %s", rootNode);
  }
165651
public void addChild(HierarchicalFormModel child) {
		Assert.notNull(child, "child");
		if (child.getParent() == this)
			return;
		Assert.isTrue(child.getParent() == null, "Child form model '" + child + "' already has a parent");
		child.setParent(this);
		children.add(child);
		child.addPropertyChangeListener(DIRTY_PROPERTY, childStateChangeHandler);
		child.addPropertyChangeListener(COMMITTABLE_PROPERTY, childStateChangeHandler);
		if (child.isDirty())
		{
			dirtyValueAndFormModels.add(child);
			dirtyUpdated();
		}
	}