text:
#include "../BaseFixture.h"
#include "FakeHttpClient.hpp"
#include "MemPreferencesBackend.hpp"

#include <api/ConfigurationDefaults.hpp>
#include <api/EthereumLikeOperation.hpp>
#include <api/EthereumLikeTransaction.hpp>
#include <api/KeychainEngines.hpp>
#include <api/OperationOrderKey.hpp>
#include <gtest/gtest.h>
#include <iostream>
#include <math/BigInt.h>
#include <set>
#include <utils/DateUtils.hpp>
#include <wallet/ethereum/ERC20/ERC20LikeAccount.h>
#include <wallet/ethereum/database/EthereumLikeAccountDatabaseHelper.h>
#include <wallet/ethereum/transaction_builders/EthereumLikeTransactionBuilder.h>

using namespace std;

class EthereumLikeWalletSynchronization : public BaseFixture {
};

TEST_F(EthereumLikeWalletSynchronization, DISABLED_MediumXpubSynchronization) {
    auto walletName = "e847815f-488a-4301-b67c-378a5e9c8a61";
    auto erc20Count = 0;
    {
        auto newOpCount = 0;
        auto pool       = newDefaultPool();
        {
            auto configuration = DynamicObject::newInstance();
            configuration->putString(api::Configuration::KEYCHAIN_DERIVATION_SCHEME, "44'/60'/0'/0/<account>'");
            configuration->putBoolean(api::Configuration::DEACTIVATE_SYNC_TOKEN, true);
            configuration->putString(api::Configuration::BLOCKCHAIN_EXPLORER_API_ENDPOINT, "https://explorers.api.vault.ledger.com");
            auto wallet = uv::wait(pool->createWallet(walletName, "ethereum", configuration));
            {
                auto nextIndex = uv::wait(wallet->getNextAccountIndex());
                EXPECT_EQ(nextIndex, 0);

                auto account    = createEthereumLikeAccount(wallet, nextIndex, ETH_KEYS_INFO_LIVE);

                auto receiver   = make_receiver([=, &erc20Count](const std::shared_ptr<api::Event> &event) {
                    fmt::print("Received event {}\n", api::to_string(event->getCode()));
                    if (event->getCode() == api::EventCode::SYNCHRONIZATION_STARTED)
                        return;
                    EXPECT_NE(event->getCode(), api::EventCode::SYNCHRONIZATION_FAILED);
                    EXPECT_EQ(event->getCode(),
                                api::EventCode::SYNCHRONIZATION_SUCCEED);

                    auto balance       = uv::wait(account->getBalance());

                    auto erc20Accounts = account->getERC20Accounts();
                    erc20Count         = erc20Accounts.size();
                    EXPECT_NE(erc20Count, 0);
                    std::cout << "ERC20 Accounts: " << erc20Count << std::endl;

                    auto erc20Ops = erc20Accounts[0]->getOperations();
                    EXPECT_NE(erc20Ops.size(), 0);
                    EXPECT_NE(erc20Ops[0]->getBlockHeight().value_or(0), 0);

                    auto erc20Balance            = uv::wait(std::dynamic_pointer_cast<ERC20LikeAccount>(erc20Accounts[0])->getBalance());
                    auto erc20BalanceFromAccount = uv::wait(account->getERC20Balance(erc20Accounts[0]->getToken().contractAddress));
                    EXPECT_EQ(erc20Balance->toString(10), erc20BalanceFromAccount->toString(10));

                    std::vector<std::string> erc20Addresses;
                    for (auto &erc20Acc : erc20Accounts) {
                        erc20Addresses.push_back(erc20Acc->getToken().contractAddress);
                    }
                    auto erc20BalancesFromAccount = uv::wait(account->getERC20Balances(erc20Addresses));
                    EXPECT_EQ(erc20BalancesFromAccount.size(), erc20Accounts.size());
                    EXPECT_EQ(erc20BalancesFromAccount[0]->toString(10), erc20Balance->toString(10));

                    auto amountToSend = std::make_shared<api::BigIntImpl>(BigInt::fromString("10"));
                    auto transferData = uv::wait(std::dynamic_pointer_cast<ERC20LikeAccount>(erc20Accounts[0])->getTransferToAddressData(amountToSend, "0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43"));
                    EXPECT_GT(transferData.size(), 0);

                    auto operations = uv::wait(std::dynamic_pointer_cast<OperationQuery>(erc20Accounts[0]
                                                                                ->queryOperations()
                                                                                ->addOrder(api::OperationOrderKey::DATE, true)
                                                                                ->complete())
                                                     ->execute());
                    std::cout << "ERC20 Operations: " << operations.size() << std::endl;
                    EXPECT_NE(operations.size(), 0);

                    int64_t gasPrice = 20, gasLimit = 200;
                    auto currency  = account->getWallet()->getCurrency();
                    auto txBuilder = std::dynamic_pointer_cast<EthereumLikeTransactionBuilder>(account->buildTransaction());
                    txBuilder->setGasPrice(api::Amount::fromLong(currency, 20));
                    txBuilder->setGasLimit(api::Amount::fromLong(currency, 200));
                    txBuilder->wipeToAddress("0xfb98bdd04d82648f25e67041d6e27a866bec0b47");
                    auto tx = uv::wait(txBuilder->build());
                    EXPECT_EQ(tx->getValue()->toLong(), balance->toLong() - (gasLimit * gasPrice));

                    dispatcher->stop();
                });

                auto restoreKey = account->getRestoreKey();
                auto eventBus2  = account->synchronize();
                eventBus2->subscribe(getTestExecutionContext(), receiver);

                dispatcher->waitUntilStopped();

                auto ops = uv::wait(std::dynamic_pointer_cast<OperationQuery>(account->queryOperations()->complete())->execute());
                std::cout << "Ops: " << ops.size() << std::endl;
                auto block      = uv::wait(account->getLastBlock());
                auto blockHash  = block.blockHash;

                // ERC 20 tests
                auto ercAccount = std::dynamic_pointer_cast<ledger::core::ERC20LikeAccount>(account->getERC20Accounts()[0]);
                auto allOps     = ercAccount->getOperations();
                auto ercOps     = uv::wait(ercAccount->getAllOperations(10, 0xffffff, true));
                EXPECT_EQ(ercOps.size() + 10, allOps.size());
                auto ercOpsFromBlock = uv::wait(ercAccount->getOperationsFromBlockHeight(10, 0xffffff, 0));
                EXPECT_EQ(ercOps.size(), ercOpsFromBlock.size());
            }
        }
    }
    // Recover account
    {
        resetDispatcher();
        auto pool    = newDefaultPool();
        auto wallet  = uv::wait(pool->getWallet(walletName));
        auto account = std::dynamic_pointer_cast<EthereumLikeAccount>(uv::wait(wallet->getAccount(0)));
        EXPECT_EQ(account->getERC20Accounts().size(), erc20Count);
        uv::wait(pool->freshResetAll());
    }
}

TEST_F(EthereumLikeWalletSynchronization, DISABLED_BalanceHistory) {
    auto walletName = "e847815f-488a-4301-b67c-378a5e9c8a61";
    auto erc20Count = 0;
    {
        auto pool = newDefaultPool();
        {
            auto configuration = DynamicObject::newInstance();
            configuration->putString(api::Configuration::KEYCHAIN_DERIVATION_SCHEME, "44'/60'/0'/0/<account>'");
            configuration->putString(api::Configuration::BLOCKCHAIN_EXPLORER_API_ENDPOINT, "https://explorers.api.vault.ledger.com");
            auto wallet = uv::wait(pool->createWallet(walletName, "ethereum", configuration));

            {
                std::string balanceStr;
                auto nextIndex = uv::wait(wallet->getNextAccountIndex());
                auto account   = createEthereumLikeAccount(wallet, nextIndex, ETH_KEYS_INFO_LIVE);

                auto receiver  = make_receiver([=, &erc20Count, &balanceStr](const std::shared_ptr<api::Event> &event) {
                    fmt::print("Received event {}\n", api::to_string(event->getCode()));

                    if (event->getCode() == api::EventCode::SYNCHRONIZATION_STARTED)
                        return;

                    auto balance = uv::wait(account->getBalance());
                    balanceStr   = balance->toString();

                    auto now     = std::time(nullptr);
                    char now_str[256];
                    std::strftime(now_str, sizeof(now_str), "%Y-%m-%dT%H:%M:%SZ", std::localtime(&now));

                    auto history    = uv::wait(account->getBalanceHistory(
                            "2019-09-20T00:00:00Z",
                            now_str,
                            api::TimePeriod::DAY));
                    auto operations = uv::wait(std::dynamic_pointer_cast<OperationQuery>(account->queryOperations()->complete())->execute());
                    BigInt cumulated;
                    BigInt cumulatedInt;
                    BigInt cumulatedFees;
                    for (const auto &op : operations) {
                        fmt::print("OP {} {} {} FEES {}\n", op->asEthereumLikeOperation()->getTransaction()->getHash(), api::to_string(op->getOperationType()), op->getAmount()->toString(), op->getFees()->toString());
                        auto internal = op->asEthereumLikeOperation()->getInternalTransactions();
                        for (const auto &in : internal) {
                            if (in->getOperationType() == api::OperationType::SEND) {
                                fmt::print(" -> INTERNAL {} {}\n", api::to_string(in->getOperationType()), in->getValue()->toString(10));
                                cumulatedInt = cumulatedInt - (BigInt::fromString(in->getValue()->toString(10)));
                            } else if (in->getOperationType() == api::OperationType::RECEIVE) {
                                fmt::print(" -> INTERNAL {} {}\n", api::to_string(in->getOperationType()), in->getValue()->toString(10));
                                cumulatedInt = cumulatedInt + BigInt::fromString(in->getValue()->toString(10));
                            }
                        }
                        if (op->getOperationType() == api::OperationType::SEND) {
                            cumulated     = cumulated - BigInt(op->getAmount()->toLong());
                            cumulatedFees = cumulatedFees + BigInt::fromString(op->getFees()->toString());
                        } else if (op->getOperationType() == api::OperationType::RECEIVE) {
                            cumulated = cumulated + BigInt(op->getAmount()->toLong());
                        }
                    }
                    fmt::print("CUMULATED AMOUNTS: {}\n", cumulated.toString());
                    fmt::print("CUMULATED INTERNAL AMOUNTS: {}\n", cumulatedInt.toString());
                    fmt::print("CUMULATED FEES: {}\n", cumulatedFees.toString());
                    fmt::print("CUMULATED TOTAL: {}\n", (cumulated - cumulatedFees + cumulatedInt).toString());
                    fmt::print("EXPECTED BALANCE: {}\n", balanceStr);
                    EXPECT_EQ(history.back()->toString(), balanceStr);
                    dispatcher->stop();
                });

                auto eventBus  = account->synchronize();
                eventBus->subscribe(getTestExecutionContext(), receiver);

                dispatcher->waitUntilStopped();
            }
        }
    }
}

