tmap/smali_classes3/com/google/common/math/StatsAccumulator.smali
2022-06-10 21:38:30 +09:00

899 lines
18 KiB
Smali

.class public final Lcom/google/common/math/StatsAccumulator;
.super Ljava/lang/Object;
.source "StatsAccumulator.java"
# annotations
.annotation build Lcom/google/common/annotations/Beta;
.end annotation
.annotation build Lcom/google/common/annotations/GwtIncompatible;
.end annotation
.annotation runtime Lcom/google/common/math/ElementTypesAreNonnullByDefault;
.end annotation
# instance fields
.field private count:J
.field private max:D
.field private mean:D
.field private min:D
.field private sumOfSquaresOfDeltas:D
# direct methods
.method public constructor <init>()V
.locals 2
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const-wide/16 v0, 0x0
.line 2
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v0, 0x0
.line 3
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
.line 4
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
const-wide/high16 v0, 0x7ff8000000000000L # Double.NaN
.line 5
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->min:D
.line 6
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->max:D
return-void
.end method
.method public static calculateNewMeanNonFinite(DD)D
.locals 1
.line 1
invoke-static {p0, p1}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result v0
if-eqz v0, :cond_0
return-wide p2
.line 2
:cond_0
invoke-static {p2, p3}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result v0
if-nez v0, :cond_2
cmpl-double p2, p0, p2
if-nez p2, :cond_1
goto :goto_0
:cond_1
const-wide/high16 p0, 0x7ff8000000000000L # Double.NaN
:cond_2
:goto_0
return-wide p0
.end method
.method private merge(JDDDD)V
.locals 17
move-object/from16 v0, p0
move-wide/from16 v1, p1
move-wide/from16 v3, p3
move-wide/from16 v5, p5
move-wide/from16 v7, p7
move-wide/from16 v9, p9
.line 1
iget-wide v11, v0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v13, 0x0
cmp-long v13, v11, v13
if-nez v13, :cond_0
.line 2
iput-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->count:J
.line 3
iput-wide v3, v0, Lcom/google/common/math/StatsAccumulator;->mean:D
.line 4
iput-wide v5, v0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
.line 5
iput-wide v7, v0, Lcom/google/common/math/StatsAccumulator;->min:D
.line 6
iput-wide v9, v0, Lcom/google/common/math/StatsAccumulator;->max:D
goto :goto_1
:cond_0
add-long/2addr v11, v1
.line 7
iput-wide v11, v0, Lcom/google/common/math/StatsAccumulator;->count:J
.line 8
iget-wide v11, v0, Lcom/google/common/math/StatsAccumulator;->mean:D
invoke-static {v11, v12}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result v11
if-eqz v11, :cond_1
invoke-static/range {p3 .. p4}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result v11
if-eqz v11, :cond_1
.line 9
iget-wide v11, v0, Lcom/google/common/math/StatsAccumulator;->mean:D
sub-double v13, v3, v11
long-to-double v1, v1
mul-double v15, v13, v1
.line 10
iget-wide v9, v0, Lcom/google/common/math/StatsAccumulator;->count:J
long-to-double v9, v9
div-double/2addr v15, v9
add-double v9, v15, v11
iput-wide v9, v0, Lcom/google/common/math/StatsAccumulator;->mean:D
.line 11
iget-wide v11, v0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
sub-double/2addr v3, v9
mul-double/2addr v3, v13
mul-double/2addr v3, v1
add-double/2addr v3, v5
add-double/2addr v3, v11
iput-wide v3, v0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
goto :goto_0
.line 12
:cond_1
iget-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->mean:D
invoke-static {v1, v2, v3, v4}, Lcom/google/common/math/StatsAccumulator;->calculateNewMeanNonFinite(DD)D
move-result-wide v1
iput-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->mean:D
const-wide/high16 v1, 0x7ff8000000000000L # Double.NaN
.line 13
iput-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
.line 14
:goto_0
iget-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->min:D
invoke-static {v1, v2, v7, v8}, Ljava/lang/Math;->min(DD)D
move-result-wide v1
iput-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->min:D
.line 15
iget-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->max:D
move-wide/from16 v3, p9
invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->max(DD)D
move-result-wide v1
iput-wide v1, v0, Lcom/google/common/math/StatsAccumulator;->max:D
:goto_1
return-void
.end method
# virtual methods
.method public add(D)V
.locals 10
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x0
cmp-long v2, v0, v2
const-wide/high16 v3, 0x7ff8000000000000L # Double.NaN
const-wide/16 v5, 0x1
if-nez v2, :cond_0
.line 2
iput-wide v5, p0, Lcom/google/common/math/StatsAccumulator;->count:J
.line 3
iput-wide p1, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
.line 4
iput-wide p1, p0, Lcom/google/common/math/StatsAccumulator;->min:D
.line 5
iput-wide p1, p0, Lcom/google/common/math/StatsAccumulator;->max:D
.line 6
invoke-static {p1, p2}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result p1
if-nez p1, :cond_2
.line 7
iput-wide v3, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
goto :goto_1
:cond_0
add-long/2addr v0, v5
.line 8
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
.line 9
invoke-static {p1, p2}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result v0
if-eqz v0, :cond_1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
invoke-static {v0, v1}, Lcom/google/common/primitives/Doubles;->isFinite(D)Z
move-result v0
if-eqz v0, :cond_1
.line 10
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
sub-double v6, p1, v0
.line 11
iget-wide v2, p0, Lcom/google/common/math/StatsAccumulator;->count:J
long-to-double v2, v2
div-double v2, v6, v2
add-double v4, v2, v0
iput-wide v4, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
.line 12
iget-wide v8, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
move-wide v2, p1
invoke-static/range {v2 .. v9}, Ls0/a;->a(DDDD)D
move-result-wide v0
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
goto :goto_0
.line 13
:cond_1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
invoke-static {v0, v1, p1, p2}, Lcom/google/common/math/StatsAccumulator;->calculateNewMeanNonFinite(DD)D
move-result-wide v0
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
.line 14
iput-wide v3, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
.line 15
:goto_0
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->min:D
invoke-static {v0, v1, p1, p2}, Ljava/lang/Math;->min(DD)D
move-result-wide v0
iput-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->min:D
.line 16
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->max:D
invoke-static {v0, v1, p1, p2}, Ljava/lang/Math;->max(DD)D
move-result-wide p1
iput-wide p1, p0, Lcom/google/common/math/StatsAccumulator;->max:D
:cond_2
:goto_1
return-void
.end method
.method public addAll(Lcom/google/common/math/Stats;)V
.locals 12
.line 11
invoke-virtual {p1}, Lcom/google/common/math/Stats;->count()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-nez v0, :cond_0
return-void
.line 12
:cond_0
invoke-virtual {p1}, Lcom/google/common/math/Stats;->count()J
move-result-wide v2
invoke-virtual {p1}, Lcom/google/common/math/Stats;->mean()D
move-result-wide v4
invoke-virtual {p1}, Lcom/google/common/math/Stats;->sumOfSquaresOfDeltas()D
move-result-wide v6
invoke-virtual {p1}, Lcom/google/common/math/Stats;->min()D
move-result-wide v8
invoke-virtual {p1}, Lcom/google/common/math/Stats;->max()D
move-result-wide v10
move-object v1, p0
invoke-direct/range {v1 .. v11}, Lcom/google/common/math/StatsAccumulator;->merge(JDDDD)V
return-void
.end method
.method public addAll(Lcom/google/common/math/StatsAccumulator;)V
.locals 12
.line 13
invoke-virtual {p1}, Lcom/google/common/math/StatsAccumulator;->count()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-nez v0, :cond_0
return-void
.line 14
:cond_0
invoke-virtual {p1}, Lcom/google/common/math/StatsAccumulator;->count()J
move-result-wide v2
invoke-virtual {p1}, Lcom/google/common/math/StatsAccumulator;->mean()D
move-result-wide v4
invoke-virtual {p1}, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas()D
move-result-wide v6
invoke-virtual {p1}, Lcom/google/common/math/StatsAccumulator;->min()D
move-result-wide v8
invoke-virtual {p1}, Lcom/google/common/math/StatsAccumulator;->max()D
move-result-wide v10
move-object v1, p0
invoke-direct/range {v1 .. v11}, Lcom/google/common/math/StatsAccumulator;->merge(JDDDD)V
return-void
.end method
.method public addAll(Ljava/lang/Iterable;)V
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Iterable<",
"+",
"Ljava/lang/Number;",
">;)V"
}
.end annotation
.line 1
invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object p1
:goto_0
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_0
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Number;
.line 2
invoke-virtual {v0}, Ljava/lang/Number;->doubleValue()D
move-result-wide v0
invoke-virtual {p0, v0, v1}, Lcom/google/common/math/StatsAccumulator;->add(D)V
goto :goto_0
:cond_0
return-void
.end method
.method public addAll(Ljava/util/Iterator;)V
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Iterator<",
"+",
"Ljava/lang/Number;",
">;)V"
}
.end annotation
.line 3
:goto_0
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_0
.line 4
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Number;
invoke-virtual {v0}, Ljava/lang/Number;->doubleValue()D
move-result-wide v0
invoke-virtual {p0, v0, v1}, Lcom/google/common/math/StatsAccumulator;->add(D)V
goto :goto_0
:cond_0
return-void
.end method
.method public varargs addAll([D)V
.locals 4
.line 5
array-length v0, p1
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_0
aget-wide v2, p1, v1
.line 6
invoke-virtual {p0, v2, v3}, Lcom/google/common/math/StatsAccumulator;->add(D)V
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_0
return-void
.end method
.method public varargs addAll([I)V
.locals 4
.line 7
array-length v0, p1
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_0
aget v2, p1, v1
int-to-double v2, v2
.line 8
invoke-virtual {p0, v2, v3}, Lcom/google/common/math/StatsAccumulator;->add(D)V
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_0
return-void
.end method
.method public varargs addAll([J)V
.locals 4
.line 9
array-length v0, p1
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_0
aget-wide v2, p1, v1
long-to-double v2, v2
.line 10
invoke-virtual {p0, v2, v3}, Lcom/google/common/math/StatsAccumulator;->add(D)V
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_0
return-void
.end method
.method public count()J
.locals 2
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
return-wide v0
.end method
.method public max()D
.locals 4
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
invoke-static {v0}, Lcom/google/common/base/Preconditions;->checkState(Z)V
.line 2
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->max:D
return-wide v0
.end method
.method public mean()D
.locals 4
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
invoke-static {v0}, Lcom/google/common/base/Preconditions;->checkState(Z)V
.line 2
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
return-wide v0
.end method
.method public min()D
.locals 4
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
invoke-static {v0}, Lcom/google/common/base/Preconditions;->checkState(Z)V
.line 2
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->min:D
return-wide v0
.end method
.method public final populationStandardDeviation()D
.locals 2
.line 1
invoke-virtual {p0}, Lcom/google/common/math/StatsAccumulator;->populationVariance()D
move-result-wide v0
invoke-static {v0, v1}, Ljava/lang/Math;->sqrt(D)D
move-result-wide v0
return-wide v0
.end method
.method public final populationVariance()D
.locals 4
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
invoke-static {v0}, Lcom/google/common/base/Preconditions;->checkState(Z)V
.line 2
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
invoke-static {v0, v1}, Ljava/lang/Double;->isNaN(D)Z
move-result v0
if-eqz v0, :cond_1
const-wide/high16 v0, 0x7ff8000000000000L # Double.NaN
return-wide v0
.line 3
:cond_1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x1
cmp-long v0, v0, v2
if-nez v0, :cond_2
const-wide/16 v0, 0x0
return-wide v0
.line 4
:cond_2
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
invoke-static {v0, v1}, Lcom/google/common/math/DoubleUtils;->ensureNonNegative(D)D
move-result-wide v0
iget-wide v2, p0, Lcom/google/common/math/StatsAccumulator;->count:J
long-to-double v2, v2
div-double/2addr v0, v2
return-wide v0
.end method
.method public final sampleStandardDeviation()D
.locals 2
.line 1
invoke-virtual {p0}, Lcom/google/common/math/StatsAccumulator;->sampleVariance()D
move-result-wide v0
invoke-static {v0, v1}, Ljava/lang/Math;->sqrt(D)D
move-result-wide v0
return-wide v0
.end method
.method public final sampleVariance()D
.locals 6
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->count:J
const-wide/16 v2, 0x1
cmp-long v0, v0, v2
if-lez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
invoke-static {v0}, Lcom/google/common/base/Preconditions;->checkState(Z)V
.line 2
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
invoke-static {v0, v1}, Ljava/lang/Double;->isNaN(D)Z
move-result v0
if-eqz v0, :cond_1
const-wide/high16 v0, 0x7ff8000000000000L # Double.NaN
return-wide v0
.line 3
:cond_1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
invoke-static {v0, v1}, Lcom/google/common/math/DoubleUtils;->ensureNonNegative(D)D
move-result-wide v0
iget-wide v4, p0, Lcom/google/common/math/StatsAccumulator;->count:J
sub-long/2addr v4, v2
long-to-double v2, v4
div-double/2addr v0, v2
return-wide v0
.end method
.method public snapshot()Lcom/google/common/math/Stats;
.locals 12
.line 1
new-instance v11, Lcom/google/common/math/Stats;
iget-wide v1, p0, Lcom/google/common/math/StatsAccumulator;->count:J
iget-wide v3, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
iget-wide v5, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
iget-wide v7, p0, Lcom/google/common/math/StatsAccumulator;->min:D
iget-wide v9, p0, Lcom/google/common/math/StatsAccumulator;->max:D
move-object v0, v11
invoke-direct/range {v0 .. v10}, Lcom/google/common/math/Stats;-><init>(JDDDD)V
return-object v11
.end method
.method public final sum()D
.locals 4
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->mean:D
iget-wide v2, p0, Lcom/google/common/math/StatsAccumulator;->count:J
long-to-double v2, v2
mul-double/2addr v0, v2
return-wide v0
.end method
.method public sumOfSquaresOfDeltas()D
.locals 2
.line 1
iget-wide v0, p0, Lcom/google/common/math/StatsAccumulator;->sumOfSquaresOfDeltas:D
return-wide v0
.end method