package com.google.gson;

import java.math.BigInteger;

/* loaded from: classes3.dex */
public final class n extends i {

    /* renamed from: p, reason: collision with root package name */
    private final Object f14998p;

    public n(Boolean bool) {
        this.f14998p = uk.a.b(bool);
    }

    private static boolean z(n nVar) {
        Object obj = nVar.f14998p;
        if (!(obj instanceof Number)) {
            return false;
        }
        Number number = (Number) obj;
        return (number instanceof BigInteger) || (number instanceof Long) || (number instanceof Integer) || (number instanceof Short) || (number instanceof Byte);
    }

    public boolean B() {
        return this.f14998p instanceof Number;
    }

    public boolean C() {
        return this.f14998p instanceof String;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || n.class != obj.getClass()) {
            return false;
        }
        n nVar = (n) obj;
        if (this.f14998p == null) {
            return nVar.f14998p == null;
        }
        if (z(this) && z(nVar)) {
            return v().longValue() == nVar.v().longValue();
        }
        Object obj2 = this.f14998p;
        if (!(obj2 instanceof Number) || !(nVar.f14998p instanceof Number)) {
            return obj2.equals(nVar.f14998p);
        }
        double doubleValue = v().doubleValue();
        double doubleValue2 = nVar.v().doubleValue();
        if (doubleValue != doubleValue2) {
            return Double.isNaN(doubleValue) && Double.isNaN(doubleValue2);
        }
        return true;
    }

    public int hashCode() {
        long doubleToLongBits;
        if (this.f14998p == null) {
            return 31;
        }
        if (z(this)) {
            doubleToLongBits = v().longValue();
        } else {
            Object obj = this.f14998p;
            if (!(obj instanceof Number)) {
                return obj.hashCode();
            }
            doubleToLongBits = Double.doubleToLongBits(v().doubleValue());
        }
        return (int) ((doubleToLongBits >>> 32) ^ doubleToLongBits);
    }

    @Override // com.google.gson.i
    public long k() {
        return B() ? v().longValue() : Long.parseLong(l());
    }

    @Override // com.google.gson.i
    public String l() {
        return B() ? v().toString() : x() ? ((Boolean) this.f14998p).toString() : (String) this.f14998p;
    }

    public boolean r() {
        return x() ? ((Boolean) this.f14998p).booleanValue() : Boolean.parseBoolean(l());
    }

    public double s() {
        return B() ? v().doubleValue() : Double.parseDouble(l());
    }

    public int u() {
        return B() ? v().intValue() : Integer.parseInt(l());
    }

    public Number v() {
        Object obj = this.f14998p;
        return obj instanceof String ? new uk.f((String) obj) : (Number) obj;
    }

    public boolean x() {
        return this.f14998p instanceof Boolean;
    }

    public n(Number number) {
        this.f14998p = uk.a.b(number);
    }

    public n(String str) {
        this.f14998p = uk.a.b(str);
    }
}
