text:
.class public final Landroid/view/Display;
.super Ljava/lang/Object;
.source "Display.java"

# static fields
.field private static final CACHED_APP_SIZE_DURATION_MILLIS:I = 0x14

.field private static final DEBUG:Z = false

.field public static final DEFAULT_DISPLAY:I = 0x0

.field public static final FLAG_PRESENTATION:I = 0x8

.field public static final FLAG_PRIVATE:I = 0x4

.field public static final FLAG_SECURE:I = 0x2

.field public static final FLAG_SUPPORTS_PROTECTED_BUFFERS:I = 0x1

.field public static final STATE_DOZE:I = 0x3

.field public static final STATE_DOZE_SUSPEND:I = 0x4

.field public static final STATE_OFF:I = 0x1

.field public static final STATE_ON:I = 0x2

.field public static final STATE_UNKNOWN:I = 0x0

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

.field public static final TYPE_BUILT_IN:I = 0x1

.field public static final TYPE_HDMI:I = 0x2

.field public static final TYPE_OVERLAY:I = 0x4

.field public static final TYPE_UNKNOWN:I = 0x0

.field public static final TYPE_VIRTUAL:I = 0x5

.field public static final TYPE_WIFI:I = 0x3

# instance fields
.field private final mAddress:Ljava/lang/String;

.field private mCachedAppHeightCompat:I

.field private mCachedAppWidthCompat:I

.field private final mDisplayAdjustments:Landroid/view/DisplayAdjustments;

.field private final mDisplayId:I

.field private mDisplayInfo:Landroid/view/DisplayInfo;

.field private final mFlags:I

.field private final mGlobal:Landroid/hardware/display/DisplayManagerGlobal;

.field private mIsValid:Z

.field private mLastCachedAppSizeUpdate:J

.field private final mLayerStack:I

.field private final mOwnerPackageName:Ljava/lang/String;

.field private final mOwnerUid:I

.field private final mTempMetrics:Landroid/util/DisplayMetrics;

.field private final mType:I

# direct methods
.method public constructor <init>(Landroid/hardware/display/DisplayManagerGlobal;ILandroid/view/DisplayInfo;Landroid/view/DisplayAdjustments;)V
    .locals 1
    .param p1, "global"    # Landroid/hardware/display/DisplayManagerGlobal;
    .param p2, "displayId"    # I
    .param p3, "displayInfo"    # Landroid/view/DisplayInfo;
    .param p4, "daj"    # Landroid/view/DisplayAdjustments;

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

    .line 72
    new-instance v0, Landroid/util/DisplayMetrics;

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

    iput-object v0, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    .line 263
    iput-object p1, p0, Landroid/view/Display;->mGlobal:Landroid/hardware/display/DisplayManagerGlobal;

    .line 264
    iput p2, p0, Landroid/view/Display;->mDisplayId:I

    .line 265
    iput-object p3, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    .line 266
    new-instance v0, Landroid/view/DisplayAdjustments;

    invoke-direct {v0, p4}, Landroid/view/DisplayAdjustments;-><init>(Landroid/view/DisplayAdjustments;)V

    iput-object v0, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    .line 267
    const/4 v0, 0x1

    iput-boolean v0, p0, Landroid/view/Display;->mIsValid:Z

    .line 270
    iget v0, p3, Landroid/view/DisplayInfo;->layerStack:I

    iput v0, p0, Landroid/view/Display;->mLayerStack:I

    .line 271
    iget v0, p3, Landroid/view/DisplayInfo;->flags:I

    iput v0, p0, Landroid/view/Display;->mFlags:I

    .line 272
    iget v0, p3, Landroid/view/DisplayInfo;->type:I

    iput v0, p0, Landroid/view/Display;->mType:I

    .line 273
    iget-object v0, p3, Landroid/view/DisplayInfo;->address:Ljava/lang/String;

    iput-object v0, p0, Landroid/view/Display;->mAddress:Ljava/lang/String;

    .line 274
    iget v0, p3, Landroid/view/DisplayInfo;->ownerUid:I

    iput v0, p0, Landroid/view/Display;->mOwnerUid:I

    .line 275
    iget-object v0, p3, Landroid/view/DisplayInfo;->ownerPackageName:Ljava/lang/String;

    iput-object v0, p0, Landroid/view/Display;->mOwnerPackageName:Ljava/lang/String;

    .line 276
    return-void
.end method

.method public static hasAccess(III)Z
    .locals 1
    .param p0, "uid"    # I
    .param p1, "flags"    # I
    .param p2, "ownerUid"    # I

    .prologue
    .line 749
    and-int/lit8 v0, p1, 0x4

    if-eqz v0, :cond_0

    if-eq p0, p2, :cond_0

    const/16 v0, 0x3e8

    if-eq p0, v0, :cond_0

    if-nez p0, :cond_1

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public static isSuspendedState(I)Z
    .locals 2
    .param p0, "state"    # I

    .prologue
    const/4 v0, 0x1

    .line 857
    if-eq p0, v0, :cond_0

    const/4 v1, 0x4

    if-ne p0, v1, :cond_1

    :cond_0
    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public static stateToString(I)Ljava/lang/String;
    .locals 1
    .param p0, "state"    # I

    .prologue
    .line 835
    packed-switch p0, :pswitch_data_0

    .line 847
    invoke-static {p0}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v0

    :goto_0
    return-object v0

    .line 837
    :pswitch_0
    const-string v0, "UNKNOWN"

    goto :goto_0

    .line 839
    :pswitch_1
    const-string v0, "OFF"

    goto :goto_0

    .line 841
    :pswitch_2
    const-string v0, "ON"

    goto :goto_0

    .line 843
    :pswitch_3
    const-string v0, "DOZE"

    goto :goto_0

    .line 845
    :pswitch_4
    const-string v0, "DOZE_SUSPEND"

    goto :goto_0

    .line 835
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
    .end packed-switch
.end method

.method public static typeToString(I)Ljava/lang/String;
    .locals 1
    .param p0, "type"    # I

    .prologue
    .line 813
    packed-switch p0, :pswitch_data_0

    .line 827
    invoke-static {p0}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v0

    :goto_0
    return-object v0

    .line 815
    :pswitch_0
    const-string v0, "UNKNOWN"

    goto :goto_0

    .line 817
    :pswitch_1
    const-string v0, "BUILT_IN"

    goto :goto_0

    .line 819
    :pswitch_2
    const-string v0, "HDMI"

    goto :goto_0

    .line 821
    :pswitch_3
    const-string v0, "WIFI"

    goto :goto_0

    .line 823
    :pswitch_4
    const-string v0, "OVERLAY"

    goto :goto_0

    .line 825
    :pswitch_5
    const-string v0, "VIRTUAL"

    goto :goto_0

    .line 813
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_5
    .end packed-switch
.end method

.method private updateCachedAppSizeIfNeededLocked()V
    .locals 6

    .prologue
    .line 788
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v0

    .line 789
    .local v0, "now":J
    iget-wide v2, p0, Landroid/view/Display;->mLastCachedAppSizeUpdate:J

    const-wide/16 v4, 0x14

    add-long/2addr v2, v4

    cmp-long v2, v0, v2

    if-lez v2, :cond_0

    .line 790
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 791
    iget-object v2, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v3, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget-object v4, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    invoke-virtual {v2, v3, v4}, Landroid/view/DisplayInfo;->getAppMetrics(Landroid/util/DisplayMetrics;Landroid/view/DisplayAdjustments;)V

    .line 792
    iget-object v2, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget v2, v2, Landroid/util/DisplayMetrics;->widthPixels:I

    iput v2, p0, Landroid/view/Display;->mCachedAppWidthCompat:I

    .line 793
    iget-object v2, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget v2, v2, Landroid/util/DisplayMetrics;->heightPixels:I

    iput v2, p0, Landroid/view/Display;->mCachedAppHeightCompat:I

    .line 794
    iput-wide v0, p0, Landroid/view/Display;->mLastCachedAppSizeUpdate:J

    .line 796
    :cond_0
    return-void
.end method

.method private updateDisplayInfoLocked()V
    .locals 3

    .prologue
    .line 766
    iget-object v1, p0, Landroid/view/Display;->mGlobal:Landroid/hardware/display/DisplayManagerGlobal;

    iget v2, p0, Landroid/view/Display;->mDisplayId:I

    invoke-virtual {v1, v2}, Landroid/hardware/display/DisplayManagerGlobal;->getDisplayInfo(I)Landroid/view/DisplayInfo;

    move-result-object v0

    .line 767
    .local v0, "newInfo":Landroid/view/DisplayInfo;
    if-nez v0, :cond_1

    .line 769
    iget-boolean v1, p0, Landroid/view/Display;->mIsValid:Z

    if-eqz v1, :cond_0

    .line 770
    const/4 v1, 0x0

    iput-boolean v1, p0, Landroid/view/Display;->mIsValid:Z

    .line 785
    :cond_0
    :goto_0
    return-void

    .line 777
    :cond_1
    iput-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    .line 778
    iget-boolean v1, p0, Landroid/view/Display;->mIsValid:Z

    if-nez v1, :cond_0

    .line 779
    const/4 v1, 0x1

    iput-boolean v1, p0, Landroid/view/Display;->mIsValid:Z

    goto :goto_0
.end method

# virtual methods
.method public getAddress()Ljava/lang/String;
    .locals 1

    .prologue
    .line 375
    iget-object v0, p0, Landroid/view/Display;->mAddress:Ljava/lang/String;

    return-object v0
.end method

.method public getAppVsyncOffsetNanos()J
    .locals 2

    .prologue
    .line 638
    monitor-enter p0

    .line 639
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 640
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-wide v0, v0, Landroid/view/DisplayInfo;->appVsyncOffsetNanos:J

    monitor-exit p0

    return-wide v0

    .line 641
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getCurrentSizeRange(Landroid/graphics/Point;Landroid/graphics/Point;)V
    .locals 1
    .param p1, "outSmallestSize"    # Landroid/graphics/Point;
    .param p2, "outLargestSize"    # Landroid/graphics/Point;

    .prologue
    .line 503
    monitor-enter p0

    .line 504
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 505
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->smallestNominalAppWidth:I

    iput v0, p1, Landroid/graphics/Point;->x:I

    .line 506
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->smallestNominalAppHeight:I

    iput v0, p1, Landroid/graphics/Point;->y:I

    .line 507
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->largestNominalAppWidth:I

    iput v0, p2, Landroid/graphics/Point;->x:I

    .line 508
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->largestNominalAppHeight:I

    iput v0, p2, Landroid/graphics/Point;->y:I

    .line 509
    monitor-exit p0

    .line 510
    return-void

    .line 509
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getDisplayAdjustments()Landroid/view/DisplayAdjustments;
    .locals 1

    .prologue
    .line 411
    iget-object v0, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    return-object v0
.end method

