90 lines
2.2 KiB
Java
90 lines
2.2 KiB
Java
package c.o.a.x;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import java.util.HashMap;
|
|
/* compiled from: AspectRatio */
|
|
public class a implements Comparable<a> {
|
|
@VisibleForTesting
|
|
public static final HashMap<String, a> i = new HashMap<>(16);
|
|
public final int j;
|
|
public final int k;
|
|
|
|
public a(int i2, int i3) {
|
|
this.j = i2;
|
|
this.k = i3;
|
|
}
|
|
|
|
@NonNull
|
|
public static a f(int i2, int i3) {
|
|
int i4 = i2;
|
|
int i5 = i3;
|
|
while (i5 != 0) {
|
|
int i6 = i4 % i5;
|
|
i4 = i5;
|
|
i5 = i6;
|
|
}
|
|
if (i4 > 0) {
|
|
i2 /= i4;
|
|
}
|
|
if (i4 > 0) {
|
|
i3 /= i4;
|
|
}
|
|
String str = i2 + ":" + i3;
|
|
HashMap<String, a> hashMap = i;
|
|
a aVar = hashMap.get(str);
|
|
if (aVar != null) {
|
|
return aVar;
|
|
}
|
|
a aVar2 = new a(i2, i3);
|
|
hashMap.put(str, aVar2);
|
|
return aVar2;
|
|
}
|
|
|
|
@NonNull
|
|
public static a g(@NonNull b bVar) {
|
|
return f(bVar.i, bVar.j);
|
|
}
|
|
|
|
@NonNull
|
|
public static a h(@NonNull String str) {
|
|
String[] split = str.split(":");
|
|
if (split.length == 2) {
|
|
return f(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
}
|
|
throw new NumberFormatException("Illegal AspectRatio string. Must be x:y");
|
|
}
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // java.lang.Comparable
|
|
public int compareTo(@NonNull a aVar) {
|
|
return Float.compare(i(), aVar.i());
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
public boolean equals(Object obj) {
|
|
if (obj == null) {
|
|
return false;
|
|
}
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
return (obj instanceof a) && i() == ((a) obj).i();
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
public int hashCode() {
|
|
return Float.floatToIntBits(i());
|
|
}
|
|
|
|
public float i() {
|
|
return ((float) this.j) / ((float) this.k);
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
@NonNull
|
|
public String toString() {
|
|
return this.j + ":" + this.k;
|
|
}
|
|
}
|