text:
.class public Lcom/facebook/AppEventsLogger;
.super Ljava/lang/Object;
.source ""

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/facebook/AppEventsLogger$PersistedEvents;,
        Lcom/facebook/AppEventsLogger$AppEvent;,
        Lcom/facebook/AppEventsLogger$SessionEventsState;,
        Lcom/facebook/AppEventsLogger$FlushStatistics;,
        Lcom/facebook/AppEventsLogger$FlushResult;,
        Lcom/facebook/AppEventsLogger$FlushReason;,
        Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;,
        Lcom/facebook/AppEventsLogger$EventSuppression;,
        Lcom/facebook/AppEventsLogger$SuppressionTimeoutBehavior;,
        Lcom/facebook/AppEventsLogger$FlushBehavior;
    }
.end annotation

# static fields
.field public static final ACTION_APP_EVENTS_FLUSHED:Ljava/lang/String; = "com.facebook.sdk.APP_EVENTS_FLUSHED"

.field private static final APP_ACTIVATE_SUPPRESSION_PERIOD_IN_SECONDS:I = 0x12c

.field public static final APP_EVENTS_EXTRA_FLUSH_RESULT:Ljava/lang/String; = "com.facebook.sdk.APP_EVENTS_FLUSH_RESULT"

.field public static final APP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED:Ljava/lang/String; = "com.facebook.sdk.APP_EVENTS_NUM_EVENTS_FLUSHED"

.field private static final APP_SUPPORTS_ATTRIBUTION_ID_RECHECK_PERIOD_IN_SECONDS:I = 0x15180

.field private static final FLUSH_PERIOD_IN_SECONDS:I = 0x3c

.field private static final NUM_LOG_EVENTS_TO_TRY_TO_FLUSH_AFTER:I = 0x64

.field private static final TAG:Ljava/lang/String; = null

.field private static applicationContext:Landroid/content/Context; = null

.field private static flushBehavior:Lcom/facebook/AppEventsLogger$FlushBehavior; = null

.field private static flushTimer:Ljava/util/Timer; = null

.field private static hashedDeviceAndAppId:Ljava/lang/String; = null

.field private static mapEventNameToSuppress:Ljava/util/Map; = null
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<Ljava/lang/String;Lcom/facebook/AppEventsLogger$EventSuppression;>;"
        }
    .end annotation
.end field

.field private static mapEventsToSuppressionTime:Ljava/util/Map; = null
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<Ljava/lang/String;Ljava/util/Date;>;"
        }
    .end annotation
.end field

.field private static requestInFlight:Z = false

.field private static stateMap:Ljava/util/Map; = null
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/AppEventsLogger$SessionEventsState;>;"
        }
    .end annotation
.end field

.field private static staticLock:Ljava/lang/Object; = null

.field private static supportsAttributionRecheckTimer:Ljava/util/Timer; = null

# instance fields
.field private final accessTokenAppId:Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

.field private final context:Landroid/content/Context;

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

    .line 154
    const-class v0, Lcom/facebook/AppEventsLogger;

    invoke-virtual {v0}, Ljava/lang/Class;->getCanonicalName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/facebook/AppEventsLogger;->TAG:Ljava/lang/String;

    .line 165
    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

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

    sput-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    .line 169
    sget-object v0, Lcom/facebook/AppEventsLogger$FlushBehavior;->AUTO:Lcom/facebook/AppEventsLogger$FlushBehavior;

    sput-object v0, Lcom/facebook/AppEventsLogger;->flushBehavior:Lcom/facebook/AppEventsLogger$FlushBehavior;

    .line 172
    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    .line 174
    new-instance v0, Ljava/util/HashMap;

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

    sput-object v0, Lcom/facebook/AppEventsLogger;->mapEventsToSuppressionTime:Ljava/util/Map;

    .line 176
    new-instance v0, Lcom/facebook/AppEventsLogger$1;

    invoke-direct {v0}, Lcom/facebook/AppEventsLogger$1;-><init>()V

    sput-object v0, Lcom/facebook/AppEventsLogger;->mapEventNameToSuppress:Ljava/util/Map;

    return-void
.end method

