text:
.class public Lorg/apache/http/conn/ssl/SSLSocketFactory;
.super Ljava/lang/Object;
.source "SSLSocketFactory.java"

# interfaces
.implements Lorg/apache/http/conn/scheme/LayeredSocketFactory;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lorg/apache/http/conn/ssl/SSLSocketFactory$1;,
        Lorg/apache/http/conn/ssl/SSLSocketFactory$NoPreloadHolder;
    }
.end annotation

# static fields
.field public static final ALLOW_ALL_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

.field public static final BROWSER_COMPATIBLE_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

.field public static final SSL:Ljava/lang/String; = "SSL"

.field public static final SSLV2:Ljava/lang/String; = "SSLv2"

.field public static final STRICT_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

.field public static final TLS:Ljava/lang/String; = "TLS"

# instance fields
.field private hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

.field private final nameResolver:Lorg/apache/http/conn/scheme/HostNameResolver;

.field private final socketfactory:Ljavax/net/ssl/SSLSocketFactory;

.field private final sslcontext:Ljavax/net/ssl/SSLContext;

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

    .prologue
    .line 145
    new-instance v0, Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier;

    invoke-direct {v0}, Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier;-><init>()V

    sput-object v0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->ALLOW_ALL_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .line 148
    new-instance v0, Lorg/apache/http/conn/ssl/BrowserCompatHostnameVerifier;

    invoke-direct {v0}, Lorg/apache/http/conn/ssl/BrowserCompatHostnameVerifier;-><init>()V

    sput-object v0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->BROWSER_COMPATIBLE_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .line 151
    new-instance v0, Lorg/apache/http/conn/ssl/StrictHostnameVerifier;

    invoke-direct {v0}, Lorg/apache/http/conn/ssl/StrictHostnameVerifier;-><init>()V

    sput-object v0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->STRICT_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    return-void
