package xh;

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

/* loaded from: classes4.dex */
public class f {

    /* renamed from: a, reason: collision with root package name */
    private final List f50844a = new ArrayList();

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class a {

        /* renamed from: a, reason: collision with root package name */
        final Class f50845a;

        /* renamed from: b, reason: collision with root package name */
        final Class f50846b;

        /* renamed from: c, reason: collision with root package name */
        final e f50847c;

        a(Class cls, Class cls2, e eVar) {
            this.f50845a = cls;
            this.f50846b = cls2;
            this.f50847c = eVar;
        }

        public boolean a(Class cls, Class cls2) {
            return this.f50845a.isAssignableFrom(cls) && cls2.isAssignableFrom(this.f50846b);
        }
    }

    public synchronized e a(Class cls, Class cls2) {
        if (cls2.isAssignableFrom(cls)) {
            return g.b();
        }
        for (a aVar : this.f50844a) {
            if (aVar.a(cls, cls2)) {
                return aVar.f50847c;
            }
        }
        throw new IllegalArgumentException("No transcoder registered to transcode from " + cls + " to " + cls2);
    }

    public synchronized List b(Class cls, Class cls2) {
        ArrayList arrayList = new ArrayList();
        if (cls2.isAssignableFrom(cls)) {
            arrayList.add(cls2);
            return arrayList;
        }
        for (a aVar : this.f50844a) {
            if (aVar.a(cls, cls2) && !arrayList.contains(aVar.f50846b)) {
                arrayList.add(aVar.f50846b);
            }
        }
        return arrayList;
    }

    public synchronized void c(Class cls, Class cls2, e eVar) {
        this.f50844a.add(new a(cls, cls2, eVar));
    }
}