.method public getDisplayId()I
    .locals 1

    .prologue
    .line 286
    iget v0, p0, Landroid/view/Display;->mDisplayId:I

    return v0
.end method

.method public getDisplayInfo(Landroid/view/DisplayInfo;)Z
    .locals 1
    .param p1, "outDisplayInfo"    # Landroid/view/DisplayInfo;

    .prologue
    .line 317
    monitor-enter p0

    .line 318
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 319
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    invoke-virtual {p1, v0}, Landroid/view/DisplayInfo;->copyFrom(Landroid/view/DisplayInfo;)V

    .line 320
    iget-boolean v0, p0, Landroid/view/Display;->mIsValid:Z

    monitor-exit p0

    return v0

    .line 321
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getFlags()I
    .locals 1

    .prologue
    .line 347
    iget v0, p0, Landroid/view/Display;->mFlags:I

    return v0
.end method

.method public getHeight()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 540
    monitor-enter p0

    .line 541
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateCachedAppSizeIfNeededLocked()V

    .line 542
    iget v0, p0, Landroid/view/Display;->mCachedAppHeightCompat:I

    monitor-exit p0

    return v0

    .line 543
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getLayerStack()I
    .locals 1

    .prologue
    .line 334
    iget v0, p0, Landroid/view/Display;->mLayerStack:I

    return v0
.end method

.method public getMaximumSizeDimension()I
    .locals 2

    .prologue
    .line 518
    monitor-enter p0

    .line 519
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 520
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->logicalWidth:I

    iget-object v1, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v1, v1, Landroid/view/DisplayInfo;->logicalHeight:I

    invoke-static {v0, v1}, Ljava/lang/Math;->max(II)I

    move-result v0

    monitor-exit p0

    return v0

    .line 521
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getMetrics(Landroid/util/DisplayMetrics;)V
    .locals 2
    .param p1, "outMetrics"    # Landroid/util/DisplayMetrics;

    .prologue
    .line 677
    monitor-enter p0

    .line 678
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 679
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v1, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    invoke-virtual {v0, p1, v1}, Landroid/view/DisplayInfo;->getAppMetrics(Landroid/util/DisplayMetrics;Landroid/view/DisplayAdjustments;)V

    .line 680
    invoke-virtual {p0}, Landroid/view/Display;->getDisplayId()I

    move-result v0

    if-nez v0, :cond_0

    .line 681
    sget v0, Landroid/util/DisplayMetrics;->DENSITY_DEVICE_DEFAULT:I

    iput v0, p1, Landroid/util/DisplayMetrics;->densityDpi:I

    .line 683
    :cond_0
    monitor-exit p0

    .line 684
    return-void

    .line 683
    :catchall_0
    move-exception v0

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

    throw v0
.end method

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

    .prologue
    .line 423
    monitor-enter p0

    .line 424
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 425
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v0, v0, Landroid/view/DisplayInfo;->name:Ljava/lang/String;

    monitor-exit p0

    return-object v0

    .line 426
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getOrientation()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 592
    invoke-virtual {p0}, Landroid/view/Display;->getRotation()I

    move-result v0

    return v0
.end method

.method public getOverscanInsets(Landroid/graphics/Rect;)V
    .locals 4
    .param p1, "outRect"    # Landroid/graphics/Rect;

    .prologue
    .line 553
    monitor-enter p0

    .line 554
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 555
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->overscanLeft:I

    iget-object v1, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v1, v1, Landroid/view/DisplayInfo;->overscanTop:I

    iget-object v2, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v2, v2, Landroid/view/DisplayInfo;->overscanRight:I

    iget-object v3, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v3, v3, Landroid/view/DisplayInfo;->overscanBottom:I

    invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Rect;->set(IIII)V

    .line 557
    monitor-exit p0

    .line 558
    return-void

    .line 557
    :catchall_0
    move-exception v0

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

    throw v0
.end method

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

    .prologue
    .line 401
    iget-object v0, p0, Landroid/view/Display;->mOwnerPackageName:Ljava/lang/String;

    return-object v0
.end method

.method public getOwnerUid()I
    .locals 1

    .prologue
    .line 388
    iget v0, p0, Landroid/view/Display;->mOwnerUid:I

    return v0
.end method

.method public getPixelFormat()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 604
    const/4 v0, 0x1

    return v0
.end method

