axel/src/main/java/fr/xgouchet/xmleditor/core/model/TreeNode.java
public void appendChild(final @NonNull TreeNode<T> child) {

        // child already has a parent
        if (child.getParent() != null) {
            throw new UnsupportedOperationException("Cannot append child, it already has a parent");
        }

        // child is an ancestor (avoid weird families)
        if (isAncestor(child)) {
            throw new UnsupportedOperationException("Cannot append child, it is an ancestor of this node");
        }

        if (!mChildren.contains(child)) {
            if (mChildren.add(child)) {
                child.setParent(this);
            }
        }
    }
/**
     * Attach a child to this node. The child will be ordered after all existing children of this node.
     *
     * @param child the child to attach to this node (must not be null)
     */
Attach a child to this node. The child will be ordered after all existing children of this node.
@param child the child to attach to this node (must not be null)
Attach a child to this node . The child will be ordered after all existing children of this node . @param child the child to attach to this node ( must not be null )
public void appendChild(final @NonNull TreeNode<T> child) {
        if (child.getParent() != null) {
            throw new UnsupportedOperationException("Cannot append child, it already has a parent");
        }
        if (isAncestor(child)) {
            throw new UnsupportedOperationException("Cannot append child, it is an ancestor of this node");
        }
        if (!mChildren.contains(child)) {
            if (mChildren.add(child)) {
                child.setParent(this);
            }
        }
    }
public void appendChild ( final @ NonNull TreeNode < T > child ) { if ( child . getParent ( ) != null ) { throw new UnsupportedOperationException ( "Cannot append child, it already has a parent" ) ; } if ( isAncestor ( child ) ) { throw new UnsupportedOperationException ( "Cannot append child, it is an ancestor of this node" ) ; } if ( ! mChildren . contains ( child ) ) { if ( mChildren . add ( child ) ) { child . setParent ( this ) ; } } }
Attach a child to this node.
Attach a child to this node .
// child already has a parent // child is an ancestor (avoid weird families)