package x5;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/* JADX INFO: loaded from: classes3.dex */
public abstract class r {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public r f26081a = null;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public r f26082b = null;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public r f26083c = null;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public r f26084d = null;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public r f26085e = null;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public ArrayList f26086f = null;

    public final void a(r rVar) {
        rVar.f();
        rVar.c(this);
        r rVar2 = this.f26083c;
        if (rVar2 == null) {
            this.f26082b = rVar;
            this.f26083c = rVar;
        } else {
            rVar2.f26085e = rVar;
            rVar.f26084d = rVar2;
            this.f26083c = rVar;
        }
    }

    public final List b() {
        ArrayList arrayList = this.f26086f;
        return arrayList != null ? Collections.unmodifiableList(arrayList) : Collections.EMPTY_LIST;
    }

    public void c(r rVar) {
        this.f26081a = rVar;
    }

    public final void d(List list) {
        if (list.isEmpty()) {
            this.f26086f = null;
        } else {
            this.f26086f = new ArrayList(list);
        }
    }

    public String e() {
        return "";
    }

    public final void f() {
        r rVar = this.f26084d;
        if (rVar != null) {
            rVar.f26085e = this.f26085e;
        } else {
            r rVar2 = this.f26081a;
            if (rVar2 != null) {
                rVar2.f26082b = this.f26085e;
            }
        }
        r rVar3 = this.f26085e;
        if (rVar3 != null) {
            rVar3.f26084d = rVar;
        } else {
            r rVar4 = this.f26081a;
            if (rVar4 != null) {
                rVar4.f26083c = rVar;
            }
        }
        this.f26081a = null;
        this.f26085e = null;
        this.f26084d = null;
    }

    public final String toString() {
        return getClass().getSimpleName() + "{" + e() + "}";
    }
}