.method public getPresentationDeadlineNanos()J
    .locals 2

    .prologue
    .line 656
    monitor-enter p0

    .line 657
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 658
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-wide v0, v0, Landroid/view/DisplayInfo;->presentationDeadlineNanos:J

    monitor-exit p0

    return-wide v0

    .line 659
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getRealMetrics(Landroid/util/DisplayMetrics;)V
    .locals 3
    .param p1, "outMetrics"    # Landroid/util/DisplayMetrics;

    .prologue
    .line 718
    monitor-enter p0

    .line 719
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 720
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    sget-object v1, Landroid/content/res/CompatibilityInfo;->DEFAULT_COMPATIBILITY_INFO:Landroid/content/res/CompatibilityInfo;

    iget-object v2, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    invoke-virtual {v2}, Landroid/view/DisplayAdjustments;->getActivityToken()Landroid/os/IBinder;

    move-result-object v2

    invoke-virtual {v0, p1, v1, v2}, Landroid/view/DisplayInfo;->getLogicalMetrics(Landroid/util/DisplayMetrics;Landroid/content/res/CompatibilityInfo;Landroid/os/IBinder;)V

    .line 723
    monitor-exit p0

    .line 724
    return-void

    .line 723
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getRealSize(Landroid/graphics/Point;)V
    .locals 1
    .param p1, "outSize"    # Landroid/graphics/Point;

    .prologue
    .line 699
    monitor-enter p0

    .line 700
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 701
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->logicalWidth:I

    iput v0, p1, Landroid/graphics/Point;->x:I

    .line 702
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->logicalHeight:I

    iput v0, p1, Landroid/graphics/Point;->y:I

    .line 703
    monitor-exit p0

    .line 704
    return-void

    .line 703
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getRectSize(Landroid/graphics/Rect;)V
    .locals 4
    .param p1, "outSize"    # Landroid/graphics/Rect;

    .prologue
    .line 465
    monitor-enter p0

    .line 466
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 467
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v1, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget-object v2, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    invoke-virtual {v0, v1, v2}, Landroid/view/DisplayInfo;->getAppMetrics(Landroid/util/DisplayMetrics;Landroid/view/DisplayAdjustments;)V

    .line 468
    const/4 v0, 0x0

    const/4 v1, 0x0

    iget-object v2, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget v2, v2, Landroid/util/DisplayMetrics;->widthPixels:I

    iget-object v3, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget v3, v3, Landroid/util/DisplayMetrics;->heightPixels:I

    invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Rect;->set(IIII)V

    .line 469
    monitor-exit p0

    .line 470
    return-void

    .line 469
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getRefreshRate()F
    .locals 1

    .prologue
    .line 611
    monitor-enter p0

    .line 612
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 613
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->refreshRate:F

    monitor-exit p0

    return v0

    .line 614
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getRotation()I
    .locals 1

    .prologue
    .line 579
    monitor-enter p0

    .line 580
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 581
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->rotation:I

    monitor-exit p0

    return v0

    .line 582
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getSize(Landroid/graphics/Point;)V
    .locals 3
    .param p1, "outSize"    # Landroid/graphics/Point;

    .prologue
    .line 450
    monitor-enter p0

    .line 451
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 452
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v1, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget-object v2, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    invoke-virtual {v0, v1, v2}, Landroid/view/DisplayInfo;->getAppMetrics(Landroid/util/DisplayMetrics;Landroid/view/DisplayAdjustments;)V

    .line 453
    iget-object v0, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget v0, v0, Landroid/util/DisplayMetrics;->widthPixels:I

    iput v0, p1, Landroid/graphics/Point;->x:I

    .line 454
    iget-object v0, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget v0, v0, Landroid/util/DisplayMetrics;->heightPixels:I

    iput v0, p1, Landroid/graphics/Point;->y:I

    .line 455
    monitor-exit p0

    .line 456
    return-void

    .line 455
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getState()I
    .locals 1

    .prologue
    .line 733
    monitor-enter p0

    .line 734
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 735
    iget-boolean v0, p0, Landroid/view/Display;->mIsValid:Z

    if-eqz v0, :cond_0

    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget v0, v0, Landroid/view/DisplayInfo;->state:I

    :goto_0
    monitor-exit p0

    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0

    .line 736
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public getSupportedRefreshRates()[F
    .locals 2

    .prologue
    .line 621
    monitor-enter p0

    .line 622
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 623
    iget-object v1, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v0, v1, Landroid/view/DisplayInfo;->supportedRefreshRates:[F

    .line 624
    .local v0, "refreshRates":[F
    array-length v1, v0

    invoke-static {v0, v1}, Ljava/util/Arrays;->copyOf([FI)[F

    move-result-object v1

    monitor-exit p0

    return-object v1

    .line 625
    .end local v0    # "refreshRates":[F
    :catchall_0
    move-exception v1

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

    throw v1
.end method

.method public getType()I
    .locals 1

    .prologue
    .line 364
    iget v0, p0, Landroid/view/Display;->mType:I

    return v0
.end method

.method public getWidth()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 529
    monitor-enter p0

    .line 530
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateCachedAppSizeIfNeededLocked()V

    .line 531
    iget v0, p0, Landroid/view/Display;->mCachedAppWidthCompat:I

    monitor-exit p0

    return v0

    .line 532
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public hasAccess(I)Z
    .locals 2
    .param p1, "uid"    # I

    .prologue
    .line 744
    iget v0, p0, Landroid/view/Display;->mFlags:I

    iget v1, p0, Landroid/view/Display;->mOwnerUid:I

    invoke-static {p1, v0, v1}, Landroid/view/Display;->hasAccess(III)Z

    move-result v0

    return v0
.end method

.method public isPublicPresentation()Z
    .locals 2

    .prologue
    .line 760
    iget v0, p0, Landroid/view/Display;->mFlags:I

    and-int/lit8 v0, v0, 0xc

    const/16 v1, 0x8

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isValid()Z
    .locals 1

    .prologue
    .line 303
    monitor-enter p0

    .line 304
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 305
    iget-boolean v0, p0, Landroid/view/Display;->mIsValid:Z

    monitor-exit p0

    return v0

    .line 306
    :catchall_0
    move-exception v0

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

    throw v0
.end method

.method public toString()Ljava/lang/String;
    .locals 3

    .prologue
    .line 801
    monitor-enter p0

    .line 802
    :try_start_0
    invoke-direct {p0}, Landroid/view/Display;->updateDisplayInfoLocked()V

    .line 803
    iget-object v0, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

    iget-object v1, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

    iget-object v2, p0, Landroid/view/Display;->mDisplayAdjustments:Landroid/view/DisplayAdjustments;

    invoke-virtual {v0, v1, v2}, Landroid/view/DisplayInfo;->getAppMetrics(Landroid/util/DisplayMetrics;Landroid/view/DisplayAdjustments;)V

    .line 804
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "Display id "

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

    move-result-object v0

    iget v1, p0, Landroid/view/Display;->mDisplayId:I

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

    move-result-object v0

    const-string v1, ": "

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

    move-result-object v0

    iget-object v1, p0, Landroid/view/Display;->mDisplayInfo:Landroid/view/DisplayInfo;

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

    move-result-object v0

    const-string v1, ", "

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

    move-result-object v0

    iget-object v1, p0, Landroid/view/Display;->mTempMetrics:Landroid/util/DisplayMetrics;

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

    move-result-object v0

    const-string v1, ", isValid="

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

    move-result-object v0

    iget-boolean v1, p0, Landroid/view/Display;->mIsValid:Z

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

    move-result-object v0

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

    move-result-object v0

    monitor-exit p0

    return-object v0

    .line 806
    :catchall_0
    move-exception v0

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

    throw v0
.end method


text:
<?php
/** extendsions/ldap/controller.php
 *  Used for testing the ldap functions
 */
class ldap extends GarageSale\Controller {

    /** Index is the entry point for the blog. It simply shows the most
     *  recent posts and can scroll by page.
     *  @param array $args The arguments passed to the controller via
     *         the url. This contains $args['name'] only.
     */
    function test( $args ){

        $ldap = $this->app->extension('ldap');

        $this->view->add('user_args',$ldap->get_user($args['name']));

        /*
        $stmt = $this->app->db->select('reviews');
        $stmt->average('rating','rating_average')->
            where('userid','i',1)->where('status','i',
                GarageSale\BaseDatabase::STATUS_ACTIVE)->
            limit(1);

        echo $stmt->get_query();
        $this->view->add('result',$this->app->db->
            statement_result($stmt));*/
    }

}
?>

redpajama_set_name: RedPajamaGithub


text:
Makes package development easier by editing them on any project via the same central filesystem location.

### Introduction

This Composer plugin simplifies the development of packages that are being used on multiple projects.

During a project's package installation (via `composer install` or `composer update`), it creates symlinks on a "junction directory" for each package that is "exposed".

Which packages are selected for exposure is determined by a set of matching patterns that are defined the project's `composer.json` or on a global `composer.json` (which defines rules for all projects).

The same packages on different projects will always be available on the same location on the junction directory; all you have to do is to run the `composer expose` command whenever you switch projects.

Additionaly, it creates a backup of all exposed packages to a "source directory", which can be exposed on the junction directory by running the `composer expose-source` command.

Finally, you can get status information about which packages on a project are being exposed by running the `composer expose-status` command.

#### Use cases

These features are quite useful when you want to:

  - edit packages on their own repository (the 'source directory') or directly on any of the projects that use them, but always via the same central filesystem location (the junction directory);
  - register a package's repository only once on your VCS GUI client (ex: Git), and reuse that registration for any project you work on that uses that package;
  - automatically configure an authenticated `origin` remote with write permissions, for all exposed packages.

#### Additional Features

- On MacOS, if you have SourceTree installed, it updates the registered repository paths to use the junction directories, not the symlink targets (SourceTree must not be running); this needs to be done only once for each repository;
- Supports custom package installation directories, where some packages may use installer plugins that install them to alternative locations (other than the default `vendor` directory);
- Supports customizing the vendor directory location using the `config.vendor-dir` standard Composer setting;
- Supports symlinking on Windows (using "junctions") - `To be done`.

### Requirements

- PHP version >= 5.6
- Operating System: Mac OS X, Linux or Windows (Vista, Server 2008 or a newer version)

### Installing

The **recommended** setup is to **install the plugin globally** and set its configuration also globally. This way you avoid polluting each project's `composer.json` with information relative to this plugin which will be of no use neither to other developers nor to users of those projects.

##### To install globally on your development machine

If it doesn't exist yet, create a `composer.json` file on the composer's configuration folder (usually at `~/.composer`).

> Ex: `~/.composer/composer.json`

Add `php-kit/composer-expose-packages-plugin` to the `composer.json`'s `require` setting.

Run `composer global update` anywhere.

> The plugin will be active for **all** projects **on your machine only**.
No packages will be exposed until you configure the plugin to expose **specific** packages and then perform a `composer install|update|expose|expose-source` operation.

##### To install locally, per project

Add `php-kit/composer-expose-packages-plugin` to the `composer.json`'s `require-dev` setting of those projects that will use shared packages.

Delete all packages that you whish to expose and then run `composer update` on the project folder.

> On production, this plugin will not be installed and no packages wil be shared if you run `composer install -no-dev`. That is why the plugin name should be added to `required-dev` and not to `require`.

### Configuring

> From this point on, when mentioning `composer.json`, I mean the global one or the project's one, depending on the type of installation you have chosen.

> The plugin will load both the global configuration (if one exists) and the project configuration (again, if one exists) and merge them.
Project-specific settings will take precedence over global ones.

Add an extra `expose-packages` configuration section to the `composer.json`'s `extra` section.

On that section, you can specify a `match` setting containing an array of `vendor/packages` names or glob patterns.

> If neither a `match` setting exists, nor a name or pattern are specified, no packages will be exposed.

You can also specify a `junctiondDir` setting that defines the directory path of the central access location for exposed packages. It can be a relative or absolute path and you can also use `~` as an alias to the user's home directory. The default is `~/exposed-packages`.

> These configuration settings only apply to the root `composer.json` of your project. Settings specified on packages will have no effect.

> You can use Wikimedia's `composer-merge-plugin` if you need to also merge those settings with the ones from the main project.

Finally, you may specify a `sourceDir` setting that defines the directory path where backup copies of exposed packages are stored.

#### Example

###### global `composer.json` at `~/.composer`

```json
{
  "require": {
    "php-kit/composer-expose-packages-plugin": "^2.0"
  },
  "extra": {
    "expose-packages": {
      "match": [
        "vendor/package",
        "vendor/prefix-*",
        "vendor/package-*-whatever",
        "vendor/wildcards??",
        "vendor/*",
        "*"
      ],
      "junctiondDir": "~/exposed-packages",
      "sourceDir": "~/packages"
    }
  }
}
```

### Debugging

You can run Composer in debug mode with the `-v` flag to enable the output of extended information messages, which can be useful for troubleshooting.

Messages output by this plugin will be prefixed with `[shared-packages-plugin]`.

### TO DO

- Windows support

### License

This library is open-source software licensed under the [MIT license](http://opensource.org/licenses/MIT).

Copyright © 2015 by [Cláudio Silva](claudio.silva@impactwave.com) and [Impactwave Lda](impactwave@impactwave.com).


text:
#include "../../../inc/MarlinConfig.h"

#if HAS_TFT_LVGL_UI && USE_SENSORLESS

#include "draw_ui.h"
#include <lv_conf.h>

#include "../../../module/planner.h"
#include "../../../module/probe.h"
#include "../../../module/stepper/indirection.h"
#include "../../../feature/tmc_util.h"

extern lv_group_t *g;
static lv_obj_t *scr;

enum {
  ID_SENSITIVITY_RETURN = 1,
  ID_SENSITIVITY_X,
  ID_SENSITIVITY_Y,
  ID_SENSITIVITY_Z,
  ID_SENSITIVITY_Z2
};

static void event_handler(lv_obj_t *obj, lv_event_t event) {
  if (event != LV_EVENT_RELEASED) return;
  switch (obj->mks_obj_id) {
    case ID_SENSITIVITY_RETURN:
      lv_clear_homing_sensitivity_settings();
      draw_return_ui();
      break;
    case ID_SENSITIVITY_X:
      value = x_sensitivity;
      lv_clear_homing_sensitivity_settings();
      lv_draw_number_key();
      break;
    case ID_SENSITIVITY_Y:
      value = y_sensitivity;
      lv_clear_homing_sensitivity_settings();
      lv_draw_number_key();
      break;
    case ID_SENSITIVITY_Z:
      value = z_sensitivity;
      lv_clear_homing_sensitivity_settings();
      lv_draw_number_key();
      break;
    #if Z2_SENSORLESS
      case ID_SENSITIVITY_Z2:
      value = z2_sensitivity;
      lv_clear_homing_sensitivity_settings();
      lv_draw_number_key();
      break;
    #endif
  }
}

void lv_draw_homing_sensitivity_settings() {
  scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle);

  itoa(TERN(X_SENSORLESS, stepperX.homing_threshold(), 0), public_buf_l, 10);
  lv_screen_menu_item_1_edit(scr, machine_menu.X_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_SENSITIVITY_X, 0, public_buf_l);

  itoa(TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0), public_buf_l, 10);
  lv_screen_menu_item_1_edit(scr, machine_menu.Y_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_SENSITIVITY_Y, 1, public_buf_l);

  itoa(TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0), public_buf_l, 10);
  lv_screen_menu_item_1_edit(scr, machine_menu.Z_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_SENSITIVITY_Z, 2, public_buf_l);

  #if Z2_SENSORLESS
    itoa(TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0), public_buf_l, 10);
    lv_screen_menu_item_1_edit(scr, machine_menu.Z2_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_SENSITIVITY_Z2, 3, public_buf_l);
  #endif

  lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_SENSITIVITY_RETURN, true);
}

void lv_clear_homing_sensitivity_settings() {
  #if HAS_ROTARY_ENCODER
    if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  #endif
  lv_obj_del(scr);
}

#endif // HAS_TFT_LVGL_UI && USE_SENSORLESS


text:
<?php
/**
 * Unit test for class Eix\Core\Responders\Http\Error.
 */

namespace Eix\Core\Responders\Http;

use Eix\Core\Requests\Exception;
use Eix\Core\Requests\Http as HttpRequest;
use Eix\Core\Requests\Http\Error as ErrorRequest;
use Eix\Core\Responders\Http\Error as ErrorResponder;

class ErrorTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @expectedException \InvalidArgumentException
     */
    public function testDefaultConstructor()
    {
        new ErrorResponder;
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    public function testConstructorWithNormalRequest()
    {
        new ErrorResponder(new HttpRequest);
    }

    /**
     * @expectedException \Eix\Core\Exception
     */
    public function testConstructorWithEmptyErrorRequest()
    {
        new ErrorResponder(new ErrorRequest);
    }

    public function testConstructorWithException()
    {
        $exception = new Exception;
        $request = new ErrorRequest;
        $request->setThrowable(new \Exception('Test exception'));
        $responder = new ErrorResponder($request);
        $responder->setThrowable($exception);

        $this->assertEquals(
            $responder->getThrowable(),
            $exception
        );
    }

    public function testConstructorWithError()
    {
        $exception = new Exception;
        $request = new ErrorRequest;
        $request->setThrowable(new \Error('Test error'));
        $responder = new ErrorResponder($request);
        $responder->setThrowable($exception);

        $this->assertEquals(
            $responder->getThrowable(),
            $exception
        );
    }

}


text:
Octree::Octree(Box box)
    : box(box), accepted(false), rejected(false),
      halfDimension(box.GetSideLength() / 2)
{
    // Initially no children.
    for (int i = 0; i < NUM_CHILDREN; i++) {
        children[i] = NULL;
    }
}

Octree::~Octree()
{
    // Recursively delete sub-trees.
    for (int i = 0; i < NUM_CHILDREN; i++) {
        delete children[i];
    }
}

void Octree::Subdivide()
{
    double scaleFactor = 0.5;

    for (int i = 0; i < NUM_CHILDREN; i++) {
        Vector3D newCenter = box.GetCenter();
        newCenter += halfDimension *
                Vector3D(i & 4 ? scaleFactor : -scaleFactor,
                         i & 2 ? scaleFactor : -scaleFactor,
                         i & 1 ? scaleFactor : -scaleFactor);

        children[i] = new Octree(Box(newCenter,
                box.GetSideLength() * scaleFactor));
    }
}

void Octree::Subdivide(int level)
{
    if (level < 0) {
        throw std::range_error("Subdivision level must be >= 0.");
    }

    if (level > 0) {
        Subdivide();
        level--;

        for (int i = 0; i < NUM_CHILDREN; i++) {
            GetChild(i)->Subdivide(level);
        }
    }
}

Octree *Octree::GetChild(int index)
{
    if (index < 0 || index >= NUM_CHILDREN) {
        throw std::range_error("Child index out of range");
    }

    return children[index];
}

void Octree::Accept()
{
    accepted = true;
}

bool Octree::IsAccepted()
{
    return accepted;
}

void Octree::Reject()
{
    rejected = true;
}

bool Octree::IsRejected()
{
    return rejected;
}

Vector3D Octree::GetCenter()
{
    return box.GetCenter();
}

double Octree::GetSideLength()
{
    return box.GetSideLength();
}

bool Octree::IsLeaf()
{
    return children[0] == NULL;
}

Box Octree::GetBox()
{
    return box;
}


text:
_prepend_path("${arbotix_msgs_DIR}/.." "msg" arbotix_msgs_MSG_INCLUDE_DIRS UNIQUE)
set(arbotix_msgs_MSG_DEPENDENCIES std_msgs)


text:
{% extends '../layout.view.html' %}
{% block content %}

        <form action="/todos" method="POST">

            Todo Task
            <input type="text" class="form-control" name="text" id="todo" placeholder="TodoText">

          <button type="submit" class="btn btn-default">Submit</button>
        </form>

{% endblock %}


text:
<?php
Class Project_model extends MY_Model
{
    var $table = 'sna_project';

}


text:
#include <aws/apprunner/model/AutoScalingConfiguration.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace AppRunner
{
namespace Model
{

AutoScalingConfiguration::AutoScalingConfiguration() :
    m_autoScalingConfigurationArnHasBeenSet(false),
    m_autoScalingConfigurationNameHasBeenSet(false),
    m_autoScalingConfigurationRevision(0),
    m_autoScalingConfigurationRevisionHasBeenSet(false),
    m_latest(false),
    m_latestHasBeenSet(false),
    m_status(AutoScalingConfigurationStatus::NOT_SET),
    m_statusHasBeenSet(false),
    m_maxConcurrency(0),
    m_maxConcurrencyHasBeenSet(false),
    m_minSize(0),
    m_minSizeHasBeenSet(false),
    m_maxSize(0),
    m_maxSizeHasBeenSet(false),
    m_createdAtHasBeenSet(false),
    m_deletedAtHasBeenSet(false)
{
}

AutoScalingConfiguration::AutoScalingConfiguration(JsonView jsonValue) :
    m_autoScalingConfigurationArnHasBeenSet(false),
    m_autoScalingConfigurationNameHasBeenSet(false),
    m_autoScalingConfigurationRevision(0),
    m_autoScalingConfigurationRevisionHasBeenSet(false),
    m_latest(false),
    m_latestHasBeenSet(false),
    m_status(AutoScalingConfigurationStatus::NOT_SET),
    m_statusHasBeenSet(false),
    m_maxConcurrency(0),
    m_maxConcurrencyHasBeenSet(false),
    m_minSize(0),
    m_minSizeHasBeenSet(false),
    m_maxSize(0),
    m_maxSizeHasBeenSet(false),
    m_createdAtHasBeenSet(false),
    m_deletedAtHasBeenSet(false)
{
  *this = jsonValue;
}

AutoScalingConfiguration& AutoScalingConfiguration::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("AutoScalingConfigurationArn"))
  {
    m_autoScalingConfigurationArn = jsonValue.GetString("AutoScalingConfigurationArn");

    m_autoScalingConfigurationArnHasBeenSet = true;
  }

  if(jsonValue.ValueExists("AutoScalingConfigurationName"))
  {
    m_autoScalingConfigurationName = jsonValue.GetString("AutoScalingConfigurationName");

    m_autoScalingConfigurationNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("AutoScalingConfigurationRevision"))
  {
    m_autoScalingConfigurationRevision = jsonValue.GetInteger("AutoScalingConfigurationRevision");

    m_autoScalingConfigurationRevisionHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Latest"))
  {
    m_latest = jsonValue.GetBool("Latest");

    m_latestHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Status"))
  {
    m_status = AutoScalingConfigurationStatusMapper::GetAutoScalingConfigurationStatusForName(jsonValue.GetString("Status"));

    m_statusHasBeenSet = true;
  }

  if(jsonValue.ValueExists("MaxConcurrency"))
  {
    m_maxConcurrency = jsonValue.GetInteger("MaxConcurrency");

    m_maxConcurrencyHasBeenSet = true;
  }

  if(jsonValue.ValueExists("MinSize"))
  {
    m_minSize = jsonValue.GetInteger("MinSize");

    m_minSizeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("MaxSize"))
  {
    m_maxSize = jsonValue.GetInteger("MaxSize");

    m_maxSizeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("CreatedAt"))
  {
    m_createdAt = jsonValue.GetDouble("CreatedAt");

    m_createdAtHasBeenSet = true;
  }

  if(jsonValue.ValueExists("DeletedAt"))
  {
    m_deletedAt = jsonValue.GetDouble("DeletedAt");

    m_deletedAtHasBeenSet = true;
  }

  return *this;
}

JsonValue AutoScalingConfiguration::Jsonize() const
{
  JsonValue payload;

  if(m_autoScalingConfigurationArnHasBeenSet)
  {
   payload.WithString("AutoScalingConfigurationArn", m_autoScalingConfigurationArn);

  }

  if(m_autoScalingConfigurationNameHasBeenSet)
  {
   payload.WithString("AutoScalingConfigurationName", m_autoScalingConfigurationName);

  }

  if(m_autoScalingConfigurationRevisionHasBeenSet)
  {
   payload.WithInteger("AutoScalingConfigurationRevision", m_autoScalingConfigurationRevision);

  }

  if(m_latestHasBeenSet)
  {
   payload.WithBool("Latest", m_latest);

  }

  if(m_statusHasBeenSet)
  {
   payload.WithString("Status", AutoScalingConfigurationStatusMapper::GetNameForAutoScalingConfigurationStatus(m_status));
  }

  if(m_maxConcurrencyHasBeenSet)
  {
   payload.WithInteger("MaxConcurrency", m_maxConcurrency);

  }

  if(m_minSizeHasBeenSet)
  {
   payload.WithInteger("MinSize", m_minSize);

  }

  if(m_maxSizeHasBeenSet)
  {
   payload.WithInteger("MaxSize", m_maxSize);

  }

  if(m_createdAtHasBeenSet)
  {
   payload.WithDouble("CreatedAt", m_createdAt.SecondsWithMSPrecision());
  }

  if(m_deletedAtHasBeenSet)
  {
   payload.WithDouble("DeletedAt", m_deletedAt.SecondsWithMSPrecision());
  }

  return payload;
}

} // namespace Model
} // namespace AppRunner
} // namespace Aws