.method private constructor <init>(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)V
    .locals 2

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

    .line 561
    const-string v0, "context"

    invoke-static {p1, v0}, Lcom/facebook/internal/Validate;->notNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 562
    iput-object p1, p0, Lcom/facebook/AppEventsLogger;->context:Landroid/content/Context;

    .line 564
    if-nez p3, :cond_0

    .line 565
    invoke-static {}, Lcom/facebook/Session;->getActiveSession()Lcom/facebook/Session;

    move-result-object p3

    .line 568
    :cond_0
    if-eqz p3, :cond_1

    .line 569
    new-instance v0, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    invoke-direct {v0, p3}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;-><init>(Lcom/facebook/Session;)V

    iput-object v0, p0, Lcom/facebook/AppEventsLogger;->accessTokenAppId:Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    goto :goto_0

    .line 571
    :cond_1
    if-nez p2, :cond_2

    .line 572
    invoke-static {p1}, Lcom/facebook/internal/Utility;->getMetadataApplicationId(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p2

    .line 574
    :cond_2
    new-instance v0, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    const/4 v1, 0x0

    invoke-direct {v0, v1, p2}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    iput-object v0, p0, Lcom/facebook/AppEventsLogger;->accessTokenAppId:Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    .line 577
    :goto_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object p3, v0

    monitor-enter v0

    .line 579
    :try_start_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->hashedDeviceAndAppId:Ljava/lang/String;

    if-nez v0, :cond_3

    .line 580
    invoke-static {p1, p2}, Lcom/facebook/internal/Utility;->getHashedDeviceAndAppID(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/facebook/AppEventsLogger;->hashedDeviceAndAppId:Ljava/lang/String;

    .line 583
    :cond_3
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    if-nez v0, :cond_4

    .line 584
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    sput-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    .line 586
    :cond_4
    monitor-exit p3
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_1

    :catchall_0
    :try_start_1
    move-exception p1

    monitor-exit p3
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p1

    .line 588
    :goto_1
    invoke-static {}, Lcom/facebook/AppEventsLogger;->initializeTimersIfNeeded()V

    .line 589
    return-void
.end method

.method static synthetic access$100(Lcom/facebook/AppEventsLogger$FlushReason;)V
    .locals 0

    .line 106
    invoke-static {p0}, Lcom/facebook/AppEventsLogger;->flushAndWait(Lcom/facebook/AppEventsLogger$FlushReason;)V

    return-void
.end method

.method static synthetic access$200()Ljava/lang/Object;
    .locals 1

    .line 106
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    return-object v0
.end method

.method static synthetic access$300()Ljava/util/Map;
    .locals 1

    .line 106
    sget-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    return-object v0
.end method

.method static synthetic access$500(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/Request;Lcom/facebook/Response;Lcom/facebook/AppEventsLogger$SessionEventsState;Lcom/facebook/AppEventsLogger$FlushStatistics;)V
    .locals 0

    .line 106
    invoke-static {p0, p1, p2, p3, p4}, Lcom/facebook/AppEventsLogger;->handleResponse(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/Request;Lcom/facebook/Response;Lcom/facebook/AppEventsLogger$SessionEventsState;Lcom/facebook/AppEventsLogger$FlushStatistics;)V

    return-void
.end method

.method static synthetic access$800()Ljava/lang/String;
    .locals 1

    .line 106
    sget-object v0, Lcom/facebook/AppEventsLogger;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method private static accumulatePersistedEvents()I
    .locals 6

    .line 900
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/facebook/AppEventsLogger$PersistedEvents;->readAndClearStore(Landroid/content/Context;)Lcom/facebook/AppEventsLogger$PersistedEvents;

    move-result-object v1

    .line 902
    const/4 v2, 0x0

    .line 903
    invoke-virtual {v1}, Lcom/facebook/AppEventsLogger$PersistedEvents;->keySet()Ljava/util/Set;

    move-result-object v0

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

    move-result-object v3

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

    move-result v0

    if-eqz v0, :cond_0

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

    move-result-object v0

    check-cast v0, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    move-object v4, v0

    .line 904
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    invoke-static {v0, v4}, Lcom/facebook/AppEventsLogger;->getSessionEventsState(Landroid/content/Context;Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)Lcom/facebook/AppEventsLogger$SessionEventsState;

    move-result-object v5

    .line 906
    invoke-virtual {v1, v4}, Lcom/facebook/AppEventsLogger$PersistedEvents;->getEvents(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)Ljava/util/List;

    move-result-object v4

    .line 907
    invoke-virtual {v5, v4}, Lcom/facebook/AppEventsLogger$SessionEventsState;->accumulatePersistedEvents(Ljava/util/List;)V

    .line 908
    invoke-interface {v4}, Ljava/util/List;->size()I

    move-result v0

    add-int/2addr v2, v0

    .line 909
    goto :goto_0

    .line 911
    :cond_0
    return v2
.end method

.method public static activateApp(Landroid/content/Context;)V
    .locals 1

    .line 272
    invoke-static {p0}, Lcom/facebook/internal/Utility;->getMetadataApplicationId(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/facebook/AppEventsLogger;->activateApp(Landroid/content/Context;Ljava/lang/String;)V

    .line 273
    return-void
.end method

.method public static activateApp(Landroid/content/Context;Ljava/lang/String;)V
    .locals 2

    .line 285
    if-eqz p0, :cond_0

    if-nez p1, :cond_1

    .line 286
    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Both context and applicationId must be non-null"

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

    throw v0

    .line 291
    :cond_1
    invoke-static {p0, p1}, Lcom/facebook/Settings;->publishInstallAsync(Landroid/content/Context;Ljava/lang/String;)V

    .line 293
    new-instance v0, Lcom/facebook/AppEventsLogger;

    const/4 v1, 0x0

    invoke-direct {v0, p0, p1, v1}, Lcom/facebook/AppEventsLogger;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)V

    .line 294
    const-string v1, "fb_mobile_activate_app"

    invoke-virtual {v0, v1}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;)V

    .line 295
    return-void
.end method

.method private static buildAndExecuteRequests(Lcom/facebook/AppEventsLogger$FlushReason;Ljava/util/Set;)Lcom/facebook/AppEventsLogger$FlushStatistics;
    .locals 11
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Lcom/facebook/AppEventsLogger$FlushReason;Ljava/util/Set<Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;>;)Lcom/facebook/AppEventsLogger$FlushStatistics;"
        }
    .end annotation

    .line 766
    new-instance v6, Lcom/facebook/AppEventsLogger$FlushStatistics;

    const/4 v0, 0x0

    invoke-direct {v6, v0}, Lcom/facebook/AppEventsLogger$FlushStatistics;-><init>(Lcom/facebook/AppEventsLogger$1;)V

    .line 768
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/facebook/Settings;->getLimitEventAndDataUsage(Landroid/content/Context;)Z

    move-result v7

    .line 770
    new-instance v8, Ljava/util/ArrayList;

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

    .line 771
    invoke-interface {p1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :cond_0
    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_2

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

    move-result-object v0

    check-cast v0, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    .line 772
    move-object v9, v0

    invoke-static {v0}, Lcom/facebook/AppEventsLogger;->getSessionEventsState(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)Lcom/facebook/AppEventsLogger$SessionEventsState;

    move-result-object v0

    .line 773
    move-object v10, v0

    if-eqz v0, :cond_0

    .line 774
    invoke-static {v9, v10, v7, v6}, Lcom/facebook/AppEventsLogger;->buildRequestForSession(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/AppEventsLogger$SessionEventsState;ZLcom/facebook/AppEventsLogger$FlushStatistics;)Lcom/facebook/Request;

    move-result-object v0

    .line 779
    move-object v9, v0

    if-eqz v0, :cond_1

    .line 780
    invoke-interface {v8, v9}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 782
    :cond_1
    goto :goto_0

    .line 784
    :cond_2
    invoke-interface {v8}, Ljava/util/List;->size()I

    move-result v0

    if-lez v0, :cond_4

    .line 785
    sget-object v0, Lcom/facebook/LoggingBehavior;->APP_EVENTS:Lcom/facebook/LoggingBehavior;

    sget-object v1, Lcom/facebook/AppEventsLogger;->TAG:Ljava/lang/String;

    const-string v2, "Flushing %d events due to %s."

    const/4 v3, 0x2

    new-array v3, v3, [Ljava/lang/Object;

    iget v4, v6, Lcom/facebook/AppEventsLogger$FlushStatistics;->numEvents:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    const/4 v5, 0x0

    aput-object v4, v3, v5

    invoke-virtual {p0}, Lcom/facebook/AppEventsLogger$FlushReason;->toString()Ljava/lang/String;

    move-result-object v4

    const/4 v5, 0x1

    aput-object v4, v3, v5

    invoke-static {v0, v1, v2, v3}, Lcom/facebook/internal/Logger;->log(Lcom/facebook/LoggingBehavior;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V

    .line 789
    invoke-interface {v8}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p1

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

    move-result v0

    if-eqz v0, :cond_3

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

    move-result-object v0

    check-cast v0, Lcom/facebook/Request;

    .line 792
    invoke-virtual {v0}, Lcom/facebook/Request;->executeAndWait()Lcom/facebook/Response;

    .line 793
    goto :goto_1

    .line 794
    :cond_3
    return-object v6

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

    return-object v0
.end method

.method private static buildRequestForSession(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/AppEventsLogger$SessionEventsState;ZLcom/facebook/AppEventsLogger$FlushStatistics;)Lcom/facebook/Request;
    .locals 7

    .line 808
    invoke-virtual {p0}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;->getApplicationId()Ljava/lang/String;

    move-result-object v0

    .line 810
    move-object v4, v0

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/facebook/internal/Utility;->queryAppSettings(Ljava/lang/String;Z)Lcom/facebook/internal/Utility$FetchedAppSettings;

    move-result-object v5

    .line 812
    const-string v0, "%s/activities"

    const/4 v1, 0x1

    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    aput-object v4, v1, v2

    invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    const/4 v2, 0x0

    const/4 v3, 0x0

    invoke-static {v1, v0, v2, v3}, Lcom/facebook/Request;->newPostRequest(Lcom/facebook/Session;Ljava/lang/String;Lcom/facebook/model/GraphObject;Lcom/facebook/Request$Callback;)Lcom/facebook/Request;

    move-result-object v0

    .line 818
    move-object v4, v0

    invoke-virtual {v0}, Lcom/facebook/Request;->getParameters()Landroid/os/Bundle;

    move-result-object v0

    .line 819
    move-object v6, v0

    if-nez v0, :cond_0

    .line 820
    new-instance v6, Landroid/os/Bundle;

    invoke-direct {v6}, Landroid/os/Bundle;-><init>()V

    .line 822
    :cond_0
    const-string v0, "access_token"

    invoke-virtual {p0}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;->getAccessToken()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v6, v0, v1}, Landroid/os/Bundle;->putString(Ljava/lang/String;Ljava/lang/String;)V

    .line 823
    invoke-virtual {v4, v6}, Lcom/facebook/Request;->setParameters(Landroid/os/Bundle;)V

    .line 825
    invoke-virtual {v5}, Lcom/facebook/internal/Utility$FetchedAppSettings;->supportsImplicitLogging()Z

    move-result v0

    invoke-virtual {v5}, Lcom/facebook/internal/Utility$FetchedAppSettings;->supportsAttribution()Z

    move-result v1

    invoke-virtual {p1, v4, v0, v1, p2}, Lcom/facebook/AppEventsLogger$SessionEventsState;->populateRequest(Lcom/facebook/Request;ZZZ)I

    move-result v0

    .line 827
    move p2, v0

    if-nez v0, :cond_1

    .line 828
    const/4 v0, 0x0

    return-object v0

    .line 831
    :cond_1
    iget v0, p3, Lcom/facebook/AppEventsLogger$FlushStatistics;->numEvents:I

    add-int/2addr v0, p2

    iput v0, p3, Lcom/facebook/AppEventsLogger$FlushStatistics;->numEvents:I

    .line 833
    new-instance v0, Lcom/facebook/AppEventsLogger$5;

    invoke-direct {v0, p0, v4, p1, p3}, Lcom/facebook/AppEventsLogger$5;-><init>(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/Request;Lcom/facebook/AppEventsLogger$SessionEventsState;Lcom/facebook/AppEventsLogger$FlushStatistics;)V

    invoke-virtual {v4, v0}, Lcom/facebook/Request;->setCallback(Lcom/facebook/Request$Callback;)V

    .line 840
    return-object v4
.end method

.method static eagerFlush()V
    .locals 2

    .line 675
    invoke-static {}, Lcom/facebook/AppEventsLogger;->getFlushBehavior()Lcom/facebook/AppEventsLogger$FlushBehavior;

    move-result-object v0

    sget-object v1, Lcom/facebook/AppEventsLogger$FlushBehavior;->EXPLICIT_ONLY:Lcom/facebook/AppEventsLogger$FlushBehavior;

    if-eq v0, v1, :cond_0

    .line 676
    sget-object v0, Lcom/facebook/AppEventsLogger$FlushReason;->EAGER_FLUSHING_EVENT:Lcom/facebook/AppEventsLogger$FlushReason;

    invoke-static {v0}, Lcom/facebook/AppEventsLogger;->flush(Lcom/facebook/AppEventsLogger$FlushReason;)V

    .line 678
    :cond_0
    return-void
.end method

.method private static flush(Lcom/facebook/AppEventsLogger$FlushReason;)V
    .locals 2

    .line 725
    invoke-static {}, Lcom/facebook/Settings;->getExecutor()Ljava/util/concurrent/Executor;

    move-result-object v0

    new-instance v1, Lcom/facebook/AppEventsLogger$4;

    invoke-direct {v1, p0}, Lcom/facebook/AppEventsLogger$4;-><init>(Lcom/facebook/AppEventsLogger$FlushReason;)V

    invoke-interface {v0, v1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V

    .line 731
    return-void
.end method

.method private static flushAndWait(Lcom/facebook/AppEventsLogger$FlushReason;)V
    .locals 5

    .line 736
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v4, v0

    monitor-enter v0

    .line 737
    :try_start_0
    sget-boolean v0, Lcom/facebook/AppEventsLogger;->requestInFlight:Z

    if-eqz v0, :cond_0

    .line 738
    monitor-exit v4
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-void

    .line 740
    :cond_0
    :try_start_1
    const/4 v0, 0x1

    sput-boolean v0, Lcom/facebook/AppEventsLogger;->requestInFlight:Z

    .line 741
    new-instance v3, Ljava/util/HashSet;

    sget-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v0

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

    .line 742
    monitor-exit v4
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    :try_start_2
    move-exception p0

    monitor-exit v4
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    throw p0

    .line 744
    :goto_0
    invoke-static {}, Lcom/facebook/AppEventsLogger;->accumulatePersistedEvents()I

    .line 746
    const/4 v4, 0x0

    .line 748
    :try_start_3
    invoke-static {p0, v3}, Lcom/facebook/AppEventsLogger;->buildAndExecuteRequests(Lcom/facebook/AppEventsLogger$FlushReason;Ljava/util/Set;)Lcom/facebook/AppEventsLogger$FlushStatistics;

    move-result-object v0

    move-object v4, v0
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0

    .line 751
    nop

    .line 749
    .line 750
    :catch_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object p0, v0

    monitor-enter v0

    .line 754
    :try_start_4
    const/4 v0, 0x0

    sput-boolean v0, Lcom/facebook/AppEventsLogger;->requestInFlight:Z

    .line 755
    monitor-exit p0
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_1

    goto :goto_1

    :catchall_1
    :try_start_5
    move-exception v3

    monitor-exit p0
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_1

    throw v3

    .line 757
    :goto_1
    if-eqz v4, :cond_1

    .line 758
    new-instance v0, Landroid/content/Intent;

    const-string v1, "com.facebook.sdk.APP_EVENTS_FLUSHED"

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

    .line 759
    move-object p0, v0

    const-string v1, "com.facebook.sdk.APP_EVENTS_NUM_EVENTS_FLUSHED"

    iget v2, v4, Lcom/facebook/AppEventsLogger$FlushStatistics;->numEvents:I

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 760
    const-string v0, "com.facebook.sdk.APP_EVENTS_FLUSH_RESULT"

    iget-object v1, v4, Lcom/facebook/AppEventsLogger$FlushStatistics;->result:Lcom/facebook/AppEventsLogger$FlushResult;

    invoke-virtual {p0, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 761
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    invoke-static {v0}, Lo/con;->ˊ(Landroid/content/Context;)Lo/con;

    move-result-object v0

    invoke-virtual {v0, p0}, Lo/con;->ˊ(Landroid/content/Intent;)Z

    .line 763
    :cond_1
    return-void
.end method

.method private static flushIfNecessary()V
    .locals 4

    .line 681
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v2, v0

    monitor-enter v0

    .line 682
    :try_start_0
    invoke-static {}, Lcom/facebook/AppEventsLogger;->getFlushBehavior()Lcom/facebook/AppEventsLogger$FlushBehavior;

    move-result-object v0

    sget-object v1, Lcom/facebook/AppEventsLogger$FlushBehavior;->EXPLICIT_ONLY:Lcom/facebook/AppEventsLogger$FlushBehavior;

    if-eq v0, v1, :cond_0

    .line 683
    invoke-static {}, Lcom/facebook/AppEventsLogger;->getAccumulatedEventCount()I

    move-result v0

    const/16 v1, 0x64

    if-le v0, v1, :cond_0

    .line 684
    sget-object v0, Lcom/facebook/AppEventsLogger$FlushReason;->EVENT_THRESHOLD:Lcom/facebook/AppEventsLogger$FlushReason;

    invoke-static {v0}, Lcom/facebook/AppEventsLogger;->flush(Lcom/facebook/AppEventsLogger$FlushReason;)V

    .line 687
    :cond_0
    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-void

    :catchall_0
    :try_start_1
    move-exception v3

    monitor-exit v2
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v3
.end method

.method private static getAccumulatedEventCount()I
    .locals 5

    .line 691
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v1, v0

    monitor-enter v0

    .line 693
    :try_start_0
    const/4 v2, 0x0

    .line 694
    sget-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;

    move-result-object v0

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

    move-result-object v3

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

    move-result v0

    if-eqz v0, :cond_0

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

    move-result-object v0

    check-cast v0, Lcom/facebook/AppEventsLogger$SessionEventsState;

    move-object v4, v0

    .line 695
    invoke-virtual {v4}, Lcom/facebook/AppEventsLogger$SessionEventsState;->getAccumulatedEventCount()I

    move-result v0

    add-int/2addr v2, v0

    .line 696
    goto :goto_0

    .line 697
    :cond_0
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return v2

    .line 698
    :catchall_0
    :try_start_1
    move-exception v2

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v2
.end method

.method public static getFlushBehavior()Lcom/facebook/AppEventsLogger$FlushBehavior;
    .locals 3

    .line 371
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v1, v0

    monitor-enter v0

    .line 372
    :try_start_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->flushBehavior:Lcom/facebook/AppEventsLogger$FlushBehavior;

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-object v0

    .line 373
    :catchall_0
    :try_start_1
    move-exception v2

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v2
.end method

.method public static getLimitEventUsage(Landroid/content/Context;)Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .line 251
    invoke-static {p0}, Lcom/facebook/Settings;->getLimitEventAndDataUsage(Landroid/content/Context;)Z

    move-result v0

    return v0
.end method

.method private static getSessionEventsState(Landroid/content/Context;Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)Lcom/facebook/AppEventsLogger$SessionEventsState;
    .locals 5

    .line 703
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v3, v0

    monitor-enter v0

    .line 704
    :try_start_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

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

    move-result-object v0

    check-cast v0, Lcom/facebook/AppEventsLogger$SessionEventsState;

    .line 705
    move-object v4, v0

    if-nez v0, :cond_0

    .line 707
    invoke-static {p0}, Lcom/facebook/internal/AttributionIdentifiers;->getAttributionIdentifiers(Landroid/content/Context;)Lcom/facebook/internal/AttributionIdentifiers;

    move-result-object v4

    .line 710
    new-instance v0, Lcom/facebook/AppEventsLogger$SessionEventsState;

    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v1

    sget-object v2, Lcom/facebook/AppEventsLogger;->hashedDeviceAndAppId:Ljava/lang/String;

    invoke-direct {v0, v4, v1, v2}, Lcom/facebook/AppEventsLogger$SessionEventsState;-><init>(Lcom/facebook/internal/AttributionIdentifiers;Ljava/lang/String;Ljava/lang/String;)V

    move-object v4, v0

    .line 711
    sget-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    invoke-interface {v0, p1, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 713
    :cond_0
    monitor-exit v3
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-object v4

    .line 714
    :catchall_0
    :try_start_1
    move-exception p0

    monitor-exit v3
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p0
.end method

.method private static getSessionEventsState(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)Lcom/facebook/AppEventsLogger$SessionEventsState;
    .locals 2

    .line 718
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v1, v0

    monitor-enter v0

    .line 719
    :try_start_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/facebook/AppEventsLogger$SessionEventsState;

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-object v0

    .line 720
    :catchall_0
    :try_start_1
    move-exception p0

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p0
.end method

.method private static handleResponse(Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/Request;Lcom/facebook/Response;Lcom/facebook/AppEventsLogger$SessionEventsState;Lcom/facebook/AppEventsLogger$FlushStatistics;)V
    .locals 9

    .line 845
    invoke-virtual {p2}, Lcom/facebook/Response;->getError()Lcom/facebook/FacebookRequestError;

    move-result-object v6

    .line 846
    const-string v7, "Success"

    .line 848
    sget-object v8, Lcom/facebook/AppEventsLogger$FlushResult;->SUCCESS:Lcom/facebook/AppEventsLogger$FlushResult;

    .line 850
    if-eqz v6, :cond_1

    .line 851
    invoke-virtual {v6}, Lcom/facebook/FacebookRequestError;->getErrorCode()I

    move-result v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_0

    .line 853
    const-string v7, "Failed: No Connectivity"

    .line 854
    sget-object v8, Lcom/facebook/AppEventsLogger$FlushResult;->NO_CONNECTIVITY:Lcom/facebook/AppEventsLogger$FlushResult;

    goto :goto_0

    .line 856
    :cond_0
    const-string v0, "Failed:\n  Response: %s\n  Error %s"

    const/4 v1, 0x2

    new-array v1, v1, [Ljava/lang/Object;

    invoke-virtual {p2}, Lcom/facebook/Response;->toString()Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x0

    aput-object v2, v1, v3

    invoke-virtual {v6}, Lcom/facebook/FacebookRequestError;->toString()Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x1

    aput-object v2, v1, v3

    invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v7

    .line 859
    sget-object v8, Lcom/facebook/AppEventsLogger$FlushResult;->SERVER_ERROR:Lcom/facebook/AppEventsLogger$FlushResult;

    .line 863
    :cond_1
    :goto_0
    sget-object v0, Lcom/facebook/LoggingBehavior;->APP_EVENTS:Lcom/facebook/LoggingBehavior;

    invoke-static {v0}, Lcom/facebook/Settings;->isLoggingBehaviorEnabled(Lcom/facebook/LoggingBehavior;)Z

    move-result v0

    if-eqz v0, :cond_2

    .line 864
    invoke-virtual {p1}, Lcom/facebook/Request;->getTag()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    move-object p2, v0

    .line 868
    :try_start_0
    new-instance v0, Lorg/json/JSONArray;

    invoke-direct {v0, p2}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    .line 869
    const/4 v1, 0x2

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

    move-result-object p2
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 872
    goto :goto_1

    .line 870
    .line 871
    :catch_0
    const-string p2, "<Can\'t encode events for debug logging>"

    .line 874
    :goto_1
    sget-object v0, Lcom/facebook/LoggingBehavior;->APP_EVENTS:Lcom/facebook/LoggingBehavior;

    sget-object v1, Lcom/facebook/AppEventsLogger;->TAG:Ljava/lang/String;

    const-string v2, "Flush completed\nParams: %s\n  Result: %s\n  Events JSON: %s"

    const/4 v3, 0x3

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {p1}, Lcom/facebook/Request;->getGraphObject()Lcom/facebook/model/GraphObject;

    move-result-object v4

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

    move-result-object v4

    const/4 v5, 0x0

    aput-object v4, v3, v5

    const/4 v4, 0x1

    aput-object v7, v3, v4

    const/4 v4, 0x2

    aput-object p2, v3, v4

    invoke-static {v0, v1, v2, v3}, Lcom/facebook/internal/Logger;->log(Lcom/facebook/LoggingBehavior;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V

    .line 881
    :cond_2
    if-eqz v6, :cond_3

    const/4 v0, 0x1

    goto :goto_2

    :cond_3
    const/4 v0, 0x0

    :goto_2
    invoke-virtual {p3, v0}, Lcom/facebook/AppEventsLogger$SessionEventsState;->clearInFlightAndStats(Z)V

    .line 883
    sget-object v0, Lcom/facebook/AppEventsLogger$FlushResult;->NO_CONNECTIVITY:Lcom/facebook/AppEventsLogger$FlushResult;

    if-ne v8, v0, :cond_4

    .line 888
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    invoke-static {v0, p0, p3}, Lcom/facebook/AppEventsLogger$PersistedEvents;->persistEvents(Landroid/content/Context;Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;Lcom/facebook/AppEventsLogger$SessionEventsState;)V

    .line 891
    :cond_4
    sget-object v0, Lcom/facebook/AppEventsLogger$FlushResult;->SUCCESS:Lcom/facebook/AppEventsLogger$FlushResult;

    if-eq v8, v0, :cond_5

    .line 893
    iget-object v0, p4, Lcom/facebook/AppEventsLogger$FlushStatistics;->result:Lcom/facebook/AppEventsLogger$FlushResult;

    sget-object v1, Lcom/facebook/AppEventsLogger$FlushResult;->NO_CONNECTIVITY:Lcom/facebook/AppEventsLogger$FlushResult;

    if-eq v0, v1, :cond_5

    .line 894
    iput-object v8, p4, Lcom/facebook/AppEventsLogger$FlushStatistics;->result:Lcom/facebook/AppEventsLogger$FlushResult;

    .line 897
    :cond_5
    return-void
.end method

.method private static initializeTimersIfNeeded()V
    .locals 8

    .line 592
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v6, v0

    monitor-enter v0

    .line 593
    :try_start_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->flushTimer:Ljava/util/Timer;

    if-eqz v0, :cond_0

    .line 594
    monitor-exit v6
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-void

    .line 596
    :cond_0
    :try_start_1
    new-instance v0, Ljava/util/Timer;

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

    sput-object v0, Lcom/facebook/AppEventsLogger;->flushTimer:Ljava/util/Timer;

    .line 597
    new-instance v0, Ljava/util/Timer;

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

    sput-object v0, Lcom/facebook/AppEventsLogger;->supportsAttributionRecheckTimer:Ljava/util/Timer;

    .line 598
    monitor-exit v6
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    :try_start_2
    move-exception v7

    monitor-exit v6
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    throw v7

    .line 600
    :goto_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->flushTimer:Ljava/util/Timer;

    new-instance v1, Lcom/facebook/AppEventsLogger$2;

    invoke-direct {v1}, Lcom/facebook/AppEventsLogger$2;-><init>()V

    const-wide/16 v2, 0x0

    const-wide/32 v4, 0xea60

    invoke-virtual/range {v0 .. v5}, Ljava/util/Timer;->schedule(Ljava/util/TimerTask;JJ)V

    .line 612
    sget-object v0, Lcom/facebook/AppEventsLogger;->supportsAttributionRecheckTimer:Ljava/util/Timer;

    new-instance v1, Lcom/facebook/AppEventsLogger$3;

    invoke-direct {v1}, Lcom/facebook/AppEventsLogger$3;-><init>()V

    const-wide/16 v2, 0x0

    const-wide/32 v4, 0x5265c00

    invoke-virtual/range {v0 .. v5}, Ljava/util/Timer;->schedule(Ljava/util/TimerTask;JJ)V

    .line 629
    return-void
.end method

.method private static logEvent(Landroid/content/Context;Lcom/facebook/AppEventsLogger$AppEvent;Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)V
    .locals 1

    .line 638
    invoke-static {p1}, Lcom/facebook/AppEventsLogger;->shouldSuppressEvent(Lcom/facebook/AppEventsLogger$AppEvent;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 639
    return-void

    .line 642
    :cond_0
    invoke-static {p0, p2}, Lcom/facebook/AppEventsLogger;->getSessionEventsState(Landroid/content/Context;Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)Lcom/facebook/AppEventsLogger$SessionEventsState;

    move-result-object v0

    .line 643
    invoke-virtual {v0, p1}, Lcom/facebook/AppEventsLogger$SessionEventsState;->addEvent(Lcom/facebook/AppEventsLogger$AppEvent;)V

    .line 645
    invoke-static {}, Lcom/facebook/AppEventsLogger;->flushIfNecessary()V

    .line 646
    return-void
.end method

.method private logEvent(Ljava/lang/String;Ljava/lang/Double;Landroid/os/Bundle;Z)V
    .locals 2

    .line 633
    new-instance v0, Lcom/facebook/AppEventsLogger$AppEvent;

    invoke-direct {v0, p1, p2, p3, p4}, Lcom/facebook/AppEventsLogger$AppEvent;-><init>(Ljava/lang/String;Ljava/lang/Double;Landroid/os/Bundle;Z)V

    move-object p1, v0

    .line 634
    iget-object v0, p0, Lcom/facebook/AppEventsLogger;->context:Landroid/content/Context;

    iget-object v1, p0, Lcom/facebook/AppEventsLogger;->accessTokenAppId:Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    invoke-static {v0, p1, v1}, Lcom/facebook/AppEventsLogger;->logEvent(Landroid/content/Context;Lcom/facebook/AppEventsLogger$AppEvent;Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;)V

    .line 635
    return-void
.end method

.method public static newLogger(Landroid/content/Context;)Lcom/facebook/AppEventsLogger;
    .locals 3

    .line 307
    new-instance v0, Lcom/facebook/AppEventsLogger;

    const/4 v1, 0x0

    const/4 v2, 0x0

    invoke-direct {v0, p0, v1, v2}, Lcom/facebook/AppEventsLogger;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)V

    return-object v0
.end method

.method public static newLogger(Landroid/content/Context;Lcom/facebook/Session;)Lcom/facebook/AppEventsLogger;
    .locals 2

    .line 321
    new-instance v0, Lcom/facebook/AppEventsLogger;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1, p1}, Lcom/facebook/AppEventsLogger;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)V

    return-object v0
.end method

.method public static newLogger(Landroid/content/Context;Ljava/lang/String;)Lcom/facebook/AppEventsLogger;
    .locals 2

    .line 352
    new-instance v0, Lcom/facebook/AppEventsLogger;

    const/4 v1, 0x0

    invoke-direct {v0, p0, p1, v1}, Lcom/facebook/AppEventsLogger;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)V

    return-object v0
.end method

.method public static newLogger(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)Lcom/facebook/AppEventsLogger;
    .locals 1

    .line 337
    new-instance v0, Lcom/facebook/AppEventsLogger;

    invoke-direct {v0, p0, p1, p2}, Lcom/facebook/AppEventsLogger;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/facebook/Session;)V

    return-object v0
.end method

.method private static notifyDeveloperError(Ljava/lang/String;)V
    .locals 2

    .line 920
    sget-object v0, Lcom/facebook/LoggingBehavior;->DEVELOPER_ERRORS:Lcom/facebook/LoggingBehavior;

    const-string v1, "AppEvents"

    invoke-static {v0, v1, p0}, Lcom/facebook/internal/Logger;->log(Lcom/facebook/LoggingBehavior;Ljava/lang/String;Ljava/lang/String;)V

    .line 921
    return-void
.end method

.method public static onContextStop()V
    .locals 2

    .line 513
    sget-object v0, Lcom/facebook/AppEventsLogger;->applicationContext:Landroid/content/Context;

    sget-object v1, Lcom/facebook/AppEventsLogger;->stateMap:Ljava/util/Map;

    invoke-static {v0, v1}, Lcom/facebook/AppEventsLogger$PersistedEvents;->persistEvents(Landroid/content/Context;Ljava/util/Map;)V

    .line 514
    return-void
.end method

.method public static setFlushBehavior(Lcom/facebook/AppEventsLogger$FlushBehavior;)V
    .locals 2

    .line 382
    sget-object v0, Lcom/facebook/AppEventsLogger;->staticLock:Ljava/lang/Object;

    move-object v1, v0

    monitor-enter v0

    .line 383
    :try_start_0
    sput-object p0, Lcom/facebook/AppEventsLogger;->flushBehavior:Lcom/facebook/AppEventsLogger$FlushBehavior;

    .line 384
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    return-void

    :catchall_0
    :try_start_1
    move-exception p0

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p0
.end method

.method public static setLimitEventUsage(Landroid/content/Context;Z)V
    .locals 0
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .line 259
    invoke-static {p0, p1}, Lcom/facebook/Settings;->setLimitEventAndDataUsage(Landroid/content/Context;Z)V

    .line 260
    return-void
.end method

.method private static shouldSuppressEvent(Lcom/facebook/AppEventsLogger$AppEvent;)Z
    .locals 6

    .line 650
    sget-object v0, Lcom/facebook/AppEventsLogger;->mapEventNameToSuppress:Ljava/util/Map;

    invoke-virtual {p0}, Lcom/facebook/AppEventsLogger$AppEvent;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/facebook/AppEventsLogger$EventSuppression;

    .line 651
    move-object v4, v0

    if-nez v0, :cond_0

    .line 652
    const/4 v0, 0x0

    return v0

    .line 655
    :cond_0
    sget-object v0, Lcom/facebook/AppEventsLogger;->mapEventsToSuppressionTime:Ljava/util/Map;

    invoke-virtual {p0}, Lcom/facebook/AppEventsLogger$AppEvent;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Date;

    .line 657
    move-object v5, v0

    if-eqz v0, :cond_1

    .line 658
    new-instance v0, Ljava/util/Date;

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

    invoke-virtual {v0}, Ljava/util/Date;->getTime()J

    move-result-wide v0

    invoke-virtual {v5}, Ljava/util/Date;->getTime()J

    move-result-wide v2

    sub-long/2addr v0, v2

    .line 661
    invoke-virtual {v4}, Lcom/facebook/AppEventsLogger$EventSuppression;->getTimeoutPeriod()I

    move-result v2

    mul-int/lit16 v2, v2, 0x3e8

    int-to-long v2, v2

    cmp-long v0, v0, v2

    if-gez v0, :cond_1

    const/4 v0, 0x1

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    .line 666
    :goto_0
    move v5, v0

    if-eqz v0, :cond_2

    invoke-virtual {v4}, Lcom/facebook/AppEventsLogger$EventSuppression;->getBehavior()Lcom/facebook/AppEventsLogger$SuppressionTimeoutBehavior;

    move-result-object v0

    sget-object v1, Lcom/facebook/AppEventsLogger$SuppressionTimeoutBehavior;->RESET_TIMEOUT_WHEN_LOG_ATTEMPTED:Lcom/facebook/AppEventsLogger$SuppressionTimeoutBehavior;

    if-ne v0, v1, :cond_3

    .line 668
    :cond_2
    sget-object v0, Lcom/facebook/AppEventsLogger;->mapEventsToSuppressionTime:Ljava/util/Map;

    invoke-virtual {p0}, Lcom/facebook/AppEventsLogger$AppEvent;->getName()Ljava/lang/String;

    move-result-object v1

    new-instance v2, Ljava/util/Date;

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

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 671
    :cond_3
    return v5
.end method

# virtual methods
.method public flush()V
    .locals 1

    .line 501
    sget-object v0, Lcom/facebook/AppEventsLogger$FlushReason;->EXPLICIT:Lcom/facebook/AppEventsLogger$FlushReason;

    invoke-static {v0}, Lcom/facebook/AppEventsLogger;->flush(Lcom/facebook/AppEventsLogger$FlushReason;)V

    .line 502
    return-void
.end method

.method public getApplicationId()Ljava/lang/String;
    .locals 1

    .line 533
    iget-object v0, p0, Lcom/facebook/AppEventsLogger;->accessTokenAppId:Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    invoke-virtual {v0}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;->getApplicationId()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method isValidForSession(Lcom/facebook/Session;)Z
    .locals 1

    .line 517
    new-instance v0, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    invoke-direct {v0, p1}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;-><init>(Lcom/facebook/Session;)V

    move-object p1, v0

    .line 518
    iget-object v0, p0, Lcom/facebook/AppEventsLogger;->accessTokenAppId:Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;

    invoke-virtual {v0, p1}, Lcom/facebook/AppEventsLogger$AccessTokenAppIdPair;->equals(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public logEvent(Ljava/lang/String;)V
    .locals 1

    .line 397
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;Landroid/os/Bundle;)V

    .line 398
    return-void
.end method

.method public logEvent(Ljava/lang/String;D)V
    .locals 1

    .line 413
    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, p3, v0}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;DLandroid/os/Bundle;)V

    .line 414
    return-void
.end method

.method public logEvent(Ljava/lang/String;DLandroid/os/Bundle;)V
    .locals 2

    .line 453
    invoke-static {p2, p3}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v0

    const/4 v1, 0x0

    invoke-direct {p0, p1, v0, p4, v1}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;Ljava/lang/Double;Landroid/os/Bundle;Z)V

    .line 454
    return-void
