/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  java.util.AbstractList
 *  java.util.Collection
 *  java.util.Iterator
 *  java.util.List
 */
package org.dom4j.tree;

import java.util.AbstractList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.dom4j.IllegalAddException;
import org.dom4j.Node;
import org.dom4j.tree.AbstractBranch;

public class ContentListFacade
extends AbstractList {
    private AbstractBranch branch;
    private List branchContent;

    public ContentListFacade(AbstractBranch abstractBranch, List list) {
        this.branch = abstractBranch;
        this.branchContent = list;
    }

    public void add(int n, Object object) {
        this.branch.childAdded(this.asNode(object));
        this.branchContent.add(n, object);
    }

    public boolean add(Object object) {
        this.branch.childAdded(this.asNode(object));
        return this.branchContent.add(object);
    }

    public boolean addAll(int n, Collection collection) {
        int n2 = this.branchContent.size();
        Iterator iterator = collection.iterator();
        while (iterator.hasNext()) {
            int n3 = n + 1;
            this.add(n, iterator.next());
            --n2;
            n = n3;
        }
        if (n2 == this.branchContent.size()) {
            return true;
        }
        return false;
    }

    public boolean addAll(Collection collection) {
        int n = this.branchContent.size();
        Iterator iterator = collection.iterator();
        while (iterator.hasNext()) {
            this.add(iterator.next());
            ++n;
        }
        if (n == this.branchContent.size()) {
            return true;
        }
        return false;
    }

    protected Node asNode(Object object) {
        if (object instanceof Node) {
            return (Node)object;
        }
        throw new IllegalAddException(new StringBuffer().append("This list must contain instances of Node. Invalid type: ").append(object).toString());
    }

    public void clear() {
        Iterator iterator = this.iterator();
        while (iterator.hasNext()) {
            Object object = iterator.next();
            this.branch.childRemoved(this.asNode(object));
        }
        this.branchContent.clear();
    }

    public boolean contains(Object object) {
        return this.branchContent.contains(object);
    }

    public boolean containsAll(Collection collection) {
        return this.branchContent.containsAll(collection);
    }

    public Object get(int n) {
        return this.branchContent.get(n);
    }

    protected List getBackingList() {
        return this.branchContent;
    }

    public int indexOf(Object object) {
        return this.branchContent.indexOf(object);
    }

    public boolean isEmpty() {
        return this.branchContent.isEmpty();
    }

    public int lastIndexOf(Object object) {
        return this.branchContent.lastIndexOf(object);
    }

    public Object remove(int n) {
        Object object = this.branchContent.remove(n);
        if (object != null) {
            this.branch.childRemoved(this.asNode(object));
        }
        return object;
    }

    public boolean remove(Object object) {
        this.branch.childRemoved(this.asNode(object));
        return this.branchContent.remove(object);
    }

    public boolean removeAll(Collection collection) {
        for (Object object : collection) {
            this.branch.childRemoved(this.asNode(object));
        }
        return this.branchContent.removeAll(collection);
    }

    public Object set(int n, Object object) {
        this.branch.childAdded(this.asNode(object));
        return this.branchContent.set(n, object);
    }

    public int size() {
        return this.branchContent.size();
    }

    public Object[] toArray() {
        return this.branchContent.toArray();
    }

    public Object[] toArray(Object[] arrobject) {
        return this.branchContent.toArray(arrobject);
    }
}

