UserWords.smali

.class public Lcom/iflytek/cloud/util/UserWords;
.super Ljava/lang/Object;
.source "SourceFile"


# instance fields
.field private a:Ljava/util/Hashtable;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Hashtable",
            "<",
            "Ljava/lang/String;",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;>;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .registers 2

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

    .line 55
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    .line 61
    new-instance v0, Ljava/util/Hashtable;

    invoke-direct {v0}, Ljava/util/Hashtable;-><init>()V

    iput-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    .line 62
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .registers 3

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

    .line 55
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    .line 73
    new-instance v0, Ljava/util/Hashtable;

    invoke-direct {v0}, Ljava/util/Hashtable;-><init>()V

    iput-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    .line 74
    invoke-direct {p0, p1}, Lcom/iflytek/cloud/util/UserWords;->a(Ljava/lang/String;)V

    .line 75
    return-void
.end method

.method private a()Ljava/lang/String;
    .registers 10

    .prologue
    const/4 v2, 0x0

    .line 303
    :try_start_1
    iget-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    if-nez v0, :cond_c

    .line 305
    const-string v0, "mwords is null..."

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    move-object v0, v2

    .line 329
    :goto_b
    return-object v0

    .line 309
    :cond_c
    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    .line 310
    new-instance v4, Lorg/json/JSONArray;

    invoke-direct {v4}, Lorg/json/JSONArray;-><init>()V

    .line 312
    iget-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v0}, Ljava/util/Hashtable;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v5

    .line 313
    :goto_20
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_68

    .line 315
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 316
    new-instance v6, Lorg/json/JSONObject;

    invoke-direct {v6}, Lorg/json/JSONObject;-><init>()V

    .line 317
    new-instance v7, Lorg/json/JSONArray;

    invoke-direct {v7}, Lorg/json/JSONArray;-><init>()V

    .line 318
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v8

    :goto_40
    invoke-interface {v8}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_56

    invoke-interface {v8}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 319
    invoke-virtual {v7, v1}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;
    :try_end_4f
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_4f} :catch_50

    goto :goto_40

    .line 327
    :catch_50
    move-exception v0

    .line 328
    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/Throwable;)V

    move-object v0, v2

    .line 329
    goto :goto_b

    .line 320
    :cond_56
    :try_start_56
    const-string v1, "words"

    invoke-virtual {v6, v1, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 321
    const-string v1, "name"

    invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v0

    invoke-virtual {v6, v1, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 322
    invoke-virtual {v4, v6}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    goto :goto_20

    .line 325
    :cond_68
    const-string v0, "userword"

    invoke-virtual {v3, v0, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 326
    invoke-virtual {v3}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
    :try_end_70
    .catch Lorg/json/JSONException; {:try_start_56 .. :try_end_70} :catch_50

    move-result-object v0

    goto :goto_b
.end method

.method private a(Ljava/lang/String;)V
    .registers 11

    .prologue
    const/4 v2, 0x0

    .line 266
    :try_start_1
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_d

    .line 268
    const-string v0, "userword is null..."

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 289
    :cond_c
    :goto_c
    return-void

    .line 272
    :cond_d
    new-instance v0, Lorg/json/JSONObject;

    new-instance v1, Lorg/json/JSONTokener;

    invoke-direct {v1, p1}, Lorg/json/JSONTokener;-><init>(Ljava/lang/String;)V

    invoke-direct {v0, v1}, Lorg/json/JSONObject;-><init>(Lorg/json/JSONTokener;)V

    .line 273
    const-string v1, "userword"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v4

    move v3, v2

    .line 274
    :goto_1e
    invoke-virtual {v4}, Lorg/json/JSONArray;->length()I

    move-result v0

    if-ge v3, v0, :cond_c

    .line 275
    invoke-virtual {v4, v3}, Lorg/json/JSONArray;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/json/JSONObject;

    .line 276
    const-string v1, "words"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v5

    .line 277
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    move v1, v2

    .line 278
    :goto_36
    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I

    move-result v7

    if-ge v1, v7, :cond_52

    .line 279
    invoke-virtual {v5, v1}, Lorg/json/JSONArray;->get(I)Ljava/lang/Object;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v7

    .line 280
    if-eqz v6, :cond_4f

    invoke-virtual {v6, v7}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v8

    if-nez v8, :cond_4f

    .line 281
    invoke-virtual {v6, v7}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 278
    :cond_4f
    add-int/lit8 v1, v1, 0x1

    goto :goto_36

    .line 283
    :cond_52
    iget-object v1, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    const-string v5, "name"

    invoke-virtual {v0, v5}, Lorg/json/JSONObject;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0, v6}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_61
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_61} :catch_65

    .line 274
    add-int/lit8 v0, v3, 0x1

    move v3, v0

    goto :goto_1e

    .line 285
    :catch_65
    move-exception v0

    .line 286
    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/Throwable;)V

    goto :goto_c
.end method