.end method

.method public logEvent(Ljava/lang/String;Landroid/os/Bundle;)V
    .locals 2

    .line 432
    const/4 v0, 0x0

    const/4 v1, 0x0

    invoke-direct {p0, p1, v0, p2, v1}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;Ljava/lang/Double;Landroid/os/Bundle;Z)V

    .line 433
    return-void
.end method

.method public logPurchase(Ljava/math/BigDecimal;Ljava/util/Currency;)V
    .locals 1

    .line 464
    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, v0}, Lcom/facebook/AppEventsLogger;->logPurchase(Ljava/math/BigDecimal;Ljava/util/Currency;Landroid/os/Bundle;)V

    .line 465
    return-void
.end method

.method public logPurchase(Ljava/math/BigDecimal;Ljava/util/Currency;Landroid/os/Bundle;)V
    .locals 3

    .line 479
    if-nez p1, :cond_0

    .line 480
    const-string v0, "purchaseAmount cannot be null"

    invoke-static {v0}, Lcom/facebook/AppEventsLogger;->notifyDeveloperError(Ljava/lang/String;)V

    .line 481
    return-void

    .line 482
    :cond_0
    if-nez p2, :cond_1

    .line 483
    const-string v0, "currency cannot be null"

    invoke-static {v0}, Lcom/facebook/AppEventsLogger;->notifyDeveloperError(Ljava/lang/String;)V

    .line 484
    return-void

    .line 487
    :cond_1
    if-nez p3, :cond_2

    .line 488
    new-instance p3, Landroid/os/Bundle;

    invoke-direct {p3}, Landroid/os/Bundle;-><init>()V

    .line 490
    :cond_2
    const-string v0, "fb_currency"

    invoke-virtual {p2}, Ljava/util/Currency;->getCurrencyCode()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p3, v0, v1}, Landroid/os/Bundle;->putString(Ljava/lang/String;Ljava/lang/String;)V

    .line 492
    const-string v0, "fb_mobile_purchase"

    invoke-virtual {p1}, Ljava/math/BigDecimal;->doubleValue()D

    move-result-wide v1

    invoke-virtual {p0, v0, v1, v2, p3}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;DLandroid/os/Bundle;)V

    .line 493
    invoke-static {}, Lcom/facebook/AppEventsLogger;->eagerFlush()V

    .line 494
    return-void