text:
import { rangesOverlap, intersectRanges } from "../ranges.js";

/**
 * Given two positions relative to the same origin, return `child`'s position
 * relative to `parent`'s position.
 */
export function getRelativePosition(child, parent) {
    return {
        left: child.left - parent.left,
        top: child.top - parent.top,
    };
}

/**
 * `getRelativePosition`, but for Rects.
 *
 * Given a rectangle and a position relative to the same origin, return a new
 * rectangle of the same size, whose position is relative to the given
 * position.
 */
export function getRelativeRect(child, parent) {
    return {
        ...getRelativePosition(child, parent),
        width: child.width,
        height: child.height,
    };
}

/**
 * Given a DOMRange, return a list of client-relative rects that cover the text
 * inside the DOMRange.
 *
 * This behaves differently than the browser's built-in `getClientRects` method
 * for DOMRanges, because this method only gets rects for the *text* nodes,
 * whereas the browser's method will also return rects for any fully-contained
 * *element* nodes.
 *
 * For example, if an entire paragraph is selected, then `getClientRects` will
 * return a rectangle that covers the entire paragraph block, whereas this
 * method will only return rectangles for the text inside the paragraph.
 */
export function getClientRectsForTextInRange(range) {
    const mutableRects = [];
    addClientRectsForTextInNodeAndRange(
        range.commonAncestorContainer, range, mutableRects);
    return mutableRects;
}

/**
 * A helper method for getClientRectsForTextInRange.
 *
 * Given a node and a range, find text that is contained within both the node
 * and the range by recursing down the node's subtree, and push the text's
 * client rects onto the given `mutableRects` array.
 */
export function addClientRectsForTextInNodeAndRange(node, range, mutableRects) {
    const nodeContentsRange = new Range();
    nodeContentsRange.selectNodeContents(node);

    if (node.nodeType === Node.TEXT_NODE) {
        // Get the text that appears both in this text node and in the range
        // we're searching.
        const intersectedRange = intersectRanges(range, nodeContentsRange);
        if (intersectedRange) {
            addClientRectsForText(node, intersectedRange, mutableRects);
        }
    } else if (node.nodeType === Node.ELEMENT_NODE) {
        // Don't bother deep-traversing a node that doesn't even overlap the
        // range we're searching.
        if (!rangesOverlap(range, nodeContentsRange)) {
            return;
        }

        // NOTE(mdr): Safari returns a non-iterable `childNodes` object, so
        //     convert it to an array.
        for (const child of Array.from(node.childNodes)) {
            // TODO(mdr): If this parent has overflow: hidden, bound the child
            //     rects accordingly. This would allow us to remove the hack
            //     we added to .perseus-sr-only.
            addClientRectsForTextInNodeAndRange(child, range, mutableRects);
        }
    }
}