TEST_F(EthereumLikeWalletSynchronization, XpubSynchronization) {
    auto pool = newDefaultPool();
    {
        auto configuration = DynamicObject::newInstance();
        configuration->putString(api::Configuration::KEYCHAIN_DERIVATION_SCHEME, "44'/60'/0'/0/<account>'");
        configuration->putString(api::Configuration::BLOCKCHAIN_EXPLORER_API_ENDPOINT, "https://explorers.api.vault.ledger.com");
        auto wallet = uv::wait(pool->createWallet("e847815f-488a-4301-b67c-378a5e9c8a61", "ethereum", configuration));
        {
            auto nextIndex = uv::wait(wallet->getNextAccountIndex());
            EXPECT_EQ(nextIndex, 0);

            auto account    = createEthereumLikeAccount(wallet, nextIndex, ETH_KEYS_INFO_LIVE);
            auto keychain   = account->getRestoreKey();

            auto keyStore   = account->getRestoreKey();

            auto receiver   = make_receiver([=](const std::shared_ptr<api::Event> &event) { // NOLINT(readability-function-cognitive-complexity)
                fmt::print("Received event {}\n", api::to_string(event->getCode()));
                if (event->getCode() == api::EventCode::SYNCHRONIZATION_STARTED)
                    return;
                EXPECT_NE(event->getCode(), api::EventCode::SYNCHRONIZATION_FAILED);
                EXPECT_EQ(event->getCode(),
                            api::EventCode::SYNCHRONIZATION_SUCCEED);

                auto balance = uv::wait(account->getBalance());
                cout << " ETH Balance: " << balance->toLong() << endl;
                auto txBuilder     = std::dynamic_pointer_cast<EthereumLikeTransactionBuilder>(account->buildTransaction());
                auto erc20Accounts = account->getERC20Accounts();
                std::shared_ptr<api::ERC20LikeAccount> erc20Account;
                for (const auto &item : erc20Accounts) {
                      if (item->getToken().contractAddress == "0xE41d2489571d322189246DaFA5ebDe1F4699F498") {
                          erc20Account = item;
                          continue;
                    }
                }
                EXPECT_GT(erc20Accounts.size(), 0);
                EXPECT_GT(erc20Account->getOperations().size(), 0);
                auto erc20Balance = uv::wait(std::dynamic_pointer_cast<ERC20LikeAccount>(erc20Account)->getBalance());
                EXPECT_TRUE(BigInt(erc20Balance->toString(10)) > BigInt("0"));
                auto contractAddress = erc20Account->getToken().contractAddress;
                std::cout << "Contract Address: " << contractAddress << std::endl;
                std::cout << "ERC20 balance: " << erc20Balance->toString(10) << std::endl;
                auto erc20Ops = uv::wait(std::dynamic_pointer_cast<OperationQuery>(erc20Account->queryOperations()->complete())->execute());
                EXPECT_EQ(erc20Account->getOperations().size(), erc20Ops.size());
                EXPECT_EQ(erc20Ops[0]->isComplete(), true);
                dispatcher->stop();
            });

            auto restoreKey = account->getRestoreKey();
            auto eventBus2  = account->synchronize();
            eventBus2->subscribe(getTestExecutionContext(), receiver);

            dispatcher->waitUntilStopped();

            auto opQuery = account->queryOperations()->complete();
            auto ops     = uv::wait(std::dynamic_pointer_cast<OperationQuery>(account->queryOperations()->complete())->execute());
            // auto ops = ::wait(std::dynamic_pointer_cast<OperationQuery>(opQuery)->execute());
            std::cout << "Ops: " << ops.size() << std::endl;
            EXPECT_EQ(ops[0]->isComplete(), true);
            auto block     = uv::wait(account->getLastBlock());
            auto blockHash = block.blockHash;
        }
    }
}

TEST_F(EthereumLikeWalletSynchronization, BigInputData) {
    auto pool = newDefaultPool();
    {
        auto configuration = DynamicObject::newInstance();
        configuration->putString(api::Configuration::KEYCHAIN_DERIVATION_SCHEME, "44'/<coin_type>'/<account>'/<node>/<address>");
        configuration->putString(api::Configuration::BLOCKCHAIN_EXPLORER_API_ENDPOINT, "https://explorers.api.vault.ledger.com");
        auto wallet = uv::wait(pool->createWallet("e847815f-488a-4301-b67c-378a5e9c8a61", "ethereum", configuration));
        {
            auto nextIndex = uv::wait(wallet->getNextAccountIndex());
            EXPECT_EQ(nextIndex, 0);

            auto account    = createEthereumLikeAccount(wallet, nextIndex, ETH_KEYS_INPUT_DATA);
            auto keychain   = account->getRestoreKey();

            auto keyStore   = account->getRestoreKey();

            auto receiver   = make_receiver([=](const std::shared_ptr<api::Event> &event) {
                fmt::print("Received event {}\n", api::to_string(event->getCode()));
                if (event->getCode() == api::EventCode::SYNCHRONIZATION_STARTED)
                    return;
                EXPECT_NE(event->getCode(), api::EventCode::SYNCHRONIZATION_FAILED);
                EXPECT_EQ(event->getCode(),
                            api::EventCode::SYNCHRONIZATION_SUCCEED);
                dispatcher->stop();
            });

            auto restoreKey = account->getRestoreKey();
            auto eventBus2  = account->synchronize();
            eventBus2->subscribe(getTestExecutionContext(), receiver);

            dispatcher->waitUntilStopped();

            auto transaction = uv::wait(account->getTransaction("0x90f99a093b57052f393ed43be1abb40a54b41f6aad38f6b6e9c159f3adbdc02a"));
            EXPECT_EQ(transaction->inputData.size(), 228);
        }
    }
}

TEST_F(EthereumLikeWalletSynchronization, XpubETCSynchronization) {
    auto pool = newDefaultPool();
    {
        auto configuration = DynamicObject::newInstance();
        configuration->putString(api::Configuration::KEYCHAIN_DERIVATION_SCHEME, "44'/60'/0'/<account>");
        auto wallet = uv::wait(pool->createWallet("e847815f-488a-4301-b67c-378a5e9c8a61", "ethereum_classic", configuration));
        {
            auto infos = uv::wait(wallet->getNextAccountCreationInfo());
            EXPECT_EQ(infos.index, 0);

            infos.publicKeys = ETC_KEYS_INFO_LIVE.publicKeys;
            infos.chainCodes = ETC_KEYS_INFO_LIVE.chainCodes;

            // Test that the cointype we use is the one set by KEYCHAIN_DERIVATION_SCHEME
            EXPECT_EQ(infos.derivations[0], "44'/60'/0'/0");
            auto account    = createEthereumLikeAccount(wallet, infos.index, infos);

            auto keychain   = account->getRestoreKey();

            auto keyStore   = account->getRestoreKey();

            auto receiver   = make_receiver([=](const std::shared_ptr<api::Event> &event) {
                fmt::print("Received event {}\n", api::to_string(event->getCode()));
                if (event->getCode() == api::EventCode::SYNCHRONIZATION_STARTED)
                    return;
                EXPECT_NE(event->getCode(), api::EventCode::SYNCHRONIZATION_FAILED);
                EXPECT_EQ(event->getCode(),
                            api::EventCode::SYNCHRONIZATION_SUCCEED);

                auto balance = uv::wait(account->getBalance());
                cout << " ETH Balance: " << balance->toLong() << endl;
                dispatcher->stop();
            });

            auto restoreKey = account->getRestoreKey();
            auto eventBus2  = account->synchronize();
            eventBus2->subscribe(getTestExecutionContext(), receiver);

            dispatcher->waitUntilStopped();

            auto opQuery = account->queryOperations()->complete();
            auto ops     = uv::wait(std::dynamic_pointer_cast<OperationQuery>(account->queryOperations()->complete())->execute());
            std::cout << "Ops: " << ops.size() << std::endl;
            EXPECT_EQ(ops[0]->isComplete(), true);
        }
    }
}

std::pair<std::shared_ptr<LambdaEventReceiver>, ledger::core::Future<bool>> createSyncReceiver() {
    auto promise = std::make_shared<Promise<bool>>();
    return std::make_pair<std::shared_ptr<LambdaEventReceiver>, ledger::core::Future<bool>>(
        make_receiver([promise](const std::shared_ptr<api::Event> &event) {
            if (event->getCode() == api::EventCode::SYNCHRONIZATION_SUCCEED ||
                event->getCode() == api::EventCode::SYNCHRONIZATION_SUCCEED_ON_PREVIOUSLY_EMPTY_ACCOUNT) {
                promise->success(true);
            } else if (event->getCode() == api::EventCode::SYNCHRONIZATION_FAILED) {
                promise->success(false);
            }
        }),
        promise->getFuture());
}

TEST_F(EthereumLikeWalletSynchronization, ReorgLastBlock) {
    auto walletName = "e847815f-488a-4301-b67c-378a5e9c8a61";
    {
        auto fakeHttp = std::make_shared<test::FakeHttpClient>();
        backend       = std::static_pointer_cast<DatabaseBackend>(DatabaseBackend::getPostgreSQLBackend(api::ConfigurationDefaults::DEFAULT_PG_CONNECTION_POOL_SIZE, api::ConfigurationDefaults::DEFAULT_PG_CONNECTION_POOL_SIZE));
        auto pool     = newDefaultPool("", "", api::DynamicObject::newInstance(), fakeHttp);

        {
            auto configuration = DynamicObject::newInstance();
            configuration->putString(api::Configuration::KEYCHAIN_DERIVATION_SCHEME, "44'/60'/0'/0/<account>'");
            configuration->putString(api::Configuration::BLOCKCHAIN_EXPLORER_API_ENDPOINT, "http://test.test");
            auto wallet = uv::wait(pool->createWallet(walletName, "ethereum", configuration));
            {
                auto nextIndex = uv::wait(wallet->getNextAccountIndex());
                EXPECT_EQ(nextIndex, 0);

                auto account = createEthereumLikeAccount(wallet, nextIndex, ETH_KEYS_INFO_LIVE);
                auto waiter  = createSyncReceiver();
                test::UrlConnectionData blockNotFound;
                blockNotFound.statusCode = 404;
                blockNotFound.body       = "Block 0xaef3a92f1017445c98139b7ab3ddd6e8abfe75588652338ca6f537cf47ab620d not found";

                fakeHttp->setBehavior({{"http://test.test/blockchain/v3/eth/blocks/current",
                                        test::FakeUrlConnection::fromString("{\"hash\":\"0xdd73566cf4913cba5060377397283cf411e03bdbe1b83d4695699d9e6ac1c941\",\"height\":8175344,\"time\":\"2019-07-18T14:54:00Z\",\"txs\":[]}")},
                                       {"http://test.test/blockchain/v3/eth/syncToken",
                                        test::FakeUrlConnection::fromString("{\"token\":\"f867afdf-c5b1-4a9d-b3e3-b4dfc985be8a\"}")},
                                       {"http://test.test/blockchain/v3/eth/addresses/0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43/transactions",
                                        test::FakeUrlConnection::fromString("\
                            {\
                                \"truncated\": false,\
                                \"txs\": [\
                                    {\
                                        \"hash\": \"0x24ebd24caebcdb5d5fe22ba4d2e1904515dbb7d8fcd968789c8810ad379ba866\",\
                                        \"status\": 1,\
                                        \"received_at\": \"2018-06-08T10:19:10Z\",\
                                        \"nonce\": \"0x05\",\
                                        \"value\": 1000000000000000,\
                                        \"gas\": 21000,\
                                        \"gas_price\": 11000000000,\
                                        \"from\": \"0xf0c91a8f0f95a2fd90ab74c6c13ef0db2af96447\",\
                                        \"to\": \"0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43\",\
                                        \"input\": \"0x\",\
                                        \"cumulative_gas_used\": 6388806,\
                                        \"gas_used\": 21000,\
                                        \"transfer_events\": {\
                                            \"list\": [],\
                                            \"truncated\": false\
                                        },\
                                        \"actions\": [\
                                            {\
                                                \"from\": \"0xf0c91a8f0f95a2fd90ab74c6c13ef0db2af96447\",\
                                                \"to\": \"0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43\",\
                                                \"value\": 1000000000000000\
                                            }\
                                        ],\
                                        \"block\": {\
                                            \"hash\": \"0x0160a3b2b762ec42f5a1134ac260a21c98f377e153d332efb6e20534abb37f78\",\
                                            \"height\": 5752778,\
                                            \"time\": \"2018-06-08T10:19:10Z\"\
                                        }\
                                    }\
                                ]\
                            }")},
                                       {"http://test.test/blockchain/v3/eth/addresses/0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43/transactions?block_hash=0x0160a3b2b762ec42f5a1134ac260a21c98f377e153d332efb6e20534abb37f78",
                                        std::make_shared<test::FakeUrlConnection>(blockNotFound)}});
                auto eventBus = account->synchronize();
                eventBus->subscribe(getTestExecutionContext(), waiter.first);
                EXPECT_TRUE(uv::wait(waiter.second));
                // next time
                waiter         = createSyncReceiver();
                auto eventBus2 = account->synchronize();
                eventBus2->subscribe(getTestExecutionContext(), waiter.first);
                EXPECT_TRUE(uv::wait(waiter.second));
                dispatcher->stop();
            }
        }
    }
}