.end method

.method public logSdkEvent(Ljava/lang/String;Ljava/lang/Double;Landroid/os/Bundle;)V
    .locals 1

    .line 525
    const/4 v0, 0x1

    invoke-direct {p0, p1, p2, p3, v0}, Lcom/facebook/AppEventsLogger;->logEvent(Ljava/lang/String;Ljava/lang/Double;Landroid/os/Bundle;Z)V

    .line 526
    return-void
.end method


text:
import React from 'react';
import Title from 'react-title-component';

import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';

import timePickerReadmeText from './README';
import TimePickerExampleSimple from './ExampleSimple';
import timePickerExampleSimpleCode from '!raw!./ExampleSimple';
import TimePickerExampleComplex from './ExampleComplex';
import timePickerExampleComplexCode from '!raw!./ExampleComplex';
import TimePickerExampleInternational from './ExampleInternational';
import timePickerExampleInternationalCode from '!raw!./ExampleInternational';
import timePickerCode from '!raw!material-ui/lib/TimePicker/TimePicker';

const descriptions = {
  simple: 'Time Picker supports 12 hour and 24 hour formats. In 12 hour format the AM and PM indicators toggle the ' +
  'selected time period. You can also disable the Dialog passing true to the disabled property.',
  controlled: '`TimePicker` can be used as a controlled component.',
  localised: 'The buttons can be localised using the `cancelLabel` and `okLabel` properties.',
};