.end method

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

    .prologue
    const/4 v1, 0x0

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

    .line 176
    sget-object v0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->BROWSER_COMPATIBLE_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    iput-object v0, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .line 246
    iput-object v1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->sslcontext:Ljavax/net/ssl/SSLContext;

    .line 247
    invoke-static {}, Ljavax/net/ssl/HttpsURLConnection;->getDefaultSSLSocketFactory()Ljavax/net/ssl/SSLSocketFactory;

    move-result-object v0

    iput-object v0, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->socketfactory:Ljavax/net/ssl/SSLSocketFactory;

    .line 248
    iput-object v1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->nameResolver:Lorg/apache/http/conn/scheme/HostNameResolver;

    .line 249
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;Ljava/security/KeyStore;Ljava/lang/String;Ljava/security/KeyStore;Ljava/security/SecureRandom;Lorg/apache/http/conn/scheme/HostNameResolver;)V
    .locals 3
    .param p1, "algorithm"    # Ljava/lang/String;
    .param p2, "keystore"    # Ljava/security/KeyStore;
    .param p3, "keystorePassword"    # Ljava/lang/String;
    .param p4, "truststore"    # Ljava/security/KeyStore;
    .param p5, "random"    # Ljava/security/SecureRandom;
    .param p6, "nameResolver"    # Lorg/apache/http/conn/scheme/HostNameResolver;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/NoSuchAlgorithmException;,
            Ljava/security/KeyManagementException;,
            Ljava/security/KeyStoreException;,
            Ljava/security/UnrecoverableKeyException;
        }
    .end annotation

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

    .line 176
    sget-object v2, Lorg/apache/http/conn/ssl/SSLSocketFactory;->BROWSER_COMPATIBLE_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    iput-object v2, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .line 188
    if-nez p1, :cond_0

    .line 189
    const-string p1, "TLS"

    .line 191
    :cond_0
    const/4 v0, 0x0

    .line 192
    .local v0, "keymanagers":[Ljavax/net/ssl/KeyManager;
    if-eqz p2, :cond_1

    .line 193
    invoke-static {p2, p3}, Lorg/apache/http/conn/ssl/SSLSocketFactory;->createKeyManagers(Ljava/security/KeyStore;Ljava/lang/String;)[Ljavax/net/ssl/KeyManager;

    move-result-object v0

    .line 195
    :cond_1
    const/4 v1, 0x0

    .line 196
    .local v1, "trustmanagers":[Ljavax/net/ssl/TrustManager;
    if-eqz p4, :cond_2

    .line 197
    invoke-static {p4}, Lorg/apache/http/conn/ssl/SSLSocketFactory;->createTrustManagers(Ljava/security/KeyStore;)[Ljavax/net/ssl/TrustManager;

    move-result-object v1

    .line 199
    :cond_2
    invoke-static {p1}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;

    move-result-object v2

    iput-object v2, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->sslcontext:Ljavax/net/ssl/SSLContext;

    .line 200
    iget-object v2, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->sslcontext:Ljavax/net/ssl/SSLContext;

    invoke-virtual {v2, v0, v1, p5}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V

    .line 201
    iget-object v2, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->sslcontext:Ljavax/net/ssl/SSLContext;

    invoke-virtual {v2}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;

    move-result-object v2

    iput-object v2, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->socketfactory:Ljavax/net/ssl/SSLSocketFactory;

    .line 202
    iput-object p6, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->nameResolver:Lorg/apache/http/conn/scheme/HostNameResolver;

    .line 203
    return-void
.end method

.method public constructor <init>(Ljava/security/KeyStore;)V
    .locals 7
    .param p1, "truststore"    # Ljava/security/KeyStore;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/NoSuchAlgorithmException;,
            Ljava/security/KeyManagementException;,
            Ljava/security/KeyStoreException;,
            Ljava/security/UnrecoverableKeyException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x0

    .line 223
    const-string v1, "TLS"

    move-object v0, p0

    move-object v3, v2

    move-object v4, p1

    move-object v5, v2

    move-object v6, v2

    invoke-direct/range {v0 .. v6}, Lorg/apache/http/conn/ssl/SSLSocketFactory;-><init>(Ljava/lang/String;Ljava/security/KeyStore;Ljava/lang/String;Ljava/security/KeyStore;Ljava/security/SecureRandom;Lorg/apache/http/conn/scheme/HostNameResolver;)V

    .line 224
    return-void
.end method

.method public constructor <init>(Ljava/security/KeyStore;Ljava/lang/String;)V
    .locals 7
    .param p1, "keystore"    # Ljava/security/KeyStore;
    .param p2, "keystorePassword"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/NoSuchAlgorithmException;,
            Ljava/security/KeyManagementException;,
            Ljava/security/KeyStoreException;,
            Ljava/security/UnrecoverableKeyException;
        }
    .end annotation

    .prologue
    const/4 v4, 0x0

    .line 217
    const-string v1, "TLS"

    move-object v0, p0

    move-object v2, p1

    move-object v3, p2

    move-object v5, v4

    move-object v6, v4

    invoke-direct/range {v0 .. v6}, Lorg/apache/http/conn/ssl/SSLSocketFactory;-><init>(Ljava/lang/String;Ljava/security/KeyStore;Ljava/lang/String;Ljava/security/KeyStore;Ljava/security/SecureRandom;Lorg/apache/http/conn/scheme/HostNameResolver;)V

    .line 218
    return-void
.end method

.method public constructor <init>(Ljava/security/KeyStore;Ljava/lang/String;Ljava/security/KeyStore;)V
    .locals 7
    .param p1, "keystore"    # Ljava/security/KeyStore;
    .param p2, "keystorePassword"    # Ljava/lang/String;
    .param p3, "truststore"    # Ljava/security/KeyStore;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/NoSuchAlgorithmException;,
            Ljava/security/KeyManagementException;,
            Ljava/security/KeyStoreException;,
            Ljava/security/UnrecoverableKeyException;
        }
    .end annotation

    .prologue
    const/4 v5, 0x0

    .line 211
    const-string v1, "TLS"

    move-object v0, p0

    move-object v2, p1

    move-object v3, p2

    move-object v4, p3

    move-object v6, v5

    invoke-direct/range {v0 .. v6}, Lorg/apache/http/conn/ssl/SSLSocketFactory;-><init>(Ljava/lang/String;Ljava/security/KeyStore;Ljava/lang/String;Ljava/security/KeyStore;Ljava/security/SecureRandom;Lorg/apache/http/conn/scheme/HostNameResolver;)V

    .line 212
    return-void
.end method

.method public constructor <init>(Ljavax/net/ssl/SSLSocketFactory;)V
    .locals 2
    .param p1, "socketfactory"    # Ljavax/net/ssl/SSLSocketFactory;

    .prologue
    const/4 v1, 0x0

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

    .line 176
    sget-object v0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->BROWSER_COMPATIBLE_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    iput-object v0, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .line 234
    iput-object v1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->sslcontext:Ljavax/net/ssl/SSLContext;

    .line 235
    iput-object p1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->socketfactory:Ljavax/net/ssl/SSLSocketFactory;

    .line 236
    iput-object v1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->nameResolver:Lorg/apache/http/conn/scheme/HostNameResolver;

    .line 237
    return-void
.end method

.method synthetic constructor <init>(Lorg/apache/http/conn/ssl/SSLSocketFactory$1;)V
    .locals 0
    .param p1, "x0"    # Lorg/apache/http/conn/ssl/SSLSocketFactory$1;

    .prologue
    .line 139
    invoke-direct {p0}, Lorg/apache/http/conn/ssl/SSLSocketFactory;-><init>()V

    return-void
.end method

.method private static createKeyManagers(Ljava/security/KeyStore;Ljava/lang/String;)[Ljavax/net/ssl/KeyManager;
    .locals 3
    .param p0, "keystore"    # Ljava/security/KeyStore;
    .param p1, "password"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/KeyStoreException;,
            Ljava/security/NoSuchAlgorithmException;,
            Ljava/security/UnrecoverableKeyException;
        }
    .end annotation

    .prologue
    .line 253
    if-nez p0, :cond_0

    .line 254
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "Keystore may not be null"

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

    throw v1

    .line 256
    :cond_0
    invoke-static {}, Ljavax/net/ssl/KeyManagerFactory;->getDefaultAlgorithm()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljavax/net/ssl/KeyManagerFactory;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/KeyManagerFactory;

    move-result-object v0

    .line 258
    .local v0, "kmfactory":Ljavax/net/ssl/KeyManagerFactory;
    if-eqz p1, :cond_1

    invoke-virtual {p1}, Ljava/lang/String;->toCharArray()[C

    move-result-object v1

    :goto_0
    invoke-virtual {v0, p0, v1}, Ljavax/net/ssl/KeyManagerFactory;->init(Ljava/security/KeyStore;[C)V

    .line 259
    invoke-virtual {v0}, Ljavax/net/ssl/KeyManagerFactory;->getKeyManagers()[Ljavax/net/ssl/KeyManager;

    move-result-object v1

    return-object v1

    .line 258
    :cond_1
    const/4 v1, 0x0

    goto :goto_0
.end method

.method private static createTrustManagers(Ljava/security/KeyStore;)[Ljavax/net/ssl/TrustManager;
    .locals 3
    .param p0, "keystore"    # Ljava/security/KeyStore;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/KeyStoreException;,
            Ljava/security/NoSuchAlgorithmException;
        }
    .end annotation

    .prologue
    .line 264
    if-nez p0, :cond_0

    .line 265
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "Keystore may not be null"

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

    throw v1

    .line 267
    :cond_0
    invoke-static {}, Ljavax/net/ssl/TrustManagerFactory;->getDefaultAlgorithm()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljavax/net/ssl/TrustManagerFactory;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/TrustManagerFactory;

    move-result-object v0

    .line 269
    .local v0, "tmfactory":Ljavax/net/ssl/TrustManagerFactory;
    invoke-virtual {v0, p0}, Ljavax/net/ssl/TrustManagerFactory;->init(Ljava/security/KeyStore;)V

    .line 270
    invoke-virtual {v0}, Ljavax/net/ssl/TrustManagerFactory;->getTrustManagers()[Ljavax/net/ssl/TrustManager;

    move-result-object v1

    return-object v1
.end method

.method public static getSocketFactory()Lorg/apache/http/conn/ssl/SSLSocketFactory;
    .locals 1

    .prologue
    .line 170
    # getter for: Lorg/apache/http/conn/ssl/SSLSocketFactory$NoPreloadHolder;->DEFAULT_FACTORY:Lorg/apache/http/conn/ssl/SSLSocketFactory;
    invoke-static {}, Lorg/apache/http/conn/ssl/SSLSocketFactory$NoPreloadHolder;->access$100()Lorg/apache/http/conn/ssl/SSLSocketFactory;

    move-result-object v0

    return-object v0
.end method

# virtual methods
.method public connectSocket(Ljava/net/Socket;Ljava/lang/String;ILjava/net/InetAddress;ILorg/apache/http/params/HttpParams;)Ljava/net/Socket;
    .locals 8
    .param p1, "sock"    # Ljava/net/Socket;
    .param p2, "host"    # Ljava/lang/String;
    .param p3, "port"    # I
    .param p4, "localAddress"    # Ljava/net/InetAddress;
    .param p5, "localPort"    # I
    .param p6, "params"    # Lorg/apache/http/params/HttpParams;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 293
    if-nez p2, :cond_0

    .line 294
    new-instance v6, Ljava/lang/IllegalArgumentException;

    const-string v7, "Target host may not be null."

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

    throw v6

    .line 296
    :cond_0
    if-nez p6, :cond_1

    .line 297
    new-instance v6, Ljava/lang/IllegalArgumentException;

    const-string v7, "Parameters may not be null."

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

    throw v6

    .line 300
    :cond_1
    if-eqz p1, :cond_5

    move-object v6, p1

    :goto_0
    check-cast v6, Ljavax/net/ssl/SSLSocket;

    move-object v5, v6

    check-cast v5, Ljavax/net/ssl/SSLSocket;

    .line 303
    .local v5, "sslsock":Ljavax/net/ssl/SSLSocket;
    if-nez p4, :cond_2

    if-lez p5, :cond_4

    .line 306
    :cond_2
    if-gez p5, :cond_3

    .line 307
    const/4 p5, 0x0

    .line 309
    :cond_3
    new-instance v2, Ljava/net/InetSocketAddress;

    invoke-direct {v2, p4, p5}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V

    .line 311
    .local v2, "isa":Ljava/net/InetSocketAddress;
    invoke-virtual {v5, v2}, Ljavax/net/ssl/SSLSocket;->bind(Ljava/net/SocketAddress;)V

    .line 314
    .end local v2    # "isa":Ljava/net/InetSocketAddress;
    :cond_4
    invoke-static {p6}, Lorg/apache/http/params/HttpConnectionParams;->getConnectionTimeout(Lorg/apache/http/params/HttpParams;)I

    move-result v0

    .line 315
    .local v0, "connTimeout":I
    invoke-static {p6}, Lorg/apache/http/params/HttpConnectionParams;->getSoTimeout(Lorg/apache/http/params/HttpParams;)I

    move-result v4

    .line 318
    .local v4, "soTimeout":I
    iget-object v6, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->nameResolver:Lorg/apache/http/conn/scheme/HostNameResolver;

    if-eqz v6, :cond_6

    .line 319
    new-instance v3, Ljava/net/InetSocketAddress;

    iget-object v6, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->nameResolver:Lorg/apache/http/conn/scheme/HostNameResolver;

    invoke-interface {v6, p2}, Lorg/apache/http/conn/scheme/HostNameResolver;->resolve(Ljava/lang/String;)Ljava/net/InetAddress;

    move-result-object v6

    invoke-direct {v3, v6, p3}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V

    .line 324
    .local v3, "remoteAddress":Ljava/net/InetSocketAddress;
    :goto_1
    invoke-virtual {v5, v3, v0}, Ljavax/net/ssl/SSLSocket;->connect(Ljava/net/SocketAddress;I)V

    .line 326
    invoke-virtual {v5, v4}, Ljavax/net/ssl/SSLSocket;->setSoTimeout(I)V

    .line 328
    :try_start_0
    iget-object v6, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    invoke-interface {v6, p2, v5}, Lorg/apache/http/conn/ssl/X509HostnameVerifier;->verify(Ljava/lang/String;Ljavax/net/ssl/SSLSocket;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 336
    return-object v5

    .line 300
    .end local v0    # "connTimeout":I
    .end local v3    # "remoteAddress":Ljava/net/InetSocketAddress;
    .end local v4    # "soTimeout":I
    .end local v5    # "sslsock":Ljavax/net/ssl/SSLSocket;
    :cond_5
    invoke-virtual {p0}, Lorg/apache/http/conn/ssl/SSLSocketFactory;->createSocket()Ljava/net/Socket;

    move-result-object v6

    goto :goto_0

    .line 321
    .restart local v0    # "connTimeout":I
    .restart local v4    # "soTimeout":I
    .restart local v5    # "sslsock":Ljavax/net/ssl/SSLSocket;
    :cond_6
    new-instance v3, Ljava/net/InetSocketAddress;

    invoke-direct {v3, p2, p3}, Ljava/net/InetSocketAddress;-><init>(Ljava/lang/String;I)V

    .restart local v3    # "remoteAddress":Ljava/net/InetSocketAddress;
    goto :goto_1

    .line 330
    :catch_0
    move-exception v1

    .line 332
    .local v1, "iox":Ljava/io/IOException;
    :try_start_1
    invoke-virtual {v5}, Ljavax/net/ssl/SSLSocket;->close()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    .line 333
    :goto_2
    throw v1

    .line 332
    :catch_1
    move-exception v6

    goto :goto_2
.end method

.method public createSocket()Ljava/net/Socket;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 279
    iget-object v0, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->socketfactory:Ljavax/net/ssl/SSLSocketFactory;

    invoke-virtual {v0}, Ljavax/net/ssl/SSLSocketFactory;->createSocket()Ljava/net/Socket;

    move-result-object v0

    check-cast v0, Ljavax/net/ssl/SSLSocket;

    return-object v0
.end method

.method public createSocket(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;
    .locals 2
    .param p1, "socket"    # Ljava/net/Socket;
    .param p2, "host"    # Ljava/lang/String;
    .param p3, "port"    # I
    .param p4, "autoClose"    # Z
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/net/UnknownHostException;
        }
    .end annotation

    .prologue
    .line 382
    iget-object v1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->socketfactory:Ljavax/net/ssl/SSLSocketFactory;

    invoke-virtual {v1, p1, p2, p3, p4}, Ljavax/net/ssl/SSLSocketFactory;->createSocket(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;

    move-result-object v0

    check-cast v0, Ljavax/net/ssl/SSLSocket;

    .line 388
    .local v0, "sslSocket":Ljavax/net/ssl/SSLSocket;
    iget-object v1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    invoke-interface {v1, p2, v0}, Lorg/apache/http/conn/ssl/X509HostnameVerifier;->verify(Ljava/lang/String;Ljavax/net/ssl/SSLSocket;)V

    .line 390
    return-object v0
.end method

.method public getHostnameVerifier()Lorg/apache/http/conn/ssl/X509HostnameVerifier;
    .locals 1

    .prologue
    .line 401
    iget-object v0, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    return-object v0
.end method

.method public isSecure(Ljava/net/Socket;)Z
    .locals 2
    .param p1, "sock"    # Ljava/net/Socket;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/IllegalArgumentException;
        }
    .end annotation

    .prologue
    .line 357
    if-nez p1, :cond_0

    .line 358
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Socket may not be null."

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

    throw v0

    .line 361
    :cond_0
    instance-of v0, p1, Ljavax/net/ssl/SSLSocket;

    if-nez v0, :cond_1

    .line 362
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Socket not created by this factory."

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

    throw v0

    .line 366
    :cond_1
    invoke-virtual {p1}, Ljava/net/Socket;->isClosed()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 367
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Socket is closed."

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

    throw v0

    .line 370
    :cond_2
    const/4 v0, 0x1

    return v0
.end method

.method public setHostnameVerifier(Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V
    .locals 2
    .param p1, "hostnameVerifier"    # Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .prologue
    .line 394
    if-nez p1, :cond_0

    .line 395
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Hostname verifier may not be null"

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

    throw v0

    .line 397
    :cond_0
    iput-object p1, p0, Lorg/apache/http/conn/ssl/SSLSocketFactory;->hostnameVerifier:Lorg/apache/http/conn/ssl/X509HostnameVerifier;

    .line 398
    return-void
.end method


text:
using UnityEngine;
using System.Collections;

public class PauseButton : MonoBehaviour {

	public GUIStyle Customized;

	private int _repeatButton1 = 0;
	private string _textString = "Show this test string";
	private Rect _windowRect = new Rect (20, 20, 120, 50);
	private Rect _settingMenu = new Rect (Screen.width/2, Screen.height/2, 300, 300);
	private float sliderValue = 50.0f;
	private float sliderValue2 = 50.0f;
	private float maxSliderValue = 100.0f;

	// Overwrite when Unity reload
	void Start(){

	}

	// Overwrite, when Unity UI Event System is triggered
	void OnGUI(){

		_textString = GUI.TextArea (new Rect (Screen.width * 0.5f - 200, Screen.height * 0.5f - 150, 100, 50), _textString);
		if (GUI.Button (new Rect (0, Screen.height - 50, 100, 50), "Settings")){
			Debug.Log("Click settings buttons");
		}

		if (GUI.Button (new Rect (Screen.width - 100, Screen.height - 50, 100, 50), "Task")) {
			Debug.Log ("Click task buttons");

			Debug.Log ("Text String is: " + _textString);
		}

		if (GUI.Button (new Rect (Screen.width * 0.5f - 100, Screen.height * 0.5f - 50, 100, 50), "Press this Repeated Button" )){
			_repeatButton1 += 1;
			Debug.Log("I was pressed for "+ _repeatButton1.ToString() + " times");
		}
		if (GUI.changed) {
			Debug.Log ("GUI changed!");
		}
//		GUILayout.BeginArea (_settingMenu);
//		GUILayout.BeginVertical ();
//
//		GUI.Box (_settingMenu, "Settings");
//		GUILayout.EndVertical ();
//		GUILayout.EndArea ();
//		_windowRect = GUI.Window (0, _windowRect, WindowFunction, "My Window");

		// Wrap everything in the designated GUI Area
		GUILayout.BeginArea (new Rect (Screen.width/2 - 100, Screen.height/2 - 40,200,80));

		// Begin the singular Horizontal Group
		GUILayout.BeginHorizontal();

		GUILayout.BeginVertical();
		// Arrange two more Controls vertically beside the Button
		GUILayout.BeginVertical();
		GUILayout.Box("Music Value: " + Mathf.Round(sliderValue));
		sliderValue = GUILayout.HorizontalSlider (sliderValue, 0.0f, maxSliderValue);
		GUILayout.EndVertical();

		GUILayout.BeginVertical();
		GUILayout.Box("SE Value: " + Mathf.Round(sliderValue2));
		sliderValue2 = GUILayout.HorizontalSlider (sliderValue2, 0.0f, maxSliderValue);
		// End the Groups and Area
		GUILayout.EndVertical();

		GUILayout.EndVertical();
		GUILayout.EndHorizontal();
		GUILayout.EndArea();

	}

	// This funciton is aborted *****
	void WindowFunction (int windowID) {
		// Draw any Controls inside the window here
		GUI.Button (new Rect (0, 0, 100, 50), "Pops up");
	}
}

redpajama_set_name: RedPajamaGithub


text:
"""
Simplified Chinese language mappings for language-dependent features of
reStructuredText.
"""

__docformat__ = 'reStructuredText'

directives = {
      # language-dependent: fixed
      '注意': 'attention',
      '小心': 'caution',
      'code (translation required)': 'code',
      '危险': 'danger',
      '错误': 'error',
      '提示': 'hint',
      '重要': 'important',
      '注解': 'note',
      '技巧': 'tip',
      '警告': 'warning',
      '忠告': 'admonition',
      '侧框': 'sidebar',
      '主题': 'topic',
      'line-block (translation required)': 'line-block',
      'parsed-literal (translation required)': 'parsed-literal',
      '醒目': 'rubric',
      '铭文': 'epigraph',
      '要点': 'highlights',
      'pull-quote (translation required)': 'pull-quote',
      '复合': 'compound',
      '容器': 'container',
      #u'questions (translation required)': 'questions',
      '表格': 'table',
      'csv表格': 'csv-table',
      '列表表格': 'list-table',
      #u'qa (translation required)': 'questions',
      #u'faq (translation required)': 'questions',
      '元数据': 'meta',
      'math (translation required)': 'math',
      #u'imagemap (translation required)': 'imagemap',
      '图片': 'image',
      '图例': 'figure',
      '包含': 'include',
      '原文': 'raw',
      '代替': 'replace',
      '统一码': 'unicode',
      '日期': 'date',
      '类型': 'class',
      '角色': 'role',
      '默认角色': 'default-role',
      '标题': 'title',
      '目录': 'contents',
      '章节序号': 'sectnum',
      '题头': 'header',
      '页脚': 'footer',
      #u'footnotes (translation required)': 'footnotes',
      #u'citations (translation required)': 'citations',
      'target-notes (translation required)': 'target-notes',
      'restructuredtext-test-directive': 'restructuredtext-test-directive'}
"""Simplified Chinese name to registered (in directives/__init__.py)
directive name mapping."""

roles = {
    # language-dependent: fixed
    '缩写': 'abbreviation',
    '简称': 'acronym',
    'code (translation required)': 'code',
    'index (translation required)': 'index',
    'i (translation required)': 'index',
    '下标': 'subscript',
    '上标': 'superscript',
    'title-reference (translation required)': 'title-reference',
    'title (translation required)': 'title-reference',
    't (translation required)': 'title-reference',
    'pep-reference (translation required)': 'pep-reference',
    'pep (translation required)': 'pep-reference',
    'rfc-reference (translation required)': 'rfc-reference',
    'rfc (translation required)': 'rfc-reference',
    '强调': 'emphasis',
    '加粗': 'strong',
    '字面': 'literal',
    'math (translation required)': 'math',
    'named-reference (translation required)': 'named-reference',
    'anonymous-reference (translation required)': 'anonymous-reference',
    'footnote-reference (translation required)': 'footnote-reference',
    'citation-reference (translation required)': 'citation-reference',
    'substitution-reference (translation required)': 'substitution-reference',
    'target (translation required)': 'target',
    'uri-reference (translation required)': 'uri-reference',
    'uri (translation required)': 'uri-reference',
    'url (translation required)': 'uri-reference',
    'raw (translation required)': 'raw',}
"""Mapping of Simplified Chinese role names to canonical role names
for interpreted text."""


text:
namespace __gnu_debug_def
{
  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
	   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
    class multimap
    : public _GLIBCXX_STD::multimap<_Key, _Tp, _Compare, _Allocator>,
    public __gnu_debug::_Safe_sequence<multimap<_Key,_Tp,_Compare,_Allocator> >
    {
      typedef _GLIBCXX_STD::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
      typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;

    public:
      // types:
      typedef _Key				     key_type;
      typedef _Tp				     mapped_type;
      typedef std::pair<const _Key, _Tp>             value_type;
      typedef _Compare                               key_compare;
      typedef _Allocator                             allocator_type;
      typedef typename _Allocator::reference         reference;
      typedef typename _Allocator::const_reference   const_reference;

      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multimap>
                                                     iterator;
      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
                                           multimap> const_iterator;

      typedef typename _Base::size_type              size_type;
      typedef typename _Base::difference_type        difference_type;
      typedef typename _Allocator::pointer           pointer;
      typedef typename _Allocator::const_pointer     const_pointer;
      typedef std::reverse_iterator<iterator>        reverse_iterator;
      typedef std::reverse_iterator<const_iterator>  const_reverse_iterator;

      using _Base::value_compare;

      // 23.3.1.1 construct/copy/destroy:
      explicit multimap(const _Compare& __comp = _Compare(),
			const _Allocator& __a = _Allocator())
      : _Base(__comp, __a) { }

      template<typename _InputIterator>
      multimap(_InputIterator __first, _InputIterator __last,
	       const _Compare& __comp = _Compare(),
	       const _Allocator& __a = _Allocator())
      : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
	      __comp, __a) { }

      multimap(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)
      : _Base(__x), _Safe_base() { }

      multimap(const _Base& __x) : _Base(__x), _Safe_base() { }

      ~multimap() { }

      multimap<_Key,_Tp,_Compare,_Allocator>&
      operator=(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)
      {
	*static_cast<_Base*>(this) = __x;
	this->_M_invalidate_all();
	return *this;
      }

      using _Base::get_allocator;

      // iterators:
      iterator
      begin()
      { return iterator(_Base::begin(), this); }

      const_iterator
      begin() const
      { return const_iterator(_Base::begin(), this); }

      iterator
      end()
      { return iterator(_Base::end(), this); }

      const_iterator
      end() const
      { return const_iterator(_Base::end(), this); }

      reverse_iterator
      rbegin()
      { return reverse_iterator(end()); }

      const_reverse_iterator
      rbegin() const
      { return const_reverse_iterator(end()); }

      reverse_iterator
      rend()
      { return reverse_iterator(begin()); }

      const_reverse_iterator
      rend() const
      { return const_reverse_iterator(begin()); }

      // capacity:
      using _Base::empty;
      using _Base::size;
      using _Base::max_size;

      // modifiers:
      iterator
      insert(const value_type& __x)
      { return iterator(_Base::insert(__x), this); }

      iterator
      insert(iterator __position, const value_type& __x)
      {
	__glibcxx_check_insert(__position);
	return iterator(_Base::insert(__position.base(), __x), this);
      }

      template<typename _InputIterator>
        void
        insert(_InputIterator __first, _InputIterator __last)
        {
	  __glibcxx_check_valid_range(__first, __last);
	  _Base::insert(__first, __last);
	}

      void
      erase(iterator __position)
      {
	__glibcxx_check_erase(__position);
	__position._M_invalidate();
	_Base::erase(__position.base());
      }

      size_type
      erase(const key_type& __x)
      {
	std::pair<iterator, iterator> __victims = this->equal_range(__x);
	size_type __count = 0;
	while (__victims.first != __victims.second)
	{
	  iterator __victim = __victims.first++;
	  __victim._M_invalidate();
	  _Base::erase(__victim.base());
	  ++__count;
	}
	return __count;
      }

      void
      erase(iterator __first, iterator __last)
      {
	// _GLIBCXX_RESOLVE_LIB_DEFECTS
	// 151. can't currently clear() empty container
	__glibcxx_check_erase_range(__first, __last);
	while (__first != __last)
	this->erase(__first++);
      }

      void
      swap(multimap<_Key,_Tp,_Compare,_Allocator>& __x)
      {
	_Base::swap(__x);
	this->_M_swap(__x);
      }

      void
      clear()
      { this->erase(begin(), end()); }

      // observers:
      using _Base::key_comp;
      using _Base::value_comp;

      // 23.3.1.3 multimap operations:
      iterator
      find(const key_type& __x)
      { return iterator(_Base::find(__x), this); }

      const_iterator
      find(const key_type& __x) const
      { return const_iterator(_Base::find(__x), this); }

      using _Base::count;

      iterator
      lower_bound(const key_type& __x)
      { return iterator(_Base::lower_bound(__x), this); }

      const_iterator
      lower_bound(const key_type& __x) const
      { return const_iterator(_Base::lower_bound(__x), this); }

      iterator
      upper_bound(const key_type& __x)
      { return iterator(_Base::upper_bound(__x), this); }

      const_iterator
      upper_bound(const key_type& __x) const
      { return const_iterator(_Base::upper_bound(__x), this); }

      std::pair<iterator,iterator>
      equal_range(const key_type& __x)
      {
	typedef typename _Base::iterator _Base_iterator;
	std::pair<_Base_iterator, _Base_iterator> __res =
	_Base::equal_range(__x);
	return std::make_pair(iterator(__res.first, this),
			      iterator(__res.second, this));
      }

      std::pair<const_iterator,const_iterator>
      equal_range(const key_type& __x) const
      {
	typedef typename _Base::const_iterator _Base_const_iterator;
	std::pair<_Base_const_iterator, _Base_const_iterator> __res =
	_Base::equal_range(__x);
	return std::make_pair(const_iterator(__res.first, this),
			      const_iterator(__res.second, this));
      }

      _Base&
      _M_base() { return *this; }

      const _Base&
      _M_base() const { return *this; }

    private:
      void
      _M_invalidate_all()
      {
	typedef typename _Base::const_iterator _Base_const_iterator;
	typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
	this->_M_invalidate_if(_Not_equal(_M_base().end()));
      }
    };

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline bool
    operator==(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { return __lhs._M_base() == __rhs._M_base(); }

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline bool
    operator!=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { return __lhs._M_base() != __rhs._M_base(); }

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline bool
    operator<(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	      const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { return __lhs._M_base() < __rhs._M_base(); }

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline bool
    operator<=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { return __lhs._M_base() <= __rhs._M_base(); }

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline bool
    operator>=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { return __lhs._M_base() >= __rhs._M_base(); }

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline bool
    operator>(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	      const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { return __lhs._M_base() > __rhs._M_base(); }

  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
    inline void
    swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
	 multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
    { __lhs.swap(__rhs); }
} // namespace __gnu_debug_def

#endif


text:
/**
 * @file tray.h
 * @author Joe Wingbermuehle
 * @date 2004-2006
 *
 * @brief Header for the tray functions.
 *
 */

#ifndef TRAY_H
#define TRAY_H

#include "hint.h"

struct TimeType;

/** Enumeration of tray layouts. */
typedef enum {
   LAYOUT_HORIZONTAL,   /**< Left-to-right. */
   LAYOUT_VERTICAL      /**< Top-to-bottom. */
} LayoutType;

/** Enumeration of tray alignments. */
typedef enum {
   TALIGN_FIXED,     /**< Fixed at user specified x and y coordinates. */
   TALIGN_LEFT,      /**< Left aligned. */
   TALIGN_TOP,       /**< Top aligned. */
   TALIGN_CENTER,    /**< Center aligned. */
   TALIGN_RIGHT,     /**< Right aligned. */
   TALIGN_BOTTOM     /**< Bottom aligned. */
} TrayAlignmentType;

/** Structure to hold common tray component data.
 * Sizing is handled as follows:
 *  - The component is created via a factory method. It sets its
 *    requested size (0 for no preference).
 *  - The SetSize callback is issued with size constraints
 *    (0 for no constraint). The component should update
 *    width and height in SetSize.
 *  - The Create callback is issued with finalized size information.
 * Resizing is handled as follows:
 *  - A component determines that it needs to change size. It updates
 *    its requested size (0 for no preference).
 *  - The component calls ResizeTray.
 *  - The SetSize callback is issued with size constraints
 *    (0 for no constraint). The component should update
 *    width and height in SetSize.
 *  - The Resize callback is issued with finalized size information.
 */
typedef struct TrayComponentType {

   /** The tray containing the component.
    * UpdateSpecificTray(TrayType*, TrayComponentType*) should be called
    * when content changes.
    */
   struct TrayType *tray;

   /** Additional information needed for the component. */
   void *object;

   int x;   /**< x-coordinate on the tray (valid only after Create). */
   int y;   /**< y-coordinate on the tray (valid only after Create). */

   int screenx;   /**< x-coordinate on the screen (valid only after Create). */
   int screeny;   /**< y-coordinate on the screen (valid only after Create). */

   int requestedWidth;  /**< Requested width. */
   int requestedHeight; /**< Requested height. */

   int width;     /**< Actual width. */
   int height;    /**< Actual height. */

   int grabbed;   /**< 1 if the mouse was grabbed by this component. */

   Window window;    /**< Content (if a window, otherwise None). */
   Pixmap pixmap;    /**< Content (if a pixmap, otherwise None). */

   /** Callback to create the component. */
   void (*Create)(struct TrayComponentType *cp);

   /** Callback to destroy the component. */
   void (*Destroy)(struct TrayComponentType *cp);

   /** Callback to set the size known so fari.
    * This is needed for items that maintain width/height ratios.
    * Either width or height may be zero.
    * This is called before Create.
    */
   void (*SetSize)(struct TrayComponentType *cp, int width, int height);

   /** Callback to resize the component. */
   void (*Resize)(struct TrayComponentType *cp);

   /** Callback for mouse presses. */
   void (*ProcessButtonPress)(struct TrayComponentType *cp,
      int x, int y, int mask);

   /** Callback for mouse releases. */
   void (*ProcessButtonRelease)(struct TrayComponentType *cp,
      int x, int y, int mask);

   /** Callback for mouse motion. */
   void (*ProcessMotionEvent)(struct TrayComponentType *cp,
      int x, int y, int mask);

   /** The next component in the tray. */
   struct TrayComponentType *next;

} TrayComponentType;

/** Structure to represent a tray. */
typedef struct TrayType {

   int x;   /**< The x-coordinate of the tray. */
   int y;   /**< The y-coordinate of the tray. */

   int requestedWidth;  /**< Total requested width of the tray. */
   int requestedHeight; /**< Total requested height of the tray. */

   int width;     /**< Actual width of the tray. */
   int height;    /**< Actual height of the tray. */

   int border;                /**< Border size in pixels. */
   WinLayerType layer;        /**< Layer. */
   LayoutType layout;         /**< Layout. */
   TrayAlignmentType valign;  /**< Vertical alignment. */
   TrayAlignmentType halign;  /**< Horizontal alignment. */

   int autoHide;  /**< 1 for autohide, 0 otherwise. */
   int hidden;    /**< 1 if hidden (due to autohide), 0 otherwise. */

   Window window; /**< The tray window. */

   /** Start of the tray components. */
   struct TrayComponentType *components;

   /** End of the tray components. */
   struct TrayComponentType *componentsTail;

   struct TrayType *next;  /**< Next tray. */

} TrayType;

void InitializeTray();
void StartupTray();
void ShutdownTray();
void DestroyTray();

/** Create a new tray.
 * @return A new, empty tray.
 */
TrayType *CreateTray();

/** Create a tray component.
 * @return A new tray component structure.
 */
TrayComponentType *CreateTrayComponent();

/** Add a tray component to a tray.
 * @param tp The tray to update.
 * @param cp The tray component to add.
 */
void AddTrayComponent(TrayType *tp, TrayComponentType *cp);

/** Show a tray.
 * @param tp The tray to show.
 */
void ShowTray(TrayType *tp);

/** Hide a tray.
 * @param tp The tray to hide.
 */
void HideTray(TrayType *tp);

/** Draw all trays. */
void DrawTray();

/** Draw a specific tray.
 * @param tp The tray to draw.
 */
void DrawSpecificTray(const TrayType *tp);

/** Update a component on a tray.
 * @param tp The tray containing the component.
 * @param cp The component that needs updating.
 */
void UpdateSpecificTray(const TrayType *tp, const TrayComponentType *cp);

/** Resize a tray.
 * @param tp The tray to resize containing the new requested size information.
 */
void ResizeTray(TrayType *tp);

/** Get a linked list of trays.
 * @return The trays.
 */
TrayType *GetTrays();

/** Get a window to use as the supporting window.
 * This is used by clients to validate that compliant window manager is
 * running.
 * @return The supporting window.
 */
Window GetSupportingWindow();

/** Process an event that may be for a tray.
 * @param event The event to process.
 * @return 1 if this event was for a tray, 0 otherwise.
 */
int ProcessTrayEvent(const XEvent *event);

/** Signal the trays.
 * This function is called regularly so that autohide, etc. can take place.
 * @param now The current time.
 * @param x The mouse x-coordinate (root relative).
 * @param y The mouse y-coordinate (root relative).
 */
void SignalTray(const struct TimeType *now, int x, int y);

/** Set whether auto hide is enabled for a tray.
 * @param tp The tray.
 * @param v 1 to enable, 0 to disable.
 */
void SetAutoHideTray(TrayType *tp, int v);

/** Set the tray x-coordinate.
 * @param tp The tray.
 * @param str The x-coordinate (ASCII, pixels, negative ok).
 */
void SetTrayX(TrayType *tp, const char *str);

/** Set the tray y-coordinate.
 * @param tp The tray.
 * @param str The y-coordinate (ASCII, pixels, negative ok).
 */
void SetTrayY(TrayType *tp, const char *str);

/** Set the tray width.
 * @param tp The tray.
 * @param str The width (ASCII, pixels).
 */
void SetTrayWidth(TrayType *tp, const char *str);

/** Set the tray height.
 * @param tp The tray.
 * @param str The height (ASCII, pixels).
 */
void SetTrayHeight(TrayType *tp, const char *str);

/** Set the tray layout.
 * @param tp The tray.
 * @param str A string representation of the layout to use.
 */
void SetTrayLayout(TrayType *tp, const char *str);

/** Set the tray layer.
 * @param tp The tray.
 * @param str The layer (ASCII).
 */
void SetTrayLayer(TrayType *tp, const char *str);

/** Set the tray border size.
 * @param tp The tray.
 * @param str The border size (ASCII, pixels).
 */
void SetTrayBorder(TrayType *tp, const char *str);

/** Set the tray horizontal alignment.
 * @param tp The tray.
 * @param str The alignment(ASCII).
 */
void SetTrayHorizontalAlignment(TrayType *tp, const char *str);

/** Set the tray vertical alignment.
 * @param tp The tray.
 * @param str The alignment(ASCII).
 */
void SetTrayVerticalAlignment(TrayType *tp, const char *str);

#endif /* TRAY_H */


text:
<?php

namespace Kendo\Dataviz\UI;

class DiagramConnectionSelectionHandlesStroke extends \Kendo\SerializableObject {
//>> Properties

    /**
    * Defines the handles stroke color.
    * @param string $value
    * @return \Kendo\Dataviz\UI\DiagramConnectionSelectionHandlesStroke
    */
    public function color($value) {
        return $this->setProperty('color', $value);
    }

//<< Properties
}

?>


text:
package com.google.code.jdde.server.event;

/**
 *
 * @author Vitor Costa
 */
import com.google.code.jdde.ddeml.constants.FlagCallbackResult;
import com.google.code.jdde.event.AdviseRequestEvent;
import com.google.code.jdde.event.AdviseStartEvent;
import com.google.code.jdde.event.AdviseStopEvent;
import com.google.code.jdde.event.ExecuteEvent;
import com.google.code.jdde.event.PokeEvent;
import com.google.code.jdde.event.RequestEvent;

public class TransactionAdapter implements TransactionListener {

	@Override
	public byte[] onAdviseRequest(AdviseRequestEvent e) {
		return null;
	}

	@Override
	public boolean onAdviseStart(AdviseStartEvent e) {
		return false;
	}

	@Override
	public void onAdviseStop(AdviseStopEvent e) {

	}

	@Override
	public FlagCallbackResult onExecute(ExecuteEvent e) {
		return FlagCallbackResult.DDE_FNOTPROCESSED;
	}

	@Override
	public FlagCallbackResult onPoke(PokeEvent e) {
		return FlagCallbackResult.DDE_FNOTPROCESSED;
	}

	@Override
	public byte[] onRequest(RequestEvent e) {
		return null;
	}

}


text:
package versions

import (
	"context"
	"sync"

	"go.chromium.org/luci/common/tsmon/field"
	"go.chromium.org/luci/common/tsmon/metric"
)

var registry struct {
	m sync.RWMutex
	r map[string]string
}

var (
	versionMetric = metric.NewString(
		"luci/components/version",
		"Versions of LUCI components linked into the process.",
		nil,
		field.String("component"),
	)
)

// Register tells the library to start reporting a version for given component.
//
// This should usually called during 'init' time.
//
// The component name will be used as a value of 'component' metric field, and
// the given version will become the actual reported metric value. It is a good
// idea to use a fully qualified go package name as 'component'.
func Register(component, version string) {
	registry.m.Lock()
	defer registry.m.Unlock()
	if registry.r == nil {
		registry.r = make(map[string]string, 1)
	}
	registry.r[component] = version
}

// Report populates 'luci/components/version' metric with versions of all
// registered components.
func Report(c context.Context) {
	registry.m.RLock()
	defer registry.m.RUnlock()
	for component := range registry.r {
		versionMetric.Set(c, registry.r[component], component)
	}
}


text:
var _ = require('lodash');

Object.prototype.allStartWith = function pathsAllStartWith(startString) {
    var paths = this.obj;
    var result = paths.every(function(path) {
        var value = require(path);
        if(!_.startsWith(path, startString)) {
            return false;
        }
        return true;
    });

    this.assert(result , function(){ return "Paths don't all start with " + startString;  });
};

Object.prototype.allBeRequireable = function pathsAreAllRequireable() {
    var paths = this.obj;
    var result = paths.every(function(path) {
        var value = require(path);
        if( (_.contains(path, 'foo-mod') && value !== 'foo')
            || (_.contains(path, 'foo-mod') && value !== 'foo')
            || (_.contains(path, 'baz-mod') && value !== 'baz') ) {

            return false;
        }
        return true;
    });

    this.assert(result , function(){ return 'Paths are not all requireable' });
};


text:
require 'pathname'

Puppet::Type.newtype(:dsc_xsqlserverrssecureconnectionlevel) do
  require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'

  provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do
    defaultfor :operatingsystem => :windows
  end

  @doc = %q{
    The DSC xSQLServerRSSecureConnectionLevel resource type.
    Originally generated from the following schema.mof file:
      import/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.schema.mof
  }

  validate do
      fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil?
      fail('dsc_secureconnectionlevel is a required attribute') if self[:dsc_secureconnectionlevel].nil?
    end

  newparam(:dscmeta_resource_friendly_name) do
    defaultto "xSQLServerRSSecureConnectionLevel"
  end

  newparam(:dscmeta_resource_name) do
    defaultto "MSFT_xSQLServerRSSecureConnectionLevel"
  end

  newparam(:dscmeta_import_resource) do
    newvalues(true, false)

    munge do |value|
      provider.munge_boolean(value.to_s)
    end

    defaultto true
  end

  newparam(:dscmeta_module_name) do
    defaultto "xSQLServer"
  end

  newparam(:dscmeta_module_version) do
    defaultto "1.3.0.0"
  end

  newparam(:name, :namevar => true ) do
  end

  ensurable do
    newvalue(:exists?) { provider.exists? }
    newvalue(:present) { provider.create }
    defaultto { :present }
  end

  # Name:         InstanceName
  # Type:         string
  # IsMandatory:  True
  # Values:       None
  newparam(:dsc_instancename) do
    desc "SQL instance to set secure connection level for."
    isrequired
    validate do |value|
      unless value.kind_of?(String)
        fail("Invalid value '#{value}'. Should be a string")
      end
    end
  end

  # Name:         SecureConnectionLevel
  # Type:         uint16
  # IsMandatory:  True
  # Values:       None
  newparam(:dsc_secureconnectionlevel) do
    desc "SQL Server Reporting Service secure connection level."
    isrequired
    validate do |value|
      unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0)
          fail("Invalid value #{value}. Should be a unsigned Integer")
      end
    end
    munge do |value|
      value.to_i
    end
  end

  # Name:         SQLAdminCredential
  # Type:         string
  # IsMandatory:  False
  # Values:       None
  newparam(:dsc_sqladmincredential) do
    desc "Credential with administrative permissions to the SQL instance."
    validate do |value|
      unless value.kind_of?(String)
        fail("Invalid value '#{value}'. Should be a string")
      end
    end
  end

end


text:
Package.describe({
  name: 'zuzel:reactive-query',
  version: '1.1.5',
  summary: 'Package that makes it easy to serialize application state in URL query params',
  git: 'https://github.com/iSuslov/reactive-query',
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use([
    'reactive-dict',
    'tracker',
    'underscore',
  ], ['client']);
  api.export([
      'ReactiveQuery'
  ],['client'])
  api.addFiles(
      [
        'ReactiveQuery.js',
        'lib/ReactiveQueryUtils.js',
      ], ['client']);
});

Package.onTest(function(api) {
  api.use([
    'tinytest',
    'tracker',
    'reactive-dict',
    'underscore',
    'zuzel:reactive-query'
  ]);

  api.export([
    'ReactiveQueryUtils'
  ], ['client'])
  api.addFiles([
    'lib/ReactiveQueryUtils.js',
    'test/merge-method.js',
    'test/main.js',
    'test/force-method.js',
    'test/uri.js'
  ], ['client']);
});


text:
using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;

namespace PowerShellTools.LanguageService
{
    public static class EditorExtensions
    {
        public static bool CommentOrUncommentBlock(ITextView view, bool comment)
        {
            SnapshotPoint start, end;
            SnapshotPoint? mappedStart, mappedEnd;

            if (view.Selection.IsActive && !view.Selection.IsEmpty)
            {
                // comment every line in the selection
                start = view.Selection.Start.Position;
                end = view.Selection.End.Position;
                mappedStart = MapPoint(view, start);

                var endLine = end.GetContainingLine();
                if (endLine.Start == end)
                {
                    // http://pytools.codeplex.com/workitem/814
                    // User selected one extra line, but no text on that line.  So let's
                    // back it up to the previous line.  It's impossible that we're on the
                    // 1st line here because we have a selection, and we end at the start of
                    // a line.  In normal selection this is only possible if we wrapped onto the
                    // 2nd line, and it's impossible to have a box selection with a single line.
                    end = end.Snapshot.GetLineFromLineNumber(endLine.LineNumber - 1).End;
                }

                mappedEnd = MapPoint(view, end);
            }
            else
            {
                // comment the current line
                start = end = view.Caret.Position.BufferPosition;
                mappedStart = mappedEnd = MapPoint(view, start);
            }

            if (mappedStart != null && mappedEnd != null &&
                mappedStart.Value <= mappedEnd.Value)
            {
                if (comment)
                {
                    CommentRegion(view, mappedStart.Value, mappedEnd.Value);
                }
                else
                {
                    UncommentRegion(view, mappedStart.Value, mappedEnd.Value);
                }

                if (view.TextBuffer.ContentType.IsOfType("PowerShell"))
                {
                    UpdateSelection(view, start, end);
                }
                return true;
            }

            return false;
        }

        private static SnapshotPoint? MapPoint(ITextView view, SnapshotPoint point)
        {
            return view.BufferGraph.MapDownToFirstMatch(
               point,
               PointTrackingMode.Positive,
               x => x.TextBuffer.ContentType.IsOfType("PowerShell"),
               PositionAffinity.Successor
            );
        }

        /// <summary>
        /// Adds comment characters (#) to the start of each line.  If there is a selection the comment is applied
        /// to each selected line.  Otherwise the comment is applied to the current line.
        /// </summary>
        /// <param name="view"></param>
        private static void CommentRegion(ITextView view, SnapshotPoint start, SnapshotPoint end)
        {
            Debug.Assert(start.Snapshot == end.Snapshot);
            var snapshot = start.Snapshot;

            using (var edit = snapshot.TextBuffer.CreateEdit())
            {
                int minColumn = Int32.MaxValue;
                // first pass, determine the position to place the comment
                for (int i = start.GetContainingLine().LineNumber; i <= end.GetContainingLine().LineNumber; i++)
                {
                    var curLine = snapshot.GetLineFromLineNumber(i);
                    var text = curLine.GetText();

                    int firstNonWhitespace = IndexOfNonWhitespaceCharacter(text);
                    if (firstNonWhitespace >= 0 && firstNonWhitespace < minColumn)
                    {
                        // ignore blank lines
                        minColumn = firstNonWhitespace;
                    }
                }

                // second pass, place the comment
                for (int i = start.GetContainingLine().LineNumber; i <= end.GetContainingLine().LineNumber; i++)
                {
                    var curLine = snapshot.GetLineFromLineNumber(i);
                    if (String.IsNullOrWhiteSpace(curLine.GetText()))
                    {
                        continue;
                    }

                    Debug.Assert(curLine.Length >= minColumn);

                    edit.Insert(curLine.Start.Position + minColumn, "#");
                }

                edit.Apply();
            }
        }

        private static int IndexOfNonWhitespaceCharacter(string text)
        {
            for (int j = 0; j < text.Length; j++)
            {
                if (!Char.IsWhiteSpace(text[j]))
                {
                    return j;
                }
            }
            return -1;
        }

        /// <summary>
        /// Removes a comment character (#) from the start of each line.  If there is a selection the character is
        /// removed from each selected line.  Otherwise the character is removed from the current line.  Uncommented
        /// lines are ignored.
        /// </summary>
        private static void UncommentRegion(ITextView view, SnapshotPoint start, SnapshotPoint end)
        {
            Debug.Assert(start.Snapshot == end.Snapshot);
            var snapshot = start.Snapshot;

            using (var edit = snapshot.TextBuffer.CreateEdit())
            {

                // first pass, determine the position to place the comment
                for (int i = start.GetContainingLine().LineNumber; i <= end.GetContainingLine().LineNumber; i++)
                {
                    var curLine = snapshot.GetLineFromLineNumber(i);

                    DeleteFirstCommentChar(edit, curLine);
                }

                edit.Apply();
            }
        }

        private static void UpdateSelection(ITextView view, SnapshotPoint start, SnapshotPoint end)
        {
            view.Selection.Select(
                new SnapshotSpan(
                // translate to the new snapshot version:
                    start.GetContainingLine().Start.TranslateTo(view.TextBuffer.CurrentSnapshot, PointTrackingMode.Negative),
                    end.GetContainingLine().End.TranslateTo(view.TextBuffer.CurrentSnapshot, PointTrackingMode.Positive)
                ),
                false
            );
        }

        private static void DeleteFirstCommentChar(ITextEdit edit, ITextSnapshotLine curLine)
        {
            var text = curLine.GetText();
            for (int j = 0; j < text.Length; j++)
            {
                if (!Char.IsWhiteSpace(text[j]))
                {
                    if (text[j] == '#')
                    {
                        edit.Delete(curLine.Start.Position + j, 1);
                    }
                    break;
                }
            }
        }
    }
}


text:
using System;
using Xunit;
using Tynamix.ObjectFiller;
// ReSharper disable RedundantCast

namespace ObjectFiller.Test
{
    public class SequenceGeneratorTest
    {
        [Fact]
        public void SequenceGeneratorSByte__Should_work()
        {
            var generator = new SequenceGeneratorSByte();
            Assert.Equal((SByte)0, generator.GetValue());
            Assert.Equal((SByte)1, generator.GetValue());
            Assert.Equal((SByte)2, generator.GetValue());

            generator = new SequenceGeneratorSByte { From = 3 };
            Assert.Equal((SByte)3, generator.GetValue());
            Assert.Equal((SByte)4, generator.GetValue());
            Assert.Equal((SByte)5, generator.GetValue());

            generator = new SequenceGeneratorSByte { From = 3, Step = 3 };
            Assert.Equal((SByte)3, generator.GetValue());
            Assert.Equal((SByte)6, generator.GetValue());
            Assert.Equal((SByte)9, generator.GetValue());

            generator = new SequenceGeneratorSByte { From = 3, Step = -3 };
            Assert.Equal((SByte)3, generator.GetValue());
            Assert.Equal((SByte)0, generator.GetValue());
            Assert.Equal((SByte)(-3), generator.GetValue());

            generator = new SequenceGeneratorSByte { From = SByte.MaxValue - 1 };
            Assert.Equal((SByte)(SByte.MaxValue - 1), generator.GetValue());
            Assert.Equal((SByte)(SByte.MaxValue - 0), generator.GetValue());
            Assert.Equal((SByte)(SByte.MinValue + 0), generator.GetValue());
            Assert.Equal((SByte)(SByte.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorInt16__Should_work()
        {
            var generator = new SequenceGeneratorInt16();
            Assert.Equal((Int16)0, generator.GetValue());
            Assert.Equal((Int16)1, generator.GetValue());
            Assert.Equal((Int16)2, generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = 3 };
            Assert.Equal((Int16)3, generator.GetValue());
            Assert.Equal((Int16)4, generator.GetValue());
            Assert.Equal((Int16)5, generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = 3, Step = 3 };
            Assert.Equal((Int16)3, generator.GetValue());
            Assert.Equal((Int16)6, generator.GetValue());
            Assert.Equal((Int16)9, generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = 3, Step = -3 };
            Assert.Equal((Int16)3, generator.GetValue());
            Assert.Equal((Int16)0, generator.GetValue());
            Assert.Equal((Int16)(-3), generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = Int16.MaxValue - 1 };
            Assert.Equal((Int16)(Int16.MaxValue - 1), generator.GetValue());
            Assert.Equal((Int16)(Int16.MaxValue - 0), generator.GetValue());
            Assert.Equal((Int16)(Int16.MinValue + 0), generator.GetValue());
            Assert.Equal((Int16)(Int16.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorInt32__Should_work()
        {
            var generator = new SequenceGeneratorInt32();
            Assert.Equal((Int32)0, generator.GetValue());
            Assert.Equal((Int32)1, generator.GetValue());
            Assert.Equal((Int32)2, generator.GetValue());

            generator = new SequenceGeneratorInt32 { From = 3 };
            Assert.Equal((Int32)3, generator.GetValue());
            Assert.Equal((Int32)4, generator.GetValue());
            Assert.Equal((Int32)5, generator.GetValue());

            generator = new SequenceGeneratorInt32 { From = 3, Step = 3 };
            Assert.Equal((Int32)3, generator.GetValue());
            Assert.Equal((Int32)6, generator.GetValue());
            Assert.Equal((Int32)9, generator.GetValue());

            generator = new SequenceGeneratorInt32 { From = 3, Step = -3 };
            Assert.Equal((Int32)3, generator.GetValue());
            Assert.Equal((Int32)0, generator.GetValue());
            Assert.Equal((Int32)(-3), generator.GetValue());

            generator = new SequenceGeneratorInt32 { From = Int32.MaxValue - 1 };
            Assert.Equal((Int32)(Int32.MaxValue - 1), generator.GetValue());
            Assert.Equal((Int32)(Int32.MaxValue - 0), generator.GetValue());
            Assert.Equal((Int32)(Int32.MinValue + 0), generator.GetValue());
            Assert.Equal((Int32)(Int32.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorInt64__Should_work()
        {
            var generator = new SequenceGeneratorInt64();
            Assert.Equal((Int64)0, generator.GetValue());
            Assert.Equal((Int64)1, generator.GetValue());
            Assert.Equal((Int64)2, generator.GetValue());

            generator = new SequenceGeneratorInt64 { From = 3 };
            Assert.Equal((Int64)3, generator.GetValue());
            Assert.Equal((Int64)4, generator.GetValue());
            Assert.Equal((Int64)5, generator.GetValue());

            generator = new SequenceGeneratorInt64 { From = 3, Step = 3 };
            Assert.Equal((Int64)3, generator.GetValue());
            Assert.Equal((Int64)6, generator.GetValue());
            Assert.Equal((Int64)9, generator.GetValue());

            generator = new SequenceGeneratorInt64 { From = 3, Step = -3 };
            Assert.Equal((Int64)3, generator.GetValue());
            Assert.Equal((Int64)0, generator.GetValue());
            Assert.Equal((Int64)(-3), generator.GetValue());

            generator = new SequenceGeneratorInt64 { From = Int64.MaxValue - 1 };
            Assert.Equal((Int64)(Int64.MaxValue - 1), generator.GetValue());
            Assert.Equal((Int64)(Int64.MaxValue - 0), generator.GetValue());
            Assert.Equal((Int64)(Int64.MinValue + 0), generator.GetValue());
            Assert.Equal((Int64)(Int64.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorUInt16__Should_work()
        {
            var generator = new SequenceGeneratorUInt16();
            Assert.Equal((UInt16)0, generator.GetValue());
            Assert.Equal((UInt16)1, generator.GetValue());
            Assert.Equal((UInt16)2, generator.GetValue());

            generator = new SequenceGeneratorUInt16 { From = 3 };
            Assert.Equal((UInt16)3, generator.GetValue());
            Assert.Equal((UInt16)4, generator.GetValue());
            Assert.Equal((UInt16)5, generator.GetValue());

            generator = new SequenceGeneratorUInt16 { From = 3, Step = 3 };
            Assert.Equal((UInt16)3, generator.GetValue());
            Assert.Equal((UInt16)6, generator.GetValue());
            Assert.Equal((UInt16)9, generator.GetValue());

            generator = new SequenceGeneratorUInt16 { From = UInt16.MaxValue - 1 };
            Assert.Equal((UInt16)(UInt16.MaxValue - 1), generator.GetValue());
            Assert.Equal((UInt16)(UInt16.MaxValue - 0), generator.GetValue());
            Assert.Equal((UInt16)(UInt16.MinValue + 0), generator.GetValue());
            Assert.Equal((UInt16)(UInt16.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorByte__Should_work()
        {
            var generator = new SequenceGeneratorByte();
            Assert.Equal((Byte)0, generator.GetValue());
            Assert.Equal((Byte)1, generator.GetValue());
            Assert.Equal((Byte)2, generator.GetValue());

            generator = new SequenceGeneratorByte { From = 3 };
            Assert.Equal((Byte)3, generator.GetValue());
            Assert.Equal((Byte)4, generator.GetValue());
            Assert.Equal((Byte)5, generator.GetValue());

            generator = new SequenceGeneratorByte { From = 3, Step = 3 };
            Assert.Equal((Byte)3, generator.GetValue());
            Assert.Equal((Byte)6, generator.GetValue());
            Assert.Equal((Byte)9, generator.GetValue());

            generator = new SequenceGeneratorByte { From = Byte.MaxValue - 1 };
            Assert.Equal((Byte)(Byte.MaxValue - 1), generator.GetValue());
            Assert.Equal((Byte)(Byte.MaxValue - 0), generator.GetValue());
            Assert.Equal((Byte)(Byte.MinValue + 0), generator.GetValue());
            Assert.Equal((Byte)(Byte.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorUInt32__Should_work()
        {
            var generator = new SequenceGeneratorUInt32();
            Assert.Equal((UInt32)0, generator.GetValue());
            Assert.Equal((UInt32)1, generator.GetValue());
            Assert.Equal((UInt32)2, generator.GetValue());

            generator = new SequenceGeneratorUInt32 { From = 3 };
            Assert.Equal((UInt32)3, generator.GetValue());
            Assert.Equal((UInt32)4, generator.GetValue());
            Assert.Equal((UInt32)5, generator.GetValue());

            generator = new SequenceGeneratorUInt32 { From = 3, Step = 3 };
            Assert.Equal((UInt32)3, generator.GetValue());
            Assert.Equal((UInt32)6, generator.GetValue());
            Assert.Equal((UInt32)9, generator.GetValue());

            generator = new SequenceGeneratorUInt32 { From = UInt32.MaxValue - 1 };
            Assert.Equal((UInt32)(UInt32.MaxValue - 1), generator.GetValue());
            Assert.Equal((UInt32)(UInt32.MaxValue - 0), generator.GetValue());
            Assert.Equal((UInt32)(UInt32.MinValue + 0), generator.GetValue());
            Assert.Equal((UInt32)(UInt32.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorUInt64__Should_work()
        {
            var generator = new SequenceGeneratorUInt64();
            Assert.Equal((UInt64)0, generator.GetValue());
            Assert.Equal((UInt64)1, generator.GetValue());
            Assert.Equal((UInt64)2, generator.GetValue());

            generator = new SequenceGeneratorUInt64 { From = 3 };
            Assert.Equal((UInt64)3, generator.GetValue());
            Assert.Equal((UInt64)4, generator.GetValue());
            Assert.Equal((UInt64)5, generator.GetValue());

            generator = new SequenceGeneratorUInt64 { From = 3, Step = 3 };
            Assert.Equal((UInt64)3, generator.GetValue());
            Assert.Equal((UInt64)6, generator.GetValue());
            Assert.Equal((UInt64)9, generator.GetValue());

            generator = new SequenceGeneratorUInt64 { From = UInt64.MaxValue - 1 };
            Assert.Equal((UInt64)(UInt64.MaxValue - 1), generator.GetValue());
            Assert.Equal((UInt64)(UInt64.MaxValue - 0), generator.GetValue());
            Assert.Equal((UInt64)(UInt64.MinValue + 0), generator.GetValue());
            Assert.Equal((UInt64)(UInt64.MinValue + 1), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorChar__Should_work()
        {
            var generator = new SequenceGeneratorChar();
            Assert.Equal((Char)0, generator.GetValue());
            Assert.Equal((Char)1, generator.GetValue());
            Assert.Equal((Char)2, generator.GetValue());

            generator = new SequenceGeneratorChar { From = 'A' };
            Assert.Equal((Char)'A', generator.GetValue());
            Assert.Equal((Char)'B', generator.GetValue());
            Assert.Equal((Char)'C', generator.GetValue());

            generator = new SequenceGeneratorChar { From = 'A', Step = (Char)3 };
            Assert.Equal((Char)'A', generator.GetValue());
            Assert.Equal((Char)'D', generator.GetValue());
            Assert.Equal((Char)'G', generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorSingle__Should_work()
        {
            var generator = new SequenceGeneratorSingle();
            Assert.Equal((Single)0, generator.GetValue());
            Assert.Equal((Single)1, generator.GetValue());
            Assert.Equal((Single)2, generator.GetValue());

            generator = new SequenceGeneratorSingle { From = 3 };
            Assert.Equal((Single)3, generator.GetValue());
            Assert.Equal((Single)4, generator.GetValue());
            Assert.Equal((Single)5, generator.GetValue());

            generator = new SequenceGeneratorSingle { From = 3, Step = 3 };
            Assert.Equal((Single)3, generator.GetValue());
            Assert.Equal((Single)6, generator.GetValue());
            Assert.Equal((Single)9, generator.GetValue());

            generator = new SequenceGeneratorSingle { From = 3, Step = -3 };
            Assert.Equal((Single)3, generator.GetValue());
            Assert.Equal((Single)0, generator.GetValue());
            Assert.Equal((Single)(-3), generator.GetValue());

            generator = new SequenceGeneratorSingle { From = Single.MaxValue - 1 };
            Assert.Equal((Single)(Single.MaxValue - 1), generator.GetValue());
            Assert.Equal((Single)(Single.MaxValue - 0), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorDouble__Should_work()
        {
            var generator = new SequenceGeneratorDouble();
            Assert.Equal((Double)0, generator.GetValue());
            Assert.Equal((Double)1, generator.GetValue());
            Assert.Equal((Double)2, generator.GetValue());

            generator = new SequenceGeneratorDouble { From = 3 };
            Assert.Equal((Double)3, generator.GetValue());
            Assert.Equal((Double)4, generator.GetValue());
            Assert.Equal((Double)5, generator.GetValue());

            generator = new SequenceGeneratorDouble { From = 3, Step = 3 };
            Assert.Equal((Double)3, generator.GetValue());
            Assert.Equal((Double)6, generator.GetValue());
            Assert.Equal((Double)9, generator.GetValue());

            generator = new SequenceGeneratorDouble { From = 3, Step = -3 };
            Assert.Equal((Double)3, generator.GetValue());
            Assert.Equal((Double)0, generator.GetValue());
            Assert.Equal((Double)(-3), generator.GetValue());

            generator = new SequenceGeneratorDouble { From = Double.MaxValue - 1 };
            Assert.Equal((Double)(Double.MaxValue - 1), generator.GetValue());
            Assert.Equal((Double)(Double.MaxValue - 0), generator.GetValue());
        }

        [Fact]
        public void SequenceGeneratorDateTime__Should_work()
        {
            var generator = new SequenceGeneratorDateTime();
            Assert.Equal(new DateTime().AddDays(0), generator.GetValue());
            Assert.Equal(new DateTime().AddDays(1), generator.GetValue());
            Assert.Equal(new DateTime().AddDays(2), generator.GetValue());

            var date = DateTime.Now.Date;
            generator = new SequenceGeneratorDateTime { From = date };
            Assert.Equal(date.AddDays(0), generator.GetValue());
            Assert.Equal(date.AddDays(1), generator.GetValue());
            Assert.Equal(date.AddDays(2), generator.GetValue());

            generator = new SequenceGeneratorDateTime { From = date, Step = TimeSpan.FromDays(3) };
            Assert.Equal(date.AddDays(0), generator.GetValue());
            Assert.Equal(date.AddDays(3), generator.GetValue());
            Assert.Equal(date.AddDays(6), generator.GetValue());

            generator = new SequenceGeneratorDateTime { From = date, Step = TimeSpan.FromDays(-3) };
            Assert.Equal(date.AddDays(0), generator.GetValue());
            Assert.Equal(date.AddDays(-3), generator.GetValue());
            Assert.Equal(date.AddDays(-6), generator.GetValue());
        }

    }
}


text:
using System;
using System.Collections;
using UnityEngine;

namespace VRStandardAssets.Flyer
{
    // This script looks after the explosion after an asteroid has been hit.
    public class AsteroidExplosion : MonoBehaviour
    {
        public event Action<AsteroidExplosion> OnExplosionEnded;    // This event is triggered after the last particle system has finished.

        private ParticleSystem[] m_ParticleSystems;                 // The particle systems for the explosion and their children.
        private float m_Duration;                                   // The longest duration of all the particle systems.

        private void Awake()
        {
            // Find all the particle systems.
            m_ParticleSystems = GetComponentsInChildren<ParticleSystem>(true);

            // By default the duration is zero.
            m_Duration = 0f;

            // Go through all the particle systems and if their duration is longer use that instead.
            for (int i = 0; i < m_ParticleSystems.Length; i++)
            {
                if (m_ParticleSystems[i].duration > m_Duration)
                    m_Duration = m_ParticleSystems[i].duration;
            }
        }

        private void OnDestroy()
        {
            // Ensure the event is completely unsubscribed when the explosion is destroyed.
            OnExplosionEnded = null;
        }

        public void Restart()
        {
            // Go through all the particle systems and clear their current particles then play them.
            for (int i = 0; i < m_ParticleSystems.Length; i++)
            {
                m_ParticleSystems[i].Clear();
                m_ParticleSystems[i].Play();
            }

            // Start the time out.
            StartCoroutine (Timeout ());
        }

        private IEnumerator Timeout()
        {
            // Wait for the longest particle system to finish.
            yield return new WaitForSeconds (m_Duration);

            // If anything is subscribed to OnExplosionEnded call it.
            if (OnExplosionEnded != null)
                OnExplosionEnded(this);
        }
    }
}


text:
package seedu.ezdo.commons.events.ui;

import seedu.ezdo.commons.events.BaseEvent;

/**
 * An event requesting to view the help page.
 */
public class ShowHelpRequestEvent extends BaseEvent {

    @Override
    public String toString() {
        return this.getClass().getSimpleName();
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Lw.ComponentModel.DataAnnotations
{
    /// <summary>
    ///     Specifies the minimum and maximum length of characters that are allowed in a data field.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
    public sealed class DataStringLengthAttribute : DataValidationWrapperAttributeBase
    {
        #region Public Constructors
        /// <summary>
        ///     Initializes a new instance of the <see cref="Lw.ComponentModel.DataAnnotations.DataStringLengthAttribute"/> class.
        /// </summary>
        /// <param name="maximumLength">
        ///     The maximum length a string.
        /// </param>
        public DataStringLengthAttribute(int maximumLength)
            : base(new StringLengthAttribute(maximumLength))
        {
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="Lw.ComponentModel.DataAnnotations.DataStringLengthAttribute"/> class.
        /// </summary>
        /// <param name="maximumLength">
        ///     The maximum length a string.
        /// </param>
        /// <param name="errorMessage">
        ///     The error message to associate with a validation control.
        /// </param>
        public DataStringLengthAttribute(int maximumLength, string errorMessage)
            : base(errorMessage, new StringLengthAttribute(maximumLength))
        {
        }
        #endregion Public Constructors

        #region Public Properties
        /// <summary>
        ///     Gets or sets the maximum length of a string.
        /// </summary>
        /// <value>
        ///     The maximum length a string.
        /// </value>
        public int MaximumLength
        {
            get { return ((StringLengthAttribute)this.InnerAttribute).MaximumLength; }
        }

        /// <summary>
        ///     Gets or sets the minimum length of a string.
        /// </summary>
        /// <returns>
        ///     The minimum length of a string.
        /// </returns>
        public int MinimumLength { get; set; }
        #endregion Public Properties

        #region Protected Methods
        protected override void AssignOptionalPropertiesToInnerAttribute()
        {
            base.AssignOptionalPropertiesToInnerAttribute();
            ((StringLengthAttribute)this.InnerAttribute).MinimumLength = this.MinimumLength;
        }
        #endregion Protected Methods

        #region Internal Methods
        protected internal override object[] GetMessageArgs(
            ValidationContext validationContext, object value, ValidationResult validationResult)
        {
            return new object[]
            {
                ((StringLengthAttribute)this.InnerAttribute).MinimumLength,
                ((StringLengthAttribute)this.InnerAttribute).MaximumLength,
                value
            };
        }

        protected internal override long GetMessageCode(
            ValidationContext validationContext, object value, ValidationResult validationResult)
        {
            return LwComponentModelDataAnnotationsMessages.ErrorMessageCodeValueRequiredError;
        }
        #endregion Internal Methods
    }
}


text:
package org.apache.hadoop.mapred;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import java.util.TreeSet;
import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.SecurityUtil.AccessControlList;
import org.apache.hadoop.util.StringUtils;

/**
 * Class that exposes information about queues maintained by the Hadoop
 * Map/Reduce framework.
 *
 * The Map/Reduce framework can be configured with one or more queues,
 * depending on the scheduler it is configured with. While some
 * schedulers work only with one queue, some schedulers support multiple
 * queues.
 *
 * Queues can be configured with various properties. Some of these
 * properties are common to all schedulers, and those are handled by this
 * class. Schedulers might also associate several custom properties with
 * queues. Where such a case exists, the queue name must be used to link
 * the common properties with the scheduler specific ones.
 */
class QueueManager {

  private static final Log LOG = LogFactory.getLog(QueueManager.class);

  // Prefix in configuration for queue related keys
  private static final String QUEUE_CONF_PROPERTY_NAME_PREFIX
                                                        = "mapred.queue.";
  // Configured queues
  private Set<String> queueNames;
  // Map of a queue and ACL property name with an ACL
  private HashMap<String, AccessControlList> aclsMap;
  // Map of a queue name to any generic object that represents
  // scheduler information
  private HashMap<String, Object> schedulerInfoObjects;
  // Whether ACLs are enabled in the system or not.
  private boolean aclsEnabled;

  //Resource in which queue acls are configured.
  static final String QUEUE_ACLS_FILE_NAME = "mapred-queue-acls.xml";

  /**
   * Enum representing an operation that can be performed on a queue.
   */
  static enum QueueOperation {
    SUBMIT_JOB ("acl-submit-job", false),
    ADMINISTER_JOBS ("acl-administer-jobs", true);
    // TODO: Add ACL for LIST_JOBS when we have ability to authenticate
    //       users in UI
    // TODO: Add ACL for CHANGE_ACL when we have an admin tool for
    //       configuring queues.

    private final String aclName;
    private final boolean jobOwnerAllowed;

    QueueOperation(String aclName, boolean jobOwnerAllowed) {
      this.aclName = aclName;
      this.jobOwnerAllowed = jobOwnerAllowed;
    }

    final String getAclName() {
      return aclName;
    }

    final boolean isJobOwnerAllowed() {
      return jobOwnerAllowed;
    }
  }

  /**
   * Construct a new QueueManager using configuration specified in the passed
   * in {@link org.apache.hadoop.conf.Configuration} object.
   *
   * @param conf Configuration object where queue configuration is specified.
   */
  public QueueManager(Configuration conf) {
    queueNames = new TreeSet<String>();
    aclsMap = new HashMap<String, AccessControlList>();
    schedulerInfoObjects = new HashMap<String, Object>();
    initialize(conf);
  }

  /**
   * Return the set of queues configured in the system.
   *
   * The number of queues configured should be dependent on the Scheduler
   * configured. Note that some schedulers work with only one queue, whereas
   * others can support multiple queues.
   *
   * @return Set of queue names.
   */
  public synchronized Set<String> getQueues() {
    return queueNames;
  }

  /**
   * Return true if the given {@link QueueManager.QueueOperation} can be
   * performed by the specified user on the given queue.
   *
   * An operation is allowed if all users are provided access for this
   * operation, or if either the user or any of the groups specified is
   * provided access.
   *
   * @param queueName Queue on which the operation needs to be performed.
   * @param oper The operation to perform
   * @param ugi The user and groups who wish to perform the operation.
   *
   * @return true if the operation is allowed, false otherwise.
   */
  public synchronized boolean hasAccess(String queueName, QueueOperation oper,
                                UserGroupInformation ugi) {
    return hasAccess(queueName, null, oper, ugi);
  }

  /**
   * Return true if the given {@link QueueManager.QueueOperation} can be
   * performed by the specified user on the specified job in the given queue.
   *
   * An operation is allowed either if the owner of the job is the user
   * performing the task, all users are provided access for this
   * operation, or if either the user or any of the groups specified is
   * provided access.
   *
   * If the {@link QueueManager.QueueOperation} is not job specific then the
   * job parameter is ignored.
   *
   * @param queueName Queue on which the operation needs to be performed.
   * @param job The {@link JobInProgress} on which the operation is being
   *            performed.
   * @param oper The operation to perform
   * @param ugi The user and groups who wish to perform the operation.
   *
   * @return true if the operation is allowed, false otherwise.
   */
  public synchronized boolean hasAccess(String queueName, JobInProgress job,
                                QueueOperation oper,
                                UserGroupInformation ugi) {
    if (!aclsEnabled) {
      return true;
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("checking access for : " + toFullPropertyName(queueName,
                                            oper.getAclName()));
    }

    if (oper.isJobOwnerAllowed()) {
      if (job != null && job.getJobConf().getUser().equals(ugi.getUserName())) {
        return true;
      }
    }

    AccessControlList acl = aclsMap.get(toFullPropertyName(queueName, oper.getAclName()));
    if (acl == null) {
      return false;
    }

    // Check the ACL list
    boolean allowed = acl.allAllowed();
    if (!allowed) {
      // Check the allowed users list
      if (acl.getUsers().contains(ugi.getUserName())) {
        allowed = true;
      } else {
        // Check the allowed groups list
        Set<String> allowedGroups = acl.getGroups();
        for (String group : ugi.getGroupNames()) {
          if (allowedGroups.contains(group)) {
            allowed = true;
            break;
          }
        }
      }
    }

    return allowed;
  }

  /**
   * Set a generic Object that represents scheduling information relevant
   * to a queue.
   *
   * A string representation of this Object will be used by the framework
   * to display in user facing applications like the JobTracker web UI and
   * the hadoop CLI.
   *
   * @param queueName queue for which the scheduling information is to be set.
   * @param queueInfo scheduling information for this queue.
   */
  public synchronized void setSchedulerInfo(String queueName,
                                              Object queueInfo) {
    schedulerInfoObjects.put(queueName, queueInfo);
  }

  /**
   * Return the scheduler information configured for this queue.
   *
   * @param queueName queue for which the scheduling information is required.
   * @return The scheduling information for this queue.
   *
   * @see #setSchedulerInfo(String, Object)
   */
  public synchronized Object getSchedulerInfo(String queueName) {
    return schedulerInfoObjects.get(queueName);
  }

  /**
   * Refresh the acls for the configured queues in the system by reading
   * it from mapred-queue-acls.xml.
   *
   * The previous acls are removed. Previously configured queues and
   * if or not acl is disabled is retained.
   *
   * @throws IOException when queue ACL configuration file is invalid.
   */
  synchronized void refreshAcls(Configuration conf) throws IOException {
    try {
      HashMap<String, AccessControlList> newAclsMap =
        getQueueAcls(conf);
      aclsMap = newAclsMap;
    } catch (Throwable t) {
      String exceptionString = StringUtils.stringifyException(t);
      LOG.warn("Queue ACLs could not be refreshed because there was an " +
      		"exception in parsing the configuration: "+ exceptionString +
      		". Existing ACLs are retained.");
      throw new IOException(exceptionString);
    }

  }

  private void checkDeprecation(Configuration conf) {
    for(String queue: queueNames) {
      for (QueueOperation oper : QueueOperation.values()) {
        String key = toFullPropertyName(queue, oper.getAclName());
        String aclString = conf.get(key);
        if(aclString != null) {
          LOG.warn("Configuring queue ACLs in mapred-site.xml or " +
          		"hadoop-site.xml is deprecated. Configure queue ACLs in " +
          		QUEUE_ACLS_FILE_NAME);
          return;
        }
      }
    }
  }

  private HashMap<String, AccessControlList> getQueueAcls(Configuration conf)  {
    checkDeprecation(conf);
    conf.addResource(QUEUE_ACLS_FILE_NAME);
    HashMap<String, AccessControlList> aclsMap =
      new HashMap<String, AccessControlList>();
    for (String queue : queueNames) {
      for (QueueOperation oper : QueueOperation.values()) {
        String key = toFullPropertyName(queue, oper.getAclName());
        String aclString = conf.get(key, "*");
        aclsMap.put(key, new AccessControlList(aclString));
      }
    }
    return aclsMap;
  }

  private void initialize(Configuration conf) {
    aclsEnabled = conf.getBoolean("mapred.acls.enabled", false);
    String[] queues = conf.getStrings("mapred.queue.names",
        new String[] {JobConf.DEFAULT_QUEUE_NAME});
    addToSet(queueNames, queues);
    aclsMap = getQueueAcls(conf);
  }

  private static final String toFullPropertyName(String queue,
      String property) {
    return QUEUE_CONF_PROPERTY_NAME_PREFIX + queue + "." + property;
  }

  private static final void addToSet(Set<String> set, String[] elems) {
    for (String elem : elems) {
      set.add(elem);
    }
  }

  synchronized JobQueueInfo[] getJobQueueInfos() {
    ArrayList<JobQueueInfo> queueInfoList = new ArrayList<JobQueueInfo>();
    for(String queue : queueNames) {
      Object schedulerInfo = schedulerInfoObjects.get(queue);
      if(schedulerInfo != null) {
        queueInfoList.add(new JobQueueInfo(queue,schedulerInfo.toString()));
      }else {
        queueInfoList.add(new JobQueueInfo(queue,null));
      }
    }
    return (JobQueueInfo[]) queueInfoList.toArray(new JobQueueInfo[queueInfoList
        .size()]);
  }

  JobQueueInfo getJobQueueInfo(String queue) {
    Object schedulingInfo = schedulerInfoObjects.get(queue);
    if(schedulingInfo!=null){
      return new JobQueueInfo(queue,schedulingInfo.toString());
    }else {
      return new JobQueueInfo(queue,null);
    }
  }

  /**
   * Generates the array of QueueAclsInfo object. The array consists of only those queues
   * for which user <ugi.getUserName()> has acls
   *
   * @return QueueAclsInfo[]
   * @throws java.io.IOException
   */
  synchronized QueueAclsInfo[] getQueueAcls(UserGroupInformation
          ugi) throws IOException {
    //List of all QueueAclsInfo objects , this list is returned
    ArrayList<QueueAclsInfo> queueAclsInfolist =
            new ArrayList<QueueAclsInfo>();
    QueueOperation[] operations = QueueOperation.values();
    for (String queueName : queueNames) {
      QueueAclsInfo queueAclsInfo = null;
      ArrayList<String> operationsAllowed = null;
      for (QueueOperation operation : operations) {
        if (hasAccess(queueName, operation, ugi)) {
          if (operationsAllowed == null) {
            operationsAllowed = new ArrayList<String>();
          }
          operationsAllowed.add(operation.getAclName());
        }
      }
      if (operationsAllowed != null) {
        //There is atleast 1 operation supported for queue <queueName>
        //, hence initialize queueAclsInfo
        queueAclsInfo = new QueueAclsInfo(queueName, operationsAllowed.toArray
                (new String[operationsAllowed.size()]));
        queueAclsInfolist.add(queueAclsInfo);
      }
    }
    return queueAclsInfolist.toArray(new QueueAclsInfo[
            queueAclsInfolist.size()]);
  }

  /**
   * prints the configuration of QueueManager in Json format.
   * The method should be modified accordingly whenever
   * QueueManager(Configuration) constructor is modified.
   * @param writer {@link}Writer object to which the configuration properties
   * are printed in json format
   * @throws IOException
   */
  static void dumpConfiguration(Writer writer) throws IOException {
    Configuration conf = new Configuration(false);
    conf.addResource(QUEUE_ACLS_FILE_NAME);
    Configuration.dumpConfiguration(conf, writer);
  }

}


text:
package metrics

import (
	"context"
	"testing"
	"time"

	. "knative.dev/pkg/logging/testing"
)

func TestNewPrometheusExporter(t *testing.T) {
	testCases := []struct {
		name         string
		config       metricsConfig
		expectedAddr string
	}{{
		name: "port 9090",
		config: metricsConfig{
			domain:             "does not matter",
			component:          testComponent,
			backendDestination: prometheus,
			prometheusPort:     9090,
			prometheusHost:     "0.0.0.0",
		},
		expectedAddr: "0.0.0.0:9090",
	}, {
		name: "port 9091",
		config: metricsConfig{
			domain:             "does not matter",
			component:          testComponent,
			backendDestination: prometheus,
			prometheusPort:     9091,
			prometheusHost:     "127.0.0.1",
		},
		expectedAddr: "127.0.0.1:9091",
	}}
	for _, tc := range testCases {
		t.Run(tc.name, func(t *testing.T) {
			e, _, err := newPrometheusExporter(&tc.config, TestLogger(t))
			if err != nil {
				t.Error(err)
			}
			if e == nil {
				t.Fatal("expected a non-nil metrics exporter")
			}
			expectPromSrv(t, tc.expectedAddr)
		})
	}
}

func TestNewPrometheusExporter_fromEnv(t *testing.T) {
	exporterOptions := ExporterOptions{
		ConfigMap: map[string]string{},
		Domain:    "does not matter",
		Component: testComponent,
	}
	testCases := []struct {
		name                   string
		prometheusPortVarName  string
		prometheusPortVarValue string
		prometheusHostVarName  string
		prometheusHostVarValue string
		ops                    ExporterOptions
		expectedAddr           string
	}{{
		name:                   "port from env var with no host set",
		prometheusPortVarName:  prometheusPortEnvName,
		prometheusPortVarValue: "9092",
		ops:                    exporterOptions,
		expectedAddr:           "0.0.0.0:9092",
	}, {
		name:                   "no port set with host from env var",
		prometheusHostVarName:  prometheusHostEnvName,
		prometheusHostVarValue: "127.0.0.1",
		ops:                    exporterOptions,
		expectedAddr:           "127.0.0.1:9090",
	}, {
		name:                   "port set and host set to empty string",
		prometheusPortVarName:  prometheusPortEnvName,
		prometheusPortVarValue: "",
		prometheusHostVarName:  prometheusHostEnvName,
		prometheusHostVarValue: "",
		ops:                    exporterOptions,
		expectedAddr:           "0.0.0.0:9090",
	}, {
		name:         "no port or host from the env",
		ops:          exporterOptions,
		expectedAddr: "0.0.0.0:9090",
	}}
	for _, tc := range testCases {
		t.Run(tc.name, func(t *testing.T) {
			if tc.prometheusPortVarName != "" {
				t.Setenv(tc.prometheusPortVarName, tc.prometheusPortVarValue)
			}
			if tc.prometheusHostVarName != "" {
				t.Setenv(tc.prometheusHostVarName, tc.prometheusHostVarValue)
			}
			mc, err := createMetricsConfig(context.Background(), tc.ops)
			if err != nil {
				t.Fatal("Failed to create the metrics config:", err)
			}
			e, _, err := newPrometheusExporter(mc, TestLogger(t))
			if err != nil {
				t.Fatal("Failed to create a new Prometheus exporter:", err)
			}
			if e == nil {
				t.Fatal("expected a non-nil metrics exporter")
			}
			expectPromSrv(t, tc.expectedAddr)
		})
	}
}

func expectPromSrv(t *testing.T, expectedAddr string) {
	time.Sleep(200 * time.Millisecond)
	srv := getCurPromSrv()
	if srv == nil {
		t.Fatal("expected a server for prometheus exporter")
	}
	if got, want := srv.Addr, expectedAddr; got != want {
		t.Errorf("metrics port addresses diff, got=%v, want=%v", got, want)
	}
}


text:
import React, { Component } from 'react';

import './style.css';

/* NOT IN USE CURRENTLY */

class Drink extends Component {

  render() {
    var path = this.props.image ? 'url(drink_images/' + this.props.image + ')' : null;

    return (

          {this.props.name}

    );
  }
}

export default Drink;