package o; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import o.AUI.RVV; /* loaded from: classes2.dex */ public final class AUI { public List> a; public Set c; private final int d; public final C15709htl e; /* loaded from: classes2.dex */ public interface RVV { HTs e(); } public AUI() { this(new C15709htl(0.0d, 1.0d, 0.0d, 1.0d)); } private AUI(C15709htl c15709htl) { this(c15709htl, 0); } private AUI(double d, double d2, double d3, double d4, int i) { this(new C15709htl(d, d2, d3, d4), i); } private AUI(C15709htl c15709htl, int i) { this.a = null; this.e = c15709htl; this.d = i; } public final void a(double d, double d2, T t) { AUI aui = this; while (aui.a != null) { if (d2 < aui.e.c) { if (d < aui.e.b) { aui = aui.a.get(0); } else { aui = aui.a.get(1); } } else if (d < aui.e.b) { aui = aui.a.get(2); } else { aui = aui.a.get(3); } } if (aui.c == null) { aui.c = new HashSet(); } aui.c.add(t); if (aui.c.size() <= 50 || aui.d >= 40) { return; } aui.d(); } private void d() { ArrayList arrayList = new ArrayList(4); this.a = arrayList; arrayList.add(new AUI(this.e.a, this.e.b, this.e.g, this.e.c, this.d + 1)); this.a.add(new AUI<>(this.e.b, this.e.d, this.e.g, this.e.c, this.d + 1)); this.a.add(new AUI<>(this.e.a, this.e.b, this.e.c, this.e.e, this.d + 1)); this.a.add(new AUI<>(this.e.b, this.e.d, this.e.c, this.e.e, this.d + 1)); Set set = this.c; this.c = null; for (T t : set) { a(t.e().d, t.e().e, t); } } public final void e(C15709htl c15709htl, Collection collection) { if (this.e.c(c15709htl)) { List> list = this.a; if (list != null) { Iterator> it = list.iterator(); while (it.hasNext()) { it.next().e(c15709htl, collection); } } else if (this.c != null) { if (c15709htl.e(this.e)) { collection.addAll(this.c); return; } for (T t : this.c) { HTs e = t.e(); if (c15709htl.c(e.d, e.e)) { collection.add(t); } } } } } }