discord-jadx/app/src/main/java/c/i/a/c/i2/z.java

106 lines
2.6 KiB
Java
Raw Normal View History

2021-07-24 02:37:17 +00:00
package c.i.a.c.i2;
import java.util.ArrayList;
import java.util.Collections;
/* compiled from: SlidingPercentile */
public class z {
public static final /* synthetic */ int a = 0;
public final int b;
/* renamed from: c reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public final ArrayList<b> f915c = new ArrayList<>();
2021-07-24 02:37:17 +00:00
public final b[] d = new b[5];
public int e = -1;
public int f;
public int g;
public int h;
/* compiled from: SlidingPercentile */
public static class b {
public int a;
public int b;
/* renamed from: c reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public float f916c;
2021-07-24 02:37:17 +00:00
public b() {
}
public b(a aVar) {
}
}
public z(int i) {
this.b = i;
}
public void a(int i, float f) {
b bVar;
if (this.e != 1) {
2021-07-28 07:39:21 +00:00
Collections.sort(this.f915c, c.i);
2021-07-24 02:37:17 +00:00
this.e = 1;
}
int i2 = this.h;
if (i2 > 0) {
b[] bVarArr = this.d;
int i3 = i2 - 1;
this.h = i3;
bVar = bVarArr[i3];
} else {
bVar = new b(null);
}
int i4 = this.f;
this.f = i4 + 1;
bVar.a = i4;
bVar.b = i;
2021-07-28 07:39:21 +00:00
bVar.f916c = f;
this.f915c.add(bVar);
2021-07-24 02:37:17 +00:00
this.g += i;
while (true) {
int i5 = this.g;
int i6 = this.b;
if (i5 > i6) {
int i7 = i5 - i6;
2021-07-28 07:39:21 +00:00
b bVar2 = this.f915c.get(0);
2021-07-24 02:37:17 +00:00
int i8 = bVar2.b;
if (i8 <= i7) {
this.g -= i8;
2021-07-28 07:39:21 +00:00
this.f915c.remove(0);
2021-07-24 02:37:17 +00:00
int i9 = this.h;
if (i9 < 5) {
b[] bVarArr2 = this.d;
this.h = i9 + 1;
bVarArr2[i9] = bVar2;
}
} else {
bVar2.b = i8 - i7;
this.g -= i7;
}
} else {
return;
}
}
}
public float b(float f) {
if (this.e != 0) {
2021-07-28 07:39:21 +00:00
Collections.sort(this.f915c, d.i);
2021-07-24 02:37:17 +00:00
this.e = 0;
}
float f2 = f * ((float) this.g);
int i = 0;
2021-07-28 07:39:21 +00:00
for (int i2 = 0; i2 < this.f915c.size(); i2++) {
b bVar = this.f915c.get(i2);
2021-07-24 02:37:17 +00:00
i += bVar.b;
if (((float) i) >= f2) {
2021-07-28 07:39:21 +00:00
return bVar.f916c;
2021-07-24 02:37:17 +00:00
}
}
2021-07-28 07:39:21 +00:00
if (this.f915c.isEmpty()) {
2021-07-24 02:37:17 +00:00
return Float.NaN;
}
2021-07-28 07:39:21 +00:00
ArrayList<b> arrayList = this.f915c;
return arrayList.get(arrayList.size() - 1).f916c;
2021-07-24 02:37:17 +00:00
}
}