text:
.class public abstract Landroid/graphics/drawable/Drawable;
.super Ljava/lang/Object;
.source "Drawable.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/graphics/drawable/Drawable$ConstantState;,
        Landroid/graphics/drawable/Drawable$Callback2;,
        Landroid/graphics/drawable/Drawable$Callback;
    }
.end annotation

# static fields
.field private static final ZERO_BOUNDS_RECT:Landroid/graphics/Rect;

# instance fields
.field private mBounds:Landroid/graphics/Rect;

.field private mCallback:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Landroid/graphics/drawable/Drawable$Callback;",
            ">;"
        }
    .end annotation
.end field

.field private mChangingConfigurations:I

.field private mLevel:I

.field private mStateSet:[I

.field private mVisible:Z

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

    .prologue
    .line 117
    new-instance v0, Landroid/graphics/Rect;

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

    sput-object v0, Landroid/graphics/drawable/Drawable;->ZERO_BOUNDS_RECT:Landroid/graphics/Rect;

    return-void
.end method

.method public constructor <init>()V
    .locals 2

    .prologue
    const/4 v1, 0x0

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

    .line 119
    sget-object v0, Landroid/util/StateSet;->WILD_CARD:[I

    iput-object v0, p0, Landroid/graphics/drawable/Drawable;->mStateSet:[I

    .line 120
    iput v1, p0, Landroid/graphics/drawable/Drawable;->mLevel:I

    .line 121
    iput v1, p0, Landroid/graphics/drawable/Drawable;->mChangingConfigurations:I

    .line 122
    sget-object v0, Landroid/graphics/drawable/Drawable;->ZERO_BOUNDS_RECT:Landroid/graphics/Rect;

    iput-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    .line 123
    const/4 v0, 0x0

    iput-object v0, p0, Landroid/graphics/drawable/Drawable;->mCallback:Ljava/lang/ref/WeakReference;

    .line 124
    const/4 v0, 0x1

    iput-boolean v0, p0, Landroid/graphics/drawable/Drawable;->mVisible:Z

    .line 926
    return-void
.end method

.method public static createFromPath(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 2
    .parameter "pathName"

    .prologue
    const/4 v1, 0x0

    .line 876
    if-nez p0, :cond_1

    .line 885
    :cond_0
    :goto_0
    return-object v1

    .line 880
    :cond_1
    invoke-static {p0}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 881
    .local v0, bm:Landroid/graphics/Bitmap;
    if-eqz v0, :cond_0

    .line 882
    invoke-static {v1, v0, v1, v1, p0}, Landroid/graphics/drawable/Drawable;->drawableFromBitmap(Landroid/content/res/Resources;Landroid/graphics/Bitmap;[BLandroid/graphics/Rect;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    goto :goto_0
.end method

.method public static createFromResourceStream(Landroid/content/res/Resources;Landroid/util/TypedValue;Ljava/io/InputStream;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 1
    .parameter "res"
    .parameter "value"
    .parameter "is"
    .parameter "srcName"

    .prologue
    .line 742
    const/4 v0, 0x0

    invoke-static {p0, p1, p2, p3, v0}, Landroid/graphics/drawable/Drawable;->createFromResourceStream(Landroid/content/res/Resources;Landroid/util/TypedValue;Ljava/io/InputStream;Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    return-object v0
.end method

.method public static createFromResourceStream(Landroid/content/res/Resources;Landroid/util/TypedValue;Ljava/io/InputStream;Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/drawable/Drawable;
    .locals 5
    .parameter "res"
    .parameter "value"
    .parameter "is"
    .parameter "srcName"
    .parameter "opts"

    .prologue
    const/4 v3, 0x0

    .line 752
    if-nez p2, :cond_1

    .line 782
    :cond_0
    :goto_0
    return-object v3

    .line 762
    :cond_1
    new-instance v2, Landroid/graphics/Rect;

    invoke-direct {v2}, Landroid/graphics/Rect;-><init>()V

    .line 771
    .local v2, pad:Landroid/graphics/Rect;
    if-nez p4, :cond_2

    new-instance p4, Landroid/graphics/BitmapFactory$Options;

    .end local p4
    invoke-direct {p4}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 772
    .restart local p4
    :cond_2
    sget v4, Landroid/util/DisplayMetrics;->DENSITY_DEVICE:I

    iput v4, p4, Landroid/graphics/BitmapFactory$Options;->inScreenDensity:I

    .line 773
    invoke-static {p0, p1, p2, v2, p4}, Landroid/graphics/BitmapFactory;->decodeResourceStream(Landroid/content/res/Resources;Landroid/util/TypedValue;Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 774
    .local v0, bm:Landroid/graphics/Bitmap;
    if-eqz v0, :cond_0

    .line 775
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getNinePatchChunk()[B

    move-result-object v1

    .line 776
    .local v1, np:[B
    if-eqz v1, :cond_3

    invoke-static {v1}, Landroid/graphics/NinePatch;->isNinePatchChunk([B)Z

    move-result v3

    if-nez v3, :cond_4

    .line 777
    :cond_3
    const/4 v1, 0x0

    .line 778
    const/4 v2, 0x0

    .line 780
    :cond_4
    invoke-static {p0, v0, v1, v2, p3}, Landroid/graphics/drawable/Drawable;->drawableFromBitmap(Landroid/content/res/Resources;Landroid/graphics/Bitmap;[BLandroid/graphics/Rect;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v3

    goto :goto_0
.end method

.method public static createFromStream(Ljava/io/InputStream;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 1
    .parameter "is"
    .parameter "srcName"

    .prologue
    const/4 v0, 0x0

    .line 733
    invoke-static {v0, v0, p0, p1, v0}, Landroid/graphics/drawable/Drawable;->createFromResourceStream(Landroid/content/res/Resources;Landroid/util/TypedValue;Ljava/io/InputStream;Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    return-object v0
.end method

.method public static createFromXml(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;)Landroid/graphics/drawable/Drawable;
    .locals 6
    .parameter "r"
    .parameter "parser"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/xmlpull/v1/XmlPullParserException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    const/4 v4, 0x2

    .line 792
    invoke-static {p1}, Landroid/util/Xml;->asAttributeSet(Lorg/xmlpull/v1/XmlPullParser;)Landroid/util/AttributeSet;

    move-result-object v0

    .line 796
    .local v0, attrs:Landroid/util/AttributeSet;
    :cond_0
    invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->next()I

    move-result v2

    .local v2, type:I
    if-eq v2, v4, :cond_1

    const/4 v3, 0x1

    if-ne v2, v3, :cond_0

    .line 800
    :cond_1
    if-eq v2, v4, :cond_2

    .line 801
    new-instance v3, Lorg/xmlpull/v1/XmlPullParserException;

    const-string v4, "No start tag found"

    invoke-direct {v3, v4}, Lorg/xmlpull/v1/XmlPullParserException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 804
    :cond_2
    invoke-static {p0, p1, v0}, Landroid/graphics/drawable/Drawable;->createFromXmlInner(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    .line 806
    .local v1, drawable:Landroid/graphics/drawable/Drawable;
    if-nez v1, :cond_3

    .line 807
    new-instance v3, Ljava/lang/RuntimeException;

    new-instance v4, Ljava/lang/StringBuilder;

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

    const-string v5, "Unknown initial tag: "

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

    move-result-object v4

    invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;

    move-result-object v5

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

    move-result-object v4

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

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 810
    :cond_3
    return-object v1
.end method

.method public static createFromXmlInner(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;)Landroid/graphics/drawable/Drawable;
    .locals 5
    .parameter "r"
    .parameter "parser"
    .parameter "attrs"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/xmlpull/v1/XmlPullParserException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 822
    invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;

    move-result-object v1

    .line 824
    .local v1, name:Ljava/lang/String;
    const-string/jumbo v2, "selector"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1

    .line 825
    new-instance v0, Landroid/graphics/drawable/StateListDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/StateListDrawable;-><init>()V

    .line 867
    .local v0, drawable:Landroid/graphics/drawable/Drawable;
    :cond_0
    :goto_0
    invoke-virtual {v0, p0, p1, p2}, Landroid/graphics/drawable/Drawable;->inflate(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;)V

    .line 868
    return-object v0

    .line 826
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_1
    const-string v2, "level-list"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2

    .line 827
    new-instance v0, Landroid/graphics/drawable/LevelListDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/LevelListDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 832
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_2
    const-string v2, "layer-list"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_3

    .line 833
    new-instance v0, Landroid/graphics/drawable/LayerDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/LayerDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 834
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_3
    const-string/jumbo v2, "transition"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_4

    .line 835
    new-instance v0, Landroid/graphics/drawable/TransitionDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/TransitionDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 836
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_4
    const-string v2, "color"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_5

    .line 837
    new-instance v0, Landroid/graphics/drawable/ColorDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/ColorDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 838
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_5
    const-string/jumbo v2, "shape"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_6

    .line 839
    new-instance v0, Landroid/graphics/drawable/GradientDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/GradientDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 840
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_6
    const-string/jumbo v2, "scale"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_7

    .line 841
    new-instance v0, Landroid/graphics/drawable/ScaleDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/ScaleDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 842
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_7
    const-string v2, "clip"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_8

    .line 843
    new-instance v0, Landroid/graphics/drawable/ClipDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/ClipDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 844
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_8
    const-string/jumbo v2, "rotate"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_9

    .line 845
    new-instance v0, Landroid/graphics/drawable/RotateDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/RotateDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto :goto_0

    .line 846
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_9
    const-string v2, "animated-rotate"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_a

    .line 847
    new-instance v0, Landroid/graphics/drawable/AnimatedRotateDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/AnimatedRotateDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto/16 :goto_0

    .line 848
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_a
    const-string v2, "animation-list"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_b

    .line 849
    new-instance v0, Landroid/graphics/drawable/AnimationDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/AnimationDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto/16 :goto_0

    .line 850
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_b
    const-string v2, "inset"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_c

    .line 851
    new-instance v0, Landroid/graphics/drawable/InsetDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/InsetDrawable;-><init>()V

    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    goto/16 :goto_0

    .line 852
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_c
    const-string v2, "bitmap"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_d

    .line 853
    new-instance v0, Landroid/graphics/drawable/BitmapDrawable;

    invoke-direct {v0, p0}, Landroid/graphics/drawable/BitmapDrawable;-><init>(Landroid/content/res/Resources;)V

    .line 854
    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    if-eqz p0, :cond_0

    move-object v2, v0

    .line 855
    check-cast v2, Landroid/graphics/drawable/BitmapDrawable;

    invoke-virtual {p0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/graphics/drawable/BitmapDrawable;->setTargetDensity(Landroid/util/DisplayMetrics;)V

    goto/16 :goto_0

    .line 857
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_d
    const-string/jumbo v2, "nine-patch"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_e

    .line 858
    new-instance v0, Landroid/graphics/drawable/NinePatchDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/NinePatchDrawable;-><init>()V

    .line 859
    .restart local v0       #drawable:Landroid/graphics/drawable/Drawable;
    if-eqz p0, :cond_0

    move-object v2, v0

    .line 860
    check-cast v2, Landroid/graphics/drawable/NinePatchDrawable;

    invoke-virtual {p0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/graphics/drawable/NinePatchDrawable;->setTargetDensity(Landroid/util/DisplayMetrics;)V

    goto/16 :goto_0

    .line 863
    .end local v0           #drawable:Landroid/graphics/drawable/Drawable;
    :cond_e
    new-instance v2, Lorg/xmlpull/v1/XmlPullParserException;

    new-instance v3, Ljava/lang/StringBuilder;

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

    invoke-interface {p1}, Lorg/xmlpull/v1/XmlPullParser;->getPositionDescription()Ljava/lang/String;

    move-result-object v4

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

    move-result-object v3

    const-string v4, ": invalid drawable tag "

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

    move-result-object v3

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

    move-result-object v3

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

    move-result-object v3

    invoke-direct {v2, v3}, Lorg/xmlpull/v1/XmlPullParserException;-><init>(Ljava/lang/String;)V

    throw v2
.end method

.method private static drawableFromBitmap(Landroid/content/res/Resources;Landroid/graphics/Bitmap;[BLandroid/graphics/Rect;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 6
    .parameter "res"
    .parameter "bm"
    .parameter "np"
    .parameter "pad"
    .parameter "srcName"

    .prologue
    .line 965
    if-eqz p2, :cond_0

    .line 966
    new-instance v0, Landroid/graphics/drawable/NinePatchDrawable;

    move-object v1, p0

    move-object v2, p1

    move-object v3, p2

    move-object v4, p3

    move-object v5, p4

    invoke-direct/range {v0 .. v5}, Landroid/graphics/drawable/NinePatchDrawable;-><init>(Landroid/content/res/Resources;Landroid/graphics/Bitmap;[BLandroid/graphics/Rect;Ljava/lang/String;)V

    .line 969
    :goto_0
    return-object v0

    :cond_0
    new-instance v0, Landroid/graphics/drawable/BitmapDrawable;

    invoke-direct {v0, p0, p1}, Landroid/graphics/drawable/BitmapDrawable;-><init>(Landroid/content/res/Resources;Landroid/graphics/Bitmap;)V

    goto :goto_0
.end method

.method public static resolveOpacity(II)I
    .locals 2
    .parameter "op1"
    .parameter "op2"

    .prologue
    const/4 v0, -0x2

    const/4 v1, -0x3

    .line 599
    if-ne p0, p1, :cond_0

    .line 611
    .end local p0
    :goto_0
    return p0

    .line 602
    .restart local p0
    :cond_0
    if-eqz p0, :cond_1

    if-nez p1, :cond_2

    .line 603
    :cond_1
    const/4 p0, 0x0

    goto :goto_0

    .line 605
    :cond_2
    if-eq p0, v1, :cond_3

    if-ne p1, v1, :cond_4

    :cond_3
    move p0, v1

    .line 606
    goto :goto_0

    .line 608
    :cond_4
    if-eq p0, v0, :cond_5

    if-ne p1, v0, :cond_6

    :cond_5
    move p0, v0

    .line 609
    goto :goto_0

    .line 611
    :cond_6
    const/4 p0, -0x1

    goto :goto_0
.end method

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

    .prologue
    .line 422
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Landroid/graphics/drawable/Drawable;->setColorFilter(Landroid/graphics/ColorFilter;)V

    .line 423
    return-void
.end method

.method public final copyBounds()Landroid/graphics/Rect;
    .locals 2

    .prologue
    .line 181
    new-instance v0, Landroid/graphics/Rect;

    iget-object v1, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    invoke-direct {v0, v1}, Landroid/graphics/Rect;-><init>(Landroid/graphics/Rect;)V

    return-object v0
.end method

.method public final copyBounds(Landroid/graphics/Rect;)V
    .locals 1
    .parameter "bounds"

    .prologue
    .line 169
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

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

    .line 170
    return-void
.end method

.method public abstract draw(Landroid/graphics/Canvas;)V
.end method

.method public final getBounds()Landroid/graphics/Rect;
    .locals 2

    .prologue
    .line 200
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    sget-object v1, Landroid/graphics/drawable/Drawable;->ZERO_BOUNDS_RECT:Landroid/graphics/Rect;

    if-ne v0, v1, :cond_0

    .line 201
    new-instance v0, Landroid/graphics/Rect;

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

    iput-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    .line 204
    :cond_0
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    return-object v0
.end method

.method public getCallback()Landroid/graphics/drawable/Drawable$Callback;
    .locals 1

    .prologue
    .line 332
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mCallback:Ljava/lang/ref/WeakReference;

    if-eqz v0, :cond_0

    .line 333
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mCallback:Ljava/lang/ref/WeakReference;

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

    move-result-object v0

    check-cast v0, Landroid/graphics/drawable/Drawable$Callback;

    .line 335
    :goto_0
    return-object v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public getChangingConfigurations()I
    .locals 1

    .prologue
    .line 234
    iget v0, p0, Landroid/graphics/drawable/Drawable;->mChangingConfigurations:I

    return v0
.end method

.method public getConstantState()Landroid/graphics/drawable/Drawable$ConstantState;
    .locals 1

    .prologue
    .line 959
    const/4 v0, 0x0

    return-object v0
.end method

.method public getCurrent()Landroid/graphics/drawable/Drawable;
    .locals 0

    .prologue
    .line 494
    return-object p0
.end method

.method public getIntrinsicHeight()I
    .locals 1

    .prologue
    .line 668
    const/4 v0, -0x1

    return v0
.end method

.method public getIntrinsicWidth()I
    .locals 1

    .prologue
    .line 660
    const/4 v0, -0x1

    return v0
.end method

.method public final getLevel()I
    .locals 1

    .prologue
    .line 527
    iget v0, p0, Landroid/graphics/drawable/Drawable;->mLevel:I

    return v0
.end method

.method public getMinimumHeight()I
    .locals 1

    .prologue
    .line 695
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v0

    .line 696
    .local v0, intrinsicHeight:I
    if-lez v0, :cond_0

    .end local v0           #intrinsicHeight:I
    :goto_0
    return v0

    .restart local v0       #intrinsicHeight:I
    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public getMinimumWidth()I
    .locals 1

    .prologue
    .line 681
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v0

    .line 682
    .local v0, intrinsicWidth:I
    if-lez v0, :cond_0

    .end local v0           #intrinsicWidth:I
    :goto_0
    return v0

    .restart local v0       #intrinsicWidth:I
    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public abstract getOpacity()I
.end method

.method public getPadding(Landroid/graphics/Rect;)Z
    .locals 1
    .parameter "padding"

    .prologue
    const/4 v0, 0x0

    .line 707
    invoke-virtual {p1, v0, v0, v0, v0}, Landroid/graphics/Rect;->set(IIII)V

    .line 708
    return v0
.end method

.method public getResolvedLayoutDirectionSelf()I
    .locals 2

    .prologue
    .line 394
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 395
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    instance-of v1, v0, Landroid/graphics/drawable/Drawable$Callback2;

    if-nez v1, :cond_1

    .line 396
    :cond_0
    const/4 v1, 0x0

    .line 398
    .end local v0           #callback:Landroid/graphics/drawable/Drawable$Callback;
    :goto_0
    return v1

    .restart local v0       #callback:Landroid/graphics/drawable/Drawable$Callback;
    :cond_1
    check-cast v0, Landroid/graphics/drawable/Drawable$Callback2;

    .end local v0           #callback:Landroid/graphics/drawable/Drawable$Callback;
    invoke-interface {v0, p0}, Landroid/graphics/drawable/Drawable$Callback2;->getResolvedLayoutDirection(Landroid/graphics/drawable/Drawable;)I

    move-result v1

    goto :goto_0
.end method

.method public getState()[I
    .locals 1

    .prologue
    .line 477
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mStateSet:[I

    return-object v0
.end method

.method public getTransparentRegion()Landroid/graphics/Region;
    .locals 1

    .prologue
    .line 628
    const/4 v0, 0x0

    return-object v0
.end method

.method public inflate(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;)V
    .locals 2
    .parameter "r"
    .parameter "parser"
    .parameter "attrs"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/xmlpull/v1/XmlPullParserException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 894
    sget-object v1, Lcom/android/internal/R$styleable;->Drawable:[I

    invoke-virtual {p1, p3, v1}, Landroid/content/res/Resources;->obtainAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;

    move-result-object v0

    .line 895
    .local v0, a:Landroid/content/res/TypedArray;
    const/4 v1, 0x0

    invoke-virtual {p0, p1, p2, v0, v1}, Landroid/graphics/drawable/Drawable;->inflateWithAttributes(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/content/res/TypedArray;I)V

    .line 896
    invoke-virtual {v0}, Landroid/content/res/TypedArray;->recycle()V

    .line 897
    return-void
.end method

.method inflateWithAttributes(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/content/res/TypedArray;I)V
    .locals 1
    .parameter "r"
    .parameter "parser"
    .parameter "attrs"
    .parameter "visibleAttr"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/xmlpull/v1/XmlPullParserException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 909
    iget-boolean v0, p0, Landroid/graphics/drawable/Drawable;->mVisible:Z

    invoke-virtual {p3, p4, v0}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z

    move-result v0

    iput-boolean v0, p0, Landroid/graphics/drawable/Drawable;->mVisible:Z

    .line 910
    return-void
.end method

.method public invalidateSelf()V
    .locals 1

    .prologue
    .line 348
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 349
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    .line 350
    invoke-interface {v0, p0}, Landroid/graphics/drawable/Drawable$Callback;->invalidateDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 352
    :cond_0
    return-void
.end method

.method public isStateful()Z
    .locals 1

    .prologue
    .line 436
    const/4 v0, 0x0

    return v0
.end method

.method public final isVisible()Z
    .locals 1

    .prologue
    .line 554
    iget-boolean v0, p0, Landroid/graphics/drawable/Drawable;->mVisible:Z

    return v0
.end method

.method public jumpToCurrentState()V
    .locals 0

    .prologue
    .line 485
    return-void
.end method

.method public mutate()Landroid/graphics/drawable/Drawable;
    .locals 0

    .prologue
    .line 726
    return-object p0
.end method

.method protected onBoundsChange(Landroid/graphics/Rect;)V
    .locals 0
    .parameter "bounds"

    .prologue
    .line 653
    return-void
.end method

.method protected onLevelChange(I)Z
    .locals 1
    .parameter "level"

    .prologue
    .line 648
    const/4 v0, 0x0

    return v0
.end method

.method protected onStateChange([I)Z
    .locals 1
    .parameter "state"

    .prologue
    .line 640
    const/4 v0, 0x0

    return v0
.end method

.method public scheduleSelf(Ljava/lang/Runnable;J)V
    .locals 1
    .parameter "what"
    .parameter "when"

    .prologue
    .line 365
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 366
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    .line 367
    invoke-interface {v0, p0, p1, p2, p3}, Landroid/graphics/drawable/Drawable$Callback;->scheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V

    .line 369
    :cond_0
    return-void
.end method

.method public abstract setAlpha(I)V
.end method

.method public setBounds(IIII)V
    .locals 2
    .parameter "left"
    .parameter "top"
    .parameter "right"
    .parameter "bottom"

    .prologue
    .line 139
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    .line 141
    .local v0, oldBounds:Landroid/graphics/Rect;
    sget-object v1, Landroid/graphics/drawable/Drawable;->ZERO_BOUNDS_RECT:Landroid/graphics/Rect;

    if-ne v0, v1, :cond_0

    .line 142
    new-instance v0, Landroid/graphics/Rect;

    .end local v0           #oldBounds:Landroid/graphics/Rect;
    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    .line 145
    .restart local v0       #oldBounds:Landroid/graphics/Rect;
    :cond_0
    iget v1, v0, Landroid/graphics/Rect;->left:I

    if-ne v1, p1, :cond_1

    iget v1, v0, Landroid/graphics/Rect;->top:I

    if-ne v1, p2, :cond_1

    iget v1, v0, Landroid/graphics/Rect;->right:I

    if-ne v1, p3, :cond_1

    iget v1, v0, Landroid/graphics/Rect;->bottom:I

    if-eq v1, p4, :cond_2

    .line 147
    :cond_1
    iget-object v1, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    invoke-virtual {v1, p1, p2, p3, p4}, Landroid/graphics/Rect;->set(IIII)V

    .line 148
    iget-object v1, p0, Landroid/graphics/drawable/Drawable;->mBounds:Landroid/graphics/Rect;

    invoke-virtual {p0, v1}, Landroid/graphics/drawable/Drawable;->onBoundsChange(Landroid/graphics/Rect;)V

    .line 150
    :cond_2
    return-void
.end method

.method public setBounds(Landroid/graphics/Rect;)V
    .locals 4
    .parameter "bounds"

    .prologue
    .line 157
    iget v0, p1, Landroid/graphics/Rect;->left:I

    iget v1, p1, Landroid/graphics/Rect;->top:I

    iget v2, p1, Landroid/graphics/Rect;->right:I

    iget v3, p1, Landroid/graphics/Rect;->bottom:I

    invoke-virtual {p0, v0, v1, v2, v3}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 158
    return-void
.end method

.method public final setCallback(Landroid/graphics/drawable/Drawable$Callback;)V
    .locals 1
    .parameter "cb"

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

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

    iput-object v0, p0, Landroid/graphics/drawable/Drawable;->mCallback:Ljava/lang/ref/WeakReference;

    .line 321
    return-void
.end method

.method public setChangingConfigurations(I)V
    .locals 0
    .parameter "configs"

    .prologue
    .line 217
    iput p1, p0, Landroid/graphics/drawable/Drawable;->mChangingConfigurations:I

    .line 218
    return-void
.end method

.method public setColorFilter(ILandroid/graphics/PorterDuff$Mode;)V
    .locals 1
    .parameter "color"
    .parameter "mode"

    .prologue
    .line 418
    new-instance v0, Landroid/graphics/PorterDuffColorFilter;

    invoke-direct {v0, p1, p2}, Landroid/graphics/PorterDuffColorFilter;-><init>(ILandroid/graphics/PorterDuff$Mode;)V

    invoke-virtual {p0, v0}, Landroid/graphics/drawable/Drawable;->setColorFilter(Landroid/graphics/ColorFilter;)V

    .line 419
    return-void
.end method

.method public abstract setColorFilter(Landroid/graphics/ColorFilter;)V
.end method

.method public setDither(Z)V
    .locals 0
    .parameter "dither"

    .prologue
    .line 242
    return-void
.end method

.method public setFilterBitmap(Z)V
    .locals 0
    .parameter "filter"

    .prologue
    .line 250
    return-void
.end method

.method public final setLevel(I)Z
    .locals 1
    .parameter "level"

    .prologue
    .line 514
    iget v0, p0, Landroid/graphics/drawable/Drawable;->mLevel:I

    if-eq v0, p1, :cond_0

    .line 515
    iput p1, p0, Landroid/graphics/drawable/Drawable;->mLevel:I

    .line 516
    invoke-virtual {p0, p1}, Landroid/graphics/drawable/Drawable;->onLevelChange(I)Z

    move-result v0

    .line 518
    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setState([I)Z
    .locals 1
    .parameter "stateSet"

    .prologue
    .line 462
    iget-object v0, p0, Landroid/graphics/drawable/Drawable;->mStateSet:[I

    invoke-static {v0, p1}, Ljava/util/Arrays;->equals([I[I)Z

    move-result v0

    if-nez v0, :cond_0

    .line 463
    iput-object p1, p0, Landroid/graphics/drawable/Drawable;->mStateSet:[I

    .line 464
    invoke-virtual {p0, p1}, Landroid/graphics/drawable/Drawable;->onStateChange([I)Z

    move-result v0

    .line 466
    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setVisible(ZZ)Z
    .locals 2
    .parameter "visible"
    .parameter "restart"

    .prologue
    .line 545
    iget-boolean v1, p0, Landroid/graphics/drawable/Drawable;->mVisible:Z

    if-eq v1, p1, :cond_1

    const/4 v0, 0x1

    .line 546
    .local v0, changed:Z
    :goto_0
    if-eqz v0, :cond_0

    .line 547
    iput-boolean p1, p0, Landroid/graphics/drawable/Drawable;->mVisible:Z

    .line 548
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->invalidateSelf()V

    .line 550
    :cond_0
    return v0

    .line 545
    .end local v0           #changed:Z
    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public unscheduleSelf(Ljava/lang/Runnable;)V
    .locals 1
    .parameter "what"

    .prologue
    .line 381
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 382
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    .line 383
    invoke-interface {v0, p0, p1}, Landroid/graphics/drawable/Drawable$Callback;->unscheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V

    .line 385
    :cond_0
    return-void
.end method


text:
package org.anc.lapps.oauth.masc;

import org.apache.oltu.oauth2.as.issuer.MD5Generator;
import org.apache.oltu.oauth2.as.issuer.OAuthIssuer;
import org.apache.oltu.oauth2.as.issuer.OAuthIssuerImpl;
import org.apache.oltu.oauth2.as.response.OAuthASResponse;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.message.OAuthResponse;
import org.junit.Test;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author Keith Suderman
 */
public class TokenTests
{
	public TokenTests()
	{

	}

	@Test
	public void testToken() throws OAuthSystemException
	{
		OAuthIssuer oauthIssuerImpl =
				  new OAuthIssuerImpl(new MD5Generator());
		String token = oauthIssuerImpl.accessToken();
		String refresh = oauthIssuerImpl.refreshToken();
		OAuthResponse response = OAuthASResponse
				  .tokenResponse(HttpServletResponse.SC_OK)
				  .setAccessToken(token)
				  .setRefreshToken(refresh)
				  .setExpiresIn("3600")
				  .buildJSONMessage();
		Map<String,String> headers = response.getHeaders();
		for (String key : headers.keySet())
		{
			System.out.println(key + "=" + headers.get(key));
		}
		System.out.println(response.getBody());
	}
}

redpajama_set_name: RedPajamaGithub


text:
package views.html.relation

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._

import controllers.routes

object actions {

  private val dataHoverText = data("hover-text")

  def apply(
      userId: lila.user.User.ID,
      relation: Option[lila.relation.Relation],
      followable: Boolean,
      blocked: Boolean,
      signup: Boolean = false
  )(implicit ctx: Context) =
    div(cls := "relation-actions btn-rack")(
      ctx.userId map { myId =>
        (myId != userId) ?? frag(
          !blocked option frag(
            a(
              titleOrText(trans.challenge.challengeToPlay.txt()),
              href := s"${routes.Lobby.home}?user=$userId#friend",
              cls := "btn-rack__btn",
              dataIcon := ""
            ),
            a(
              titleOrText(trans.composeMessage.txt()),
              href := routes.Msg.convo(userId),
              cls := "btn-rack__btn",
              dataIcon := ""
            )
          ),
          relation match {
            case None =>
              frag(
                followable && !blocked option a(
                  cls := "btn-rack__btn relation-button",
                  href := routes.Relation.follow(userId),
                  titleOrText(trans.follow.txt()),
                  dataIcon := ""
                ),
                a(
                  cls := "btn-rack__btn relation-button",
                  href := routes.Relation.block(userId),
                  titleOrText(trans.block.txt()),
                  dataIcon := ""
                )
              )
            case Some(true) =>
              a(
                dataIcon := "",
                cls := "btn-rack__btn relation-button text hover-text",
                href := routes.Relation.unfollow(userId),
                titleOrText(trans.following.txt()),
                dataHoverText := trans.unfollow.txt()
              )
            case Some(false) =>
              a(
                dataIcon := "",
                cls := "btn-rack__btn relation-button text hover-text",
                href := routes.Relation.unblock(userId),
                titleOrText(trans.blocked.txt()),
                dataHoverText := trans.unblock.txt()
              )
          }
        )
      } getOrElse {
        signup option frag(
          trans.youNeedAnAccountToDoThat(),
          a(href := routes.Auth.login, cls := "signup")(trans.signUp())
        )
      }
    )
}


text:
load.ivy("org.eclipse.mylyn.github" % "org.eclipse.egit.github.core" % "2.1.5")

@

import scala.collection.JavaConversions._

import org.eclipse.egit.github.core._
import org.eclipse.egit.github.core.client.GitHubClient
import org.eclipse.egit.github.core.service.RepositoryService
import org.eclipse.egit.github.core.service.ContentsService
import org.eclipse.egit.github.core.service.MarkdownService

import java.util.Base64

implicit class Apply[A](a: A) {
  def |>[B](f: A => B): B = f(a)
}

sealed trait Content { def src: RepositoryContents }
case class File (path: String, src: RepositoryContents) extends Content
case class Dir  (path: String, children: Seq[Content], src: RepositoryContents) extends Content

val ghclient    = new GitHubClient()
val repoService = new RepositoryService(ghclient)
val contService = new ContentsService(ghclient)
val mdService   = new MarkdownService(ghclient)

ghclient.setOAuth2Token("c8a329326458c3cbc4d89b20534060764eba8b5e")
val spout = new Repo("eija-johansson", "spout")

class Repo(userName: String, repoName: String) {

  val repo = repoService.getRepository(userName, repoName)

  def list(path: String = null): Seq[Content] = {
    def convert(c: RepositoryContents) = c.getType match {
      case RepositoryContents.TYPE_FILE => File(c.getPath, c)
      case RepositoryContents.TYPE_DIR  => Dir(c.getPath, list(c.getPath), c)
    }
    val cont = contService.getContents(repo, path)
    cont map convert
  }

  def files = {
    def unwrap(c: Content): Seq[File] = c match {
      case f: File => Seq(f)
      case d: Dir  => d.children flatMap unwrap
    }
    list() flatMap unwrap
  }

  def read(file: File): Option[String] = {
    def decode(b64: String) =
      b64.replaceAll("""\s""","") |> Base64.getDecoder.decode |> (new String(_))

    contService.getContents(repo, file.path)
      .headOption
      .map (_.getContent)
      .map (decode(_))
  }

  def renderMd(file: File): String =
    read(file)
      .map (renderMd)
      .getOrElse ("")

  def renderMd(text: String): String =
    mdService.getRepositoryHtml(repo, text)
}


text:
'use strict';

angular.module('myApp')

.component('myApp', {
  template: '<ui-view></ui-view>',
  controller: function(BackendService, ConfigService, $state) {

    this.$onInit = function() {
      BackendService.getConfig().query(function(data) {
        ConfigService.setConfig(data.config);
      }, function(error) {
        $state.go('public.uops');
      });
    }
  }
});


text:
package org.apache.ignite.internal.util.io;

import java.io.IOException;
import java.io.OutputStream;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;

import static org.apache.ignite.IgniteSystemProperties.IGNITE_MARSHAL_BUFFERS_RECHECK;
import static org.apache.ignite.internal.util.GridUnsafe.BIG_ENDIAN;
import static org.apache.ignite.internal.util.GridUnsafe.BYTE_ARR_OFF;
import static org.apache.ignite.internal.util.GridUnsafe.CHAR_ARR_OFF;
import static org.apache.ignite.internal.util.GridUnsafe.DOUBLE_ARR_OFF;
import static org.apache.ignite.internal.util.GridUnsafe.FLOAT_ARR_OFF;
import static org.apache.ignite.internal.util.GridUnsafe.INT_ARR_OFF;
import static org.apache.ignite.internal.util.GridUnsafe.LONG_ARR_OFF;
import static org.apache.ignite.internal.util.GridUnsafe.SHORT_ARR_OFF;

/**
 * Data output based on {@code Unsafe} operations.
 */
public class GridUnsafeDataOutput extends OutputStream implements GridDataOutput {
    /** */
    private static final Long CHECK_FREQ = Long.getLong(IGNITE_MARSHAL_BUFFERS_RECHECK, 10000);

    /** Length of char buffer (for writing strings). */
    private static final int CHAR_BUF_SIZE = 256;

    /** Char buffer for fast string writes. */
    private final char[] cbuf = new char[CHAR_BUF_SIZE];

    /** Bytes. */
    private byte[] bytes;

    /** Offset. */
    private int off;

    /** Underlying output stream. */
    private OutputStream out;

    /** Maximum message size. */
    private int maxOff;

    /** Last length check timestamp. */
    private long lastCheck = U.currentTimeMillis();

    /**
     *
     */
    public GridUnsafeDataOutput() {
        // No-op.
    }

    /**
     * @param size Size
     */
    public GridUnsafeDataOutput(int size) {
        bytes = new byte[size];
    }

    /**
     * @param bytes Bytes.
     * @param off Offset.
     */
    public void bytes(byte[] bytes, int off) {
        this.bytes = bytes;
        this.off = off;
    }

    /**
     * @param out Underlying output stream.
     */
    @Override public void outputStream(OutputStream out) {
        this.out = out;

        off = 0;
    }

    /** {@inheritDoc} */
    @Override public byte[] array() {
        byte[] bytes0 = new byte[off];

        System.arraycopy(bytes, 0, bytes0, 0, off);

        return bytes0;
    }

    /** {@inheritDoc} */
    @Override public byte[] internalArray() {
        return bytes;
    }

    /** {@inheritDoc} */
    @Override public int offset() {
        return off;
    }

    /** {@inheritDoc} */
    @Override public void offset(int off) {
        this.off = off;
    }

    /**
     * @param size Size.
     */
    private void requestFreeSize(int size) {
        size = off + size;

        maxOff = Math.max(maxOff, size);

        long now = U.currentTimeMillis();

        if (size > bytes.length) {
            byte[] newBytes = new byte[size << 1]; // Grow.

            System.arraycopy(bytes, 0, newBytes, 0, off);

            bytes = newBytes;
        }
        else if (now - lastCheck > CHECK_FREQ) {
            int halfSize = bytes.length >> 1;

            if (maxOff < halfSize) {
                byte[] newBytes = new byte[halfSize]; // Shrink.

                System.arraycopy(bytes, 0, newBytes, 0, off);

                bytes = newBytes;
            }

            maxOff = 0;
            lastCheck = now;
        }
    }

    /**
     * @param size Size.
     * @throws IOException In case of error.
     */
    private void onWrite(int size) throws IOException {
        if (out != null)
            out.write(bytes, 0, size);
        else
            off += size;
    }

    /** {@inheritDoc} */
    @Override public void write(byte[] b) throws IOException {
        requestFreeSize(b.length);

        System.arraycopy(b, 0, bytes, off, b.length);

        onWrite(b.length);
    }

    /** {@inheritDoc} */
    @Override public void write(byte[] b, int off, int len) throws IOException {
        requestFreeSize(len);

        System.arraycopy(b, off, bytes, this.off, len);

        onWrite(len);
    }

    /** {@inheritDoc} */
    @Override public void writeDoubleArray(double[] arr) throws IOException {
        writeInt(arr.length);

        int bytesToCp = arr.length << 3;

        requestFreeSize(bytesToCp);

        if (BIG_ENDIAN) {
            long off = BYTE_ARR_OFF + this.off;

            for (double val : arr) {
                GridUnsafe.putDoubleLE(bytes, off, val);

                off += 8;
            }
        }
        else
            GridUnsafe.copyMemory(arr, DOUBLE_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

        onWrite(bytesToCp);
    }

    /** {@inheritDoc} */
    @SuppressWarnings("ForLoopReplaceableByForEach")
    @Override public void writeBooleanArray(boolean[] arr) throws IOException {
        writeInt(arr.length);

        for (int i = 0; i < arr.length; i++)
            writeBoolean(arr[i]);
    }

    /** {@inheritDoc} */
    @Override public void writeCharArray(char[] arr) throws IOException {
        writeInt(arr.length);

        int bytesToCp = arr.length << 1;

        requestFreeSize(bytesToCp);

        if (BIG_ENDIAN) {
            long off = BYTE_ARR_OFF + this.off;

            for (char val : arr) {
                GridUnsafe.putCharLE(bytes, off, val);

                off += 2;
            }
        }
        else
            GridUnsafe.copyMemory(arr, CHAR_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

        onWrite(bytesToCp);
    }

    /** {@inheritDoc} */
    @Override public void writeLongArray(long[] arr) throws IOException {
        writeInt(arr.length);

        int bytesToCp = arr.length << 3;

        requestFreeSize(bytesToCp);

        if (BIG_ENDIAN) {
            long off = BYTE_ARR_OFF + this.off;

            for (long val : arr) {
                GridUnsafe.putLongLE(bytes, off, val);

                off += 8;
            }
        }
        else
            GridUnsafe.copyMemory(arr, LONG_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

        onWrite(bytesToCp);
    }

    /** {@inheritDoc} */
    @Override public void writeFloatArray(float[] arr) throws IOException {
        writeInt(arr.length);

        int bytesToCp = arr.length << 2;

        requestFreeSize(bytesToCp);

        if (BIG_ENDIAN) {
            long off = BYTE_ARR_OFF + this.off;

            for (float val : arr) {
                GridUnsafe.putFloatLE(bytes, off, val);

                off += 4;
            }
        }
        else
            GridUnsafe.copyMemory(arr, FLOAT_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

        onWrite(bytesToCp);
    }

    /** {@inheritDoc} */
    @Override public void reset() {
        off = 0;

        out = null;
    }

    /** {@inheritDoc} */
    @Override public void writeByteArray(byte[] arr) throws IOException {
        writeInt(arr.length);

        requestFreeSize(arr.length);

        System.arraycopy(arr, 0, bytes, off, arr.length);

        onWrite(arr.length);
    }

    /** {@inheritDoc} */
    @Override public void writeShortArray(short[] arr) throws IOException {
        writeInt(arr.length);

        int bytesToCp = arr.length << 1;

        requestFreeSize(bytesToCp);

        if (BIG_ENDIAN) {
            long off = BYTE_ARR_OFF + this.off;

            for (short val : arr) {
                GridUnsafe.putShortLE(bytes, off, val);

                off += 2;
            }
        }
        else
            GridUnsafe.copyMemory(arr, SHORT_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

        onWrite(bytesToCp);
    }

    /** {@inheritDoc} */
    @Override public void writeIntArray(int[] arr) throws IOException {
        writeInt(arr.length);

        int bytesToCp = arr.length << 2;

        requestFreeSize(bytesToCp);

        if (BIG_ENDIAN) {
            long off = BYTE_ARR_OFF + this.off;

            for (int val : arr) {
                GridUnsafe.putIntLE(bytes, off, val);

                off += 4;
            }
        }
        else
            GridUnsafe.copyMemory(arr, INT_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

        onWrite(bytesToCp);
    }

    /** {@inheritDoc} */
    @Override public void close() throws IOException {
        reset();
    }

    /** {@inheritDoc} */
    @Override public void writeBoolean(boolean v) throws IOException {
        requestFreeSize(1);

        GridUnsafe.putBoolean(bytes, BYTE_ARR_OFF + off, v);

        onWrite(1);
    }

    /** {@inheritDoc} */
    @Override public void writeByte(int v) throws IOException {
        requestFreeSize(1);

        GridUnsafe.putByte(bytes, BYTE_ARR_OFF + off, (byte)v);

        onWrite(1);
    }

    /** {@inheritDoc} */
    @Override public void writeShort(int v) throws IOException {
        requestFreeSize(2);

        short val = (short)v;

        long off = BYTE_ARR_OFF + this.off;

        if (BIG_ENDIAN)
            GridUnsafe.putShortLE(bytes, off, val);
        else
            GridUnsafe.putShort(bytes, off, val);

        onWrite(2);
    }

    /** {@inheritDoc} */
    @Override public void writeChar(int v) throws IOException {
        requestFreeSize(2);

        char val = (char)v;

        long off = BYTE_ARR_OFF + this.off;

        if (BIG_ENDIAN)
            GridUnsafe.putCharLE(bytes, off, val);
        else
            GridUnsafe.putChar(bytes, off, val);

        onWrite(2);
    }

    /** {@inheritDoc} */
    @Override public void writeInt(int v) throws IOException {
        requestFreeSize(4);

        long off = BYTE_ARR_OFF + this.off;

        if (BIG_ENDIAN)
            GridUnsafe.putIntLE(bytes, off, v);
        else
            GridUnsafe.putInt(bytes, off, v);

        onWrite(4);
    }

    /** {@inheritDoc} */
    @Override public void writeLong(long v) throws IOException {
        requestFreeSize(8);

        long off = BYTE_ARR_OFF + this.off;

        if (BIG_ENDIAN)
            GridUnsafe.putLongLE(bytes, off, v);
        else
            GridUnsafe.putLong(bytes, off, v);

        onWrite(8);
    }

    /** {@inheritDoc} */
    @Override public void writeFloat(float v) throws IOException {
        int val = Float.floatToIntBits(v);

        writeInt(val);
    }

    /** {@inheritDoc} */
    @Override public void writeDouble(double v) throws IOException {
        long val = Double.doubleToLongBits(v);

        writeLong(val);
    }

    /** {@inheritDoc} */
    @Override public void write(int b) throws IOException {
        writeByte(b);
    }

    /** {@inheritDoc} */
    @Override public void writeBytes(String s) throws IOException {
        int len = s.length();

        writeInt(len);

        for (int i = 0; i < len; i++)
            writeByte(s.charAt(i));
    }

    /** {@inheritDoc} */
    @Override public void writeChars(String s) throws IOException {
        int len = s.length();

        writeInt(len);

        for (int i = 0; i < len; i++)
            writeChar(s.charAt(i));
    }

    /** {@inheritDoc} */
    @Override public void writeUTF(String s) throws IOException {
        writeUTF(s, utfLength(s));
    }

    /**
     *
     * Returns the length in bytes of the UTF encoding of the given string.
     *
     * @param s String.
     * @return UTF encoding length.
     */
    private int utfLength(String s) {
        int len = s.length();
        int utfLen = 0;

        for (int off = 0; off < len; ) {
            int size = Math.min(len - off, CHAR_BUF_SIZE);

            s.getChars(off, off + size, cbuf, 0);

            for (int pos = 0; pos < size; pos++) {
                char c = cbuf[pos];

                if (c >= 0x0001 && c <= 0x007F)
                    utfLen++;
                else
                    utfLen += c > 0x07FF ? 3 : 2;
            }

            off += size;
        }

        return utfLen;
    }

    /**
     * Writes the given string in UTF format. This method is used in
     * situations where the UTF encoding length of the string is already
     * known; specifying it explicitly avoids a prescan of the string to
     * determine its UTF length.
     *
     * @param s String.
     * @param utfLen UTF length encoding.
     * @throws IOException In case of error.
     */
    private void writeUTF(String s, int utfLen) throws IOException {
        if (utfLen == s.length())
            writeBytes(s);
        else {
            writeInt(utfLen);

            writeUTFBody(s);
        }
    }

    /**
     * Writes the "body" (i.e., the UTF representation minus the 2-byte or
     * 8-byte length header) of the UTF encoding for the given string.
     *
     * @param s String.
     * @throws IOException In case of error.
     */
    private void writeUTFBody(String s) throws IOException {
        int len = s.length();

        for (int off = 0; off < len; ) {
            int csize = Math.min(len - off, CHAR_BUF_SIZE);

            s.getChars(off, off + csize, cbuf, 0);

            for (int cpos = 0; cpos < csize; cpos++) {
                char c = cbuf[cpos];

                if (c <= 0x007F && c != 0)
                    write(c);
                else if (c > 0x07FF) {
                    write(0xE0 | ((c >> 12) & 0x0F));
                    write(0x80 | ((c >> 6) & 0x3F));
                    write(0x80 | ((c) & 0x3F));
                }
                else {
                    write(0xC0 | ((c >> 6) & 0x1F));
                    write(0x80 | ((c) & 0x3F));
                }
            }

            off += csize;
        }
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(GridUnsafeDataOutput.class, this);
    }
}


text:
package org.locationtech.geowave.core.store.index;

/**
 * Registered core adapter to index field mappers.
 */
public class CoreRegisteredIndexFieldMappers implements IndexFieldMapperRegistrySPI {

  @Override
  public RegisteredFieldMapper[] getRegisteredFieldMappers() {
    return new RegisteredFieldMapper[] {
        new RegisteredFieldMapper(NoOpIndexFieldMapper::new, (short) 202)};
  }

}


text:
<?php

namespace PersonApiTest\Service;

use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\QueryBuilder;
use DvsaCommon\ApiClient\Person\PerformanceDashboardStats\Dto\DayPerformanceDashboardStatsDto;
use DvsaCommon\ApiClient\Person\PerformanceDashboardStats\Dto\MonthPerformanceDashboardStatsDto;
use DvsaCommon\Enum\MotTestStatusName;
use DvsaCommon\Enum\MotTestTypeCode;
use DvsaCommonApiTest\Service\AbstractServiceTestCase;
use DvsaCommonTest\TestUtils\XMock;
use DvsaEntities\Entity\MotTest;
use DvsaEntities\Entity\MotTestStatus;
use DvsaEntities\Entity\MotTestType;
use DvsaEntities\Entity\Person;
use DvsaEntities\Repository\MotTestRepository;
use UserApi\Dashboard\Dto\DayStats;
use UserApi\Dashboard\Dto\MonthStats;
use PersonApi\Service\UserStatsService;

/**
 * Tests for UserStatsService.
 */
class UserStatsServiceTest extends AbstractServiceTestCase
{
    /**
     * @var UserStatsService
     */
    public $statsService;

    /** @var MotTestRepository | \PHPUnit\Framework\MockObject\MockObject $mockRepository */
    private $mockRepository;

    /** @var EntityManager | \PHPUnit\Framework\MockObject\MockObject $mockEntityManager */
    private $mockEntityManager;

    private $personId = 9;

    public function testConstructor()
    {
        $motTests = $this->getArrayOfMotTests(MotTestTypeCode::NORMAL_TEST);
        $this->setUpMocks($motTests);
        $this->statsService = new UserStatsService(
            $this->mockEntityManager,
            $this->mockRepository
        );

        $this->assertEquals(get_class($this->statsService), UserStatsService::class);
    }

    public function testGetUserDayStatsByPersonId()
    {
        //given
        $motTests = $this->getArrayOfMotTests(MotTestTypeCode::NORMAL_TEST);
        $this->setUpMocks($motTests);
        $this->statsService = new UserStatsService(
            $this->mockEntityManager,
            $this->mockRepository
        );

        //when
        $result = $this->statsService->getUserDayStatsByPersonId($this->personId);

        //then
        $this->assertEquals(DayPerformanceDashboardStatsDto::class, get_class($result));
        $this->assertEquals(2, $result->getNumberOfFails());
        $this->assertEquals(3, $result->getTotal());
        $this->assertEquals(1, $result->getNumberOfPasses());
    }

    public function testGetUserCurrentMonthStatsByPersonId()
    {
        //given
        $motTests = $this->getArrayOfMotTests(MotTestTypeCode::NORMAL_TEST);
        $this->setUpMocks($motTests);
        $this->statsService = new UserStatsService(
            $this->mockEntityManager,
            $this->mockRepository
        );

        //when
        $result = $this->statsService->getUserCurrentMonthStatsByPersonId($this->personId);

        //then
        $this->assertEquals(MonthPerformanceDashboardStatsDto::class, get_class($result));
        $this->assertEquals(2, $result->getFailedTestsCount());
        $this->assertEquals(1, $result->getPassedTestsCount());
        $this->assertEquals(3, $result->getTotalTestsCount());
        $this->assertEquals(4800, $result->getAverageTime()->getTotalSeconds());
        $this->assertEquals((float) 100 * 2 / 3, $result->getFailRate());
    }

    /**
     * @param string $motTestTypeCode
     *
     * @return array
     */
    private function getArrayOfMotTests($motTestTypeCode)
    {
        $mtt = new MotTestType();
        $mtt->setCode($motTestTypeCode);
        $motTestPassed = new MotTest();
        $motTestPassed->setStatus($this->createMotTestStatus(MotTestStatusName::PASSED))
            ->setMotTestType($mtt)
            ->setStartedDate(new \DateTime('2014-07-01 10:00:00'))
            ->setCompletedDate(new \DateTime('2014-07-01 11:00:00'));

        $motTestFailed = new MotTest();
        $motTestFailed->setStatus($this->createMotTestStatus(MotTestStatusName::FAILED))
            ->setMotTestType($mtt)
            ->setStartedDate(new \DateTime('2014-07-01 11:00:00'))
            ->setCompletedDate(new \DateTime('2014-07-01 12:00:00'));

        $motTestPrs1 = new MotTest();
        $motTestPrs1->setStatus($this->createMotTestStatus(MotTestStatusName::PASSED))
            ->setMotTestType($mtt)
            ->setStartedDate(new \DateTime('2014-07-01 14:00:00'))
            ->setCompletedDate(new \DateTime('2014-07-01 16:00:00'));

        $motTestPrs2 = new MotTest();
        $motTestPrs2->setStatus($this->createMotTestStatus(MotTestStatusName::FAILED))
            ->setMotTestType($mtt)
            ->setStartedDate(new \DateTime('2014-07-01 14:00:00'))
            ->setCompletedDate(new \DateTime('2014-07-01 16:00:00'));

        $motTestPrs1->setPrsMotTest($motTestPrs2);
        $motTestPrs2->setPrsMotTest($motTestPrs1);

        return [$motTestPassed, $motTestFailed, $motTestPrs1, $motTestPrs2];
    }

    private function setUpMocks($motTests)
    {
        $person = new Person();

        $mockQuery = $this->getMockBuilder(AbstractQuery::class)
            ->setMethods(['setParameter', 'getResult'])
            ->disableOriginalConstructor()
            ->getMockForAbstractClass();
        $this->setupMockForCalls($mockQuery, 'getResult', $motTests);

        $mockQueryBuilder = $this->getMockBuilder(QueryBuilder::class, [], [], '', false)->disableOriginalConstructor()->getMock();
        $this->setupMockForCalls($mockQueryBuilder, 'getQuery', $mockQuery);

        /* @var MotTestRepository $mockRepository */
        $this->mockRepository = $this->getMockRepository(MotTestRepository::class);
        $this->setupMockForCalls($this->mockRepository, 'matching', $motTests);
        $this->setupMockForCalls($this->mockRepository, 'createQueryBuilder', $mockQueryBuilder, 't');

        /* @var EntityManager $mockEntityManager */
        $this->mockEntityManager = $this->getMockEntityManager();
        $this->setupMockForCalls($this->mockEntityManager, 'find', $person, Person::class);
        $this->setupMockForCalls($this->mockEntityManager, 'getRepository', $this->mockRepository, MotTest::class);
    }

    /**
     * @param $name
     *
     * @return \PHPUnit\Framework\MockObject\MockObject|MotTestStatus
     *
     * @throws \Exception
     */
    private function createMotTestStatus($name)
    {
        $status = XMock::of(MotTestStatus::class);
        $status
            ->expects($this->any())
            ->method('getName')
            ->willReturn($name);

        return $status;
    }
}


text:
#include "Int8ArrayList.h"
#include "Int8ArrayListImpl.h"
#include "plog.h"
#include "pmemory.h"

ESR_ReturnCode Int8ArrayListAdd(Int8ArrayList* self, asr_int8_t element)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->add(self, element);
}

ESR_ReturnCode Int8ArrayListRemove(Int8ArrayList* self, asr_int8_t element)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->remove(self, element);
}

ESR_ReturnCode Int8ArrayListRemoveAll(Int8ArrayList* self)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->removeAll(self);
}

ESR_ReturnCode Int8ArrayListContains(Int8ArrayList* self, asr_int8_t element, ESR_BOOL* exists)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->contains(self, element, exists);
}

ESR_ReturnCode Int8ArrayListGetSize(Int8ArrayList* self, size_t* size)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->getSize(self, size);
}

ESR_ReturnCode Int8ArrayListGet(Int8ArrayList* self, size_t index, asr_int8_t* element)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->get(self, index, element);
}

ESR_ReturnCode Int8ArrayListSet(Int8ArrayList* self, size_t index, asr_int8_t element)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->set(self, index, element);
}

ESR_ReturnCode Int8ArrayListToStaticArray(Int8ArrayList* self, asr_int8_t** newArray)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->toStaticArray(self, newArray);
}

ESR_ReturnCode Int8ArrayListClone(Int8ArrayList* self, Int8ArrayList* clone)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->clone(self, clone);
}

ESR_ReturnCode Int8ArrayListDestroy(Int8ArrayList* self)
{
  if (self == NULL)
  {
    PLogError(L("ESR_INVALID_ARGUMENT"));
    return ESR_INVALID_ARGUMENT;
  }
  return self->destroy(self);
}


text:
<#
.EXAMPLE
    This example shows how to deploy Access Services 2010 to the local SharePoint farm.
#>

    Configuration Example
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPAccessServices2010 Access2010Services
            {
                Name                 = "Access 2010 Services Service Application"
                ApplicationPool      = "SharePoint Service Applications"
                PsDscRunAsCredential = $SetupAccount
            }
        }
    }


text:
    Developed and Maintained by The Children's Hospital of Philadelphia

    Terms of Use ·
    Privacy Policy


text:
package dhg.ccg.cat

import java.io.FileInputStream
import java.io.ObjectInputStream
import java.io.FileOutputStream
import java.io.ObjectOutputStream
import java.util.zip._
import scala.annotation.tailrec
import scala.collection.immutable.ListMap
import scala.collection.immutable.VectorBuilder
import scala.collection.mutable.{ Map => MMap }
import scala.collection.mutable.{ Set => MSet }
import dhg.ccg.cat._
import dhg.ccg.rule._
import dhg.ccg.parse._
import dhg.ccg.tagdict.TagDictionary
import dhg.ccg.util.DrawMatrix
import dhg.util.GraphUtil._
import dhg.gfl.FudgSentence
import dhg.util._
import dhg.util.viz.TreeViz
import scalaz._
import scalaz.Scalaz._
import scala.util.Try
import dhg.ccg.util.Indexer
import dhg.ccg.util.SimpleIndexer

object CatIndexer {

  def apply(objects: TraversableOnce[Cat], rules: Set[CcgRule]): Indexer[Cat] = {
    val objectSet = objects.toSet
    val allDerived = CcgRule.allDerivable(rules, objectSet)
    new SimpleIndexer(allDerived.toVector)
  }

}


text:
if wifi.getmode() ~= wifi.SOFTAP then
    wifi.ap.config({ssid="Auto!",pwd="jedemjedem",max=1})
    wifi.setmode(wifi.SOFTAP)
end

local auto = require("auto")
auto.start()

wifi.eventmon.register(wifi.eventmon.AP_STACONNECTED, function(T)
  print("Connected "..T.MAC)

  auto.blink(3,100)
end)

wifi.eventmon.register(wifi.eventmon.AP_STADISCONNECTED, function(T)
  print("Disconnected "..T.MAC)

  auto.drive(0,0)
  auto.aux(false)
end)


text:
package com.intellij.execution.process;

import com.intellij.execution.Platform;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.StatusBar;
import org.jetbrains.annotations.NotNull;

public final class ProcessTerminatedListener extends ProcessAdapter {
  private static final String EXIT_CODE_ENTRY = "$EXIT_CODE$";
  private static final String EXIT_CODE_REGEX = "\\$EXIT_CODE\\$";

  private static final Key<ProcessTerminatedListener> KEY = new Key<>("processTerminatedListener");

  private final String myProcessFinishedMessage;
  private final Project myProject;

  private ProcessTerminatedListener(final Project project, final String processFinishedMessage) {
    myProject = project;
    myProcessFinishedMessage = processFinishedMessage;
  }

  public static void attach(final ProcessHandler processHandler, Project project, final String message) {
    final ProcessTerminatedListener previousListener = processHandler.getUserData(KEY);
    if (previousListener != null) {
      processHandler.removeProcessListener(previousListener);
      if (project == null) project = previousListener.myProject;
    }

    final ProcessTerminatedListener listener = new ProcessTerminatedListener(project, message);
    processHandler.addProcessListener(listener);
    processHandler.putUserData(KEY, listener);
  }

  public static void attach(final ProcessHandler processHandler, final Project project) {
    String message = IdeBundle.message("finished.with.exit.code.text.message", EXIT_CODE_ENTRY);
    attach(processHandler, project, "\n" + message + "\n");
  }

  public static void attach(final ProcessHandler processHandler) {
    attach(processHandler, null);
  }

  @Override
  public void processTerminated(@NotNull ProcessEvent event) {
    ProcessHandler processHandler = event.getProcessHandler();
    processHandler.removeProcessListener(this);
    @NlsSafe String message = myProcessFinishedMessage.replaceAll(EXIT_CODE_REGEX, stringifyExitCode(event.getExitCode()));
    processHandler.notifyTextAvailable(message, ProcessOutputTypes.SYSTEM);
    if (myProject != null) {
      ApplicationManager.getApplication().invokeLater(() -> StatusBar.Info.set(message, myProject), myProject.getDisposed());
    }
  }

  @NotNull
  public static String stringifyExitCode(int exitCode) {
    return stringifyExitCode(Platform.current(), exitCode);
  }

  @NotNull
  public static String stringifyExitCode(@NotNull Platform platform, int exitCode) {
    StringBuilder result = new StringBuilder();
    result.append(exitCode);

    if (platform == Platform.WINDOWS && exitCode >= 0xC0000000 && exitCode < 0xD0000000) {
      // Quote from http://support.microsoft.com/kb/308558:
      //   If the result code has the "C0000XXX" format, the task did not complete successfully (the "C" indicates an error condition).
      //   The most common "C" error code is "0xC000013A: The application terminated as a result of a CTRL+C".
      result.append(" (0x").append(StringUtil.toUpperCase(Integer.toHexString(exitCode)));
      if (exitCode == 0xC000013A) {
        result.append(": interrupted by Ctrl+C");
      }
      result.append(')');
    }
    else if (platform == Platform.UNIX && exitCode >= 129 && exitCode <= 159) {
      // "Exit Codes With Special Meanings" (http://www.tldp.org/LDP/abs/html/exitcodes.html)
      @SuppressWarnings("SpellCheckingInspection") String[] signals = {
        "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", "SYS", "PIPE", "ALRM", "TERM", "URG",
        "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2"};
      int signal = exitCode - 128;
      result.append(" (interrupted by signal ").append(signal).append(": SIG").append(signals[signal - 1]).append(')');
    }

    return result.toString();
  }
}


text:
from backlash._compat import text_type, binary_type
from random import SystemRandom

SALT_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

_sys_rng = SystemRandom()

def escape(s, quote=False):
    """Replace special characters "&", "<" and ">" to HTML-safe sequences.  If
    the optional flag `quote` is `True`, the quotation mark character is
    also translated.

    There is a special handling for `None` which escapes to an empty string.

    :param s: the string to escape.
    :param quote: set to true to also escape double quotes.
    """
    if s is None:
        return ''
    if hasattr(s, '__html__'):
        return s.__html__()
    if not isinstance(s, (text_type, binary_type)):
        s = text_type(s)
    if isinstance(s, binary_type):
        try:
            s.decode('ascii')
        except:
            s = s.decode('utf-8', 'replace')
    s = s.replace('&', '&').replace('<', '<').replace('>', '>')
    if quote:
        s = s.replace('"', """)
    return s

def gen_salt(length):
    """Generate a random string of SALT_CHARS with specified ``length``."""
    if length <= 0:
        raise ValueError('requested salt of length <= 0')
    return ''.join(_sys_rng.choice(SALT_CHARS) for _ in range(length))

class RequestContext(dict):
    def __getattr__(self, attr):
        return self[attr]


text:
package io.retxt.dispatch;

/**
 * Dispatch queue create by end user
 *

 * Allows controlling the state of dispatching; global queues do not have this ability.
 *

 * Created by kdubb on 2/3/16.
 */
public interface UserDispatchQueue extends DispatchQueue {

  boolean isSuspended();

  void suspend();

  void resume();

}


text:
from cms.app_base import CMSApp
from cms.menu_bases import CMSAttachMenu
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugettext_lazy as _
from menus.base import Menu, NavigationNode
from menus.menu_pool import menu_pool
from project.sampleapp.models import Category

class SampleAppMenu(Menu):

    def get_nodes(self, request):
        nodes = []
        for cat in Category.objects.all():
            n = NavigationNode(cat.name, cat.get_absolute_url(), cat.pk, cat.parent_id, "sampleapp")
            nodes.append(n)
        try:
            n = NavigationNode(_('sample root page'), reverse('sample-root'), 1)
            n2 = NavigationNode(_('sample settings page'), reverse('sample-settings'), 2)
            n3 = NavigationNode(_('sample account page'), reverse('sample-account'), 3)
            n4 = NavigationNode(_('sample my profile page'), reverse('sample-profile'), 4, 3)
            nodes.append(n)
            nodes.append(n2)
            nodes.append(n3)
            nodes.append(n4)
        except NoReverseMatch:
            pass
        return nodes

menu_pool.register_menu(SampleAppMenu)

class StaticMenu(CMSAttachMenu):
    name = _("Static Menu")
    def get_nodes(self, request):
        nodes = []
        n = NavigationNode('static root page', "/fresh/", 1)
        n2 = NavigationNode('static settings page', "/bye/", 2)
        n3 = NavigationNode('static account page', "/hello/", 3)
        n4 = NavigationNode('static my profile page', "/hello/world/", 4, 3)
        nodes.append(n)
        nodes.append(n2)
        nodes.append(n3)
        nodes.append(n4)
        return nodes

menu_pool.register_menu(StaticMenu)

class StaticMenu2(CMSAttachMenu):
    name = _("Static Menu2")
    def get_nodes(self, request):
        nodes = []
        n = NavigationNode('static2 root page', "/fresh/", 1)
        n2 = NavigationNode('static2 settings page', "/bye/", 2)
        n3 = NavigationNode('static2 account page', "/hello/", 3)
        n4 = NavigationNode('static2 my profile page', "/hello/world/", 4, 3)
        nodes.append(n)
        nodes.append(n2)
        nodes.append(n3)
        nodes.append(n4)
        return nodes

menu_pool.register_menu(StaticMenu2)


text:
/*
 * Minio Cloud Storage, (C) 2017, 2018 Minio, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Package ioutil implements some I/O utility functions which are not covered
// by the standard library.
package ioutil

import (
	"io"

	humanize "github.com/dustin/go-humanize"
)

// defaultAppendBufferSize - Default buffer size for the AppendFile
const defaultAppendBufferSize = humanize.MiByte

// WriteOnCloser implements io.WriteCloser and always
// exectues at least one write operation if it is closed.
//
// This can be useful within the context of HTTP. At least
// one write operation must happen to send the HTTP headers
// to the peer.
type WriteOnCloser struct {
	io.Writer
	hasWritten bool
}

func (w *WriteOnCloser) Write(p []byte) (int, error) {
	w.hasWritten = true
	return w.Writer.Write(p)
}

// Close closes the WriteOnCloser. It behaves like io.Closer.
func (w *WriteOnCloser) Close() error {
	if !w.hasWritten {
		_, err := w.Write(nil)
		if err != nil {
			return err
		}
	}
	if closer, ok := w.Writer.(io.Closer); ok {
		return closer.Close()
	}
	return nil
}

// HasWritten returns true if at least one write operation was performed.
func (w *WriteOnCloser) HasWritten() bool { return w.hasWritten }

// WriteOnClose takes an io.Writer and returns an ioutil.WriteOnCloser.
func WriteOnClose(w io.Writer) *WriteOnCloser {
	return &WriteOnCloser{w, false}
}

// LimitWriter implements io.WriteCloser.
//
// This is implemented such that we want to restrict
// an enscapsulated writer upto a certain length
// and skip a certain number of bytes.
type LimitWriter struct {
	io.Writer
	skipBytes int64
	wLimit    int64
}

// Implements the io.Writer interface limiting upto
// configured length, also skips the first N bytes.
func (w *LimitWriter) Write(p []byte) (n int, err error) {
	n = len(p)
	var n1 int
	if w.skipBytes > 0 {
		if w.skipBytes >= int64(len(p)) {
			w.skipBytes = w.skipBytes - int64(len(p))
			return n, nil
		}
		p = p[w.skipBytes:]
		w.skipBytes = 0
	}
	if w.wLimit == 0 {
		return n, nil
	}
	if w.wLimit < int64(len(p)) {
		n1, err = w.Writer.Write(p[:w.wLimit])
		w.wLimit = w.wLimit - int64(n1)
		return n, err
	}
	n1, err = w.Writer.Write(p)
	w.wLimit = w.wLimit - int64(n1)
	return n, err
}

// Close closes the LimitWriter. It behaves like io.Closer.
func (w *LimitWriter) Close() error {
	if closer, ok := w.Writer.(io.Closer); ok {
		return closer.Close()
	}
	return nil
}

// LimitedWriter takes an io.Writer and returns an ioutil.LimitWriter.
func LimitedWriter(w io.Writer, skipBytes int64, limit int64) *LimitWriter {
	return &LimitWriter{w, skipBytes, limit}
}

type nopCloser struct {
	io.Writer
}

func (nopCloser) Close() error { return nil }

// NopCloser returns a WriteCloser with a no-op Close method wrapping
// the provided Writer w.
func NopCloser(w io.Writer) io.WriteCloser {
	return nopCloser{w}
}


text:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Nucleo.Sitemaps
{
	[TestClass]
	public class DirectorySitemapLocationTest
	{
		[TestMethod]
		public void CreatingAssignsOK()
		{
			var location = new DirectorySitemapLocation(@"c:\test.aspx");

			Assert.AreEqual(@"c:\test.aspx", location.FullName);
		}
	}
}


text:
<!--

    cudos-pol-tabs - CUDOS policy tabs panel

    Author: Tim McMaster

-->

<link href="../bower_components/polymer/polymer.html" rel="import">
<link href="../bower_components/paper-material/paper-material.html" rel="import">
<link href="../bower_components/paper-ripple/paper-ripple.html" rel="import">
<link href="../bower_components/paper-behaviors/paper-button-behavior.html" rel="import">
<link href="../bower_components/iron-flex-layout/iron-flex-layout.html" rel="import">
<link href="../bower_components/paper-tabs/paper-tabs.html" rel="import">
<link href="../bower_components/iron-pages/iron-pages.html" rel="import">

<link href="cudos-policy-pane.html" rel="import"/>

<dom-module id="cudos-policy-tabs" attributes="context">

    <style is="custom-style">
        fieldset {
            width:700px;
            height:70px;
            float:left;
        }
    </style>

    <template>
        <fieldset>
            <legend>cudos-policy-tabs</legend>
            <paper-tabs selected="{{context.selected}}">
                <template is="dom-repeat" items="{{context.policies}}">
                     <paper-tab>{{item.id}}</paper-tab>
                </template>
            </paper-tabs>
        </fieldset>
    </template>

    <script>

        Polymer({
            is: "cudos-policy-tabs",
            getPolicy : function() {return this.policies[0]},
            properties: {

                selected : {
                    value : 1
                }
            }
        });

    </script>

</dom-module>


text:
import { Feed, FeedPost, FeedTopic, Service } from '@ngageoint/mage.web-core-lib/feed'
import { FeedEditState, FeedMetaData, feedMetaDataLean, FeedMetaDataNullable, feedPostFromEditState } from './feed-edit.model'

export type FeedMetaDataBooleanKeys = { [K in keyof FeedMetaData]: FeedMetaData[K] extends boolean ? K : never }[keyof FeedMetaData]

describe('feedMetaDataLean', () => {

  it('creates meta-data from populated topic', () => {

    const topic: Required<FeedTopic> = {
      id: 'abc123',
      title: 'A Topic',
      summary: 'Topic for testing',
      icon: { sourceUrl: 'hurr://durr/derp.png' },
      itemPrimaryProperty: 'primary',
      itemSecondaryProperty: 'secondary',
      itemTemporalProperty: 'temporal',
      itemsHaveIdentity: true,
      itemsHaveSpatialDimension: true,
      itemPropertiesSchema: {
        properties: {
          primary: {}, secondary: {}, temporal: {}
        }
      },
      paramsSchema: {
        properties: { when: { type: 'number' } }
      },
      mapStyle: {},
      updateFrequencySeconds: 10000
    }
    const metaData = feedMetaDataLean(topic)

    expect(metaData).toEqual(<Required<FeedMetaData>>{
      title: 'A Topic',
      summary: 'Topic for testing',
      itemPrimaryProperty: 'primary',
      itemSecondaryProperty: 'secondary',
      itemTemporalProperty: 'temporal',
      itemsHaveIdentity: true,
      itemsHaveSpatialDimension: true,
      updateFrequencySeconds: 10000,
      icon: { sourceUrl: 'hurr://durr/derp.png' }
    })
  })

  it('creates feed meta-data from populated feed', () => {

    const topic: Required<Feed> = {
      id: 'abc123',
      service: 'service1',
      topic: 'topic1',
      title: 'A Topic',
      summary: 'Topic for testing',
      icon: { id: 'icon1' },
      itemPrimaryProperty: 'primary',
      itemSecondaryProperty: 'secondary',
      itemTemporalProperty: 'temporal',
      itemsHaveIdentity: true,
      itemsHaveSpatialDimension: true,
      itemPropertiesSchema: {
        properties: {
          primary: {}, secondary: {}, temporal: {}
        }
      },
      constantParams: {
        account: 'abc-123-zxy'
      },
      variableParamsSchema: {
        properties: { when: { type: 'number' } }
      },
      mapStyle: {},
      updateFrequencySeconds: 10000
    }
    const metaData = feedMetaDataLean(topic)

    expect(metaData).toEqual(<Required<FeedMetaData>>{
      title: 'A Topic',
      summary: 'Topic for testing',
      itemPrimaryProperty: 'primary',
      itemSecondaryProperty: 'secondary',
      itemTemporalProperty: 'temporal',
      itemsHaveIdentity: true,
      itemsHaveSpatialDimension: true,
      updateFrequencySeconds: 10000,
      icon: { id: 'icon1' }
    })
  })

  it('strips all null keys from source', () => {

    const nullSource: FeedMetaDataNullable = {
      title: null,
      summary: null,
      itemPrimaryProperty: null,
      itemSecondaryProperty: null,
      itemTemporalProperty: null,
      itemsHaveIdentity: null,
      itemsHaveSpatialDimension: null,
      updateFrequencySeconds: null,
      icon: null
    }
    const lean = feedMetaDataLean(nullSource)

    expect(lean).toEqual({})
  })

  it('strips all undefined keys from source', () => {

    const undefinedSource: Record<keyof Required<FeedMetaData>, undefined> = {
      title: undefined,
      summary: undefined,
      itemPrimaryProperty: undefined,
      itemSecondaryProperty: undefined,
      itemTemporalProperty: undefined,
      itemsHaveIdentity: undefined,
      itemsHaveSpatialDimension: undefined,
      updateFrequencySeconds: undefined,
      icon: undefined
    }
    const lean = feedMetaDataLean(undefinedSource)

    expect(lean).toEqual({})
  })

  it('strips empty string keys', () => {

    type FeedMetaDataStringKeys = { [K in keyof FeedMetaData]: FeedMetaData[K] extends string ? K : never }[keyof FeedMetaData]

    const source: Record<FeedMetaDataStringKeys, ''> = {
      title: '',
      summary: '',
      itemPrimaryProperty: '',
      itemSecondaryProperty: '',
      itemTemporalProperty: ''
    }
    const lean = feedMetaDataLean(source)

    expect(lean).toEqual({})
  })

  it('does not strip false booleans', () => {

    const source: Record<FeedMetaDataBooleanKeys, false> = {
      itemsHaveIdentity: false,
      itemsHaveSpatialDimension: false
    }
    const lean = feedMetaDataLean(source)

    expect(lean).toEqual(source)
  })
})

describe('feedPostFromEditState', () => {

  it('maps all properties from complete edit state', () => {

    const service: Required<Service> = { id: 'service1', serviceType: 'type1', title: 'Service 1', summary: 'Test service 1', config: { test: true }}
    const topic: Required<FeedTopic> = {
      id: 'topic1',
      title: 'Test Topic',
      summary: 'A topic for testing',
      icon: { sourceUrl: 'test://icon1' },
      itemPrimaryProperty: 'prop1',
      itemSecondaryProperty: 'prop2',
      itemTemporalProperty: 'time',
      itemPropertiesSchema: {
        properties: {
          prop1: { type: 'string' }
        }
      },
      itemsHaveIdentity: true,
      itemsHaveSpatialDimension: true,
      mapStyle: {
        icon: {
          sourceUrl: 'icon1'
        }
      },
      paramsSchema: {
        properties: {
          when: { type: 'number' }
        }
      },
      updateFrequencySeconds: 100
    }
    const feedMetaData: Required<FeedMetaData> = {
      title: 'Test Feed',
      summary: 'A feed for testing',
      icon: { id: 'icon5' },
      itemPrimaryProperty:  'feedProp1',
      itemSecondaryProperty: 'feedProp2',
      itemTemporalProperty: 'feedTime',
      itemsHaveIdentity: false,
      itemsHaveSpatialDimension: false,
      updateFrequencySeconds: 4000
    }
    const state: FeedEditState = {
      availableServices: [],
      availableTopics: [],
      selectedService: service,
      selectedTopic: topic,
      feedMetaData,
      fetchParameters: { test: 'yes' },
      itemPropertiesSchema: {
        properties: {
          feedProp1: { type: 'string', title: 'Prop 1 Titled' }
        }
      },
      originalFeed: {
        id: 'feed1',
        service: service,
        topic: topic,
        title: 'Original Title'
      },
      preview: null
    }

    const feedFromState = feedPostFromEditState(state)

    const expectedFeed: Required<Omit<FeedPost, 'mapStyle' | 'variableParamsSchema'>> = {
      id: state.originalFeed.id,
      service: state.selectedService.id,
      topic: state.selectedTopic.id,
      itemPropertiesSchema: state.itemPropertiesSchema,
      constantParams: state.fetchParameters,
      ...feedMetaData
    }
    expect(feedFromState).toEqual(expectedFeed)
  })

  it('omits null values from edit state', () => {

    const service: Required<Service> = { id: 'service1', serviceType: 'type1', title: 'Service 1', summary: 'Test service 1', config: { test: true }}
    const topic: Required<FeedTopic> = {
      id: 'topic1',
      title: 'Test Topic',
      summary: 'A topic for testing',
      icon: { sourceUrl: 'icon1' },
      itemPrimaryProperty: 'prop1',
      itemSecondaryProperty: 'prop2',
      itemTemporalProperty: 'time',
      itemPropertiesSchema: {
        properties: {
          prop1: { type: 'string' }
        }
      },
      itemsHaveIdentity: true,
      itemsHaveSpatialDimension: true,
      mapStyle: {
        icon: {
          sourceUrl: 'icon1'
        }
      },
      paramsSchema: {
        properties: {
          when: { type: 'number' }
        }
      },
      updateFrequencySeconds: 100
    }
    const state: FeedEditState = {
      availableServices: [],
      availableTopics: [],
      selectedService: service,
      selectedTopic: topic,
      feedMetaData: null,
      fetchParameters: null,
      itemPropertiesSchema: null,
      originalFeed: null,
      preview: null
    }
    const feedPost = feedPostFromEditState(state)

    expect(feedPost).toEqual({
      service: state.selectedService.id,
      topic: state.selectedTopic.id
    })
  })
})


text:
require 'mida/vocabulary'

module Mida
  module SchemaOrg

    autoload :Thing, 'mida/vocabularies/schemaorg/thing'
    autoload :Event, 'mida/vocabularies/schemaorg/event'

    # Event type: Literary event.
    class LiteraryEvent < Mida::Vocabulary
      itemtype %r{http://schema.org/LiteraryEvent}i
      include_vocabulary Mida::SchemaOrg::Thing
      include_vocabulary Mida::SchemaOrg::Event
    end

  end
end


text:
package main

import (
	"encoding/base64"
	"encoding/json"
	"flag"
	"fmt"
	"github.com/elico/go-metalink-parser"
	"github.com/elico/go-shadowd"
	"github.com/elico/mux"
	"io"
	"net/http"
	"path"
	"strconv"
	"strings"
	"time"
)

//Config
var http_port *string
var debug *bool
var fs *string
var shadowd_addr *string
var shadowd_profileid *string
var shadowd_profilekey *string
var shadowd_debug *bool
var shadowd_rawdata *bool

//Global
var err error
var shadowServer shadowd.ShadowdConn

var internalerrorpage = `<!DOCTYPE html>

<title>Error</title>

An error occurred.

Sorry, the page you are looking for is currently unavailable.

Please try again later.

If you are the system administrator of this resource then you should check
the error log for details.

Faithfully yours, WebServer.

`

func dummyHandler(w http.ResponseWriter, r *http.Request) {
	io.WriteString(w, "dummmy handler")
}

func httpHandlerToHandlerMetalink(next http.Handler) http.Handler {
	return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
		//If there is a metalink file and the downloaded file is not a metalink file
		// Then add couple meta links headers
		file := *fs + (strings.TrimPrefix(path.Clean(req.URL.Path), "/fs"))

		// not a dir
		// a file
		// doesn't have a meta4 or metalink ext
		// have the same filename with meta4 or metalink
		if !strings.HasSuffix(file, "/") && !strings.HasSuffix(file, ".meta4") && !strings.HasSuffix(file, ".metalink") {
			// Open\Read metalink file
			metalinkinfo, err := metalinks.ParseFile(file + ".metalink")
			if err != nil && err != io.EOF {
				fmt.Printf("Error: %v\n", err.Error())
			}

			// Add digest headers
			if len(metalinkinfo.Files.File) > 0 {
				res.Header().Add("Link", fmt.Sprintf("<%v>; rel=describedby; type=\"application/metalink4+xml\"", req.URL.Path+".metalink"))
				for _, v := range metalinkinfo.Files.File[0].Verification.Hashes {
					res.Header().Add("Digest", strings.ToUpper(v.Type)+"="+(base64.StdEncoding.EncodeToString([]byte(v.Text))))
				}
			}

			// Add metalink headers

			// If the request is a GET with "if modified hash XYZ" then
			// Compare to the metalink file and if matches then respond with a 304
		}
		next.ServeHTTP(res, req)
		return
	})
}

func unsupportedMethod(w http.ResponseWriter, r *http.Request) {
	cacheResponseFor(w, r, 600)
	http.Error(w, "Unsupported Method", 405)
	w.Header().Set("Content-Type", "text/plain")
	io.WriteString(w, "Unsupported Method for this interface!!!")
}

func cacheResponseFor(w http.ResponseWriter, r *http.Request, seconds int) {
	cacheUntil := time.Now().UTC().Add(time.Duration(seconds) * time.Second).Format(http.TimeFormat)
	w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(seconds))
	w.Header().Set("Expires", cacheUntil)
}

func dontCacheResponse(w http.ResponseWriter, r *http.Request) {
	cacheUntil := time.Now().UTC().Add(time.Duration(-3600) * time.Second).Format(http.TimeFormat)
	w.Header().Set("Cache-Control", "no-cache, must-revalidate")
	w.Header().Set("Expires", cacheUntil)
}

func httpHandlerToHandlerShadowd(next http.Handler) http.Handler {
	return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
		shodowdres, err := shadowServer.SendToShadowd(req)
		newmap := make(map[string]interface{})
		err = json.Unmarshal([]byte(shodowdres), &newmap)
		if err != nil {
			panic(err)
		}
		switch int(newmap["status"].(float64)) {
		case shadowd.STATUS_OK:
			fmt.Println("Request reported, OK")
		case shadowd.STATUS_BAD_REQUEST:
			res.Header().Set("Content-Type", "text/html")
			res.WriteHeader(400)
			res.Write([]byte(internalerrorpage))
			return
		case shadowd.STATUS_BAD_SIGNATURE:
			res.Header().Set("Content-Type", "text/html")
			res.WriteHeader(500)
			res.Write([]byte(internalerrorpage))
			return
		case shadowd.STATUS_BAD_JSON:
			res.Header().Set("Content-Type", "text/html")
			res.WriteHeader(500)
			res.Write([]byte(internalerrorpage))
			return
		case shadowd.STATUS_ATTACK:
			fmt.Println("This is an attack, needs to take action!")
			res.Header().Set("Content-Type", "text/html")
			res.WriteHeader(500)
			res.Write([]byte(internalerrorpage))
			return
		case shadowd.STATUS_CRITICAL_ATTACK:
			fmt.Println("This is a critical attack, needs to take action!")
			res.Header().Set("Content-Type", "text/html")
			res.WriteHeader(500)
			res.Write([]byte(internalerrorpage))
			return
		default:
			fmt.Println("Something werid happen, response code => ", int(newmap["status"].(float64)))
			res.Header().Set("Content-Type", "text/html")
			res.WriteHeader(500)
			res.Write([]byte(internalerrorpage))
			return
		}
		next.ServeHTTP(res, req)
		return
	})
}

func init() {
	debug = flag.Bool("debug", false, "Use \"1\" to enable")
	http_port = flag.String("http_port", "127.0.0.1:8080", "ip:port or plain \":port\" to listen on all IPs")
	shadowd_addr = flag.String("shadowd_addr", "127.0.0.1:9115", "ip:port of shadowd server")
	shadowd_profileid = flag.String("shadowd_profileid", "1", "Must be a number")
	shadowd_profilekey = flag.String("shadowd_profilekey", "102030", "It's a key to hash the data")
	shadowd_debug = flag.Bool("shadowd_debug", false, "Use \"1\" to enable")
	shadowd_rawdata = flag.Bool("shadowd_rawdata", false, "Log request raw data Use \"1\" to enable")

	fs = flag.String("fs", "/var/www/fs", "User interface files path")

	flag.Parse()

	var flagsMap = make(map[string]interface{})
	flagsMap["debug"] = *debug
	flagsMap["http_port"] = *http_port
	flagsMap["shadowd_addr"] = *shadowd_addr
	flagsMap["shadowd_profileid"] = *shadowd_profileid
	flagsMap["shadowd_profilekey"] = *shadowd_profilekey
	flagsMap["shadowd_debug"] = *shadowd_debug
	flagsMap["shadowd_rawdata"] = *shadowd_rawdata

	if *debug {
		fmt.Println("Config Variables:")
		for v, k := range flagsMap {
			fmt.Printf("\t%v => %v\n", v, k)
		}
	}

}

func main() {

	shadowServer = shadowd.ShadowdConn{ServerAddr: *shadowd_addr,
		ReadBody:   *shadowd_rawdata,
		ProfileId:  *shadowd_profileid,
		Logfile:    "",
		Debug:      *shadowd_debug,
		ProfileKey: *shadowd_profilekey,
	}
	router := mux.NewRouter().StrictSlash(true)

	//router.PathPrefixWithName("/fs/").Handler(httpHandlerToHandler(http.StripPrefix("/fs/", http.FileServer(http.Dir(*fs)))))
	router.PathPrefixWithName("/fs/").Handler(httpHandlerToHandlerShadowd(http.StripPrefix("/fs/", http.FileServer(http.Dir(*fs)))))

	err := http.ListenAndServe(*http_port, router)

	if strings.Contains(err.Error(), "resource temporarily unavailable") {
		fmt.Println("### unavaliable  ###")
		fmt.Println(err)
		return
	}
	if err != nil {
		panic(err.Error())
	}
}


text:
package org.virtue.game.entity.player.interactions;

import org.virtue.game.content.chat.ChannelType;
import org.virtue.game.entity.player.Player;
import org.virtue.network.event.context.impl.in.OptionButton;
import org.virtue.network.event.context.impl.out.MessageEventContext;

/**
 * @author Im Frizzy <skype:kfriz1998>
 * @author Frosty Teh Snowman <skype:travis.mccorkle>
 * @author Arthur <skype:arthur.behesnilian>
 * @author Sundays211
 * @since Jan 21, 2015
 */
public class TradeHandler implements PlayerOptionHandler {

	/* (non-Javadoc)
	 * @see org.virtue.game.entity.player.interactions.PlayerOptionHandler#getRange()
	 */
	@Override
	public int getRange() {
		return 1;
	}

	/* (non-Javadoc)
	 * @see org.virtue.game.entity.player.interactions.PlayerOptionHandler#interact(org.virtue.game.entity.player.Player, org.virtue.game.entity.player.Player)
	 */
	@Override
	public boolean interact(Player player, Player target) {
		if (player.getPrivilegeLevel().getId() == 6 || player.getPrivilegeLevel().getId() == 7
				|| player.getPrivilegeLevel().getId() == 8) {
			player.getDispatcher().sendGameMessage("You cannot trade while being a Iron Man.");
			return false;
		}
		if (player.getInteractions().isPossiblePlayer(OptionButton.FOUR, target)) {
			player.getInteractions().setCurrentTarget(target);
			target.getInteractions().setCurrentTarget(player);
			player.getWidgets().openCentralWidget(335, false);
			target.getWidgets().openCentralWidget(335, false);
			player.getInteractions().removePossiblePlayer(OptionButton.FOUR, target);
		} else {
			target.getDispatcher().sendMessage(new MessageEventContext(ChannelType.TRADE, "wishes to trade with you.", player.getName(), null));
			target.getInteractions().addPossiblePlayer(OptionButton.FOUR, player);
			player.getDispatcher().sendGameMessage("Sending trade request...");
		}
		return true;
	}
}


text:
package org.assertj.core.test;

import java.util.LinkedHashMap;
import java.util.Map;

import org.assertj.core.data.MapEntry;

/**
 * @author Alex Ruiz
 */
public final class Maps {
  @SafeVarargs
  public static <K, V> Map<K, V> mapOf(MapEntry<K, V>... entries) {
    Map<K, V> map = new LinkedHashMap<>();
    for (MapEntry<K, V> entry : entries) {
      map.put(entry.key, entry.value);
    }
    return map;
  }

  private Maps() {}
}