.method private a(Ljava/util/ArrayList;Ljava/lang/String;)Z
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/lang/String;",
            ")Z"
        }
    .end annotation

    .prologue
    .line 181
    if-eqz p1, :cond_d

    invoke-virtual {p1, p2}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_d

    .line 183
    invoke-virtual {p1, p2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 184
    const/4 v0, 0x1

    .line 186
    :goto_c
    return v0

    :cond_d
    const/4 v0, 0x0

    goto :goto_c
.end method

.method private a(Ljava/util/ArrayList;Ljava/util/ArrayList;)Z
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;)Z"
        }
    .end annotation

    .prologue
    .line 201
    if-eqz p1, :cond_4

    if-nez p2, :cond_6

    .line 202
    :cond_4
    const/4 v0, 0x0

    .line 207
    :goto_5
    return v0

    .line 203
    :cond_6
    invoke-virtual {p2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_a
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1a

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    .line 205
    invoke-direct {p0, p1, v0}, Lcom/iflytek/cloud/util/UserWords;->a(Ljava/util/ArrayList;Ljava/lang/String;)Z

    goto :goto_a

    .line 207
    :cond_1a
    const/4 v0, 0x1

    goto :goto_5
.end method


# virtual methods
.method public getKeys()Ljava/util/ArrayList;
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 233
    iget-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    if-eqz v0, :cond_c

    iget-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v0}, Ljava/util/Hashtable;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_e

    .line 234
    :cond_c
    const/4 v0, 0x0

    .line 239
    :cond_d
    return-object v0

    .line 235
    :cond_e
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 236
    iget-object v1, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v1}, Ljava/util/Hashtable;->keySet()Ljava/util/Set;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .line 237
    :goto_1d
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_d

    .line 238
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    invoke-virtual {v0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_1d
.end method

.method public getWords()Ljava/util/ArrayList;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 220
    const-string v0, "default"

    invoke-virtual {p0, v0}, Lcom/iflytek/cloud/util/UserWords;->getWords(Ljava/lang/String;)Ljava/util/ArrayList;

    move-result-object v0

    return-object v0
.end method

.method public getWords(Ljava/lang/String;)Ljava/util/ArrayList;
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 253
    iget-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v0, p1}, Ljava/util/Hashtable;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/ArrayList;

    return-object v0
.end method

.method public hasKey(Ljava/lang/String;)Z
    .registers 3

    .prologue
    .line 87
    iget-object v0, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v0, p1}, Ljava/util/Hashtable;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public putWord(Ljava/lang/String;)Z
    .registers 3

    .prologue
    .line 101
    const-string v0, "default"

    invoke-virtual {p0, v0, p1}, Lcom/iflytek/cloud/util/UserWords;->putWord(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public putWord(Ljava/lang/String;Ljava/lang/String;)Z
    .registers 5

    .prologue
    .line 115
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_c

    invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_e

    .line 116
    :cond_c
    const/4 v0, 0x0

    .line 126
    :goto_d
    return v0

    .line 117
    :cond_e
    invoke-virtual {p0, p1}, Lcom/iflytek/cloud/util/UserWords;->getWords(Ljava/lang/String;)Ljava/util/ArrayList;

    move-result-object v0

    .line 118
    if-eqz v0, :cond_19

    .line 119
    invoke-direct {p0, v0, p2}, Lcom/iflytek/cloud/util/UserWords;->a(Ljava/util/ArrayList;Ljava/lang/String;)Z

    .line 126
    :goto_17
    const/4 v0, 0x1

    goto :goto_d

    .line 122
    :cond_19
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 123
    invoke-direct {p0, v0, p2}, Lcom/iflytek/cloud/util/UserWords;->a(Ljava/util/ArrayList;Ljava/lang/String;)Z

    .line 124
    iget-object v1, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v1, p1, v0}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_17
.end method

.method public putWords(Ljava/lang/String;Ljava/util/ArrayList;)Z
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;)Z"
        }
    .end annotation

    .prologue
    .line 155
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_8

    if-nez p2, :cond_a

    .line 156
    :cond_8
    const/4 v0, 0x0

    .line 166
    :goto_9
    return v0

    .line 157
    :cond_a
    invoke-virtual {p0, p1}, Lcom/iflytek/cloud/util/UserWords;->getWords(Ljava/lang/String;)Ljava/util/ArrayList;

    move-result-object v0

    .line 158
    if-eqz v0, :cond_15

    .line 159
    invoke-direct {p0, v0, p2}, Lcom/iflytek/cloud/util/UserWords;->a(Ljava/util/ArrayList;Ljava/util/ArrayList;)Z

    .line 166
    :goto_13
    const/4 v0, 0x1

    goto :goto_9

    .line 162
    :cond_15
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 163
    invoke-direct {p0, v0, p2}, Lcom/iflytek/cloud/util/UserWords;->a(Ljava/util/ArrayList;Ljava/util/ArrayList;)Z

    .line 164
    iget-object v1, p0, Lcom/iflytek/cloud/util/UserWords;->a:Ljava/util/Hashtable;

    invoke-virtual {v1, p1, v0}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_13
.end method

.method public putWords(Ljava/util/ArrayList;)Z
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;)Z"
        }
    .end annotation

    .prologue
    .line 140
    const-string v0, "default"

    invoke-virtual {p0, v0, p1}, Lcom/iflytek/cloud/util/UserWords;->putWords(Ljava/lang/String;Ljava/util/ArrayList;)Z

    move-result v0

    return v0
.end method

.method public toString()Ljava/lang/String;
    .registers 2

    .prologue
    .line 343
    invoke-direct {p0}, Lcom/iflytek/cloud/util/UserWords;->a()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method