const TimePickersPage = () => (
  <div>
    <Title render={(previousTitle) => `Time Picker - ${previousTitle}`} />
    <MarkdownElement text={timePickerReadmeText} />
    <CodeExample
      title="Simple examples"
      description={descriptions.simple}
      code={timePickerExampleSimpleCode}
    >
      <TimePickerExampleSimple />
    </CodeExample>
    <CodeExample
      title="Controlled examples"
      description={descriptions.controlled}
      code={timePickerExampleComplexCode}
    >
      <TimePickerExampleComplex />
    </CodeExample>
    <CodeExample
      title="Localised example"
      description={descriptions.localised}
      code={timePickerExampleInternationalCode}
    >
      <TimePickerExampleInternational />
    </CodeExample>
    <PropTypeDescription code={timePickerCode} />
  </div>
);

export default TimePickersPage;

redpajama_set_name: RedPajamaGithub


text:
package org.helianto.order.repository;

import java.io.Serializable;

import org.helianto.order.domain.TokenSerializer;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * Token adapter.
 *
 * @author Eldevan Nery Junior
 */
public class TokenSerializerReadAdapter
	implements Serializable
{

	protected static final long serialVersionUID = 1L;

	protected static final String TOKEN_FOLDER = "/TOKEN/";

	protected Integer id;

	protected TokenSerializer adaptee;

	protected Integer entityId;

	protected String entityAlias;

    protected String tokenPrefix;

    protected Integer lastToken;

    protected Character tokenType;

    protected String tokenLogoUrl;

    protected byte[] tokenLogoByteArray;

    protected byte[] tokenAlertByteArray;

    protected String tokenColorUrl;

    protected byte[] tokenColorByteArray;

    protected String tokenIconUrl;

    protected byte[] tokenIconByteArray;

    protected byte[] tokenBrandByteArray;

    protected String tokenName;

	protected Integer contextId;

    /**
     * Constructor.
     */
    public TokenSerializerReadAdapter() {
		super();
	}

    /**
     * Constructor.
     *
     * @param id
     * @param entityId
     * @param entityAlias
     * @param tokenPrefix
     * @param lastToken
     * @param tokenType
     * @param tokenLogoUrl
     * @param tokenColorUrl
     * @param tokenIconUrl
     * @param contextId
     */
	public TokenSerializerReadAdapter(
			Integer id
			, Integer entityId
			, String entityAlias
			, String tokenPrefix
			, Integer lastToken
			, Character tokenType
			, String tokenLogoUrl
			, String tokenColorUrl
			, String tokenIconUrl
			, String tokenName
			, Integer contextId) {
		super();
		this.id = id;
		this.entityId = entityId;
		this.entityAlias = entityAlias;
		this.tokenPrefix = tokenPrefix;
		this.lastToken = lastToken;
		this.tokenType = tokenType;
		this.tokenLogoUrl = tokenLogoUrl;
		this.tokenColorUrl = tokenColorUrl;
		this.tokenIconUrl = tokenIconUrl;
		this.tokenName = tokenName;
		this.contextId = contextId;
	}

	@JsonIgnore
	public TokenSerializer getAdaptee() {
		return adaptee;
	}
	public TokenSerializerReadAdapter setAdaptee(TokenSerializer adaptee) {
		this.adaptee = adaptee;
		return this;
	}

	public Integer getId() {
		return id;
	}
	public TokenSerializerReadAdapter setId(Integer id) {
		this.id = id;
		return this;
	}

	public Integer getEntityId() {
		return entityId;
	}

	public String getEntityAlias() {
		return entityAlias;
	}

	public String getTokenPrefix() {
		return tokenPrefix;
	}
	public void setTokenPrefix(String tokenPrefix) {
		this.tokenPrefix = tokenPrefix;
	}

	public Integer getLastToken() {
		return lastToken;
	}
	public void setLastToken(Integer lastToken) {
		this.lastToken = lastToken;
	}

	public Character getTokenType() {
		return tokenType;
	}
	public void setTokenType(Character tokenType) {
		this.tokenType = tokenType;
	}

	public String getTokenLogoUrl() {
		return tokenLogoUrl;
	}
	public void setTokenLogoUrl(String tokenLogoUrl) {
		this.tokenLogoUrl = tokenLogoUrl;
	}

	/**
	 * Full token logo url.
	 */
	public String getFullTokenLogoUrl() {
		return prependUrlPrefix(tokenLogoUrl);
	}

	protected String prependUrlPrefix(String plainUrl) {
		if (plainUrl!=null && !plainUrl.isEmpty()) {
			return getEntityAlias()+TOKEN_FOLDER+plainUrl;
		}
		return null;
	}

	public String getTokenColorUrl() {
		return tokenColorUrl;
	}
	public void setTokenColorUrl(String tokenColorUrl) {
		this.tokenColorUrl = tokenColorUrl;
	}

	/**
	 * Full token color url.
	 */
	public String getFullTokenColorUrl() {
		return prependUrlPrefix(tokenColorUrl);
	}

	public Integer getContextId() {
		return contextId;
	}
	public void setContextId(Integer contextId) {
		this.contextId = contextId;
	}

	public void setEntityId(Integer entityId) {
		this.entityId = entityId;
	}

	public String getTokenIconUrl() {
		return tokenIconUrl;
	}
	public void setTokenIconUrl(String tokenIconUrl) {
		this.tokenIconUrl = tokenIconUrl;
	}

	public String getTokenName() {
		return tokenName;
	}
	public void setTokenName(String tokenName) {
		this.tokenName = tokenName;
	}

	/**
	 * Full token color url.
	 */
	public String getFullTokenIconUrl() {
		return prependUrlPrefix(tokenIconUrl);
	}

	public byte[] getTokenLogoByteArray() {
		return tokenLogoByteArray;
	}
	public void setTokenLogoByteArray(byte[] tokenLogoByteArray) {
		this.tokenLogoByteArray = tokenLogoByteArray;
	}

	public byte[] getTokenAlertByteArray() {
		return tokenAlertByteArray;
	}
	public void setTokenAlertByteArray(byte[] tokenAlertByteArray) {
		this.tokenAlertByteArray = tokenAlertByteArray;
	}

	public byte[] getTokenColorByteArray() {
		return tokenColorByteArray;
	}
	public void setTokenColorByteArray(byte[] tokenColorByteArray) {
		this.tokenColorByteArray = tokenColorByteArray;
	}

	public byte[] getTokenIconByteArray() {
		return tokenIconByteArray;
	}
	public void setTokenIconByteArray(byte[] tokenIconByteArray) {
		this.tokenIconByteArray = tokenIconByteArray;
	}

	public byte[] getTokenBrandByteArray() {
		return tokenBrandByteArray;
	}
	public void setTokenBrandByteArray(byte[] tokenBrandByteArray) {
		this.tokenBrandByteArray = tokenBrandByteArray;
	}

	@Override
	public int hashCode() {
		return 31 + ((id == null) ? 0 : id.hashCode());
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		if (obj == null) return false;
		if (getClass() != obj.getClass()) return false;
		TokenSerializerReadAdapter other = (TokenSerializerReadAdapter) obj;
		if (id == null) {
			if (other.id != null) return false;
		} else if (!id.equals(other.id)) return false;
		return true;
	}

}


text:
package org.apache.kafka.common.requests;

import org.apache.kafka.common.errors.ApiException;
import org.apache.kafka.common.protocol.Errors;
import org.apache.kafka.common.protocol.types.Struct;

/**
 * Encapsulates an error code (via the Errors enum) and an optional message. Generally, the optional message is only
 * defined if it adds information over the default message associated with the error code.
 *
 * This is an internal class (like every class in the requests package).
 */
public class ApiError {

    public static final ApiError NONE = new ApiError(Errors.NONE, null);

    private static final String CODE_KEY_NAME = "error_code";
    private static final String MESSAGE_KEY_NAME = "error_message";

    private final Errors error;
    private final String message;

    public static ApiError fromThrowable(Throwable t) {
        // Avoid populating the error message if it's a generic one
        Errors error = Errors.forException(t);
        String message = error.message().equals(t.getMessage()) ? null : t.getMessage();
        return new ApiError(error, message);
    }

    public ApiError(Struct struct) {
        error = Errors.forCode(struct.getShort(CODE_KEY_NAME));
        // In some cases, the error message field was introduced in newer version
        if (struct.hasField(MESSAGE_KEY_NAME))
            message = struct.getString(MESSAGE_KEY_NAME);
        else
            message = null;
    }

    public ApiError(Errors error, String message) {
        this.error = error;
        this.message = message;
    }

    public void write(Struct struct) {
        struct.set(CODE_KEY_NAME, error.code());
        // In some cases, the error message field was introduced in a newer protocol API version
        if (struct.hasField(MESSAGE_KEY_NAME) && message != null && error != Errors.NONE)
            struct.set(MESSAGE_KEY_NAME, message);
    }

    public boolean is(Errors error) {
        return this.error == error;
    }

    public boolean isFailure() {
        return !isSuccess();
    }

    public boolean isSuccess() {
        return is(Errors.NONE);
    }

    public Errors error() {
        return error;
    }

    /**
     * Return the optional error message or null. Consider using {@link #messageWithFallback()} instead.
     */
    public String message() {
        return message;
    }

    /**
     * If `message` is defined, return it. Otherwise fallback to the default error message associated with the error
     * code.
     */
    public String messageWithFallback() {
        if (message == null)
            return error.message();
        return message;
    }

    public ApiException exception() {
        return error.exception(message);
    }

    @Override
    public String toString() {
        return "ApiError(error=" + error + ", message=" + message + ")";
    }
}


text:
package com.modinfodesigns.property;

import com.modinfodesigns.property.transform.PropertyTemplateTransform;
import com.modinfodesigns.property.transform.PropertyTransformException;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Used to convert a DataObject to a String using a template with {PROP_NAME} place holders
 * for the DataObject properties.  Uses a PropertyTemplateTransform internally.
 *
 * Used by DataObjectTemplateManager to generate a String given a PropertyHolder object.
 *
 * @author Ted Sullivan
 */

public class DataObjectTemplate implements IPropertyHolder
{
  private transient static final Logger LOG = LoggerFactory.getLogger( DataObjectTemplate.class );

  private String name;
  private String id;
  private String type;

  private String template;  // contains placeholders for property names {prop_name}
  private boolean isRootObject;

  private HashMap<String,IProperty> propertyMap;

  public DataObjectTemplate( String sqlTemplate )
  {
    this.template = sqlTemplate;
  }

  public DataObjectTemplate( String template, IPropertyHolder properties )
  {
    this.template = template;
    setProperties( properties.getProperties( ) );
    setType( properties.getType( ) );
    setIsRootObject( properties.isRootObject() );
  }

  public DataObjectTemplate( String name, String type, String template, boolean isRootObject, Iterator<IProperty> properties )
  {
    this.name = name;
    this.type = type;
    this.template = template;
    this.isRootObject = isRootObject;
    if (properties != null) setProperties( properties );
  }

  @Override
  public String getName()
  {
    return name;
  }