/**
 * Given a DOMRange of text fully contained by the given `textNode`, compute
 * rectangles that visually cover the range, and push them onto the given
 * `mutableRects` array.
 *
 * This function adjusts the rectangles to the line height of the text, to
 * match the visual behavior of native text selection, and remove annoying gaps
 * between lines that disrupt hover behavior.
 */
export function addClientRectsForText(textNode, textRange, mutableRects) {
  const parentElement = textNode.parentElement;
    const computedStyle = window.getComputedStyle(parentElement);

    // NOTE(mdr): I'm not sure how computed line height works in all contexts
    //     in all browsers. It's valid to specify line height as a ratio,
    //     relative to font size. Latest Chrome seems to transform this into a
    //     px value, but maybe some browsers don't, so I'm being defensive here
    //     and only using the computed line height if it's explicitly a px
    //     value. We could also handle other browsers by computing font size
    //     and doing the math ourselves, but let's punt that until we need it.
    let lineHeight = null;
    if (
        typeof computedStyle.lineHeight === "string" &&
        computedStyle.lineHeight.endsWith("px")
    ) {
        const parsedLineHeight = parseFloat(computedStyle.lineHeight);
        if (!isNaN(parsedLineHeight)) {
            lineHeight = parsedLineHeight;
        }
    }

    // NOTE(mdr): Safari returns a non-iterable `getClientRects` object, so
    //     convert it to an array.
    const boundingRects = Array.from(textRange.getClientRects());

    for (const boundingRect of boundingRects) {
        const rect = {
            left: boundingRect.left,
            top: boundingRect.top,
            height: boundingRect.height,
            width: boundingRect.width,
        };

        // Adjust the rectangle according to the text's line height. It should
        // keep the same bottom coordinate, so the top coordinate will move
        // accordingly.
        if (lineHeight !== null) {
            const heightIncrease = lineHeight - rect.height;
            rect.top -= heightIncrease;
            rect.height = lineHeight;
        }

        mutableRects.push(rect);
    }
}

export default {
    getClientRectsForTextInRange,
    getRelativePosition,
    getRelativeRect,
}


text:
package org.bubblecloud.zigbee.util;

import java.util.StringTokenizer;

/**
 * @author Stefano "Kismet" Lenzi
 * @author Francesco Furfari
 * @version $LastChangedRevision: 799 $ ($LastChangedDate: 2013-08-06 19:00:05 +0300 (Tue, 06 Aug 2013) $)
 * @since 0.1.0
 */
public class IEEEAddress {

    private IEEEAddress() {}

    public static final long fromColonNotation(String ieee) {
        StringTokenizer scanner = new StringTokenizer(ieee, ":");
        long result = 0;
        while (scanner.hasMoreTokens()) {
            int octect = Integer.parseInt(scanner.nextToken(), 16);
            result = (result << 8) + (octect & 0xFF);
        }
        return result;
    }

    public static final String toHex(long ieee) {
        String padding = "0000000000000000";
        String hex = Long.toHexString(ieee);
        if (hex.length() < 16) {
            hex = padding.substring(0, 16 - hex.length()) + hex;
        }
        return "0x" + hex.toUpperCase();
    }

    public static final String toHexString(long ieee) {
        StringBuffer buffer = new StringBuffer();
        String[] parts = new String[8];
        for (int i = 0; i < parts.length; i++) {
            parts[i] = Integer.toHexString((int) (ieee & 0xFF));
            ieee = ieee >> 8;
        }

        for (int i = parts.length - 1; i > 0; i--) {
            switch (parts[i].length()) {
                case 1:
                    buffer.append("0x0").append(parts[i]).append(' ');
                    break;
                case 2:
                    buffer.append("0x").append(parts[i]).append(' ');
                    break;
            }
        }
        switch (parts[0].length()) {
            case 1:
                buffer.append("0x0").append(parts[0]);
                break;
            case 2:
                buffer.append("0x").append(parts[0]);
                break;
        }

        return buffer.toString();
    }

    public static final String toString(long ieee) {
        return toColonNotation(ieee);
    }

    public static final String toColonNotation(long ieee) {
        String padding = "0000000000000000";
        String hex = Long.toHexString(ieee);
        if (hex.length() < 16) {
            hex = padding.substring(0, 16 - hex.length()) + hex;
        }
        hex = hex.toUpperCase();
        String result = hex.substring(0, 2);
        for (int i = 1; i <= 7; i++) {
            hex = hex.substring(2);
            result = result + ":" + hex.substring(0, 2);
        }
        return result;
    }

}


text:
<?php

/*
 * Michael Zijlstra 11/14/2014
 */

// helper function to checks if user is logged in
function isLoggedIn() {
    if (!isset($_SESSION['user'])) {
        global $MY_BASE;
        global $MY_URI;

        // the original url the user requested
        $_SESSION['login_to'] = $MY_URI;

        // Then show login page
        $_SESSION['error'] = "Please Login:";
        header("Location: ${MY_BASE}/login");
        exit();
    }
}

// apply the security policy
switch ($MY_MAPPING['sec']) {
    case "none":
        break;
    case "user":
        isLoggedIn();
        break;
    case "admin":
    default:
        isLoggedIn();
        if ($_SESSION['user']['type'] !== 'admin') {
            require "view/error/403.php";
            exit();
        }
}


text:
package com.google.gerrit.server.schema;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.LabelValue;
import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.testutil.InMemoryDatabase;
import com.google.gerrit.testutil.InMemoryModule;
import com.google.gwtorm.jdbc.JdbcSchema;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;

import org.eclipse.jgit.lib.Repository;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;

public class SchemaCreatorTest {
  @Inject
  private AllProjectsName allProjects;

  @Inject
  private GitRepositoryManager repoManager;

  @Inject
  private InMemoryDatabase db;

  @Before
  public void setUp() throws Exception {
    new InMemoryModule().inject(this);
  }

  @After
  public void tearDown() throws Exception {
    InMemoryDatabase.drop(db);
  }

  @Test
  public void testGetCauses_CreateSchema() throws OrmException, SQLException,
      IOException {
    // Initially the schema should be empty.
    String[] types = {"TABLE", "VIEW"};
    try (JdbcSchema d = (JdbcSchema) db.open();
        ResultSet rs = d.getConnection().getMetaData()
          .getTables(null, null, null, types)) {
      assertFalse(rs.next());
    }

    // Create the schema using the current schema version.
    //
    db.create();
    db.assertSchemaVersion();

    // By default sitePath is set to the current working directory.
    //
    File sitePath = new File(".").getAbsoluteFile();
    if (sitePath.getName().equals(".")) {
      sitePath = sitePath.getParentFile();
    }
    assertEquals(sitePath.getCanonicalPath(), db.getSystemConfig().sitePath);
  }

  private LabelTypes getLabelTypes() throws Exception {
    db.create();
    ProjectConfig c = new ProjectConfig(allProjects);
    Repository repo = repoManager.openRepository(allProjects);
    try {
      c.load(repo);
      return new LabelTypes(
          ImmutableList.copyOf(c.getLabelSections().values()));
    } finally {
      repo.close();
    }
  }

  @Test
  public void testCreateSchema_LabelTypes() throws Exception {
    List<String> labels = Lists.newArrayList();
    for (LabelType label : getLabelTypes().getLabelTypes()) {
      labels.add(label.getName());
    }
    assertEquals(ImmutableList.of("Code-Review"), labels);
  }

  @Test
  public void testCreateSchema_Label_CodeReview() throws Exception {
    LabelType codeReview = getLabelTypes().byLabel("Code-Review");
    assertNotNull(codeReview);
    assertEquals("Code-Review", codeReview.getName());
    assertEquals(0, codeReview.getDefaultValue());
    assertEquals("MaxWithBlock", codeReview.getFunctionName());
    assertTrue(codeReview.isCopyMinScore());
    assertValueRange(codeReview, 2, 1, 0, -1, -2);
  }

  private void assertValueRange(LabelType label, Integer... range) {
    assertEquals(Arrays.asList(range), label.getValuesAsList());
    assertEquals(range[0], Integer.valueOf(label.getMax().getValue()));
    assertEquals(range[range.length - 1],
      Integer.valueOf(label.getMin().getValue()));
    for (LabelValue v : label.getValues()) {
      assertFalse(Strings.isNullOrEmpty(v.getText()));
    }
  }
}


text:
class PrecomputeStudentHashesJob < Struct.new :log
  include StudentsQueryHelper

  # Runs the job for a particular day, querying for all educators' authorizations,
  # precomputing the `student_hashes` for them and writing them to the database.
  def precompute_all!(date_timestamp)
    log.puts 'Querying for jobs...'
    jobs = school_overview_precompute_jobs(date_timestamp)
    log.puts "Found #{jobs.size} jobs."

    log.puts 'Starting precomputing...'
    jobs.each_with_index do |job, index|
      precompute_and_write_student_hashes!(job[:date_timestamp], job[:authorized_student_ids])
      log.puts "Wrote document #{index+1}..."
    end
    log.puts 'Done.'
  end

  private

  def school_overview_precompute_jobs(date_timestamp)
    Educator.all.flat_map { |educator| educator_to_jobs(educator, date_timestamp) }.uniq
  end

  # Educators with district-wide access will have different authorization
  # for each school than other users.
  def educator_to_jobs(educator, date_timestamp)
    if educator.districtwide_access?
      return School.all.map do |school|
        {
          date_timestamp: date_timestamp,
          authorized_student_ids: school.students.active.map(&:id)
        }
      end
    end

    student_ids = educator.students_for_school_overview.map(&:id)
    return [] if student_ids.size == 0
    return [{ date_timestamp: date_timestamp, authorized_student_ids: student_ids }]
  end

  def precompute_and_write_student_hashes!(date_timestamp, authorized_student_ids)
    precomputed_time = Time.at(date_timestamp)
    authorized_students = Student.find(authorized_student_ids)
    student_hashes = authorized_students.map {|student| student_hash_for_slicing(student) }

    key = precomputed_student_hashes_key(precomputed_time, authorized_student_ids)
    write_doc_or_log(key, { student_hashes: student_hashes })
    nil
  end

  # This is a non-atomic upsert
  # This catches errors, emails, logs and returns nil
  def write_doc_or_log(key, json_hash)
    pre_existing_doc = PrecomputedQueryDoc.find_by_key(key)
    pre_existing_doc.destroy! if pre_existing_doc.present?
    authorized_students_digest = key.split(':').last

    begin
      PrecomputedQueryDoc.create!(
        key: key,
        json: json_hash.to_json,
        authorized_students_digest: authorized_students_digest
      )
    rescue => error
      ErrorMailer.error_report(error).deliver_now if Rails.env.production?
      log.puts "write_doc_or_log failed for key: #{key}"
      log.puts err.inspect
      nil
    end
  end
