/*
 * Decompiled with CFR 0.152.
 */
import java.io.DataInputStream;
import java.io.DataOutputStream;

public final class gr
extends gp {
    public final void d(String string) {
        if (string != null) {
            this.d();
            if (this.b.removeElement(string.trim().toLowerCase())) {
                this.f();
            }
        }
    }

    public final String a(int n) {
        return (String)this.b.elementAt(n);
    }

    public final boolean c(String string) {
        if (!ed.b(string) && !ed.b(string.trim())) {
            string = string.trim().toLowerCase();
            this.d();
            if (this.b.size() <= 0 || !this.b.lastElement().equals(string)) {
                this.b.removeElement(string);
                if (this.b.size() >= this.a) {
                    this.b.removeElementAt(0);
                }
                this.b.addElement(string);
                this.f();
            }
            return true;
        }
        return false;
    }

    public final void a(DataInputStream dataInputStream) {
        int n = dataInputStream.readUnsignedShort();
        for (int i = 0; i < n; ++i) {
            String string = dataInputStream.readUTF();
            if (i < n - this.a || this.b.contains(string)) continue;
            this.b.addElement(string);
        }
    }

    public final void a(DataOutputStream dataOutputStream) {
        int n = this.b.size();
        dataOutputStream.writeShort(n);
        for (int i = 0; i < n; ++i) {
            dataOutputStream.writeUTF((String)this.b.elementAt(i));
        }
    }

    public static gr a(String string) {
        gr gr2 = (gr)gr.b(string);
        if (gr2 == null) {
            return new gr(string, 20);
        }
        return gr2;
    }

    private gr(String string, int n) {
        super(string, n);
    }
}

