WeakAction.smali

.class public Lcom/sandboxol/common/messenger/WeakAction;
.super Ljava/lang/Object;
.source "WeakAction.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Ljava/lang/Object;"
    }
.end annotation


# instance fields
.field private action:Lrx/functions/Action0;

.field private action1:Lrx/functions/Action1;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lrx/functions/Action1<",
            "TT;>;"
        }
    .end annotation
.end field

.field private reference:Ljava/lang/ref/WeakReference;


# direct methods
.method public constructor <init>(Ljava/lang/Object;Lrx/functions/Action0;)V
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;",
            "Lrx/functions/Action0;",
            ")V"
        }
    .end annotation

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

    .line 2
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->reference:Ljava/lang/ref/WeakReference;

    .line 3
    iput-object p2, p0, Lcom/sandboxol/common/messenger/WeakAction;->action:Lrx/functions/Action0;

    return-void
.end method

.method public constructor <init>(Ljava/lang/Object;Lrx/functions/Action1;)V
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/Object;",
            "Lrx/functions/Action1<",
            "TT;>;)V"
        }
    .end annotation

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

    .line 5
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->reference:Ljava/lang/ref/WeakReference;

    .line 6
    iput-object p2, p0, Lcom/sandboxol/common/messenger/WeakAction;->action1:Lrx/functions/Action1;

    return-void
.end method


# virtual methods
.method public execute()V
    .registers 2

    .line 1
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action:Lrx/functions/Action0;

    if-eqz v0, :cond_f

    invoke-virtual {p0}, Lcom/sandboxol/common/messenger/WeakAction;->isLive()Z

    move-result v0

    if-eqz v0, :cond_f

    .line 2
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action:Lrx/functions/Action0;

    invoke-interface {v0}, Lrx/functions/Action0;->call()V

    :cond_f
    return-void
.end method

.method public execute(Ljava/lang/Object;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;)V"
        }
    .end annotation

    .line 3
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action1:Lrx/functions/Action1;

    if-eqz v0, :cond_f

    .line 4
    invoke-virtual {p0}, Lcom/sandboxol/common/messenger/WeakAction;->isLive()Z

    move-result v0

    if-eqz v0, :cond_f

    .line 5
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action1:Lrx/functions/Action1;

    invoke-interface {v0, p1}, Lrx/functions/Action1;->call(Ljava/lang/Object;)V

    :cond_f
    return-void
.end method

.method public getAction()Lrx/functions/Action0;
    .registers 2

    .line 1
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action:Lrx/functions/Action0;

    return-object v0
.end method

.method public getAction1()Lrx/functions/Action1;
    .registers 2

    .line 1
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action1:Lrx/functions/Action1;

    return-object v0
.end method

.method public getTarget()Ljava/lang/Object;
    .registers 2

    .line 1
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->reference:Ljava/lang/ref/WeakReference;

    if-eqz v0, :cond_9

    .line 2
    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    return-object v0

    :cond_9
    const/4 v0, 0x0

    return-object v0
.end method

.method public isLive()Z
    .registers 3

    .line 1
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->reference:Ljava/lang/ref/WeakReference;

    const/4 v1, 0x0

    if-nez v0, :cond_6

    return v1

    .line 2
    :cond_6
    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    if-nez v0, :cond_d

    return v1

    :cond_d
    const/4 v0, 0x1

    return v0
.end method

.method public markForDeletion()V
    .registers 2

    .line 1
    iget-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->reference:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->clear()V

    const/4 v0, 0x0

    .line 2
    iput-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->reference:Ljava/lang/ref/WeakReference;

    .line 3
    iput-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action:Lrx/functions/Action0;

    .line 4
    iput-object v0, p0, Lcom/sandboxol/common/messenger/WeakAction;->action1:Lrx/functions/Action1;

    return-void
.end method