end


text:
<?php
namespace backend\widgets;

use Yii;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use yii\helpers\Html;
/**
 * Class Menu
 * Theme menu widget.
 */
class Menu extends \yii\widgets\Menu
{
    /**
     * @inheritdoc
     */
    public $linkTemplate = '{icon} {label}';
    public $submenuTemplate = "\n
\n{items}\n
\n";
    public $activateParents = true;
    /**
     * @inheritdoc
     */
    protected function renderItem($item)
    {
        if(isset($item['items'])) {
            $labelTemplate = '{label} ';
            $linkTemplate = '{icon} {label} ';
        }
        else {
            $labelTemplate = $this->labelTemplate;
            $linkTemplate = $this->linkTemplate;
        }

        if (isset($item['url'])) {
            $template = ArrayHelper::getValue($item, 'template', $linkTemplate);
            $replace = !empty($item['icon']) ? [
                '{url}' => Url::to($item['url']),
                '{label}' => ''.$item['label'].'',
                '{icon}' => ' '
            ] : [
                '{url}' => Url::to($item['url']),
                '{label}' => ''.$item['label'].'',
                '{icon}' => null,
            ];
            return strtr($template, $replace);
        } else {
            $template = ArrayHelper::getValue($item, 'template', $labelTemplate);
            $replace = !empty($item['icon']) ? [
                '{label}' => ''.$item['label'].'',
                '{icon}' => ' '
            ] : [
                '{label}' => ''.$item['label'].'',
            ];
            return strtr($template, $replace);
        }
    }
    /**
     * Recursively renders the menu items (without the container tag).
     * @param array $items the menu items to be rendered recursively
     * @return string the rendering result
     */
    protected function renderItems($items)
    {
        $n = count($items);
        $lines = [];
        foreach ($items as $i => $item) {
            $options = array_merge($this->itemOptions, ArrayHelper::getValue($item, 'options', []));
            $tag = ArrayHelper::remove($options, 'tag', 'li');
            $class = [];
            if ($item['active']) {
                $class[] = $this->activeCssClass;
            }
            if ($i === 0 && $this->firstItemCssClass !== null) {
                $class[] = $this->firstItemCssClass;
            }
            if ($i === $n - 1 && $this->lastItemCssClass !== null) {
                $class[] = $this->lastItemCssClass;
            }
            if (!empty($class)) {
                if (empty($options['class'])) {
                    $options['class'] = implode(' ', $class);
                } else {
                    $options['class'] .= ' ' . implode(' ', $class);
                }
            }
            $menu = $this->renderItem($item);
            if (!empty($item['items'])) {
                $menu .= strtr($this->submenuTemplate, [
                    '{show}' => $item['active'] ? "style='display: block'" : '',
                    '{items}' => $this->renderItems($item['items']),
                ]);
            }
            $lines[] = Html::tag($tag, $menu, $options);
        }
        return implode("\n", $lines);
    }
    /**
     * @inheritdoc
     */
    protected function normalizeItems($items, &$active)
    {
        foreach ($items as $i => $item) {
            if (isset($item['visible']) && !$item['visible']) {
                unset($items[$i]);
                continue;
            }
            if (!isset($item['label'])) {
                $item['label'] = '';
            }
            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            $items[$i]['label'] = $encodeLabel ? Html::encode($item['label']) : $item['label'];
            $items[$i]['icon'] = isset($item['icon']) ? $item['icon'] : '';
            $hasActiveChild = false;
            if (isset($item['items'])) {
                $items[$i]['items'] = $this->normalizeItems($item['items'], $hasActiveChild);
                if (empty($items[$i]['items']) && $this->hideEmptyItems) {
                    unset($items[$i]['items']);
                    if (!isset($item['url'])) {
                        unset($items[$i]);
                        continue;
                    }
                }
            }
            if (!isset($item['active'])) {
                if ($this->activateParents && $hasActiveChild || $this->activateItems && $this->isItemActive($item)) {
                    $active = $items[$i]['active'] = true;
                } else {
                    $items[$i]['active'] = false;
                }
            } elseif ($item['active']) {
                $active = true;
            }
        }
        return array_values($items);
    }
    /**
     * Checks whether a menu item is active.
     * This is done by checking if [[route]] and [[params]] match that specified in the `url` option of the menu item.
     * When the `url` option of a menu item is specified in terms of an array, its first element is treated
     * as the route for the item and the rest of the elements are the associated parameters.
     * Only when its route and parameters match [[route]] and [[params]], respectively, will a menu item
     * be considered active.
     * @param array $item the menu item to be checked
     * @return boolean whether the menu item is active
     */
    protected function isItemActive($item)
    {
        if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
            $route = $item['url'][0];
            if ($route[0] !== '/' && Yii::$app->controller) {
                $route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
            }
            $arrayRoute = explode('/', ltrim($route, '/'));
            $arrayThisRoute = explode('/', $this->route);
            if ($arrayRoute[0] !== $arrayThisRoute[0]) {
                return false;
            }
            if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
                return false;
            }
            if (isset($arrayRoute[2]) && $arrayRoute[2] !== $arrayThisRoute[2]) {
                return false;
            }
            unset($item['url']['#']);
            if (count($item['url']) > 1) {
                foreach (array_splice($item['url'], 1) as $name => $value) {
                    if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
                        return false;
                    }
                }
            }
            return true;
        }
        return false;
    }
}


text:
{% extends "base.html" %}
{% block weekday_selected %}id="selected"{% endblock %}

{% block extra_js %}

{% endblock %}

{% block content %}

Presence by weekday

    <select id="user_id" style="display: none">
        <option value="">--</option>
    </select>

There's no data to display

{% endblock %}


text:
package core.kendo;

import com.ibm.commons.util.io.json.JsonJavaObject;

public class KendoReportModelValueAxis {
	// VARIABLES
	public JsonJavaObject labels;
	public JsonJavaObject line;
	public int axisCrossingValue;
	public double min;

	// CONSTRUCTOR
	public KendoReportModelValueAxis() {
		min = 0;
		labels = new JsonJavaObject();
		labels.put("format", "{0}");

		line = new JsonJavaObject();
		line.putBoolean("visible", false);
		axisCrossingValue = 0;
	}

	// GETTERS AND SETTERS
	public JsonJavaObject getLabels() {
		return labels;
	}

	public void setLabels(JsonJavaObject labels) {
		this.labels = labels;
	}

	public JsonJavaObject getLine() {
		return line;
	}

	public void setLine(JsonJavaObject line) {
		this.line = line;
	}

	public int getAxisCrossingValue() {
		return axisCrossingValue;
	}

	public void setAxisCrossingValue(int axisCrossingValue) {
		this.axisCrossingValue = axisCrossingValue;
	}

	public double getMin() {
		return min;
	}

	public void setMin(double min) {
		this.min = min;
	}

}


text:
namespace Coroutines {

  // -------------------------------------------------------------
  namespace internal {

    // --------------------------------------------------------------
    class TBaseChan {
    protected:
      bool         is_closed = false;

      bool         detachOneWaitingForPull();
      bool         detachOneWaitingForPush();

    public:

      TChanHandle  handle;
      TList        waiting_for_push;
      TList        waiting_for_pull;

      virtual ~TBaseChan() {}

      void close() {

        is_closed = true;

        // Wake up all coroutines waiting for me...
        // Waiting for pushing...
        while (detachOneWaitingForPush());
        // or waiting for pulling...
        while (detachOneWaitingForPull());

      }

      bool closed() const { return is_closed; }
      virtual bool empty() const { return true; }
      virtual bool full() const { return false; }

      static TBaseChan* findChannelByHandle(TChanHandle h);
    };

    // -------------------------------------------------------
    template< typename T >
    class TMemChan : public TBaseChan {

      size_t            max_elems = 0;
      size_t            nelems_stored = 0;
      size_t            first_idx = 0;
      std::vector< T >  data;

      bool full() const { return nelems_stored == max_elems; }
      bool empty() const { return nelems_stored == 0; }

      // -------------------------------------------------------------
      void pushObjData(T& new_data) {
        assert(nelems_stored < max_elems);
        assert(!closed());

        data[ (first_idx + nelems_stored) % max_elems ] = std::move( new_data );
        ++nelems_stored;

        detachOneWaitingForPull();
      }

      // -------------------------------------------------------------
      void pullObjData(T& new_data) {
        assert(data.data());
        assert(nelems_stored > 0);

        new_data = std::move(data[first_idx]);

        --nelems_stored;
        first_idx = (first_idx + 1) % max_elems;

        detachOneWaitingForPush();
      }

    public:

      TMemChan(size_t new_max_elems) {
        max_elems = new_max_elems;
        data.resize(max_elems);
      }

      ~TMemChan() {
        close();
      }

      bool pullObj(T& obj) {

        assert(this);

        while (empty() && !closed())
          wait(canRead(handle));

        if (empty() && closed())
          return false;

        pullObjData(obj);

        return true;
      }

      bool pushObj( T& obj) {

        while (full() && !closed())
          wait(canWrite(handle));

        if (closed())
          return false;

        pushObjData(obj);

        return true;
      }

    };

    // --------------------------------------------------------------
    TChanHandle registerChannel(TBaseChan* c, TChanHandle::eClassID channel_type);

    template< typename T >
    TChanHandle createTypedChannel(size_t max_capacity) {
      auto c = new TMemChan<T>(max_capacity);
      return registerChannel(c, TChanHandle::eClassID::CT_MEMORY);
    }

  }

  // -------------------------------------------------------------
  // Create a new 'typed' handle to channel
  template< typename T >
  struct TTypedChannel : public TChanHandle {
    TTypedChannel<T>(TChanHandle h) : TChanHandle(h) {};
    static TTypedChannel<T> create(size_t max_capacity = 1) {
      return internal::createTypedChannel<T>(max_capacity);
    }
  };

  // -------------------------------------------------------------

  // Closes channel
  bool close(TChanHandle cid);

  // Check if the given channel handle is valid.
  bool isChannel(TChanHandle cid);

  // -------------------------------------------------------------
  template< typename T >
  bool operator<<(T& obj, TTypedChannel<T> cid) {
    auto c = internal::TBaseChan::findChannelByHandle(cid);
    if (!c || (c->closed() && c->empty()))
      return false;
    auto tc = (internal::TMemChan<T> *)c;
    return tc->pullObj(obj);
  }

  template< typename T >
  bool operator<<(TTypedChannel<T> cid, T obj) {
    auto c = internal::TBaseChan::findChannelByHandle(cid);
    if (!c || c->closed())
      return false;

    auto tc = (internal::TMemChan<T> *)c;
    return tc->pushObj(obj);
  }

