IntHashMap.smali

.class public Lcom/googlecode/mp4parser/util/IntHashMap;
.super Ljava/lang/Object;
.source "IntHashMap.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    }
.end annotation


# instance fields
.field private transient count:I

.field private loadFactor:F

.field private transient table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

.field private threshold:I


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method public constructor <init>()V
    .registers 3

    .line 94
    const/16 v0, 0x14

    const/high16 v1, 0x3f400000    # 0.75f

    invoke-direct {p0, v0, v1}, Lcom/googlecode/mp4parser/util/IntHashMap;-><init>(IF)V

    .line 95
    return-void
.end method

.method public constructor <init>(I)V
    .registers 3
    .param p1, "initialCapacity"    # I

    .line 106
    const/high16 v0, 0x3f400000    # 0.75f

    invoke-direct {p0, p1, v0}, Lcom/googlecode/mp4parser/util/IntHashMap;-><init>(IF)V

    .line 107
    return-void
.end method

.method public constructor <init>(IF)V
    .registers 6
    .param p1, "initialCapacity"    # I
    .param p2, "loadFactor"    # F

    .line 119
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 120
    if-ltz p1, :cond_2e

    .line 123
    const/4 v0, 0x0

    cmpg-float v0, p2, v0

    if-lez v0, :cond_1a

    .line 126
    if-nez p1, :cond_d

    .line 127
    const/4 p1, 0x1

    .line 130
    :cond_d
    iput p2, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->loadFactor:F

    .line 131
    new-array v0, p1, [Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    iput-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 132
    int-to-float v0, p1

    mul-float v0, v0, p2

    float-to-int v0, v0

    iput v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->threshold:I

    .line 133
    return-void

    .line 124
    :cond_1a
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Illegal Load: "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 121
    :cond_2e
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Illegal Capacity: "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0
.end method


# virtual methods
.method public declared-synchronized clear()V
    .registers 4

    monitor-enter p0

    .line 350
    :try_start_1
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 351
    .local v0, "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    array-length v1, v0

    .local v1, "index":I
    :goto_4
    add-int/lit8 v1, v1, -0x1

    if-gez v1, :cond_d

    .line 354
    .end local v1    # "index":I
    const/4 v1, 0x0

    iput v1, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I
    :try_end_b
    .catchall {:try_start_1 .. :try_end_b} :catchall_11

    .line 355
    monitor-exit p0

    return-void

    .line 352
    .end local p0    # "this":Lcom/googlecode/mp4parser/util/IntHashMap;
    .restart local v1    # "index":I
    :cond_d
    const/4 v2, 0x0

    :try_start_e
    aput-object v2, v0, v1
    :try_end_10
    .catchall {:try_start_e .. :try_end_10} :catchall_11

    goto :goto_4

    .line 349
    .end local v0    # "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    .end local v1    # "index":I
    :catchall_11
    move-exception v0

    monitor-exit p0

    goto :goto_15

    :goto_14
    throw v0

    :goto_15
    goto :goto_14
.end method

.method public contains(Ljava/lang/Object;)Z
    .registers 6
    .param p1, "value"    # Ljava/lang/Object;

    .line 172
    if-eqz p1, :cond_1e

    .line 176
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 177
    .local v0, "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    array-length v1, v0

    .local v1, "i":I
    :goto_5
    add-int/lit8 v2, v1, -0x1

    .end local v1    # "i":I
    .local v2, "i":I
    if-gtz v1, :cond_b

    .line 184
    .end local v2    # "i":I
    const/4 v1, 0x0

    return v1

    .line 178
    .restart local v2    # "i":I
    :cond_b
    aget-object v1, v0, v2

    .local v1, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :goto_d
    if-nez v1, :cond_11

    move v1, v2

    goto :goto_5

    .line 179
    :cond_11
    iget-object v3, v1, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->value:Ljava/lang/Object;

    invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_1b

    .line 180
    const/4 v3, 0x1

    return v3

    .line 178
    :cond_1b
    iget-object v1, v1, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    goto :goto_d

    .line 173
    .end local v0    # "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    .end local v1    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    .end local v2    # "i":I
    :cond_1e
    const/4 v0, 0x0

    goto :goto_21

    :goto_20
    throw v0

    :goto_21
    goto :goto_20
.end method

.method public containsKey(I)Z
    .registers 7
    .param p1, "key"    # I

    .line 212
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 213
    .local v0, "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    move v1, p1

    .line 214
    .local v1, "hash":I
    const v2, 0x7fffffff

    and-int/2addr v2, v1

    array-length v3, v0

    rem-int/2addr v2, v3

    .line 215
    .local v2, "index":I
    aget-object v3, v0, v2

    .local v3, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :goto_b
    if-nez v3, :cond_f

    .line 220
    .end local v3    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    const/4 v3, 0x0

    return v3

    .line 216
    .restart local v3    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :cond_f
    iget v4, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->hash:I

    if-ne v4, v1, :cond_15

    .line 217
    const/4 v4, 0x1

    return v4

    .line 215
    :cond_15
    iget-object v3, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    goto :goto_b
.end method

.method public containsValue(Ljava/lang/Object;)Z
    .registers 3
    .param p1, "value"    # Ljava/lang/Object;

    .line 199
    invoke-virtual {p0, p1}, Lcom/googlecode/mp4parser/util/IntHashMap;->contains(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public get(I)Ljava/lang/Object;
    .registers 7
    .param p1, "key"    # I

    .line 233
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 234
    .local v0, "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    move v1, p1

    .line 235
    .local v1, "hash":I
    const v2, 0x7fffffff

    and-int/2addr v2, v1

    array-length v3, v0

    rem-int/2addr v2, v3

    .line 236
    .local v2, "index":I
    aget-object v3, v0, v2

    .local v3, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :goto_b
    if-nez v3, :cond_f

    .line 241
    .end local v3    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    const/4 v3, 0x0

    return-object v3

    .line 237
    .restart local v3    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :cond_f
    iget v4, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->hash:I

    if-ne v4, v1, :cond_16

    .line 238
    iget-object v4, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->value:Ljava/lang/Object;

    return-object v4

    .line 236
    :cond_16
    iget-object v3, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    goto :goto_b
.end method

.method public isEmpty()Z
    .registers 2

    .line 151
    iget v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    if-nez v0, :cond_6

    const/4 v0, 0x1

    return v0

    :cond_6
    const/4 v0, 0x0

    return v0
.end method

.method public put(ILjava/lang/Object;)Ljava/lang/Object;
    .registers 9
    .param p1, "key"    # I
    .param p2, "value"    # Ljava/lang/Object;

    .line 290
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 291
    .local v0, "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    move v1, p1

    .line 292
    .local v1, "hash":I
    const v2, 0x7fffffff

    and-int v3, v1, v2

    array-length v4, v0

    rem-int/2addr v3, v4

    .line 293
    .local v3, "index":I
    aget-object v4, v0, v3

    .local v4, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :goto_c
    if-nez v4, :cond_2e

    .line 301
    .end local v4    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    iget v4, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    iget v5, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->threshold:I

    if-lt v4, v5, :cond_1d

    .line 303
    invoke-virtual {p0}, Lcom/googlecode/mp4parser/util/IntHashMap;->rehash()V

    .line 305
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 306
    and-int/2addr v2, v1

    array-length v4, v0

    rem-int v3, v2, v4

    .line 310
    :cond_1d
    new-instance v2, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    aget-object v4, v0, v3

    invoke-direct {v2, v1, p1, p2, v4}, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;-><init>(IILjava/lang/Object;Lcom/googlecode/mp4parser/util/IntHashMap$Entry;)V

    .line 311
    .local v2, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    aput-object v2, v0, v3

    .line 312
    iget v4, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    add-int/lit8 v4, v4, 0x1

    iput v4, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    .line 313
    const/4 v4, 0x0

    return-object v4

    .line 294
    .end local v2    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    .restart local v4    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :cond_2e
    iget v5, v4, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->hash:I

    if-ne v5, v1, :cond_37

    .line 295
    iget-object v2, v4, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->value:Ljava/lang/Object;

    .line 296
    .local v2, "old":Ljava/lang/Object;
    iput-object p2, v4, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->value:Ljava/lang/Object;

    .line 297
    return-object v2

    .line 293
    .end local v2    # "old":Ljava/lang/Object;
    :cond_37
    iget-object v4, v4, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    goto :goto_c
.end method

.method protected rehash()V
    .registers 10

    .line 253
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    array-length v0, v0

    .line 254
    .local v0, "oldCapacity":I
    iget-object v1, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 256
    .local v1, "oldMap":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    mul-int/lit8 v2, v0, 0x2

    add-int/lit8 v2, v2, 0x1

    .line 257
    .local v2, "newCapacity":I
    new-array v3, v2, [Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 259
    .local v3, "newMap":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    int-to-float v4, v2

    iget v5, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->loadFactor:F

    mul-float v4, v4, v5

    float-to-int v4, v4

    iput v4, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->threshold:I

    .line 260
    iput-object v3, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 262
    move v4, v0

    .local v4, "i":I
    :goto_16
    add-int/lit8 v5, v4, -0x1

    .end local v4    # "i":I
    .local v5, "i":I
    if-gtz v4, :cond_1b

    .line 272
    .end local v5    # "i":I
    return-void

    .line 263
    .restart local v5    # "i":I
    :cond_1b
    aget-object v4, v1, v5

    .local v4, "old":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :goto_1d
    if-nez v4, :cond_21

    move v4, v5

    goto :goto_16

    .line 264
    :cond_21
    move-object v6, v4

    .line 265
    .local v6, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    iget-object v4, v4, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 267
    iget v7, v6, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->hash:I

    const v8, 0x7fffffff

    and-int/2addr v7, v8

    rem-int/2addr v7, v2

    .line 268
    .local v7, "index":I
    aget-object v8, v3, v7

    iput-object v8, v6, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 269
    aput-object v6, v3, v7

    goto :goto_1d
.end method

.method public remove(I)Ljava/lang/Object;
    .registers 9
    .param p1, "key"    # I

    .line 327
    iget-object v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->table:[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 328
    .local v0, "tab":[Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    move v1, p1

    .line 329
    .local v1, "hash":I
    const v2, 0x7fffffff

    and-int/2addr v2, v1

    array-length v3, v0

    rem-int/2addr v2, v3

    .line 330
    .local v2, "index":I
    aget-object v3, v0, v2

    .local v3, "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    const/4 v4, 0x0

    .local v4, "prev":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :goto_c
    const/4 v5, 0x0

    if-nez v3, :cond_10

    .line 343
    .end local v3    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    .end local v4    # "prev":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    return-object v5

    .line 331
    .restart local v3    # "e":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    .restart local v4    # "prev":Lcom/googlecode/mp4parser/util/IntHashMap$Entry;
    :cond_10
    iget v6, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->hash:I

    if-ne v6, v1, :cond_2a

    .line 332
    if-eqz v4, :cond_1b

    .line 333
    iget-object v6, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    iput-object v6, v4, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    .line 334
    goto :goto_1f

    .line 335
    :cond_1b
    iget-object v6, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    aput-object v6, v0, v2

    .line 337
    :goto_1f
    iget v6, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    add-int/lit8 v6, v6, -0x1

    iput v6, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    .line 338
    iget-object v6, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->value:Ljava/lang/Object;

    .line 339
    .local v6, "oldValue":Ljava/lang/Object;
    iput-object v5, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->value:Ljava/lang/Object;

    .line 340
    return-object v6

    .line 330
    .end local v6    # "oldValue":Ljava/lang/Object;
    :cond_2a
    move-object v4, v3

    iget-object v3, v3, Lcom/googlecode/mp4parser/util/IntHashMap$Entry;->next:Lcom/googlecode/mp4parser/util/IntHashMap$Entry;

    goto :goto_c
.end method

.method public size()I
    .registers 2

    .line 141
    iget v0, p0, Lcom/googlecode/mp4parser/util/IntHashMap;->count:I

    return v0
.end method