  @Override
  public void setName(String name)
  {
    this.name = name;
  }

  public void setType( String type )
  {
    this.type = type;
  }

  @Override
  public String getType()
  {
    return type;
  }

  @Override
  public String getValue()
  {
    // replace the template place-holders with values of the properties ...
    PropertyTemplateTransform templateXForm = new PropertyTemplateTransform( this.template, "output" );
    try
    {
      templateXForm.transformPropertyHolder( this );
      return getProperty( "output" ).getValue( );
    }
    catch (PropertyTransformException pte )
    {
      LOG.error( pte.getMessage() );
    }

    return null;
  }

  @Override
  public String getValue(String format)
  {
    return getValue( );
  }

  @Override
  public void setValue(String value, String format)
  {
    this.template = value;
  }

  @Override
  public String getDefaultFormat()
  {
    return null;
  }

  @Override
  public IProperty copy()
  {
    return new DataObjectTemplate( this.name, this.type, this.template, this.isRootObject,
                                   ((propertyMap != null) ? propertyMap.values().iterator() : null) );
  }

  @Override
  public Object getValueObject()
  {
    return null;
  }

  @Override
  public Map<String, IProperty> getPropertyMap()
  {
    return propertyMap;
  }

  @Override
  public String getID()
  {
    return this.id;
  }

  @Override
  public void setID( String ID )
  {
    this.id = ID;
  }

  @Override
  public IProperty getProperty(String name)
  {
    return (propertyMap != null) ? propertyMap.get( name ) : null;
  }

  @Override
  public Iterator<IProperty> getProperties()
  {
    return (propertyMap != null) ? propertyMap.values().iterator() : null;
  }

  @Override
  public Iterator<String> getPropertyNames()
  {
    return (propertyMap != null) ? propertyMap.keySet().iterator() : null;
  }

  @Override
  public void addProperty(IProperty property)
  {
    setProperty( property );
  }

  @Override
  public void setProperty(IProperty property)
  {
    if (propertyMap == null) propertyMap = new HashMap<String,IProperty>( );
    propertyMap.put( property.getName( ), property );
  }

  @Override
  public void setProperties( Iterator<IProperty> properties )
  {
    LOG.debug( "setProperties( ) " );

    while (properties != null && properties.hasNext() )
    {
      setProperty( properties.next() );
    }
  }

  @Override
  public void removeProperty( String propName )
  {
    if (propertyMap != null) propertyMap.remove( propName );
  }

  public void removeProperties( )
  {
    if (propertyMap != null) propertyMap.clear( );
  }

  @Override
  public void addAssociation(IAssociation association)
                             throws AssociationException
  {

  }

  @Override
  public void setAssociation(IAssociation association)
  {

  }

  @Override
  public Iterator<String> getAssociationNames()
  {
    return null;
  }

  @Override
  public List<IAssociation> getAssociations(String name)
  {
    return null;
  }

  @Override
  public IAssociation getAssociation(String name, String ID)
  {
    return null;
  }

  @Override
  public void removeAssociations(String name)
  {

  }

  @Override
  public void removeAssociation(String name, String ID)
  {

  }

  @Override
  public void clear()
  {

  }

  @Override
  public boolean containsKey(Object key)
  {
    return false;
  }

  @Override
  public boolean containsValue(Object value)
  {
    return false;
  }

  @Override
  public Set entrySet()
  {
    return null;
  }

  @Override
  public Object get(Object key)
  {
    return null;
  }

  @Override
  public boolean isEmpty()
  {
    return false;
  }

  @SuppressWarnings("rawtypes")
  @Override
  public Set keySet()
  {
    return null;
  }

  @Override
  public Object put(Object key, Object value)
  {
    return null;
  }

  @Override
  public void putAll( Map m )
  {

  }

  @Override
  public Object remove(Object key)
  {
    return null;
  }

  @Override
  public int size()
  {
    return 0;
  }

  @SuppressWarnings("rawtypes")
  @Override
  public Collection values()
  {
    return null;
  }

  @Override
  public boolean isMultiValue()
  {
    return false;
  }

  @Override
  public String[] getValues(String format)
  {
    return null;
  }

  @Override
  public void setIsRootObject(boolean isRoot)
  {
    this.isRootObject = isRoot;
  }

  @Override
  public boolean isRootObject()
  {
    return this.isRootObject;
  }

}


text:
30 minute Greenprint consultation with Rebecca McGrane

30 minute virtual Green Kitchen or Bath Makeover


text:
import {EventDispatcherExtension} from "../extension/eventDispatcher/EventDispatcherExtension";
import {CommandMapExtension} from "../extension/commandMap/CommandMapExtension";
import {MediatorMapExtension} from "../extension/mediatorMap/MediatorMapExtension";
import {Type} from "../../type/Type";
import {ContextExtension} from "../data/ContextExtension";

/**
 * Default listing of Context extensions for standard web application.
 * @type {Type<ContextExtension>[]}
 * @author Kristaps Peļņa
 */
export const WebApplicationBundle: Type<ContextExtension>[] = [
    EventDispatcherExtension,
    CommandMapExtension,
    MediatorMapExtension
];


text:
"""Relational SQL QuerySets"""

import abc
from collections import namedtuple
import collections.abc
import itertools

class Executable(metaclass=abc.ABCMeta):

    """SQL executable object interface.

    Implementing classes must implement the _get_query() method, which
    returns the parametrized query that would be executed.
    """

    @abc.abstractmethod
    def _get_query(self) -> 'Query':
        """Get the associated query.

        The returned query can be any object with the attributes sql and
        params set like a Query object.
        """
        raise NotImplementedError

    def execute_with(self, cur):
        """Execute query with cursor."""
        query = self._get_query()
        return cur.execute(query.sql, query.params)

class Query(Executable):

    """Parametrized query.

    Attributes:

    sql -- SQL parametrized query string
    params -- Parameters
    """

    __slots__ = ('sql', 'params')

    def __init__(self, sql, params=()):
        self.sql = sql
        self.params = params

    def __repr__(self):
        cls = type(self).__qualname__
        return f'{cls}({self.sql!r}, {self.params!r})'

    def __bool__(self):
        return bool(self.sql) and bool(self.params)

    def __add__(self, other):
        if isinstance(other, type(self)):
            return type(self)(self.sql + other.sql,
                              self.params + other.params)
        elif isinstance(other, str):
            return self + type(self)(other)
        else:
            return NotImplemented

    def __and__(self, other):
        return self + ' AND ' + other

    def __or__(self, other):
        return self + ' OR ' + other

    def _get_query(self):
        return self

class SimpleQuery(Executable):

    """Interface for objects with a non-parametrized SQL representation.

    Abstract methods:

    _get_sql -- Get SQL to execute
    """

    def __str__(self):
        return self._get_sql()

    @abc.abstractmethod
    def _get_sql(self):
        raise NotImplementedError

    def _get_query(self):
        return Query(self._get_sql())

class Schema(SimpleQuery):

    """Table schema

    Attributes:

    name -- Table name
    primary_key -- Primary key column name
    row_class -- namedtuple class for table rows
    column_names -- Tuple of column names
    column_names_sql -- Column names formatted as SQL: '"foo", "bar"'

    Methods:

    make_row -- Make row tuple
    """

    def __init__(self, name, columns, constraints):
        self.name = name
        self._columns = columns
        self._constraints = constraints
        self.row_class = namedtuple(name, (column.name for column in columns))

    @staticmethod
    def _find_primary_key(columns):
        """Find the primary key column name."""
        primary_key_cols = [col for col in columns if col.primary_key]
        if len(primary_key_cols) > 1:
            raise ValueError('More than one primary key: {columns!r}')
        elif primary_key_cols:
            return primary_key_cols[0].name
        else:
            return 'rowid'

    def __repr__(self):
        cls = type(self).__qualname__
        return (f'{cls}({self.name!r}, {self._columns!r},'
                f' {self._constraints!r})')

    @property
    def primary_key(self):
        return self._find_primary_key(self._columns)

    @property
    def column_names(self):
        return tuple(column.name for column in self._columns)

    @property
    def column_names_sql(self):
        return ','.join(
            _escape_name(column) for column in self.column_names
        )

    @property
    def _column_defs(self):
        return ','.join(itertools.chain(
            (str(column) for column in self._columns),
            self._constraints,
        ))

    def make_row(self, iterable):
        """Make row tuple."""
        return self.row_class._make(iterable)

    def _get_sql(self):
        return f'CREATE TABLE {_escape_name(self.name)} ({self._column_defs})'

class Column:

    """Column definition

    Fields:

    name -- column name as a string
    constraints -- sequence of constraint strings

    Properties:

    primary_key
    """

    def __init__(self, name, constraints=()):
        self.name = name
        self.constraints = constraints

    def __str__(self):
        return ' '.join(itertools.chain((_escape_name(self.name),),
                                        self.constraints))

    @property
    def primary_key(self):
        return any('primary key' in constraint.lower()
                   for constraint in self.constraints)

class QuerySet(collections.abc.Set, Executable):

    """SQL query as a set"""

    def __init__(self, conn, schema, where_expr=''):
        self._conn = conn
        self._schema = schema
        self._where_expr = where_expr

    def __repr__(self):
        cls = type(self).__qualname__
        return (f'{cls}({self._conn!r}, {self._schema!r},'
                f' {self._where_expr!r})')

    def __iter__(self):
        cur = self._conn.cursor()
        self.execute_with(cur)
        make_row = self._schema.make_row
        yield from (make_row(row) for row in cur)

    def __contains__(self, row):
        return row in frozenset(self)

    def __len__(self):
        return len(frozenset(self))

    def _get_query(self):
        columns = self._schema.column_names_sql
        source = _escape_name(self._schema.name)
        query = Query(f'SELECT {columns} FROM {source}')
        if self._where_expr:
            query += ' WHERE '
            query += self._where_expr
        return query

class Table(collections.abc.MutableSet, QuerySet, SimpleQuery):

    """SQL table as a set."""

    def __init__(self, conn, schema):
        super().__init__(conn, schema)

    def _get_sql(self):
        return self._schema._get_sql()

    def add(self, row):
        """Upsert."""
        cur = self._conn.cursor()
        with self._conn:
            self._get_update_query(row).execute_with(cur)
            if self._conn.changes() == 0:
                self._get_insert_query(row).execute_with(cur)

    def discard(self, row):
        cur = self._conn.cursor()
        with self._conn:
            self._get_discard_query(row).execute_with(cur)

    def _get_update_query(self, row):
        query = Query(f'UPDATE {_escape_name(self._schema.name)} SET ')
        query += self._get_joined_cols(row)
        query += Query(
            f' WHERE {_escape_name(self._schema.primary_key)}=?',
            (getattr(row, self._schema.primary_key),),
        )
        return query

    def _get_insert_query(self, row):
        table = _escape_name(self._schema.name)
        cols = self._schema.column_names_sql
        vals = ','.join('?' for _ in row)
        sql = f'INSERT INTO {table} ({cols}) VALUES ({vals})'
        return Query(sql, row)

    def _get_discard_query(self, row):
        query = Query(f'DELETE FROM {_escape_name(self._schema.name)} WHERE ')
        query += self._get_anded_cols(row)
        return query

    def _get_joined_cols(self, row):
        sql = ','.join(f'{_escape_name(col)}=?'
                       for col in self._schema.column_names)
        return Query(sql, row)

    def _get_anded_cols(self, row):
        sql = ' AND '.join(f'{_escape_name(col)}=?'
                           for col in self._schema.column_names)
        return Query(sql, row)