  // -------------------------------------------------------------
  struct TTimeHandle : public TChanHandle {
    TTimeHandle(const TChanHandle& h) : TChanHandle(h) {}
    TTimeDelta timeForNextEvent() const;
  };
  bool operator<<(TTimeStamp& value, TTimeHandle cid);
  TTimeHandle every(TTimeDelta interval_time);
  TTimeHandle after(TTimeDelta interval_time);

  // Read discarting the data.
  bool pull(TTimeHandle cid);

}

#endif


text:
package org.cqback.runtime.command;

import org.cqback.api.command.AggregateCommand;

import java.util.UUID;

/**
 * Created by pragone
 * Created on 30/12/2015 at 11:26 AM
 *
 * @author Paolo Ragone <pragone@ebay.com>
 */
public abstract class AbstractAggregateCommand extends AbstractCommand implements AggregateCommand {
    private final UUID aggregateId;

    protected AbstractAggregateCommand(UUID aggregateId) {
        super();
        this.aggregateId = aggregateId;
    }

    @Override
    public UUID getAggregateId() {
        return aggregateId;
    }
}


text:
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np

from .augment import random_affine, random_photometric
from .flow_util import flow_to_color
from .util import resize_area, resize_bilinear
from .losses import compute_losses, create_border_mask
from .util import downsample
from .image_warp import image_warp
from .flownet import flownet, FLOW_SCALE

# REGISTER ALL POSSIBLE LOSS TERMS
LOSSES = ['occ', 'sym', 'fb', 'grad', 'ternary', 'photo', 'smooth_1st', 'smooth_2nd']

def _track_loss(op, name):
    tf.add_to_collection('losses', tf.identity(op, name=name))

def _track_image(op, name):
    name = 'train/' + name
    tf.add_to_collection('train_images', tf.identity(op, name=name))

def unsupervised_loss(batch, params, normalization=None, augment=True,
                      return_flow=False):
    channel_mean = tf.constant(normalization[0]) / 255.0
    im1, im2 = batch
    im1 = im1 / 255.0
    im2 = im2 / 255.0
    im_shape = tf.shape(im1)[1:3]

    # -------------------------------------------------------------------------
    # Data & mask augmentation
    border_mask = create_border_mask(im1, 0.1)

    if augment:
        im1_geo, im2_geo, border_mask_global = random_affine(
            [im1, im2, border_mask],
            horizontal_flipping=True,
            min_scale=0.9, max_scale=1.1
            )

        # augment locally
        im2_geo, border_mask_local = random_affine(
            [im2_geo, border_mask],
            min_scale=0.9, max_scale=1.1
            )
        border_mask = border_mask_local * border_mask_global

        im1_photo, im2_photo = random_photometric(
            [im1_geo, im2_geo],
            noise_stddev=0.04, min_contrast=-0.3, max_contrast=0.3,
            brightness_stddev=0.02, min_colour=0.9, max_colour=1.1,
            min_gamma=0.7, max_gamma=1.5)

        _track_image(im1_photo, 'augmented1')
        _track_image(im2_photo, 'augmented2')
    else:
        im1_geo, im2_geo = im1, im2
        im1_photo, im2_photo = im1, im2

    # Images for loss comparisons with values in [0, 1] (scale to original using * 255)
    im1_norm = im1_geo
    im2_norm = im2_geo
    # Images for neural network input with mean-zero values in [-1, 1]
    im1_photo = im1_photo - channel_mean
    im2_photo = im2_photo - channel_mean

    flownet_spec = params.get('flownet', 'S')
    full_resolution = params.get('full_res')
    train_all = params.get('train_all')

    flows_fw, flows_bw = flownet(im1_photo, im2_photo,
                                 flownet_spec=flownet_spec,
                                 full_resolution=full_resolution,
                                 backward_flow=True,
                                 train_all=train_all)

    flows_fw = flows_fw[-1]
    flows_bw = flows_bw[-1]

    # -------------------------------------------------------------------------
    # Losses
    layer_weights = [12.7, 4.35, 3.9, 3.4, 1.1]
    layer_patch_distances = [3, 2, 2, 1, 1]
    if full_resolution:
        layer_weights = [12.7, 5.5, 5.0, 4.35, 3.9, 3.4, 1.1]
        layer_patch_distances = [3, 3] + layer_patch_distances
        im1_s = im1_norm
        im2_s = im2_norm
        mask_s = border_mask
        final_flow_scale = FLOW_SCALE * 4
        final_flow_fw = flows_fw[0] * final_flow_scale
        final_flow_bw = flows_bw[0] * final_flow_scale
    else:
        im1_s = downsample(im1_norm, 4)
        im2_s = downsample(im2_norm, 4)
        mask_s = downsample(border_mask, 4)
        final_flow_scale = FLOW_SCALE
        final_flow_fw = tf.image.resize_bilinear(flows_fw[0], im_shape) * final_flow_scale * 4
        final_flow_bw = tf.image.resize_bilinear(flows_bw[0], im_shape) * final_flow_scale * 4

    combined_losses = dict()
    combined_loss = 0.0
    for loss in LOSSES:
        combined_losses[loss] = 0.0

    if params.get('pyramid_loss'):
        flow_enum = enumerate(zip(flows_fw, flows_bw))
    else:
        flow_enum = [(0, (flows_fw[0], flows_bw[0]))]

    for i, flow_pair in flow_enum:
        layer_name = "loss" + str(i + 2)

        flow_scale = final_flow_scale / (2 ** i)

        with tf.variable_scope(layer_name):
            layer_weight = layer_weights[i]
            flow_fw_s, flow_bw_s = flow_pair

            mask_occlusion = params.get('mask_occlusion', '')
            assert mask_occlusion in ['fb', 'disocc', '']

            losses = compute_losses(im1_s, im2_s,
                                    flow_fw_s * flow_scale, flow_bw_s * flow_scale,
                                    border_mask=mask_s if params.get('border_mask') else None,
                                    mask_occlusion=mask_occlusion,
                                    data_max_distance=layer_patch_distances[i])

            layer_loss = 0.0

            for loss in LOSSES:
                weight_name = loss + '_weight'
                if params.get(weight_name):
                    _track_loss(losses[loss], loss)
                    layer_loss += params[weight_name] * losses[loss]
                    combined_losses[loss] += layer_weight * losses[loss]

            combined_loss += layer_weight * layer_loss

            im1_s = downsample(im1_s, 2)
            im2_s = downsample(im2_s, 2)
            mask_s = downsample(mask_s, 2)

    regularization_loss = tf.losses.get_regularization_loss()
    final_loss = combined_loss + regularization_loss

    _track_loss(final_loss, 'loss/combined')

    for loss in LOSSES:
        _track_loss(combined_losses[loss], 'loss/' + loss)
        weight_name = loss + '_weight'
        if params.get(weight_name):
            weight = tf.identity(params[weight_name], name='weight/' + loss)
            tf.add_to_collection('params', weight)

    if not return_flow:
        return final_loss

    return final_loss, final_flow_fw, final_flow_bw


text:
/* inject React */
(function () {
    React.render();
    let React = {};
});


text:
<!DOCTYPE html>

Passes if this text is fully visible, and only a green square below.


text:
package com.googlecode.l10nmavenplugin.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import org.apache.commons.io.FilenameUtils;

/**
 * {@link java.util.ResourceBundle} based implementation of {@link PropertiesFile}, using convention baseName[_language[_country[_variant]]].properties
 *
 * @since 1.4
 * @author romain.quinio
 *
 */
public class BundlePropertiesFile implements PropertiesFile {

  private final Properties properties;

  private final String fileName;

  private final String bundleName;

  private Locale locale;

  public BundlePropertiesFile(String fileName, Properties properties) {
    this.properties = properties;

    this.fileName = fileName;

    // Parse bundleName and locale
    String path = FilenameUtils.getPath(fileName).replace('/', '.').replace('\\', '.');
    String[] fileNameParts = FilenameUtils.getBaseName(fileName).split("_", 2);
    bundleName = path + fileNameParts[0];
    if (fileNameParts.length == 2) {
      this.locale = PropertiesFileUtils.getLocale(fileNameParts[1]);
    }
  }

  public String getFileName() {
    return fileName;
  }

  public String getBundleName() {
    return bundleName;
  }

  public Locale getLocale() {
    return locale;
  }

  public Properties getProperties() {
    return properties;
  }

  /**
   * {@inheritDoc}
   */
  public Set<String> getDuplicatedResourceKeys() {
    Set<String> duplicatedResourceKeys = new HashSet<String>();

    List<Map.Entry<String, String>> list = new ArrayList(properties.entrySet());
    // Sort the list by values, to be able to detect duplicates
    Collections.sort(list, new Comparator<Map.Entry<String, String>>() {
      public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
        return o1.getValue().compareTo(o2.getValue());
      }
    });

    String previousValue = null;
    for (Map.Entry<String, String> entry : list) {
      if (entry.getValue().equals(previousValue)) {
        duplicatedResourceKeys.add(entry.getKey());
      }
      previousValue = entry.getValue();
    }

    return duplicatedResourceKeys;
  }

  @Override
  public String toString() {
    return fileName;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (!(obj instanceof BundlePropertiesFile)) {
      return false;
    }
    BundlePropertiesFile other = (BundlePropertiesFile) obj;
    if (fileName == null) {
      if (other.fileName != null) {
        return false;
      }
    } else if (!fileName.equals(other.fileName)) {
      return false;
    }
    return true;
  }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('books', '0001_initial'),
    ]

    operations = [
        migrations.RenameModel(
            old_name='Publiser',
            new_name='Publisher',
        ),
    ]


text:
\subsection{Decision Trees}
\label{decision_trees}

\noindent{\bf Description}
Decision trees (for classification) is a classifier that is considered
more interpretable than other statistical classifiers. This implementation
is well-suited to handle large-scale data and builds a (binary) decision
tree in parallel.\\

\noindent{\bf Usage}
\begin{tabbing}
\texttt{-f} \textit{path}/\texttt{decision-tree.dml -nvargs}
\=\texttt{X=}\textit{path}/\textit{file}
  \texttt{Y=}\textit{path}/\textit{file}
  \texttt{types=}\textit{path}/\textit{file}\\
\>\texttt{model=}\textit{path}/\textit{file}
  \texttt{bins=}\textit{int}
  \texttt{depth=}\textit{int}\\
\>\texttt{num\_leaf=}\textit{int}
  \texttt{num\_samples=}\textit{int}\\
\>\texttt{Log=}\textit{path}/\textit{file}
  \texttt{fmt=}\textit{csv}$\vert$\textit{text}
\end{tabbing}

\begin{tabbing}
\texttt{-f} \textit{path}/\texttt{decision-tree-predict.dml -nvargs}
\=\texttt{X=}\textit{path}/\textit{file}
  \texttt{Y=}\textit{path}/\textit{file}
  \texttt{model=}\textit{path}/\textit{file}\\
\>\texttt{fmt=}\textit{csv}$\vert$\textit{text}
  \texttt{accuracy=}\textit{path}/\textit{file}\\
