/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.Object
 *  java.lang.UnsupportedOperationException
 *  java.util.Iterator
 *  java.util.NoSuchElementException
 */
package org.dom4j.tree;

import java.util.Iterator;
import java.util.NoSuchElementException;

public abstract class FilterIterator
implements Iterator {
    private boolean first = true;
    private Object next;
    protected Iterator proxy;

    public FilterIterator(Iterator iterator) {
        this.proxy = iterator;
    }

    protected Object findNext() {
        if (this.proxy != null) {
            while (this.proxy.hasNext()) {
                Object object = this.proxy.next();
                if (object == null || !this.matches(object)) continue;
                return object;
            }
            this.proxy = null;
        }
        return null;
    }

    public boolean hasNext() {
        if (this.first) {
            this.next = this.findNext();
            this.first = false;
        }
        Object object = this.next;
        boolean bl = false;
        if (object != null) {
            bl = true;
        }
        return bl;
    }

    protected abstract boolean matches(Object var1);

    public Object next() throws NoSuchElementException {
        if (!this.hasNext()) {
            throw new NoSuchElementException();
        }
        Object object = this.next;
        this.next = this.findNext();
        return object;
    }

    public void remove() {
        throw new UnsupportedOperationException();
    }
}