def _escape_string(string):
    """Escape SQL string."""
    string = string.replace("'", "''")
    return f"'{string}'"

def _escape_name(string):
    """Escape SQL identifier."""
    return f'"{string}"'


text:
/* global BackgroundCheck:false */

var Slider = (function () {

  var arrows,
      strip,
      slides,
      dotsWrapper,
      dots,
      clickTargets,
      x = 0,
      delta,
      prefixes;

  function init() {
    arrows = document.querySelectorAll('.slider-arrow');
    slides = document.querySelectorAll('.slider-item');
    strip = document.querySelector('.slider-strip');
    dotsWrapper = document.querySelector('.slider-dots');
    clickTargets = document.querySelectorAll('.slider-arrow, .slider-dots');

    delta = 100 / slides.length;
    prefixes = getPrefixedRules() || [];

    setStyles();
    bindEvents();

    BackgroundCheck.init({
      targets: '.slider-arrow, .slider-dots'
    });
  }

  function moveSlider(e) {
    var target = e.target,
        dataPos = target.getAttribute('data-pos'),
        pos;

    if (typeof dataPos === 'string') {
      x = parseInt(dataPos, 10);
    } else if (target.className.indexOf('slider-arrow--left') !== -1) {
      x--;
    } else if (target.className.indexOf('slider-arrow--right') !== -1) {
      x++;
    }

    x = x > (slides.length - 1) ? (slides.length - 1) : x;
    x = x < 0 ? 0 : x;
    pos = x * -delta;

    if (prefixes[0]) {
      strip.style[prefixes[0]] = 'translate3d(' + pos + '%, 0px, 0px)';
    } else {
      strip.style.position = 'relative';
      strip.style.left = -(x * 500) + 'px';
    }

    for (var d = 0; d < dots.length; d++) {
      dots[d].className = dots[d].className.replace(' slider-dot--active', '');

      if (x === d) {
        dots[d].className += ' slider-dot--active';
      }
    }

    if (!prefixes[1]) {
      setTimeout(function () {
        BackgroundCheck.refresh();
      }, 400);
    }
  }

  function getPrefixedRules() {
    var ua = navigator && navigator.userAgent,
      events = {
        'WebkitTransition': ['webkitTransform', 'webkitTransitionEnd'],
        'MozTransition': ['transform', 'transitionend'],
        'OTransition': ['oTransform', 'oTransitionEnd'],
        'MSTransition': ['msTransform', null],
        'transform': ['transform', ua.indexOf('Trident') === -1 ? 'transitionEnd' : null]
      };

    for (var e in events) {
      if (document.body.style[e] !== undefined) {
        return events[e];
      }
    }
  }

  function setStyles() {
    var dot;

    strip.style.width = (slides.length * 100) + '%';

    for (var s = 0; s < slides.length; s++) {
      slides[s].style.width = delta + '%';

      dot = document.createElement('div');
      dot.setAttribute('data-pos', s);
      dot.className = 'slider-dot' + (s === 0 ? ' slider-dot--active' : '');

      dotsWrapper.appendChild(dot);
    }

    dotsWrapper.style.marginLeft = -(dotsWrapper.clientWidth / 2) + 'px';
    dots = document.querySelectorAll('.slider-dot');
  }

  function bindEvents() {

    for (var t = 0; t < clickTargets.length; t++) {
      clickTargets[t].addEventListener('click', moveSlider);
      clickTargets[t].addEventListener('click', moveSlider);
    }

    if (prefixes[1]) {
      strip.addEventListener(prefixes[1], function () {
        BackgroundCheck.refresh();
      });
    }
  }

  return {
    init: init
  };

}());

window.addEventListener('DOMContentLoaded', Slider.init);


text:
THECA 1 "2015" theca v1.0.0-dev THECA
=====================================

NAME
----

theca - minimal cli note taking tool

SYNOPSIS
--------

`theca` [`options`] [`-s`|`-u`|`-n`]

`theca` [`options`] <`id`>

`theca` [`options`] add <`title`> [`-s`|`-u`] [`-b` *BODY*|`-t`|`-`]

`theca` [`options`] edit <`id`> [<`title`>] [`-s`|`-u`|`-n`] [`-b` *BODY*|`-t`|`-`]

`theca` [`options`] del <`id`>

`theca` [`options`] new-profile [<`name`>]

`theca` [`options`] list-profiles

`theca` [`options`] encrypt-profile [`--new-key` *KEY*]

`theca` [`options`] decrypt-profile

`theca` [`options`] info

`theca` [`options`] clear

`theca` [`options`] search [`--regex`, `--search-body`] [`-s`|`-u`|`-n`] <`pattern`>

`theca` [`options`] transfer <`id`> to <`name`>

`theca` [`options`] import <`id`> from <`name`>

DESCRIPTION
-----------

`theca` is a minimal command line profile based note taking tool
written in `rust` that stores profiles using a `JSON` based file
format.

PROFILE OPTIONS
---------------

`-f` *PATH*, `--profile-folder` *PATH*
   Path to folder containing profile.json files, this override
   any `THECA_DEFAULT_PROFILE` environment variable.

`-p` *PROFILE*, `--profile` *PROFILE*
   Specify non-default profile [default can be set with env var
   `THECA_DEFAULT_PROFILE`].

PRINTING OPTIONS
----------------

`-c`, `--condensed`
   Use the condensed printing format.

`-j`, `--json`
   Print list output as a JSON object.

LIST OPTIONS
------------

`-l` *LIMIT*, `--limit` *LIMIT*
   Limit listing to LIMIT items [default: 0].

`-d`, `--datesort`
   Sort items by date.

`-r`, `--reverse`
   Reverse list.

INPUT OPTIONS
-------------

`-y`, `--yes`
   Silently agree to any [y/n] prompts.

STATUS OPTIONS
--------------

`-n`, `--none`
   No status [default].

`-s`, `--started`
   Started status.

`-u`, `--urgent`
   Urgent status.

BODY OPTIONS
------------

`-b` *BODY*, `--body` *BODY*
   Set body of the item to BODY.

`-t`, `--editor`
   Drop to `EDITOR` to set/edit item body.

`-`
   Set body of the item from STDIN.

ENCRYPTION OPTIONS
------------------

`-e`, `--encrypted`
   Specifies using an encrypted profile.

`-k` *KEY*, `--key` *KEY*
   Encryption key to use for encryption/decryption, a prompt
   will be displayed if no key is provided.

`--new-key` *KEY*
   Specifies the encryption key for a profile when using
   `encrypt-profile`, a prompt will be displayed if no key
   is provided.

SEARCH OPTIONS
--------------

`--search-body`
   Search the note bodies instead of titles.

`--regex`
   Set search pattern to regex (default is plaintext).

MISC OPTIONS
------------

`-h`, `--help`
   Display this help and exit.

`-v`, `--version`
   Display the version of theca and exit.

FILES
-----

*~/.theca/default.json~
   The default profile file that `theca` attempts to read.

ENVIRONMENT
-----------

`THECA_DEFAULT_PROFILE`
   If non-null the default profile for `theca` to read. Overridden by
   the `-p` option.

`THECA_PROFILE_FOLDER`
   If non-null the full path for for the theca profile `folder`.
   Overridden by the `-f` option.

FILE FORMAT
-----------