\>\texttt{confusion=}\textit{path}/\textit{file}
  \texttt{predictions=}\textit{path}/\textit{file}
\end{tabbing}

\noindent{\bf Arguments}

\begin{itemize}
\item X: Location (on HDFS) to read the matrix of feature vectors;
each row constitutes one feature vector.
\item Y: Location (on HDFS) to read the one-column matrix of (categorical)
labels that correspond to feature vectors in X. Classes are assumed to be
contiguously labeled beginning from 1. Note that, this argument is optional
for prediction.
\item model: Location (on HDFS) that contains the learnt decision tree.
\item types: Location (on HDFS) that contains each feature's type. 1 denotes
continuous-valued (scale) and 2 denotes categorical.
\item bins (default: {\tt 50}): Number of thresholds to choose for each
continuous-valued feature (deterimined by equi-height binning).
\item depth (default: {\tt 10}): Maximum depth of the learnt decision tree.
\item num\_leaf (default: {\tt 1}): Parameter that controls pruning. The tree
is not expanded if a node receives less than num\_leaf training examples.
\item num\_samples (default: {\tt 10}): Parameter that decides when to switch
to in-memory building of subtrees. If a node $v$ receives less than num\_samples
training examples then this implementation switches to an in-memory subtree
building procedure to build the subtree under $v$ in its entirety.
\item Log: Location (on HDFS) that collects various useful metrics that indicate
training progress.
\item predictions: Location (on HDFS) to store predictions for a held-out test set.
Note that, this is an optional argument.
\item fmt (default: {\tt text}): Specifies the output format. Choice of
comma-separated values (csv) or as a sparse-matrix (text).
\item accuracy: Location (on HDFS) to store the testing accuracy from a
held-out test set during prediction. Note that, this is an optional argument.
\item confusion: Location (on HDFS) to store the confusion matrix
computed using a held-out test set. Note that, this is an optional
argument.
\end{itemize}

\noindent{\bf Details}

Decision trees (Breiman et al, 1984) are simple models of
classification that,  due to their structure,  are easy to
interpret. Given an example feature vector, each node in the learnt
tree runs a simple test on it. Based on the result of the test, the
example is either diverted to the left subtree or to the right
subtree. Once the example reaches a leaf, then the label stored at the
leaf is returned as the prediction for the example.

\par

Building a decision tree from a fully labeled training set entails
choosing appropriate tests for each internal node in the tree and this
is usually performed in a top-down manner. Choosing a test requires
first choosing a feature $j$ and depending on the type of $j$, either
a threshold $\sigma$, in case $j$ is continuous-valued, or a subset of
values $S \subseteq \text{Dom}(j)$ where $\text{Dom}(j)$ denotes
domain of $j$, in case it is categorical. For continuous-valued
features the test is thus of form $x_j < \sigma$ and for categorical
features it is of form $x_j \in S$, where $x_j$ denotes the $j^{th}$
feature value of feature vector $x$. One way to determine which test
to include, is to compare impurities of the subtrees induced by the
test and this implementation uses {\it Gini impurity}.

\par

The current implementation allows the user to specify the maximum
depth of the learnt tree using the argument {\it depth}. It also
allows for some automated pruning via the argument {\it num\_leaf}. If
a node receives $\leq$ {\it num\_leaf} training examples, then a leaf
is built in its place. Furthermore, for a continuous-valued feature
$j$ the number of candidate thresholds $\sigma$ to choose from is of
the order of the number of examples present in the training set. Since
for large-scale data this can result in a large number of candidate
thresholds, the user can limit this number via the arguments {\it
  bins} which controls the number of candidate thresholds considered
for each continuous-valued feature. For each continuous-valued
feature, the implementation computes an equi-height histogram to
generate one candidate threshold per equi-height bin. To determine the
best value subset to split on in the case of categorical features,
this implementation greedily includes values from the feature's domain
until the sum of the impurities of the subtrees induced stops
improving.

\par

Learning a decision tree on large-scale data has received  some
attention in the literature. The current implementation includes logic
for choosing tests for multiple nodes that belong to the same level in
the decision tree in parallel (breadth-first expansion) and for
building entire subtrees under multiple nodes in parallel (depth-first
subtree building). Empirically it has been demonstrated that it is
advantageous to perform breadth-first expansion for the nodes
belonging to the top levels of the tree and to perform depth-first
subtree building for nodes belonging to the lower levels of the tree
(Panda et al, 2009). The parameter {\it num\_samples} controls when we
switch to  depth-first subtree building. Any node in the decision tree
that receives $\leq$ {\it num\_samples} training examples, the subtree
under it is built in its entirety in one shot.

\par

{\it Description of the model}: The learnt decision tree is represented using a matrix that
contains at least 3 rows. Each column in the matrix contains the parameters relevant
to a single node in the tree. The $i^{th}$ column denotes the parameters for the $i^{th}$ node
whose left child is stored in the $2i^{th}$ column and right child is stored in the $2i+1^{th}$
column. Here is a brief description of what each row in the matrix contains:
\begin{itemize}
\item $1^{st}$ row: Contains the feature index of the feature that this node looks at if
the node is an internal node, otherwise -1.
\item $2^{nd}$ row: Contains the type of the feature that this node looks at if the node is
an internal node, otherwise the label this leaf node is supposed to predict.
1 denotes continuous-valued feature and 2 denotes categorical.
\item $3^{rd}$: Only applicable for internal nodes. Contains the threshold the example's
feature value is compared to if the feature chosen for this node is a continuous-valued feature.
If on the other hand, the feature chosen for this node is categorical then the size of the
subset of values is stored here.
\item $4^{th}$ row onwards: Only applicable in the case of internal nodes where the feature
chosen is a categorical feature. Rows $4, 5 \ldots$ depict the value subset
chosen for this node.
\end{itemize}
As an example, Figure \ref{dtree} shows a decision tree with $5$ nodes and its matrix
representation.

\begin{figure}
\begin{minipage}{0.3\linewidth}
\begin{center}
\begin{tikzpicture}
\node (labelleft) [draw,shape=circle,minimum size=16pt] at (0,0) {$2$};
\node (labelright) [draw,shape=circle,minimum size=16pt] at (1,0) {$1$};
\node (rootleft) [draw,shape=rectangle,minimum size=16pt] at (0.5,1) {$x_5 \in \{2,3\}$};
\node (rootlabel) [draw,shape=circle,minimum size=16pt] at (2.5,1) {$1$};
\node (root) [draw,shape=rectangle,minimum size=16pt] at (1.75,2) {$x_3 < 0.45$};

\draw[-latex] (root) -- (rootleft);
\draw[-latex] (root) -- (rootlabel);
\draw[-latex] (rootleft) -- (labelleft);
\draw[-latex] (rootleft) -- (labelright);

\end{tikzpicture}
\end{center}
\begin{center}
(a)
\end{center}
\end{minipage}
\hfill
\begin{minipage}{0.65\linewidth}
\begin{center}
\begin{tabular}{c|c|c|c|c|c|}
& Col 1 & Col 2 & Col 3 & Col 4 & Col 5\\
\hline
Row 1 & 3 & 5 & -1 & -1 & -1\\
\hline
Row 2 & 1 & 2 & 1 & 2 & 1\\
\hline
Row 3 & 0.45 & 2 &  &  & \\
\hline
Row 4 &  & 2 &  &  & \\
\hline
Row 5 &  & 3 &  &  & \\
\hline
\end{tabular}
\end{center}
\begin{center}
(b)
\end{center}
\end{minipage}
\caption{(a) An example tree and its (b) matrix representation. $x$ denotes an example and $x_j$ the $j^{th}$ feature's value in it.}
\label{dtree}
\end{figure}

\vspace{16pt}

\noindent{\bf Returns}

The matrix corresponding to the learnt model is written to a file in the format requested. See
details where the structure of the model matrix is
described. Depending on what arguments are provided during
invocation, decision-tree-predict.dml may compute one or more of
predictions,  accuracy and confusion matrix in the requested output format.
\\

\noindent{\bf Examples}
\begin{verbatim}
hadoop jar SystemML.jar -f decision-tree.dml -nvargs
                           X=/user/biadmin/X.mtx
                           Y=/user/biadmin/y.mtx
                           types=/user/biadmin/types.mtx
                           model=/user/biadmin/model.mtx
                           bins=50 depth=10 num_leaf=1
                           num_samples=250 fmt=csv
                           Log=/user/biadmin/accuracy.csv
\end{verbatim}

\begin{verbatim}
hadoop jar SystemML.jar -f decision-tree-predict.dml -nvargs
                           X=/user/biadmin/X.mtx
                           Y=/user/biadmin/y.mtx
                           model=/user/biadmin/model.mtx
                           fmt=csv
                           predictions=/user/biadmin/probabilities.csv
                           accuracy=/user/biadmin/accuracy.csv
                           confusion=/user/biadmin/confusion.csv
\end{verbatim}

\noindent{\bf References}

\begin{itemize}
\item B. Panda, J. Herbach, S. Basu, and R. Bayardo. \newblock{PLANET: massively parallel learning of tree ensembles with MapReduce}. In Proceedings of the VLDB Endowment, 2009.
\item L. Breiman, J. Friedman, R. Olshen, and C. Stone. \newblock{Classification and Regression Trees}. Wadsworth and Brooks, 1984.
\end{itemize}


text:
module Awful
  module Short
    def waf_ipset(*args)
      Awful::WAF::Ipset.new.invoke(*args)
    end
  end

  module WAF
    class Ipset < Base

      desc 'ls', 'list ipsets'
      method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
      def ls
        list_thing(:ip_sets).output do |ipsets|
          if options[:long]
            print_table ipsets.map { |i| [i.name, i.ip_set_id] }
          else
            puts ipsets.map(&:name)
          end
        end
      end

      desc 'get ID', 'get ipset'
      method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
      def get(id)
        waf.get_ip_set(ip_set_id: id).ip_set.ip_set_descriptors.output do |ipsets|
          if options[:long]
            print_table ipsets.map { |i| [i.value, i.type] }
          else
            puts ipsets.map(&:value)
          end
        end
      end

      desc 'update ID', 'update ipset with ips'
      method_option :type, type: :string, default: 'ipv4', desc: 'type of address, IPV4 or IPV6'
      method_option :delete, type: :boolean, default: false, desc: 'delete IPs'
      def update(id, *values)
        waf.update_ip_set(
          ip_set_id: id,
          change_token: change_token,
          updates: values.map do |value|
            {
              action: options[:delete] ? 'DELETE' : 'INSERT',
              ip_set_descriptor: {
                type: options[:type].upcase,
                value: value
              }
            }
          end
        )
      end

    end

    class Base < Cli
      desc 'ipset', 'ipset subcommands'
      subcommand 'ipset', Ipset
    end

  end
end