text:
using System;

///<summary>
///System.TypeLoadException.Message [v-zuolan]
///</summary>

public class TypeLoadExceptionCtor
{

    public static int Main()
    {
        TypeLoadExceptionCtor testObj = new TypeLoadExceptionCtor();
        TestLibrary.TestFramework.BeginTestCase("for property of System.TypeLoadException");
        if (testObj.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }

    public bool RunTests()
    {
        bool retVal = true;
        TestLibrary.TestFramework.LogInformation("Positive");
        retVal = PosTest1() && retVal;
        retVal = PosTest2() && retVal;
        retVal = PosTest3() && retVal;
        retVal = PosTest4() && retVal;
        return retVal;
    }

    #region Positive Test Logic
    public bool PosTest1()
    {
        bool retVal = true;

        String errMessage = TestLibrary.Generator.GetString(-55, false, 1, 255);
        TypeLoadException tLE = new TypeLoadException(errMessage);

        String expectedValue = errMessage;
        String actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest1:Get Message when the message is a random string");
        try
        {
            actualValue = tLE.Message;

            if (!actualValue.Equals(expectedValue))
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }

    public bool PosTest2()
    {
        bool retVal = true;

        String errMessage = null;
        TypeLoadException tLE = new TypeLoadException(errMessage);

        String expectedValue = "Failure has occurred while loading a type.";
        //when message is null,it will return the default message.

        String actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest2:Get Message when the message is a null string");
        try
        {
            actualValue = tLE.Message;

            if ((actualValue != expectedValue) &
                !(actualValue.Contains("[Arg_TypeLoadException]")))
            {
                TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }

    public bool PosTest3()
    {
        bool retVal = true;

        String errMessage = "";
        TypeLoadException tLE = new TypeLoadException(errMessage);

        String expectedValue = errMessage;
        String actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest3:Get Message when the message is a empty string");
        try
        {
            actualValue = tLE.Message;

            if (!actualValue.Equals(expectedValue))
            {
                TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }

    public bool PosTest4()
    {
        bool retVal = true;

        String errMessage = TestLibrary.Generator.GetString(-55, false, 256, 512);
        TypeLoadException tLE = new TypeLoadException(errMessage);

        String expectedValue = errMessage;
        String actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest4:Get Message when the message is a long random string");
        try
        {
            actualValue = tLE.Message;

            if (!actualValue.Equals(expectedValue))
            {
                TestLibrary.TestFramework.LogError("007", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }

    #endregion
}

redpajama_set_name: RedPajamaGithub


text:
package uk.ac.ebi.subs.repository.repos.submittables;

import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import uk.ac.ebi.subs.repository.model.SampleGroup;
import uk.ac.ebi.subs.repository.projections.SubmittableWithStatus;

@RepositoryRestResource(excerptProjection = SubmittableWithStatus.class)
public interface SampleGroupRepository extends SubmittableRepository<SampleGroup> {

}


text:
@interface MyMapUnwaitlistClassViewController : MyMapClassActionViewController

@end


text:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE IF NOT EXISTS performances
(
    id uuid NOT NULL DEFAULT uuid_generate_v4(),
    title text,
    release_year date,
    performance_type integer,
    suspended boolean,
    "raw" text,
    CONSTRAINT performances_pkey PRIMARY KEY (id)
);

CREATE INDEX ON performances (title);
CREATE INDEX ON performances (release_year);
CREATE INDEX ON performances (performance_type);

CREATE TABLE IF NOT EXISTS tv_episodes
(
    id uuid NOT NULL DEFAULT uuid_generate_v4(),
    episode_name text,
    episode_date timestamp without time zone,
    episode_season integer,
    episode_number integer,
    episode_id_raw text,
    tv_show_id uuid,
    "raw" text,
    CONSTRAINT tv_episodes_pkey PRIMARY KEY (id)
);

CREATE INDEX ON tv_episodes (episode_number);
CREATE INDEX ON tv_episodes (episode_season);
CREATE INDEX ON tv_episodes (tv_show_id);

CREATE TABLE IF NOT EXISTS actors
(
    id uuid NOT NULL DEFAULT uuid_generate_v4(),
    first_name text,
    last_name text,
    gender varchar(6),
    CONSTRAINT actors_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS roles
(
    id uuid NOT NULL DEFAULT uuid_generate_v4(),
    performers_id uuid,
    performance_id uuid,
    character_name text,
    billing_position text,
    episode_id uuid,
    CONSTRAINT roles_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS directors
(
    id uuid NOT NULL DEFAULT uuid_generate_v4(),
    first_name text,
    last_name text,
    CONSTRAINT directors_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS director_to_performance
(
    director_uuid uuid NOT NULL,
    performance_uuid uuid,
    tv_show_uuid uuid
);

CREATE TABLE IF NOT EXISTS genres
(
  entity_id uuid NOT NULL, -- Can either be a performance or tv_episode uuid, since individual episodes can have genre information
  genre text NOT NULL,
  CONSTRAINT genres_pkey PRIMARY KEY (entity_id, genre)
);

CREATE TABLE IF NOT EXISTS ratings
(
  entity_id uuid NOT NULL,
  votes integer,
  rating double precision,
  CONSTRAINT ratings_pkey PRIMARY KEY (entity_id)
)

CREATE INDEX ON director_to_performance (director_uuid);
CREATE INDEX ON director_to_performance (performance_uuid);
CREATE INDEX ON director_to_performance (tv_show_uuid);
CREATE INDEX ON tv_episodes (raw);
CREATE INDEX ON performances (raw);


text:
package com.softteco.toolset.bl;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;

/**
 *
 * @author serge
 */
public abstract class AutofillAbstractAssembler<E, D> extends AbstractAssembler<E, D> {

    @Override
    protected Class<D> getDtoClass() {
        final ParameterizedType superclass = (ParameterizedType) getClass().getGenericSuperclass();
        return (Class<D>) superclass.getActualTypeArguments()[1];
    }

    protected Class<E> getEntityClass() {
        final ParameterizedType superclass = (ParameterizedType) getClass().getGenericSuperclass();
        return (Class<E>) superclass.getActualTypeArguments()[0];
    }

    @Override
    public void assemble(final D dto, final E entity) {
        if (entity == null) {
            return;
        }

        final Class entityClass = entity.getClass();
        for (Field each : getDtoClass().getFields()) {
            if (each.getAnnotation(SkipAutoFill.class) != null) {
                continue;
            }
            if (Modifier.isFinal(each.getModifiers()) || Modifier.isStatic(each.getModifiers())) {
                continue;
            }

            try {
                final Method method;
                if (each.getType().equals(boolean.class)) {
                    method = entityClass.getMethod("is" + each.getName().substring(0, 1).toUpperCase() + each.getName().substring(1));
                } else {
                    method = entityClass.getMethod("get" + each.getName().substring(0, 1).toUpperCase() + each.getName().substring(1));
                }

                try {
                    if (method.getReturnType().equals(each.getType())) {
                        each.set(dto, method.invoke(entity));
                    } else {
                        try {
                            final Method methodInAssembler = this.getClass().getMethod("get" + each.getName().substring(0, 1).toUpperCase()
                                    + each.getName().substring(1), getEntityClass());
                            each.set(dto, methodInAssembler.invoke(this, entity));
                        } catch (NoSuchMethodException e) {
                            System.out.println("Types are not equal: " + method.getReturnType().getSimpleName() + " vs "
                                    + each.getType().getSimpleName() + " " + each.getName());
                        }
                    }
                } catch (IllegalAccessException | InvocationTargetException e) {
                    e.printStackTrace(System.out);
                }
            } catch (NoSuchMethodException e) {
                System.out.println("Skipped field " + dto.getClass().getName() + "." + each.getName());
            }
        }
    }

    public void disassemble(final E entity, final D dto) {
        final Class entityClass = entity.getClass();
        for (Field each : getDtoClass().getFields()) {
            if (each.getAnnotation(SkipAutoFill.class) != null) {
                continue;
            }

            try {
                final Method method = entityClass.getMethod("set" + each.getName().substring(0, 1).toUpperCase() + each.getName().substring(1),
                        each.getType());

                try {
                    method.invoke(entity, each.get(dto));
                } catch (IllegalAccessException | InvocationTargetException e) {
                    e.printStackTrace(System.out);
                }
            } catch (NoSuchMethodException e) {
                System.out.println("Skipped field " + each.getName());
            }
        }
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datafactory.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for DependencyCondition. */
public final class DependencyCondition extends ExpandableStringEnum<DependencyCondition> {
    /** Static value Succeeded for DependencyCondition. */
    public static final DependencyCondition SUCCEEDED = fromString("Succeeded");

    /** Static value Failed for DependencyCondition. */
    public static final DependencyCondition FAILED = fromString("Failed");

    /** Static value Skipped for DependencyCondition. */
    public static final DependencyCondition SKIPPED = fromString("Skipped");

    /** Static value Completed for DependencyCondition. */
    public static final DependencyCondition COMPLETED = fromString("Completed");

    /**
     * Creates or finds a DependencyCondition from its string representation.
     *
     * @param name a name to look for.
     * @return the corresponding DependencyCondition.
     */
    @JsonCreator
    public static DependencyCondition fromString(String name) {
        return fromString(name, DependencyCondition.class);
    }

    /**
     * Gets known DependencyCondition values.
     *
     * @return known DependencyCondition values.
     */
    public static Collection<DependencyCondition> values() {
        return values(DependencyCondition.class);
    }
}


text:
package com.impetus.client.couchdb;

import java.util.Map;

/**
 * Design document.
 *
 *
 * @author Kuldeep Mishra
 */
public class CouchDBDesignDocument
{

    /** The _rev. */
    private String _rev;

    /** The language. */
    private String language;

    /** The views. */
    private Map<String, MapReduce> views;

    /**
     * Gets the language.
     *
     * @return the language
     */
    public String getLanguage()
    {
        return language;
    }

    /**
     * Gets the views.
     *
     * @return the views
     */
    public Map<String, MapReduce> getViews()
    {
        return views;
    }

    /**
     * Sets the language.
     *
     * @param language
     *            the new language
     */
    public void setLanguage(String language)
    {
        this.language = language;
    }

    /**
     * Sets the views.
     *
     * @param views
     *            the views
     */
    public void setViews(Map<String, MapReduce> views)
    {
        this.views = views;
    }

    /**
     * Gets the _rev.
     *
     * @return the _rev
     */
    public String get_rev()
    {
        return _rev;
    }

    /**
     * Sets the _rev.
     *
     * @param _rev
     *            the new _rev
     */
    public void set_rev(String _rev)
    {
        this._rev = _rev;
    }

    /**
     * Holds Map Reduce functions.
     *
     * @author Kuldeep Mishra
     */
    public static class MapReduce
    {

        /** The map. */
        private String map;

        /** The reduce. */
        private String reduce;

        /**
         * Gets the map.
         *
         * @return the map
         */
        public String getMap()
        {
            return map;
        }

        /**
         * Gets the reduce.
         *
         * @return the reduce
         */
        public String getReduce()
        {
            return reduce;
        }

        /**
         * Sets the map.
         *
         * @param map
         *            the new map
         */
        public void setMap(String map)
        {
            this.map = map;
        }

        /**
         * Sets the reduce.
         *
         * @param reduce
         *            the new reduce
         */
        public void setReduce(String reduce)
        {
            this.reduce = reduce;
        }
    }
}


text:
$(function() {
	$('.menu_nav ul li a').css({"border-bottom-left-radius":"28px", "border-bottom-right-radius":"28px", "-moz-border-radius-bottomleft":"28px", "-moz-border-radius-bottomright":"28px", "-webkit-border-bottom-left-radius":"28px", "-webkit-border-bottom-right-radius":"28px"});

});

// Cufon
Cufon.replace('h1, h2, h3, h4, h5, h6, .menu_nav ul li a', { hover: true });

// ]]>


text:
import { browser, element, by } from 'protractor';

describe('Testing Example', () => {
  const expectedViewNames = ['Dashboard', 'Heroes', 'About'];

  beforeAll(() => browser.get(''));

  function getPageElts() {
    return {
      navElts: element.all(by.css('app-root nav a')),
      appDashboard: element(by.css('app-root app-dashboard')),
    };
  }

  it('has title', async () => {
    expect(await browser.getTitle()).toEqual('App Under Test');
  });

  it(`has views ${expectedViewNames}`, async () => {
    const viewNames = await getPageElts().navElts.map(el => el!.getText());

    expect(viewNames).toEqual(expectedViewNames);
  });

  it('has dashboard as the active view', async () => {
    const page = getPageElts();

    expect(await page.appDashboard.isPresent()).toBeTruthy();
  });
});


text:
extern crate log;
#[macro_use]
extern crate downcast_rs;

mod cursor;
pub use cursor::Cursor;

mod theme;
pub use theme::Theme;

pub mod widget;
pub use widget::Widget;
pub mod scene;
pub mod widgets;
pub use scene::{Scene, SceneAction, WidgetAdded, WidgetNode, WidgetRemoved};

pub mod canvas;
pub use canvas::{Canvas, Cell, CellBuffer, Color};
pub mod layout;
pub use layout::{Align, Layout};
pub mod geom;
pub mod style;
pub use style::{BorderCells, Style};
pub mod tree;
pub use tree::{NodeId, NodeRc, Tree};

pub mod actions;
pub use actions::{KeyAction, MouseAction};

#[cfg(feature = "default")]
pub mod terminal;
#[cfg(feature = "default")]
pub use terminal::Terminal;

// FIXME Do a cleaner fix for termion event coupling
#[cfg(not(feature = "default"))]
pub mod event {
    #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
    pub enum Key {
        /// Backspace.
        Backspace,
        /// Left arrow.
        Left,
        /// Right arrow.
        Right,
        /// Up arrow.
        Up,
        /// Down arrow.
        Down,
        /// Home key.
        Home,
        /// End key.
        End,
        /// Page Up key.
        PageUp,
        /// Page Down key.
        PageDown,
        /// Delete key.
        Delete,
        /// Insert key.
        Insert,
        /// Function keys.
        ///
        /// Only function keys 1 through 12 are supported.
        F(u8),
        /// Normal character.
        Char(char),
        /// Alt modified character.
        Alt(char),
        /// Ctrl modified character.
        ///
        /// Note that certain keys may not be modifiable with `ctrl`, due to limitations of terminals.
        Ctrl(char),
        /// Null byte.
        Null,
        /// Esc key.
        Esc,

        #[doc(hidden)]
        __IsNotComplete,
    }
}

#[cfg(feature = "default")]
extern crate termion;
#[cfg(feature = "default")]
pub use self::termion::event;

pub mod color;


text:
var scope;
function wiki_init(){
  set_scope();
  init_lightbox();
  set_unwanted();
  hide_all_sections_content();
  setup_sections();
}

function set_scope(){
  scope = $('#wikiInfo').first();
}

function init_lightbox(){
  scope.find('a.lightboxwiki').lightBox({fixedNavigation:true});
}

function set_unwanted(){
  scope.find('.dablink').addClass('unwanted');
  scope.find('.thumb').addClass('unwanted');
  scope.find('.editsection').addClass('unwanted');
  scope.find('.toc').addClass('unwanted');
  scope.find('.vertical-navbox').addClass('unwanted');
}

function hide_all_sections_content(){
  scope.find('.mw-headline:first').parent().nextAll(':not(h2:has(.mw-headline))').hide();
}

function setup_sections(){
  scope.find('h2 > .mw-headline').parent().each(function(index) {
	$(this).click(function(e) {
	  $(this).nextUntil('h2:has(.mw-headline)').not('.unwanted').toggle();
	  $(this).find('#show').toggleClass('show');
	  $(this).find('#hide').toggleClass('hide');
    });
	$(this).css('cursor', 'pointer');
	//$(this).css({'cursor' : 'pointer', 'background-color' : '#FFFFFF'});
	$(this).append(" ");
	$(this).append(" ");
	$(this).append('
');
  });
}


text:
#ifndef __GLSLProgramManagerCommon_H__
#define __GLSLProgramManagerCommon_H__

#include "OgreGLSupportPrerequisites.h"
#include "OgreString.h"
#include "OgreGpuProgramParams.h"
#include "OgreGLSLProgramCommon.h"

namespace Ogre {
    class GLSLShaderCommon;

    /** Ogre assumes that there are separate programs to deal with but
        GLSL has one program object that represents the active shader
        objects during a rendering state.  GLSL shader objects are
        compiled separately and then attached to a program object and
        then the program object is linked.  Since Ogre can only handle
        one program being active in a pass, the GLSL Link Program
        Manager does the same.  The GLSL Link program manager acts as
        a state machine and activates a program object based on the
        active programs.  Previously created program objects are
        stored along with a unique key in a hash_map for quick
        retrieval the next time the program object is required.
    */
    class GLSLProgramManagerCommon
    {
    protected:
        typedef std::map<String, GpuConstantType> StringToEnumMap;
        StringToEnumMap mTypeEnumMap;

        /** Parse an individual uniform from a GLSL source file and
            store it in a GpuNamedConstant. */
        void parseGLSLUniform(String line, GpuNamedConstants& defs, const String& filename);

        /// checks whether the param with the given name should be added to the uniforms list
        static bool validateParam(String paramName, uint32 numActiveArrayElements,
                                  const GpuConstantDefinitionMap* (&constantDefs)[6], GLUniformReference& refToUpdate);

        typedef std::map<uint32, GLSLProgramCommon*> ProgramMap;
        typedef ProgramMap::iterator ProgramIterator;

        /// container holding previously created program objects
        ProgramMap mPrograms;

        /// Active shader objects defining the active program object.
        GLShaderList mActiveShader;
    public:
        GLSLProgramManagerCommon();
        virtual ~GLSLProgramManagerCommon();

        /** Populate a list of uniforms based on GLSL source and store
            them in GpuNamedConstants.
            @param src Reference to the source code.
            @param constantDefs The defs to populate (will
            not be cleared before adding, clear it yourself before
            calling this if that's what you want).
            @param filename The file name this came from, for logging errors.
        */
        void extractUniformsFromGLSL(
            const String& src, GpuNamedConstants& constantDefs, const String& filename);

        /// Destroy all programs which referencing this shader
        void destroyAllByShader(GLSLShaderCommon* shader);
    };

}

#endif // __GLSLProgramManagerCommon_H__


text:
const faker = require('faker');
const bcrypt = require('bcrypt');
const Groups = {
  SUPER_USER: 1,
  ADMIN: 2,
  MEMBER_MANAGER: 4,
  DISTRICT_KEEPER: 8,
  RELATOR: 16,
  MODERATOR: 32,
  VOTER: 64,
  VIEWER: 128,
  GUEST: 256,
};
const numUsers = 50;
const numMods = numUsers / 10 > 0 ? numUsers / 10 : 1;
const numTestUsers = numMods;
const numTestGuests = 2;
const numGuests = numMods;
const numUsersWithFollowees = Math.floor((numUsers / 10) * 7);
const numTags = 10;
const maxNumFollowees = 5;
const numPolls = 200;
const numProposals = numPolls / 2;
const statementPercentage = 30; // how many of the voters have written a statement

const chunkSize = 1000;

function randomNumber(max) {
  return Math.floor(max * Math.random());
}
function random(array) {
  return array[Math.floor(array.length * Math.random())];
}
const dedup = (arr) => {
  const hashTable = {};

  return arr.filter((el) => {
    const key = JSON.stringify(el);
    const match = Boolean(hashTable[key]);

    return match ? false : (hashTable[key] = true);
  });
};

// https://www.frankmitchell.org/2015/01/fisher-yates/
/* eslint-disable no-param-reassign */
function shuffle(array) {
  // in place!
  let i = 0;
  let j = 0;
  let temp = null;
  for (i = array.length - 1; i > 0; i -= 1) {
    j = Math.floor(Math.random() * (i + 1));
    temp = array[i];
    array[i] = array[j];
    array[j] = temp;
  }
}
/* eslint-enable no-param-reassign */

exports.seed = function (knex, Promise) {
  /* eslint-disable comma-dangle */

  function createUser(name, surname, passwordHash, email, groups, time, emailVerified, voteSince) {
    return knex('users').insert({
      name,
      surname,
      password_hash: passwordHash,
      email,
      groups,
      can_vote_since : voteSince||new Date(),
      created_at: time,
      updated_at: time,
      email_verified: emailVerified,
      thumbnail: `https://api.adorable.io/avatars/32/${name}${surname}.io.png`,
    });
  }

  /* eslint-disable prefer-template */
  function createUsers() {
    const time = new Date();
    let users = [];
    const testSuperUser = Promise.resolve(
      bcrypt
        .hash('password', 10)
        .then(hash => createUser('superuser', 'superuser', hash, 'superuser@example.com', Groups.SUPER_USER, time, true))
    );
    const testAdmin = Promise.resolve(
      bcrypt
        .hash('password', 10)
        .then(hash => createUser('admin', 'admin', hash, 'admin@example.com', Groups.GUEST|Groups.VIEWER|Groups.VOTER| Groups.RELATOR|Groups.MEMBER_MANAGER| Groups.ADMIN, time, true))
    );
    users.push(testAdmin);
    const testMods = [];
    for (let i = 0; i < numMods; i += 1) {
      const name = 'mod_' + i;
      const groups = Groups.GUEST|Groups.VIEWER|Groups.VOTER|Groups.MODERATOR
      testMods.push(
        Promise.resolve(
          bcrypt
            .hash('password', 10)
            .then(hash => createUser(name, name, hash, name + '@example.com', groups, time, true))
        )
      );
    }
    users = users.concat(testMods);
    const testUsers = [];
    for (let i = 0; i < numTestUsers; i += 1) {
      const name = 'user_' + i;
      testUsers.push(
        Promise.resolve(
          bcrypt
            .hash('password', 10)
            .then(hash => createUser(name, name, hash, name + '@example.com', Groups.GUEST|Groups.VIEWER|Groups.VOTER, time, true))
        )
      );
    }
    users = users.concat(testUsers);
    const numUsersCalculated = numUsers - numMods - 1 - numTestUsers - numTestGuests - numGuests;
    for (let i = 0; i < numUsersCalculated; i += 1) {
      const name = faker.name.firstName();
      const surname = faker.name.lastName();
      const user = createUser(name, surname, null, faker.internet.email(), Groups.GUEST|Groups.VIEWER|Groups.VOTER, time, true);
      users.push(user);
    }

    const testGuests = [];
    let guestUsers = [];
    for (let i = 0; i < numTestGuests; i += 1) {
      const name = 'guest_' + i;
      testGuests.push(
        Promise.resolve(
          bcrypt
            .hash('password', 10)
            .then(hash => createUser(name, name, hash, name + '@example.com', Groups.GUEST, time, true))
        )
      );
    }
    /* eslint-enable prefer-template */
    guestUsers = guestUsers.concat(testGuests);

    for (let i = 0; i < numGuests; i += 1) {
      const name = faker.name.firstName();
      const surname = faker.name.lastName();
      const guest = createUser(
        name,
        surname,
        null,
        faker.internet.email(),
        Groups.GUEST,
        time,
        Math.random() > 0.5
      );
      guestUsers.push(guest);
    }

    // returns only ids of users who can vote
    return Promise.resolve(
      Promise.all(guestUsers).then(() =>
        Promise.all(users).then(() =>
          knex('users').whereNot('groups', Groups.GUEST).pluck('id').then(userIds => userIds)))
    );
  }

  function createFollowees() {
    return knex('users').pluck('id').then((userIds) => {
      const users = userIds.slice(0);
      shuffle(users);
      const time = new Date();
      const followeeData = [];
      for (let i = 0; i < numUsersWithFollowees; i += 1) {
        const followerId = users.pop();
        const numFollowees = Math.max(1, randomNumber(maxNumFollowees));
        const followees = userIds.slice(0);
        shuffle(followees);

        for (let j = 0; j < numFollowees; j += 1) {
          let followeeId = followees.pop();
          followeeId = followeeId === followerId ? followees.pop() : followeeId;

          const data = {
            follower_id: followerId,
            followee_id: followeeId,
            created_at: time,
            updated_at: time,
          };
          followeeData.push(data);
        }
      }
      return Promise.resolve(knex('user_follows').insert(followeeData));
    });
  }

  function createTags() {
    let tags = [];
    for (let i = 0; i < numTags; i += 1) {
      tags.push({ text: faker.lorem.word() });
    }
    tags = dedup(tags);
    return Promise.resolve(knex('tags').insert(tags).returning('id').then(ids => ids));
  }

  function createProposalTags(tagIds) {
    return Promise.resolve(
      knex('proposals').pluck('id').then((proposalIds) => {
        const time = new Date();
        const tagsData = [];

        const tagCounter = {};
        for (let i = 0; i < proposalIds.length; i += 1) {
          const numTagsOnProposal = randomNumber(tagIds.length);
          const tags = tagIds.slice(0);
          shuffle(tags);
          for (let j = 0; j < numTagsOnProposal; j += 1) {
            const tagId = tags.pop();
            const data = {
              proposal_id: proposalIds[i],
              tag_id: tagId,
              created_at: time,
              updated_at: time,
            };
            tagCounter[tagId] = tagCounter[tagId] ? tagCounter[tagId] + 1 : 1;
            tagsData.push(data);
          }
        }

        return knex('proposal_tags').insert(tagsData).then(() => {
          const updates = [];
          // eslint-disable-next-line no-restricted-syntax
          for (const id in tagCounter) {  // eslint-disable-line guard-for-in
            updates.push(knex('tags').where({ id }).update({ count: tagCounter[id] }));
          }

          return Promise.resolve(Promise.all(updates));
        });
      })
    );
  }

  function updatePolls(pollCounts) {
    const updates = [];
    // eslint-disable-next-line no-restricted-syntax
    for (const id in pollCounts) { // eslint-disable-line guard-for-in
      updates.push(knex('polls').where({ id }).update(pollCounts[id]));
    }

    return Promise.resolve(Promise.all(updates).then(x => x));
  }

  function createStatementLikes({ stmtIds, stmtData, userIds }) {
    if (stmtData.length !== stmtIds.length) throw Error('Inconsistent data');

    let numLikes;
    const likes = [];
    const updates = [];
    const time = new Date();
    for (let i = 0; i < stmtIds.length; i += 1) {
      numLikes = randomNumber(userIds.length / 2);

      updates.push(knex('statements').where({ id: stmtIds[i] }).update({ likes: numLikes }));
      const users = userIds.slice(0);
      shuffle(users);
      for (let j = 0; j < numLikes; j += 1) {
        const like = {
          user_id: users.pop(),
          statement_id: stmtIds[i],
          created_at: time,
          updated_at: time,
        };
        likes.push(like);
      }
    }

    return Promise.resolve(
      knex
        .batchInsert('statement_likes', likes, chunkSize)
        .then(() => Promise.all(updates).then(data => data))
    );
  }

  function createStatements({ voteIds, voteData, userIds }) {
    if (voteIds.length !== voteData.length) throw Error('Inconsistent data');
    const statements = [];
    const numStatements = Math.floor((voteIds.length * statementPercentage) / 100);
    const time = new Date();
    for (let i = 0; i < numStatements; i += 1) {
      const statement = {
        author_id: voteData[i].user_id,
        vote_id: voteIds[i],
        poll_id: voteData[i].poll_id,
        body: faker.lorem.paragraphs(randomNumber(3) || 1),
        position: voteData[i].position,
        created_at: time,
        updated_at: time,
      };
      statements.push(statement);
    }
    return Promise.resolve(
      knex
        .batchInsert('statements', statements, chunkSize)
        .returning('id')
        .then(stmtIds => ({ stmtIds, stmtData: statements, userIds }))
    );
  }

  function createVotes({ userIds, pollData }) {
    let numVotes = 0;
    let time = null;
    const userVotes = [];
    const votesWithStatement = [];
    const pollOneVoteCount = {};
    const pollTwoVoteCount = {};
    const voteProposedFull = pollData[0].slice(0);
    const voteVotablesFull = pollData[1].slice(0);
    for (let i = 0; i < userIds.length; i += 1) {
      const voteProposed = voteProposedFull.slice(0);
      const voteVotables = voteVotablesFull.slice(0);

      // phase one polls;
      numVotes = randomNumber(voteProposed.length);
      // TODO shuffle array
      time = new Date();
      shuffle(voteProposed);

      for (let j = 0; j < numVotes; j += 1) {
        const pollId = voteProposed.pop();
        pollOneVoteCount[pollId] = pollOneVoteCount[pollId]
          ? { upvotes: pollOneVoteCount[pollId].upvotes + 1 }
          : { upvotes: 1 };
        const vote = {
          user_id: userIds[i],
          poll_id: pollId,
          position: 'pro',
          created_at: time,
          updated_at: time,
        };
        userVotes.push(vote);
      }

      numVotes = randomNumber(voteVotables.length / 2);
      time = new Date();
      shuffle(voteVotables);

      for (let x = 0; x < numVotes; x += 1) {
        const position = Math.random() < 0.5 ? 'pro' : 'con';
        const column = ['upvotes', 'downvotes'];
        const index = position === 'pro' ? 0 : 1;

        const pollTwoId = voteVotables.pop();
        // TODO make with Object.assign
        pollTwoVoteCount[pollTwoId] = pollTwoVoteCount[pollTwoId]
          ? {
            [column[index]]: pollTwoVoteCount[pollTwoId][column[index]] + 1,
            [column[1 - index]]: pollTwoVoteCount[pollTwoId][column[1 - index]],
          }
          : { [column[index]]: 1, [column[1 - index]]: 0 };

        const vote = {
          user_id: userIds[i],
          poll_id: pollTwoId,
          position,
          created_at: time,
          updated_at: time,
        };
        votesWithStatement.push(vote);
      }
    }

    // create votes
    return Promise.resolve(
      Promise.all([
        knex.batchInsert('votes', userVotes, chunkSize).returning('id'),
        knex.batchInsert('votes', votesWithStatement, chunkSize).returning('id'),
      ])
        .then(voteIds =>
          updatePolls(pollOneVoteCount)
            .then(() => updatePolls(pollTwoVoteCount))
            .then(() => Promise.resolve(voteIds)))
        .then(voteIds => ({ voteIds: voteIds[1], voteData: votesWithStatement, userIds }))
    );
  }

  function createProposals(userIds, pollData) {
    const pollOneIds = pollData[0].slice(0);
    const pollTwoIds = pollData[1].slice(0);
    const proposedProposal = [];
    const votableProposals = [];
    const acceptedProposals = [];
    const rejectedProposals = [];
    const revokedProposals = [];
    // TODO check numProposals isn't to high

    shuffle(pollOneIds);
    shuffle(pollTwoIds);
    for (let i = 0; i < numProposals; i += 1) {
      const time = new Date();

      const proposal = {
        author_id: random(userIds),
        poll_one_id: pollOneIds.pop(),
        poll_two_id: pollTwoIds.pop(),
        title: faker.lorem.sentence(),
        body: faker.lorem.paragraphs(randomNumber(10) || 4),
        created_at: time,
        updated_at: time,
      };
      if (i % 5 === 0) {
        proposedProposal.push(Object.assign({}, proposal, { state: 'proposed' }));
      } else if (i % 3 === 0) {
        votableProposals.push(Object.assign({}, proposal, { state: 'voting' }));
      } else if (i % 7 === 0) {
        rejectedProposals.push(Object.assign({}, proposal, { state: 'rejected' }));
      } else if (i % 9 === 0) {
        revokedProposals.push(Object.assign({}, proposal, { state: 'revoked' }));
      } else {
        acceptedProposals.push(Object.assign({}, proposal, { state: 'accepted' }));
      }
    }

    return Promise.resolve(
      Promise.all([
        knex.batchInsert('proposals', proposedProposal, chunkSize).returning('id'),
        knex.batchInsert('proposals', votableProposals, chunkSize).returning('id'),
        knex.batchInsert('proposals', acceptedProposals, chunkSize).returning('id'),
        knex.batchInsert('proposals', rejectedProposals, chunkSize).returning('id'),
        knex.batchInsert('proposals', revokedProposals, chunkSize).returning('id'),
      ]).then(data => ({ userIds, proposalIds: data, pollData }))
    );
  }

  function createPollingmodes() {
    const data = [
      {  name: 'propose', unipolar: true, with_statements: false, threshold_ref: 'all' },
      {  name: 'vote', unipolar: false, with_statements: true, threshold_ref: 'voters' },
      {  name: 'survey', unipolar: false, with_statements: false, threshold_ref: 'voters' },
    ];
    return Promise.resolve(
      knex('polling_modes')
        .insert(data)
        .returning('id')
        .then(ids => ({ proposeId: ids[0], voteId: ids[1] }))
    );
  }

  function createPolls({ proposeId, voteId }) {
    const phaseOnePolls = [];
    const phaseTwoPolls = [];
    let poll;
    let time;
    let endTime;
    for (let i = 0; i < numPolls; i += 1) {
      time = new Date();
      endTime = new Date();
      endTime.setDate(time.getDate() + randomNumber(10));
      poll = {
        secret: Math.random() > 0.5,
        threshold: randomNumber(100) || 20,
        created_at: time,
        updated_at: time,
        start_time: time,
        end_time: endTime,
        num_voter: numUsers - numGuests - numTestGuests,
      };
      if (i % 2 === 0) {
        poll = Object.assign({}, poll, { polling_mode_id: proposeId });
        phaseOnePolls.push(poll);
      } else {
        poll = Object.assign({}, poll, {
          polling_mode_id: voteId,
          threshold: poll.threshold < 50 ? 50 : poll.threshold,
        });
        phaseTwoPolls.push(poll);
      }
    }

    return Promise.resolve(
      Promise.all([
        knex.batchInsert('polls', phaseOnePolls, chunkSize).returning('id'),
        knex.batchInsert('polls', phaseTwoPolls, chunkSize).returning('id'),
      ]).then(ids => ids)
    );
  }

  return Promise.resolve(
    //createRoles()
    createPollingmodes()
      .then(createPolls)
      .then(pollData => createUsers().then(userIds => createProposals(userIds, pollData)))
      .then(createVotes)
      .then(createStatements)
      .then(createStatementLikes)
      .then(createFollowees)
      .then(createTags)
      .then(createProposalTags)
      .catch(e => console.log(e))
  );
};


text:
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading.Tasks;
using log4net;
using log4net.Core;
using ILogger = Mozu.Api.Logging.ILogger;

namespace Mozu.Api.ToolKit.Logging
{
    public class Log4NetLogger : ILogger
    {
        private static ILog _log;
        private readonly static Type DeclaringType = typeof(Log4NetLogger);

        private log4net.Core.ILogger Logger { get; set; }
        public Log4NetLogger(ILog log)
        {
            _log = log;
            Logger = _log.Logger;
        }

        public void Info(object message, Exception ex = null, object properties = null)
        {
            var loggingEvent = CreateLoggingEvent(message, ex, Level.Info);
           LogEvent(loggingEvent, properties);
        }

        public void Warn(object message, Exception ex = null, object properties = null)
        {
            var loggingEvent = CreateLoggingEvent(message,ex, Level.Warn);
            LogEvent(loggingEvent, properties);
        }

        public void Debug(object message, Exception ex = null, object properties = null)
        {
            var loggingEvent = CreateLoggingEvent(message, ex, Level.Debug);
            LogEvent(loggingEvent, properties);
        }

        public void Error(object message, Exception ex = null, object properties = null)
        {
          //_log.Error(message, ex);

            var loggingEvent = CreateLoggingEvent(message, ex, Level.Error);
            LogEvent(loggingEvent, properties);
        }

        public void Fatal(object message, Exception ex = null, object properties = null)
        {
            var loggingEvent = CreateLoggingEvent(message, ex, Level.Fatal);
            LogEvent(loggingEvent, properties);
        }

        public bool IsInfoEnabled { get { return _log.IsInfoEnabled; } }
        public bool IsWarnEnabled { get { return _log.IsWarnEnabled; } }
        public bool IsDebugEnabled { get { return _log.IsDebugEnabled; } }
        public bool IsErrorEnabled { get { return _log.IsErrorEnabled; } }
        public bool IsFatalEnabled { get { return _log.IsFatalEnabled; } }

        private LoggingEvent CreateLoggingEvent(object message, Exception ex, Level errorLevel)
        {
            if (ex == null && message is Exception)
            {
                ex = message as Exception;
                message = "An Exception occurred:";
            }

            var mozuCorrId = (ex != null && ex.GetType() == typeof (ApiException)
                ? "Mozu CorrId " + ((ApiException) ex).CorrelationId
                : string.Empty);
            if (Trace.CorrelationManager.ActivityId != Guid.Empty)
                message = string.Format("{0} {1} {2}", Trace.CorrelationManager.ActivityId, mozuCorrId,  message);

            var logEvent =
                new LoggingEvent(DeclaringType, Logger.Repository, Logger.Name, errorLevel, message, ex);
            return logEvent;
        }

        private void LogEvent(LoggingEvent logEvent, object properties)
        {
            AddEventProperties(logEvent, properties);
            if (logEvent.ExceptionObject is ApiException)
            {
                AddEventProperties(logEvent, logEvent.ExceptionObject);
                AddEventProperties(logEvent, ((ApiException)logEvent.ExceptionObject).ApiContext);
                AddEventProperties(logEvent, ((ApiException)logEvent.ExceptionObject).ExceptionDetail);
                AddEventProperties(logEvent, ((ApiException)logEvent.ExceptionObject).Items);
            }

            Logger.Log(logEvent);
        }

        private static void AddEventProperties(LoggingEvent logEvent, object properties)
        {
            if (properties == null) return;

            foreach (PropertyDescriptor propertyDescriptor in TypeDescriptor.GetProperties(properties))
            {
                var obj = propertyDescriptor.GetValue(properties);
                if (obj != null)
                    logEvent.Properties[propertyDescriptor.Name] = obj;
            }

        }
    }
}


text:
package net.npg.abattle.common.utils;

import org.eclipse.xtext.xbase.lib.Inline;

/**
 * @author Cymric
 *
 */
public class Asserts {

	@Inline(value = "assert $1", statementExpression = false)
	public static void assertIt(final boolean condition) {
		throw new UnsupportedOperationException();
	}

	@Inline(value = "assert $1 != null", statementExpression = false)
	public static void assertNotNull(final Object object) {
		throw new UnsupportedOperationException();
	}
}


text:
<?php
namespace deArcane\Hreflang;

abstract class Input{

	/**
	 * Reference to app::$request module.
	 */
	public static $request = null;

	/**
	 * Reference to app::$href module.
	 */
	public static $href = null;
}


text:
Input::
//// [/user/username/projects/myproject/tsconfig.json]
{}

//// [/user/username/projects/myproject/main.ts]
const x = 10;

//// [/user/username/projects/myproject/other.vue]

//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }

/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json
Output::
>> Screen clear
[12:00:23 AM] Starting compilation in watch mode...

[12:00:28 AM] Found 0 errors. Watching for file changes.

Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.vue"]
Program options: {"allowNonTsExtensions":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program structureReused: Not
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/main.ts
/user/username/projects/myproject/other.vue

Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/user/username/projects/myproject/main.ts
/user/username/projects/myproject/other.vue

Shape signatures in builder refreshed for::
/a/lib/lib.d.ts (used version)
/user/username/projects/myproject/main.ts (used version)
/user/username/projects/myproject/other.vue (used version)

WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
  {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/main.ts:
  {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250}
/user/username/projects/myproject/other.vue:
  {"fileName":"/user/username/projects/myproject/other.vue","pollingInterval":250}
/a/lib/lib.d.ts:
  {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
/user/username/projects/myproject/node_modules/@types:
  {"fileName":"/user/username/projects/myproject/node_modules/@types","pollingInterval":500}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
  {"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/main.js]
var x = 10;

//// [/user/username/projects/myproject/other.vue.js]

Change:: Write a file

Input::
//// [/user/username/projects/myproject/other2.vue]

Output::
>> Screen clear
[12:00:31 AM] File change detected. Starting incremental compilation...

[12:00:34 AM] Found 0 errors. Watching for file changes.

Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.vue","/user/username/projects/myproject/other2.vue"]
Program options: {"allowNonTsExtensions":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program structureReused: Not
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/main.ts
/user/username/projects/myproject/other.vue
/user/username/projects/myproject/other2.vue

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/other2.vue

Shape signatures in builder refreshed for::
/user/username/projects/myproject/other2.vue (used version)

WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
  {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/main.ts:
  {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250}
/user/username/projects/myproject/other.vue:
  {"fileName":"/user/username/projects/myproject/other.vue","pollingInterval":250}
/a/lib/lib.d.ts:
  {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
/user/username/projects/myproject/node_modules/@types:
  {"fileName":"/user/username/projects/myproject/node_modules/@types","pollingInterval":500}
/user/username/projects/myproject/other2.vue:
  {"fileName":"/user/username/projects/myproject/other2.vue","pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
  {"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/other2.vue.js]


text:
namespace VideoCollection.Utilities
{
    public interface ILoggerProvider
    {
        ILogger CreateLogger(string name);
    }
}


text: java -Xmx4096m -classpath .:ibench-fat.jar org.vagabond.commandline.loader.CommandLineLoader


text:
package config

import (
	. "github.com/smartystreets/goconvey/convey"
	"testing"
)

func TestStatusText(t *testing.T) {
	Convey("Should return status text string for passed code int", t, func() {
		s := StatusText(100)
		So(s, ShouldEqual, "Continue")
	})
}


text:
#include "same70q21b.h"

/* Initialize segments */
extern uint32_t _sfixed;
extern uint32_t _efixed;
extern uint32_t _etext;
extern uint32_t _srelocate;
extern uint32_t _erelocate;
extern uint32_t _szero;
extern uint32_t _ezero;
extern uint32_t _sstack;
extern uint32_t _estack;

/** \cond DOXYGEN_SHOULD_SKIP_THIS */
int main(void);
/** \endcond */

void __libc_init_array(void);

/* Reset handler */
void Reset_Handler(void);

/* Default empty handler */
void Dummy_Handler(void);

/* Cortex-M7 core handlers */
void NonMaskableInt_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void HardFault_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void MemoryManagement_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void BusFault_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void UsageFault_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void SVCall_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void DebugMonitor_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PendSV_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void SysTick_Handler(void) __attribute__((weak, alias("Dummy_Handler")));

/* Peripherals handlers */
void SUPC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void RSTC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void RTC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void RTT_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void WDT_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PMC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void EFC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void UART0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void UART1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PIOA_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PIOB_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PIOC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void USART0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void USART1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void USART2_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PIOD_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PIOE_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void HSMCI_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TWIHS0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TWIHS1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void SPI0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void SSC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC2_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC3_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC4_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC5_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void AFEC0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void DACC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PWM0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void ICM_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void ACC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void USBHS_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void MCAN0_INT0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void MCAN0_INT1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void MCAN1_INT0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void MCAN1_INT1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void GMAC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void AFEC1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TWIHS2_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void SPI1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void QSPI_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void UART2_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void UART3_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void UART4_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC6_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC7_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC8_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC9_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC10_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TC11_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void AES_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void TRNG_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void XDMAC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void ISI_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void PWM1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void FPU_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void SDRAMC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void RSWDT_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void CCW_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void CCF_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void GMAC_Q1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void GMAC_Q2_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void IXC_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void I2SC0_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void I2SC1_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void GMAC_Q3_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void GMAC_Q4_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
void GMAC_Q5_Handler(void) __attribute__((weak, alias("Dummy_Handler")));

/* Exception Table */
__attribute__((section(".vectors"))) const DeviceVectors exception_table = {

    /* Configure Initial Stack Pointer, using linker-generated symbols */
    .pvStack = (void *)(&_estack),

    .pfnReset_Handler            = (void *)Reset_Handler,
    .pfnNonMaskableInt_Handler   = (void *)NonMaskableInt_Handler,
    .pfnHardFault_Handler        = (void *)HardFault_Handler,
    .pfnMemoryManagement_Handler = (void *)MemoryManagement_Handler,
    .pfnBusFault_Handler         = (void *)BusFault_Handler,
    .pfnUsageFault_Handler       = (void *)UsageFault_Handler,
    .pvReservedC9                = (void *)(0UL), /* Reserved */
    .pvReservedC8                = (void *)(0UL), /* Reserved */
    .pvReservedC7                = (void *)(0UL), /* Reserved */
    .pvReservedC6                = (void *)(0UL), /* Reserved */
    .pfnSVCall_Handler           = (void *)SVCall_Handler,
    .pfnDebugMonitor_Handler     = (void *)DebugMonitor_Handler,
    .pvReservedC3                = (void *)(0UL), /* Reserved */
    .pfnPendSV_Handler           = (void *)PendSV_Handler,
    .pfnSysTick_Handler          = (void *)SysTick_Handler,

    /* Configurable interrupts */
    .pfnSUPC_Handler       = (void *)SUPC_Handler,   /* 0  Supply Controller */
    .pfnRSTC_Handler       = (void *)RSTC_Handler,   /* 1  Reset Controller */
    .pfnRTC_Handler        = (void *)RTC_Handler,    /* 2  Real-time Clock */
    .pfnRTT_Handler        = (void *)RTT_Handler,    /* 3  Real-time Timer */
    .pfnWDT_Handler        = (void *)WDT_Handler,    /* 4  Watchdog Timer */
    .pfnPMC_Handler        = (void *)PMC_Handler,    /* 5  Power Management Controller */
    .pfnEFC_Handler        = (void *)EFC_Handler,    /* 6  Embedded Flash Controller */
    .pfnUART0_Handler      = (void *)UART0_Handler,  /* 7  Universal Asynchronous Receiver Transmitter */
    .pfnUART1_Handler      = (void *)UART1_Handler,  /* 8  Universal Asynchronous Receiver Transmitter */
    .pvReserved9           = (void *)(0UL),          /* 9  Reserved */
    .pfnPIOA_Handler       = (void *)PIOA_Handler,   /* 10 Parallel Input/Output Controller */
    .pfnPIOB_Handler       = (void *)PIOB_Handler,   /* 11 Parallel Input/Output Controller */
    .pfnPIOC_Handler       = (void *)PIOC_Handler,   /* 12 Parallel Input/Output Controller */
    .pfnUSART0_Handler     = (void *)USART0_Handler, /* 13 Universal Synchronous Asynchronous Receiver Transmitter */
    .pfnUSART1_Handler     = (void *)USART1_Handler, /* 14 Universal Synchronous Asynchronous Receiver Transmitter */
    .pfnUSART2_Handler     = (void *)USART2_Handler, /* 15 Universal Synchronous Asynchronous Receiver Transmitter */
    .pfnPIOD_Handler       = (void *)PIOD_Handler,   /* 16 Parallel Input/Output Controller */
    .pfnPIOE_Handler       = (void *)PIOE_Handler,   /* 17 Parallel Input/Output Controller */
    .pfnHSMCI_Handler      = (void *)HSMCI_Handler,  /* 18 High Speed MultiMedia Card Interface */
    .pfnTWIHS0_Handler     = (void *)TWIHS0_Handler, /* 19 Two-wire Interface High Speed */
    .pfnTWIHS1_Handler     = (void *)TWIHS1_Handler, /* 20 Two-wire Interface High Speed */
    .pfnSPI0_Handler       = (void *)SPI0_Handler,   /* 21 Serial Peripheral Interface */
    .pfnSSC_Handler        = (void *)SSC_Handler,    /* 22 Synchronous Serial Controller */
    .pfnTC0_Handler        = (void *)TC0_Handler,    /* 23 Timer Counter */
    .pfnTC1_Handler        = (void *)TC1_Handler,    /* 24 Timer Counter */
    .pfnTC2_Handler        = (void *)TC2_Handler,    /* 25 Timer Counter */
    .pfnTC3_Handler        = (void *)TC3_Handler,    /* 26 Timer Counter */
    .pfnTC4_Handler        = (void *)TC4_Handler,    /* 27 Timer Counter */
    .pfnTC5_Handler        = (void *)TC5_Handler,    /* 28 Timer Counter */
    .pfnAFEC0_Handler      = (void *)AFEC0_Handler,  /* 29 Analog Front-End Controller */
    .pfnDACC_Handler       = (void *)DACC_Handler,   /* 30 Digital-to-Analog Converter Controller */
    .pfnPWM0_Handler       = (void *)PWM0_Handler,   /* 31 Pulse Width Modulation Controller */
    .pfnICM_Handler        = (void *)ICM_Handler,    /* 32 Integrity Check Monitor */
    .pfnACC_Handler        = (void *)ACC_Handler,    /* 33 Analog Comparator Controller */
    .pfnUSBHS_Handler      = (void *)USBHS_Handler,  /* 34 USB High-Speed Interface */
    .pfnMCAN0_INT0_Handler = (void *)MCAN0_INT0_Handler, /* 35 Controller Area Network */
    .pfnMCAN0_INT1_Handler = (void *)MCAN0_INT1_Handler, /* 36 Controller Area Network */
    .pfnMCAN1_INT0_Handler = (void *)MCAN1_INT0_Handler, /* 37 Controller Area Network */
    .pfnMCAN1_INT1_Handler = (void *)MCAN1_INT1_Handler, /* 38 Controller Area Network */
    .pfnGMAC_Handler       = (void *)GMAC_Handler,       /* 39 Gigabit Ethernet MAC */
    .pfnAFEC1_Handler      = (void *)AFEC1_Handler,      /* 40 Analog Front-End Controller */
    .pfnTWIHS2_Handler     = (void *)TWIHS2_Handler,     /* 41 Two-wire Interface High Speed */
    .pfnSPI1_Handler       = (void *)SPI1_Handler,       /* 42 Serial Peripheral Interface */
    .pfnQSPI_Handler       = (void *)QSPI_Handler,       /* 43 Quad Serial Peripheral Interface */
    .pfnUART2_Handler      = (void *)UART2_Handler,      /* 44 Universal Asynchronous Receiver Transmitter */
    .pfnUART3_Handler      = (void *)UART3_Handler,      /* 45 Universal Asynchronous Receiver Transmitter */
    .pfnUART4_Handler      = (void *)UART4_Handler,      /* 46 Universal Asynchronous Receiver Transmitter */
    .pfnTC6_Handler        = (void *)TC6_Handler,        /* 47 Timer Counter */
    .pfnTC7_Handler        = (void *)TC7_Handler,        /* 48 Timer Counter */
    .pfnTC8_Handler        = (void *)TC8_Handler,        /* 49 Timer Counter */
    .pfnTC9_Handler        = (void *)TC9_Handler,        /* 50 Timer Counter */
    .pfnTC10_Handler       = (void *)TC10_Handler,       /* 51 Timer Counter */
    .pfnTC11_Handler       = (void *)TC11_Handler,       /* 52 Timer Counter */
    .pvReserved53          = (void *)(0UL),              /* 53 Reserved */
    .pvReserved54          = (void *)(0UL),              /* 54 Reserved */
    .pvReserved55          = (void *)(0UL),              /* 55 Reserved */
    .pfnAES_Handler        = (void *)AES_Handler,        /* 56 Advanced Encryption Standard */
    .pfnTRNG_Handler       = (void *)TRNG_Handler,       /* 57 True Random Number Generator */
    .pfnXDMAC_Handler      = (void *)XDMAC_Handler,      /* 58 Extensible DMA Controller */
    .pfnISI_Handler        = (void *)ISI_Handler,        /* 59 Image Sensor Interface */
    .pfnPWM1_Handler       = (void *)PWM1_Handler,       /* 60 Pulse Width Modulation Controller */
    .pfnFPU_Handler        = (void *)FPU_Handler,        /* 61 Floating Point Unit */
    .pfnSDRAMC_Handler     = (void *)SDRAMC_Handler,     /* 62 SDRAM Controller */
    .pfnRSWDT_Handler      = (void *)RSWDT_Handler,      /* 63 Reinforced Safety Watchdog Timer */
    .pfnCCW_Handler        = (void *)CCW_Handler,        /* 64 System Control Block */
    .pfnCCF_Handler        = (void *)CCF_Handler,        /* 65 System Control Block */
    .pfnGMAC_Q1_Handler    = (void *)GMAC_Q1_Handler,    /* 66 Gigabit Ethernet MAC */
    .pfnGMAC_Q2_Handler    = (void *)GMAC_Q2_Handler,    /* 67 Gigabit Ethernet MAC */
    .pfnIXC_Handler        = (void *)IXC_Handler,        /* 68 Floating Point Unit */
    .pfnI2SC0_Handler      = (void *)I2SC0_Handler,      /* 69 Inter-IC Sound Controller */
    .pfnI2SC1_Handler      = (void *)I2SC1_Handler,      /* 70 Inter-IC Sound Controller */
    .pfnGMAC_Q3_Handler    = (void *)GMAC_Q3_Handler,    /* 71 Gigabit Ethernet MAC */
    .pfnGMAC_Q4_Handler    = (void *)GMAC_Q4_Handler,    /* 72 Gigabit Ethernet MAC */
    .pfnGMAC_Q5_Handler    = (void *)GMAC_Q5_Handler     /* 73 Gigabit Ethernet MAC */
};

int rtthread_startup(void);

/**
 * \brief This is the code that gets called on processor reset.
 * To initialize the device, and call the main() routine.
 */
void Reset_Handler(void)
{
	uint32_t *pSrc, *pDest;

	/* Initialize the relocate segment */
	pSrc  = &_etext;
	pDest = &_srelocate;

	if (pSrc != pDest) {
		for (; pDest < &_erelocate;) {
			*pDest++ = *pSrc++;
		}
	}

	/* Clear the zero segment */
	for (pDest = &_szero; pDest < &_ezero;) {
		*pDest++ = 0;
	}

	/* Set the vector table base address */
	pSrc      = (uint32_t *)&_sfixed;
	SCB->VTOR = ((uint32_t)pSrc & SCB_VTOR_TBLOFF_Msk);

	/* Initialize the C library */
	__libc_init_array();

	/* Branch to rtthread_startup function */
	rtthread_startup();

	/* Infinite loop */
	while (1)
		;
}

/**
 * \brief Default interrupt handler for unused IRQs.
 */
void Dummy_Handler(void)
{
	while (1) {
	}
}


text:
<?php

namespace Fakerino\FakeData;

/**
 * Interface FakeDataInterface
 *
 * @author Nicola Pietroluongo <nik.longstone@gmail.com>
 */
interface FakeDataInterface
{
    /**
     * Constructor
     *
     * @param null|array $options
     */
    public function __construct($options = null);

    /**
     * Gets the default options.
     *
     * @return array
     */
    public function getDefaultOptions();

    /**
     * Gets the required options.
     *
     * @return array
     */
    public function getRequiredOptions();

    /**
     * Returns generators for processing the fake data.
     *
     * @return string
     */
    public function generatedBy();

    /**
     * Gets an option from its name.
     *
     * @param string $key
     *
     * @return mixed
     */
    public function getOption($key);
}


text:
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.

Imports System.Collections.Immutable
Imports System.Composition
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Debugging
Imports Microsoft.CodeAnalysis.ErrorReporting
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.Debugging

    <ExportLanguageService(GetType(IBreakpointResolutionService), LanguageNames.VisualBasic), [Shared]>
    Partial Friend Class VisualBasicBreakpointResolutionService
        Implements IBreakpointResolutionService

        <ImportingConstructor>
        Public Sub New()
        End Sub

        Friend Shared Async Function GetBreakpointAsync(document As Document, position As Integer, length As Integer, cancellationToken As CancellationToken) As Task(Of BreakpointResolutionResult)
            Try
                Dim tree = Await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(False)

                ' Non-zero length means that the span is passed by the debugger and we may need validate it.
                ' In a rare VB case, this span may contain multiple methods, e.g.,
                '
                '    [Sub Goo() Handles A
                '
                '     End Sub
                '
                '     Sub Bar() Handles B]
                '
                '     End Sub
                '
                ' It happens when IDE services (e.g., NavBar or CodeFix) inserts a new method at the beginning of the existing one
                ' which happens to have a breakpoint on its head. In this situation, we should attempt to validate the span of the existing method,
                ' not that of a newly-prepended method.

                Dim descendIntoChildren As Func(Of SyntaxNode, Boolean) =
                Function(n)
                    Return (Not n.IsKind(SyntaxKind.ConstructorBlock)) _
                        AndAlso (Not n.IsKind(SyntaxKind.SubBlock))
                End Function

                If length > 0 Then
                    Dim root = Await tree.GetRootAsync(cancellationToken).ConfigureAwait(False)
                    Dim item = root.DescendantNodes(New TextSpan(position, length), descendIntoChildren:=descendIntoChildren).OfType(Of MethodBlockSyntax).Skip(1).LastOrDefault()
                    If item IsNot Nothing Then
                        position = item.SpanStart
                    End If
                End If

                Dim span As TextSpan
                If Not BreakpointSpans.TryGetBreakpointSpan(tree, position, cancellationToken, span) Then
                    Return Nothing
                End If

                If span.Length = 0 Then
                    Return BreakpointResolutionResult.CreateLineResult(document)
                End If

                Return BreakpointResolutionResult.CreateSpanResult(document, span)
            Catch e As Exception When FatalError.ReportWithoutCrashUnlessCanceled(e)
                Return Nothing
            End Try
        End Function

        Public Function ResolveBreakpointAsync(document As Document, textSpan As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As Task(Of BreakpointResolutionResult) Implements IBreakpointResolutionService.ResolveBreakpointAsync
            Return GetBreakpointAsync(document, textSpan.Start, textSpan.Length, cancellationToken)
        End Function

        Public Function ResolveBreakpointsAsync(
            solution As Solution,
            name As String,
            Optional cancellationToken As CancellationToken = Nothing) As Task(Of IEnumerable(Of BreakpointResolutionResult)) Implements IBreakpointResolutionService.ResolveBreakpointsAsync

            Return New BreakpointResolver(solution, name).DoAsync(cancellationToken)
        End Function
    End Class
End Namespace


text:
@protocol floatMenuDelegate <NSObject>

@optional
-(void) didSelectMenuOptionAtIndex:(NSInteger)row;
@end

@interface VCFloatingActionButton : UIView <UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate>

@property NSArray      *imageArray,*labelArray;
@property UITableView  *menuTable;
@property UIView       *buttonView;
@property id<floatMenuDelegate> delegate;

@property (nonatomic) BOOL hideWhileScrolling;

@property (strong,nonatomic) UIView *bgView;
@property (strong,nonatomic) UIScrollView *bgScroller;
@property (strong,nonatomic) UIImageView *normalImageView,*pressedImageView;
@property (strong,nonatomic) UIWindow *mainWindow;
@property (strong,nonatomic) UIImage *pressedImage, *normalImage;
@property (strong,nonatomic) NSDictionary *menuItemSet;

@property BOOL isMenuVisible;
@property UIView *windowView;

-(id)initWithFrame:(CGRect)frame normalImage:(UIImage*)passiveImage andPressedImage:(UIImage*)activeImage withScrollview:(UIScrollView*)scrView;
//-(void) setupButton;

@end


text:
@interface YJToolBar ()

@property (nonatomic, strong, nullable)UIButton *cancleButton;
@property (nonatomic, strong, nullable)UILabel *titleLabel;
@property (nonatomic, strong, nullable)UIButton *confirmButton;

@end

@implementation YJToolBar

- (instancetype)initWithTitle:(nullable NSString *)title
            cancelButtonTitle:(nullable NSString *)cancelButtonTitle
                confirmButtonTitle:(nullable NSString *)confirmButtonTitle
                    addTarget:(nullable id)target
                 cancelAction:(SEL)cancelAction
                     confirmAction:(SEL)confirmAction{

    self = [self init];

    [self.titleLabel setText:title];

    [self.cancleButton setTitle:cancelButtonTitle forState:UIControlStateNormal];
    [self.cancleButton addTarget:target action:cancelAction forControlEvents:UIControlEventTouchUpInside];

    [self.confirmButton setTitle:confirmButtonTitle forState:UIControlStateNormal];
    [self.confirmButton addTarget:target action:confirmAction forControlEvents:UIControlEventTouchUpInside];

    return self;

}

- (instancetype)init
{
    if (self = [super init]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    _title = nil;
    _font = [UIFont systemFontOfSize:15];
    _titleColor = [UIColor blackColor];

    self.bounds = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44);
    [self setBackgroundColor:[UIColor whiteColor]];

    //创建
    self.cancleButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.titleLabel = [[UILabel alloc] init];

    //添加
    [self addSubview:self.titleLabel];
    [self addSubview:self.cancleButton];
    [self addSubview:self.confirmButton];

    //配置
    [self.cancleButton setTitleColor:self.titleColor forState:UIControlStateNormal];
    [self.cancleButton.titleLabel setFont:self.font];

    [self.confirmButton setTitleColor:self.titleColor forState:UIControlStateNormal];
    [self.confirmButton.titleLabel setFont:self.font];

    [self.titleLabel setTextAlignment:NSTextAlignmentCenter];
    [self.titleLabel setTextColor:self.titleColor];
    [self.titleLabel setFont:self.font];
    self.titleLabel.adjustsFontSizeToFitWidth = YES;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;

    //autoLayout
    [self.cancleButton mas_makeConstraints:^(MASConstraintMaker *make) {

        make.leftMargin.mas_equalTo(0);
        make.centerY.equalTo(self.mas_centerY);
        make.height.mas_equalTo(33);
        make.width.mas_equalTo(80);

    }];

    [self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {

        make.rightMargin.equalTo(self.mas_right).offset(0);
        make.centerY.equalTo(self.mas_centerY);
        make.height.equalTo(self.cancleButton.mas_height);
        make.width.equalTo(self.cancleButton.mas_width);
    }];

    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.leftMargin.equalTo(self.cancleButton.mas_right).offset(10);
        make.rightMargin.equalTo(self.confirmButton.mas_left).offset(-10);
        make.centerY.equalTo(self.mas_centerY);
        make.height.equalTo(self.cancleButton.mas_height);
    }];

}

#pragma mark - --- setters 属性 ---

- (void)setTitle:(NSString *)title
{
    _title = title;
    [self.titleLabel setText:title];
}

- (void)setFont:(UIFont *)font
{
    _font = font;
    [self.cancleButton.titleLabel setFont:font];
    [self.confirmButton.titleLabel setFont:font];
    [self.titleLabel setFont:font];
}

- (void)setTitleColor:(UIColor *)titleColor
{
    _titleColor = titleColor;
    [self.titleLabel setTextColor:titleColor];
    [self.cancleButton setTitleColor:titleColor forState:UIControlStateNormal];
    [self.confirmButton setTitleColor:titleColor forState:UIControlStateNormal];

}

@end


text:
module AssetsHelper

  def request_request_label resource
    icon_filename=method_to_icon_filename(resource.class.name.underscore)
    resource_type=resource.class.name.humanize
    return '' + image_tag(icon_filename,:alt=>"Request",:title=>"Request") + " Request #{resource_type}";
  end

  def show_resource_path(resource)
    path = ""
    if resource.class.name.include?("::Version")
      path = polymorphic_path(resource.parent,:version=>resource.version)
    else
      path = polymorphic_path(resource)
    end
    return path
  end

  def edit_resource_path(resource)
    path = ""
    if resource.class.name.include?("::Version")
      path = edit_polymorphic_path(resource.parent)
    else
      path = edit_polymorphic_path(resource)
    end
    return path
  end

end


text:
package edu.uci.ics.jung.graph.decorators;

import java.awt.Font;

import edu.uci.ics.jung.graph.Edge;

/**
 *
 * @author Joshua O'Madadhain
 */
public class ConstantEdgeFontFunction implements EdgeFontFunction
{
    protected Font font;

    public ConstantEdgeFontFunction(Font f)
    {
        this.font = f;
    }

    public Font getFont(Edge e)
    {
        return this.font;
    }
}