`theca` uses a `JSON` based file format that adheres to the following
schema.

   {
    "$schema": "https://github.com/rolandshoemaker/theca/blob/master/docs/DESIGN.md",
    "id": "/",
    "type": "object",
    "properties": {
      "encrypted": {
        "id": "encrypted",
        "type": "boolean"
      },
      "notes": {
        "id": "notes",
        "type": "array",
        "items": {
          "id": "0",
          "type": "object",
          "properties": {
            "id": {
              "id": "id",
              "type": "integer"
            },
            "title": {
              "id": "title",
              "type": "string"
            },
            "status": {
              "id": "status",
              "type": "string"
            },
            "body": {
              "id": "body",
              "type": "string"
            },
            "last\_touched": {
              "id": "last\_touched",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "id",
            "title",
            "body",
            "last_touched"
          ]
        },
        "additionalItems": false
      }
    },
    "additionalProperties": false,
    "required": [
      "encrypted",
      "notes"
    ]
   }

AUTHOR
------

Roland Bracewell Shoemaker <rolandshoemaker@gmail.com>

LICENSE
-------

theca is licensed under the MIT license <http://opensource.org/licenses/MIT>.

SEE ALSO
--------

memo(1)


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
  <item
    android:state_window_focused="false" android:state_enabled="true"
    android:drawable="@drawable/quick_checkin" />
  <item
    android:state_window_focused="false" android:state_enabled="false"
    android:drawable="@drawable/quick_checkin_disabled" />
  <item
    android:state_pressed="true"
    android:drawable="@drawable/quick_checkin_selected" />
  <item
    android:state_focused="true" android:state_enabled="true"
    android:drawable="@drawable/quick_checkin_selected" />
  <item
    android:state_enabled="true"
    android:drawable="@drawable/quick_checkin" />
  <item
    android:state_focused="true"
    android:drawable="@drawable/quick_checkin_disabled" />
  <item
    android:drawable="@drawable/quick_checkin_disabled" />
</selector>


text:
#ifdef TVM_LLVM_VERSION

#include <tvm/base.h>
#include <mutex>
#include "./llvm_common.h"

namespace tvm {
namespace codegen {

struct LLVMEnv {
  std::mutex mu;
  bool all_initialized{false};

  static LLVMEnv* Global() {
    static LLVMEnv inst;
    return &inst;
  }
};

void InitializeLLVM() {
  LLVMEnv* e = LLVMEnv::Global();
  if (!e->all_initialized) {
    std::lock_guard<std::mutex> lock(e->mu);
    if (!e->all_initialized) {
      e->all_initialized = true;
      llvm::InitializeAllTargetInfos();
      llvm::InitializeAllTargets();
      llvm::InitializeAllTargetMCs();
      llvm::InitializeAllAsmParsers();
      llvm::InitializeAllAsmPrinters();
    }
  }
}

void ParseLLVMTargetOptions(const std::string& target_str,
                            std::string* triple,
                            std::string* mcpu,
                            std::string* mattr,
                            llvm::TargetOptions* options) {
  // setup target triple
  size_t start = 0;
  if (target_str.length() >= 4 &&
      target_str.substr(0, 4) == "llvm") {
    start = 4;
  }
  // simple parser
  triple->resize(0);
  mcpu->resize(0);
  mattr->resize(0);

  bool soft_float_abi = false;
  std::string key, value;
  std::istringstream is(target_str.substr(start, target_str.length() - start));

  while (is >> key) {
    if (key == "--system-lib" || key == "-system-lib") {
      continue;
    }
    size_t pos = key.find('=');
    if (pos != std::string::npos) {
      CHECK_GE(key.length(), pos + 1)
          << "inavlid argument " << key;
      value = key.substr(pos + 1, key.length() - 1);
      key = key.substr(0, pos);
    } else {
      CHECK(is >> value)
          << "Unspecified value for option " << key;
    }
    if (key == "-target" ||
        key == "-mtriple") {
      *triple = value;
    } else if (key == "-mcpu") {
      *mcpu = value;
    } else if (key == "-mattr") {
      *mattr = value;
    } else if (key == "-mfloat-abi") {
      if (value == "hard") {
        soft_float_abi = false;
      } else if (value == "soft") {
        soft_float_abi = true;
      } else {
        LOG(FATAL) << "invalid -mfloat-abi option " << value;
      }
    } else if (key == "-device" || key == "-libs" || key == "-model") {
      // pass
    } else {
      LOG(FATAL) << "unknown option " << key;
    }
  }

  if (triple->length() == 0 ||
      *triple == "default") {
    *triple = llvm::sys::getDefaultTargetTriple();
  }
  // set target option
  llvm::TargetOptions& opt = *options;
  opt = llvm::TargetOptions();
  #if TVM_LLVM_VERSION < 50
  opt.LessPreciseFPMADOption = true;
  #endif
  opt.AllowFPOpFusion = llvm::FPOpFusion::Fast;
  opt.UnsafeFPMath = true;
  opt.NoInfsFPMath = true;
  opt.NoNaNsFPMath = true;
  if (soft_float_abi) {
    opt.FloatABIType = llvm::FloatABI::Soft;
  } else {
    opt.FloatABIType = llvm::FloatABI::Hard;
  }
}

llvm::TargetMachine*
GetLLVMTargetMachine(const std::string& target_str,
                     bool allow_null) {
  std::string target_triple, mcpu, mattr;
  llvm::TargetOptions opt;

  ParseLLVMTargetOptions(target_str,
                         &target_triple,
                         &mcpu,
                         &mattr,
                         &opt);

  if (target_triple.length() == 0 ||
      target_triple == "default") {
    target_triple = llvm::sys::getDefaultTargetTriple();
  }
  if (mcpu.length() == 0) {
    mcpu = "generic";
  }

  std::string err;
  const llvm::Target* target =
      llvm::TargetRegistry::lookupTarget(target_triple, err);
  if (target == nullptr) {
    CHECK(allow_null) << err << " target_triple=" << target_triple;
    return nullptr;
  }
  llvm::TargetMachine* tm = target->createTargetMachine(
      target_triple, mcpu, mattr, opt, llvm::Reloc::PIC_);
  return tm;
}

}  // namespace codegen
}  // namespace tvm
#endif  // TVM_LLVM_VERSION


text:
(function() {

var checkVersion = Dagaz.Model.checkVersion;

Dagaz.Model.checkVersion = function(design, name, value) {
  if (name != "fanorona-fix") {
     checkVersion(design, name, value);
  }
}

var CheckInvariants = Dagaz.Model.CheckInvariants;

Dagaz.Model.CheckInvariants = function(board) {
  var design = Dagaz.Model.design;
  _.each(board.moves, function(move) {
      var piece = null;
      _.each(move.actions, function(a) {
          if ((a[0] !== null) && (a[1] !== null)) {
              if (piece === null) {
                  piece = board.getPiece(a[0][0]);
              }
              a[2] = [piece];
          }
      });
  });
  CheckInvariants(board);
}

})();


text:
using Sync.Command;
using Sync.Plugins;
using Sync.Tools;
using System;
using System.Collections.Generic;
using static Sync.Tools.IO;
using static Sync.Tools.DefaultI18n;
using Sync.Client;
using Sync.Source;
using System.Reflection;
using System.Diagnostics;

namespace Sync
{
    /// <summary>
    /// A manager for global modules
    /// </summary>
    public class SyncHost
    {
        public static SyncHost Instance { get; internal set; }

        private SourceWorkWrapper sourceWrapper;
        private ClientWorkWrapper clientWrapper;
        private CommandManager commands;
        private PluginManager plugins;
        private SourceManager sources;
        private FilterManager filters;
        private MessageDispatcher messages;
        private ClientManager clients;
        /// <summary>
        /// Internal use only
        /// </summary>
        internal SyncHost()
        {

        }

        /// <summary>
        /// Invoke to load plugins
        /// </summary>
        internal void Load()
        {
            CurrentIO.Write(LANG_Loading);

            //Initial plugins manager
            plugins = new PluginManager();
            CurrentIO.WriteColor(String.Format(LANG_Plugins, plugins.LoadPlugins()), ConsoleColor.Green);

            //Initial danmaku source
            sources = new SourceManager();
            CurrentIO.WriteColor(String.Format(LANG_Sources, plugins.LoadSources()), ConsoleColor.Green);

            //select a danmaku source by config
            try
            {
                sourceWrapper = new SourceWorkWrapper(sources);
                PluginEvents.Instance.RaiseEvent(new PluginEvents.InitSourceWarpperEvent(sourceWrapper));
            }
            catch
            {
                CurrentIO.Write("");
                CurrentIO.WriteColor(LANG_Error, ConsoleColor.Red);
                CurrentIO.WriteColor("Press enter to continue", ConsoleColor.Red);
                CurrentIO.ReadCommand();
            }

            //Get clients singleton
            clients = ClientManager.Instance;
            CurrentIO.WriteColor(String.Format(LANG_Client, plugins.LoadClients()), ConsoleColor.Green);

            clientWrapper = new ClientWorkWrapper(clients);
            PluginEvents.Instance.RaiseEvent(new PluginEvents.InitClientWarpperEvent(clientWrapper));

            commands = new CommandManager();
            CurrentIO.WriteColor(String.Format(LANG_Commands, plugins.LoadCommnads()), ConsoleColor.Green);

            filters = new FilterManager();
            CurrentIO.WriteColor(String.Format(LANG_Filters, plugins.LoadFilters()), ConsoleColor.Green);

            messages = new MessageDispatcher(filters);

            plugins.ReadyProgram();

            CurrentIO.WriteColor(LANG_Ready, ConsoleColor.Cyan);
        }

        /// <summary>
        /// The internal PluginManager instance property
        /// </summary>
        internal PluginManager Plugins { get { return plugins; } }

        /// <summary>
        /// Read only plugins list
        /// </summary>
        /// <returns></returns>
        public IEnumerable<Plugin> EnumPluings()
        {
            return plugins.GetPlugins();
        }

        public CommandManager Commands
        {
            get
            {
                return commands;
            }
        }

        public SourceManager Sources
        {
            get
            {
                return sources;
            }
        }

        public FilterManager Filters
        {
            get
            {
                return filters;
            }
        }

        public MessageDispatcher Messages
        {
            get { return messages; }
        }

        public ClientManager Clients { get => clients; }

        public SourceWorkWrapper SourceWrapper { get => sourceWrapper; }

        public ClientWorkWrapper ClientWrapper { get => clientWrapper; }

        public void ExitSync()
        {
            try
            {
                SaveSync();
            }
            finally
            {
                Environment.Exit(0);
            }
        }

        public void SaveSync()
        {
            ClientWrapper?.Client?.StopWork();
            SourceWrapper?.Source?.Disconnect();

            foreach (var item in PluginConfigurationManager.ConfigurationSet)
            {
                item.SaveAll();
            }

            plugins.GetPluginList().ForEach(p => p.OnExit());

        }

        public void RestartSync()
        {
            try
            {
                SaveSync();
            }
            finally
            {
                ForceRestartSync();
            }
        }

        public void ForceRestartSync()
        {
            Process.Start(Assembly.GetEntryAssembly().Location);
            Environment.Exit(0);
        }
    }
}


text:
layout: post
title: Church App
date:   2015-01-04 13:08:00
categories: portfolio
image: church-app.jpg
short_name: Church App
description: an app built with Cordova. App was built for many churches to interact with accompanying church software.
---

We built a massively reproducible app that works hand-in-hand with the church software we built. Designed to be replicated for each church on the system with custom graphics and theming
{{ except }}

More on this soon...


text:
using System;
using System.Diagnostics;
using System.Threading;
using System.Reflection;
using System.Web;
using System.Runtime.Remoting.Messaging;

namespace Amib.Threading.Internal
{
#region CallerThreadContext class

    /// <summary>
    /// This class stores the caller call context in order to restore
    /// it when the work item is executed in the thread pool environment.
    /// </summary>
    internal class CallerThreadContext
    {
#region Prepare reflection information

        // Cached type information.
        private static readonly MethodInfo getLogicalCallContextMethodInfo =
            typeof(Thread).GetMethod("GetLogicalCallContext", BindingFlags.Instance | BindingFlags.NonPublic);

        private static readonly MethodInfo setLogicalCallContextMethodInfo =
            typeof(Thread).GetMethod("SetLogicalCallContext", BindingFlags.Instance | BindingFlags.NonPublic);

        private static string HttpContextSlotName = GetHttpContextSlotName();

        private static string GetHttpContextSlotName()
        {
            FieldInfo fi = typeof(HttpContext).GetField("CallContextSlotName", BindingFlags.Static | BindingFlags.NonPublic);

            if (fi != null)
            {
                return (string) fi.GetValue(null);
            }

            return "HttpContext";
        }

        #endregion

#region Private fields

        private HttpContext _httpContext;
        private LogicalCallContext _callContext;

        #endregion

        /// <summary>
        /// Constructor
        /// </summary>
        private CallerThreadContext()
        {
        }

        public bool CapturedCallContext
        {
            get
            {
                return (null != _callContext);
            }
        }

        public bool CapturedHttpContext
        {
            get
            {
                return (null != _httpContext);
            }
        }

        /// <summary>
        /// Captures the current thread context
        /// </summary>
        /// <returns></returns>
        public static CallerThreadContext Capture(
            bool captureCallContext,
            bool captureHttpContext)
        {
            Debug.Assert(captureCallContext || captureHttpContext);

            CallerThreadContext callerThreadContext = new CallerThreadContext();

            // TODO: In NET 2.0, redo using the new feature of ExecutionContext class - Capture()
            // Capture Call Context
            if(captureCallContext && (getLogicalCallContextMethodInfo != null))
            {
                callerThreadContext._callContext = (LogicalCallContext)getLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread, null);
                if (callerThreadContext._callContext != null)
                {
                    callerThreadContext._callContext = (LogicalCallContext)callerThreadContext._callContext.Clone();
                }
            }

            // Capture httpContext
            if (captureHttpContext && (null != HttpContext.Current))
            {
                callerThreadContext._httpContext = HttpContext.Current;
            }

            return callerThreadContext;
        }

        /// <summary>
        /// Applies the thread context stored earlier
        /// </summary>
        /// <param name="callerThreadContext"></param>
        public static void Apply(CallerThreadContext callerThreadContext)
        {
            if (null == callerThreadContext)
            {
                throw new ArgumentNullException("callerThreadContext");
            }

            // Todo: In NET 2.0, redo using the new feature of ExecutionContext class - Run()
            // Restore call context
            if ((callerThreadContext._callContext != null) && (setLogicalCallContextMethodInfo != null))
            {
                setLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread, new object[] { callerThreadContext._callContext });
            }

            // Restore HttpContext
            if (callerThreadContext._httpContext != null)
            {
                HttpContext.Current = callerThreadContext._httpContext;
                //CallContext.SetData(HttpContextSlotName, callerThreadContext._httpContext);
            }
        }
    }

    #endregion
}
#endif


text:
namespace Avdm.Scheduler.Core
{
    public interface INodeTrigger
    {
        string Cron { get; }
        string Description { get; }
    }
}