text:
package com.github.javaparser.ast.stmt;

import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.nodeTypes.NodeWithBody;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;

/**
 * @author Julio Vilmar Gesser
 */
public final class WhileStmt extends Statement implements NodeWithBody<WhileStmt> {

	private Expression condition;

	private Statement body;

	public WhileStmt() {
	}

	public WhileStmt(final Expression condition, final Statement body) {
		setCondition(condition);
		setBody(body);
	}

	public WhileStmt(Range range, final Expression condition, final Statement body) {
		super(range);
		setCondition(condition);
		setBody(body);
	}

	@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
		return v.visit(this, arg);
	}

	@Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
		v.visit(this, arg);
	}

	@Override
    public Statement getBody() {
		return body;
	}

	public Expression getCondition() {
		return condition;
	}

	@Override
    public WhileStmt setBody(final Statement body) {
		this.body = body;
		setAsParentNodeOf(this.body);
        return this;
	}

	public WhileStmt setCondition(final Expression condition) {
		this.condition = condition;
		setAsParentNodeOf(this.condition);
		return this;
	}
}


text:
package com.david.common.rpc.registry;

import java.util.concurrent.CountDownLatch;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;

import com.david.common.rpc.constant.Constant;
import com.david.common.util.LogUtils;

/**
 * 简单RPC服务注册
 *

 * 注册方法是register(),该方法的主要功能如下:
 *
 对目标服务器创建一个ZooKeeper实例

 *
 如果可以成功创建ZooKeeper实例,则创建一个节点

 *

 * @author zhangwei_david
 * @version $Id: ServiceRegistry.java, v 0.1 2014年12月31日 下午6:08:47 zhangwei_david Exp $
 */
public class ServiceRegistry {
    // 日期记录器
    private static final Logger logger       = LogManager.getLogger(ServiceRegistry.class);

    // 使用计数器实现同步
    private CountDownLatch      latch        = new CountDownLatch(1);

    private int                 timeout      = Constant.DEFAULT_ZK_SESSION_TIMEOUT;

    private String              registerPath = Constant.DEFAULT_ZK_REGISTRY_PATH;

    private String              registerAddress;

    public void register(String data) {
        LogUtils.debug(logger, "注册服务{0}", data);
        if (data != null) {
            ZooKeeper zk = connectServer();
            if (zk != null) {
                // 创建节点
                createNode(zk, data);
            }
        }
    }

    /**
     *
     *创建zooKeeper
     * @return
     */
    private ZooKeeper connectServer() {
        ZooKeeper zk = null;
        try {
            LogUtils.info(logger, "创建zk,参数是:address:{0},timeout:{1}", registerAddress, timeout);
            // 创建一个zooKeeper实例,第一个参数是目标服务器地址和端口,第二个参数是session 超时时间,第三个参数是节点发生变化时的回调方法
            zk = new ZooKeeper(registerAddress, timeout, new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == Event.KeeperState.SyncConnected) {
                        // 计数器减一
                        latch.countDown();
                    }
                }
            });
            // 阻塞到计数器为0,直到节点的变化回调方法执行完成
            latch.await();

        } catch (Exception e) {
            LogUtils.error(logger, "connectServer exception", e);
        }
        // 返回ZooKeeper实例
        return zk;
    }

    /**
     *
     *
     * @param zk ZooKeeper的实例
     * @param data 注册数据
     */
    private void createNode(ZooKeeper zk, String data) {
        try {
            byte[] bytes = data.getBytes();
            /**
             * 创建一个节点,第一个参数是该节点的路径,第二个参数是该节点的初始化数据,第三个参数是该节点的ACL,第四个参数指定节点的创建策略
             */
            String createResult = zk.create(registerPath, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE,
                CreateMode.EPHEMERAL_SEQUENTIAL);
            LogUtils.info(logger, "创建的结果是:{0}", createResult);
        } catch (Exception e) {
            LogUtils.error(logger, "createNode exception", e);
        }
    }

    /**
     * Getter method for property <tt>timeout</tt>.
     *
     * @return property value of timeout
     */
    public int getTimeout() {
        return timeout;
    }

    /**
     * Setter method for property <tt>timeout</tt>.
     *
     * @param timeout value to be assigned to property timeout
     */
    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    /**
     * Getter method for property <tt>registerPath</tt>.
     *
     * @return property value of registerPath
     */
    public String getRegisterPath() {
        return registerPath;
    }

    /**
     * Setter method for property <tt>registerPath</tt>.
     *
     * @param registerPath value to be assigned to property registerPath
     */
    public void setRegisterPath(String registerPath) {
        this.registerPath = registerPath;
    }

    /**
     * Getter method for property <tt>registerAddress</tt>.
     *
     * @return property value of registerAddress
     */
    public String getRegisterAddress() {
        return registerAddress;
    }

    /**
     * Setter method for property <tt>registerAddress</tt>.
     *
     * @param registerAddress value to be assigned to property registerAddress
     */
    public void setRegisterAddress(String registerAddress) {
        this.registerAddress = registerAddress;
    }

}

redpajama_set_name: RedPajamaGithub


text:
import os

from manager_rest import config, manager_exceptions
from manager_rest.rest import swagger
from manager_rest.security import SecuredResource
from manager_rest.security.authorization import authorize
from manager_rest.resource_manager import get_resource_manager
from manager_rest.upload_manager import UploadedBlueprintsManager
from manager_rest.storage import (get_storage_manager,
                                  models)
from manager_rest.rest.rest_decorators import marshal_with
from manager_rest.rest.rest_utils import (make_streaming_response,
                                          validate_inputs)
from manager_rest.constants import (SUPPORTED_ARCHIVE_TYPES,
                                    FILE_SERVER_RESOURCES_FOLDER,
                                    FILE_SERVER_UPLOADED_BLUEPRINTS_FOLDER)

class BlueprintsIdArchive(SecuredResource):

    @swagger.operation(
        nickname="getArchive",
        notes="Downloads blueprint as an archive."
    )
    @authorize('blueprint_download')
    def get(self, blueprint_id, **kwargs):
        """
        Download blueprint's archive
        """
        blueprint = get_storage_manager().get(models.Blueprint, blueprint_id)

        for arc_type in SUPPORTED_ARCHIVE_TYPES:
            # attempting to find the archive file on the file system
            local_path = os.path.join(
                config.instance.file_server_root,
                FILE_SERVER_UPLOADED_BLUEPRINTS_FOLDER,
                blueprint.tenant.name,
                blueprint.id,
                '{0}.{1}'.format(blueprint.id, arc_type))

            if os.path.isfile(local_path):
                archive_type = arc_type
                break
        else:
            raise manager_exceptions.NotFoundError(
                "Could not find blueprint's archive; Blueprint ID: {0}"
                .format(blueprint.id))

        blueprint_path = '{0}/{1}/{2}/{3}/{3}.{4}'.format(
            FILE_SERVER_RESOURCES_FOLDER,
            FILE_SERVER_UPLOADED_BLUEPRINTS_FOLDER,
            blueprint.tenant.name,
            blueprint.id,
            archive_type)

        return make_streaming_response(
            blueprint.id,
            blueprint_path,
            archive_type
        )

class Blueprints(SecuredResource):

    @swagger.operation(
        responseClass='List[{0}]'.format(models.Blueprint.__name__),
        nickname="list",
        notes="Returns a list of uploaded blueprints."
    )
    @authorize('blueprint_list')
    @marshal_with(models.Blueprint)
    def get(self, _include=None, **kwargs):
        """
        List uploaded blueprints
        """

        return get_storage_manager().list(
            models.Blueprint, include=_include).items

class BlueprintsId(SecuredResource):

    @swagger.operation(
        responseClass=models.Blueprint,
        nickname="getById",
        notes="Returns a blueprint by its id."
    )
    @authorize('blueprint_get')
    @marshal_with(models.Blueprint)
    def get(self, blueprint_id, _include=None, **kwargs):
        """
        Get blueprint by id
        """
        return get_storage_manager().get(
            models.Blueprint,
            blueprint_id,
            _include
        )

    @swagger.operation(
        responseClass=models.Blueprint,
        nickname="upload",
        notes="Submitted blueprint should be an archive "
              "containing the directory which contains the blueprint. "
              "Archive format may be zip, tar, tar.gz or tar.bz2."
              " Blueprint archive may be submitted via either URL or by "
              "direct upload.",
        parameters=[{'name': 'application_file_name',
                     'description': 'File name of yaml '
                                    'containing the "main" blueprint.',
                     'required': False,
                     'allowMultiple': False,
                     'dataType': 'string',
                     'paramType': 'query',
                     'defaultValue': 'blueprint.yaml'},
                    {'name': 'blueprint_archive_url',
                     'description': 'url of a blueprint archive file',
                     'required': False,
                     'allowMultiple': False,
                     'dataType': 'string',
                     'paramType': 'query'},
                    {
                        'name': 'body',
                        'description': 'Binary form of the tar '
                                       'gzipped blueprint directory',
                        'required': True,
                        'allowMultiple': False,
                        'dataType': 'binary',
                        'paramType': 'body'}],
        consumes=[
            "application/octet-stream"
        ]
    )
    @authorize('blueprint_upload')
    @marshal_with(models.Blueprint)
    def put(self, blueprint_id, **kwargs):
        """
        Upload a blueprint (id specified)
        """
        validate_inputs({'blueprint_id': blueprint_id})
        return UploadedBlueprintsManager().receive_uploaded_data(blueprint_id)

    @swagger.operation(
        responseClass=models.Blueprint,
        nickname="deleteById",
        notes="deletes a blueprint by its id."
    )
    @authorize('blueprint_delete')
    def delete(self, blueprint_id, **kwargs):
        """
        Delete blueprint by id
        """
        # Note: The current delete semantics are such that if a deployment
        # for the blueprint exists, the deletion operation will fail.
        # However, there is no handling of possible concurrency issue with
        # regard to that matter at the moment.
        get_resource_manager().delete_blueprint(blueprint_id, force=False)
        return None, 204


text:
import axios from 'axios';

import { addAPIData } from './actionCreators';

export default function getAPIDetails(imdbID: string) {
  return (dispatch: Function) => {
    axios
      .get(`http://localhost:3000/${imdbID}`)
      .then(response => {
        dispatch(addAPIData(response.data));
      })
      .catch(error => {
        console.error('axios error', error); // eslint-disable-line no-console
      });
  };
}


text:
/**
 *    @file
 *      This file implements macros, constants, and interfaces for a
 *      platform-independent logging interface for the Weave SDK.
 *
 */

#include <stdarg.h>
#include <string.h>
#include <stdio.h>

#include <Weave/Support/NLDLLUtil.h>
#include <Weave/Core/WeaveCore.h>
#include <Weave/Support/CodeUtils.h>
#include "WeaveLogging.h"

#if WEAVE_LOGGING_STYLE_ANDROID && defined(__ANDROID__)
#include <android/log.h>
#endif

#if HAVE_SYS_TIME_H && WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS
#include <sys/time.h>
#endif // HAVE_SYS_TIME_H && WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS

namespace nl {
namespace Weave {
namespace Logging {

#if _WEAVE_USE_LOGGING

/*
 * Array of strings containing the names for each of the Weave log
 * modules.
 *
 * NOTE: The names must be in the order defined in the LogModule
 *       enumeration. Each name must be a fixed number of characters
 *       long (nlWeaveLoggingModuleNameLen) padded with nulls as
 *       necessary.
 *
 */
static const char ModuleNames[] =
    "-\0\0" // None
    "IN\0"  // Inet
    "BLE"   // BLE
    "ML\0"  // MessageLayer
    "SM\0"  // SecurityManager
    "EM\0"  // ExchangeManager
    "TLV"   // TLV
    "ASN"   // ASN1
    "CR\0"  // Crypto
    "DM\0"  // DeviceManager
    "AL\0"  // Alarm
    "BDX"   // BulkDataTransfer
    "DMG"   // DataManagement
    "DC\0"  // DeviceControl
    "DD\0"  // DeviceDescription
    "ECH"   // Echo
    "FP\0"  // FabricProvisioning
    "NP\0"  // NetworkProvisioning
    "SD\0"  // ServiceDirectory
    "SP\0"  // ServiceProvisioning
    "SWU"   // SoftwareUpdate
    "TP\0"  // TokenPairing
    "HL\0"  // HeatLink
    "TS\0"  // TimeServices
    "WT\0"  // WeaveTunnel
    "HB\0"  // Heartbeat
    "WSL"   // WeaveSystemLayer
    "DLP"   // DropcamLegacyPairing
    "EVL"   // Event Logging
    "SPT"   // Support
    "APP"   // Application
    ;

#define ModuleNamesCount ((sizeof(ModuleNames) - 1) / nlWeaveLoggingModuleNameLen)

#define WeavePrefix "WEAVE:"
#define WeavePrefixSeparator ": "
#define WeaveMessageTrailer "\n"

void GetModuleName(char *buf, uint8_t module)
{
    const char *moduleNamePtr = ModuleNames + ((module < ModuleNamesCount) ? module * nlWeaveLoggingModuleNameLen : 0);
    memcpy(buf, moduleNamePtr, nlWeaveLoggingModuleNameLen);
    buf[nlWeaveLoggingModuleNameLen] = 0;
}

void GetCategoryName(char *buf, uint8_t bufSize, uint8_t category)
{
    const char *name;
    switch (category)
    {
    case kLogCategory_None:
        name = "none";
        break;
    case kLogCategory_Error:
        name = "error";
        break;
    case kLogCategory_Progress:
        name = "progress";
        break;
    case kLogCategory_Detail:
        name = "detail";
        break;
    case kLogCategory_Retain:
        name = "retain";
        break;
    default:
        name = "unknown";
        break;
    }
    strncpy(buf, name, bufSize);
    buf[bufSize-1] = 0;
}

void GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg)
{
    char moduleName[nlWeaveLoggingModuleNameLen + 1];

    GetModuleName(moduleName, module);
    snprintf(buf, bufSize, WeavePrefix "%s" WeavePrefixSeparator "%s" WeaveMessageTrailer, moduleName, msg);
}

void PrintMessagePrefix(uint8_t module)
{
    char moduleName[nlWeaveLoggingModuleNameLen + 1];
    GetModuleName(moduleName, module);

#if WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS
    struct timeval tv;
    struct tm* time_ptr;
    char detailed_time[30];
    int64_t milliseconds;
    int status;

    status = gettimeofday(&tv, NULL);
    VerifyOrExit(status == 0, perror("gettimeofday"));

    time_ptr = localtime(&tv.tv_sec);
    VerifyOrExit(time_ptr != NULL, status = -1; perror("localtime"));

    status = strftime(detailed_time, sizeof(detailed_time), "%F %T%z", time_ptr);
    VerifyOrExit(status >= 0, perror("strftime"));

    milliseconds = tv.tv_usec / 1000;
    printf("%s.%03ld " WeavePrefix "%s: ", detailed_time, milliseconds, moduleName);

exit:
    if (status < 0)
    {
        printf("\?\?\?\?-\?\?-\?\? \?\?:\?\?:\?\?.\?\?\?+\?\?\?\?" WeavePrefix "%s: ", moduleName);
    }

#else // !WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS

    printf(WeavePrefix "%s: ", moduleName);

#endif // WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS
}

#if WEAVE_LOG_FILTERING

uint8_t gLogFilter = kLogCategory_Max;

#endif // WEAVE_LOG_FILTERING

/*
 * Only enable an in-package implementation of the logging interface
 * if external logging was not requested. Within that, the package
 * supports either Android-style or C Standard I/O-style logging.
 */
#if !WEAVE_LOGGING_STYLE_EXTERNAL

#if WEAVE_LOGGING_STYLE_STDIO || WEAVE_LOGGING_STYLE_STDIO_WEAK

static void DefaultLogMessage(uint8_t module, uint8_t category, const char *msg, va_list ap)
{
    if (IsCategoryEnabled(category))
    {
        PrintMessagePrefix(module);
        vprintf(msg, ap);
        printf("\n");
    }
}

#elif WEAVE_LOGGING_STYLE_ANDROID

static void DefaultLogMessage(uint8_t module, uint8_t category, const char *msg, va_list ap)
{
    if (IsCategoryEnabled(category))
    {
        char moduleName[nlWeaveLoggingModuleNameLen + 1];
        GetModuleName(moduleName, module);

        int priority = (category == kLogCategory_Error) ? ANDROID_LOG_ERROR : ANDROID_LOG_DEBUG;

        __android_log_vprint(priority, moduleName, msg, ap);
    }
}

#else // WEAVE_LOGGING_STYLE_ANDROID

#error "Unsupported Weave logging style!"

#endif // WEAVE_LOGGING_STYLE_ANDROID

#if WEAVE_LOG_ENABLE_DYNAMIC_LOGING_FUNCTION
static LogMessageFunct gLogFunct = DefaultLogMessage;
#endif

/* If so configured, apply weak linkage to the Log function.
 */
#if WEAVE_LOGGING_STYLE_STDIO_WEAK || WEAVE_LOGGING_WEAK_LOG_FUNCT
#define __WEAVE_LOGGING_LINK_ATTRIBUTE __attribute__((weak))
#else
#define __WEAVE_LOGGING_LINK_ATTRIBUTE
#endif

/**
 * Log, to the platform-specified mechanism, the specified log
 * message, @a msg, for the specified module, @a module, in the
 * provided category, @a category.
 *
 * @param[in] module    A LogModule enumeration indicating the
 *                      source of the Weave package module that
 *                      generated the log message. This must be
 *                      translated within the function to a module
 *                      name for inclusion in the log message.
 * @param[in] category  A LogCategory enumeration indicating the
 *                      category of the log message. The category
 *                      may be filtered in or out if
 *                      WEAVE_LOG_FILTERING was asserted.
 * @param[in] msg       A pointer to a NULL-terminated C string with
 *                      C Standard Library-style format specifiers
 *                      containing the log message to be formatted and
 *                      logged.
 * @param[in] ...       A variadic argument list whose elements should
 *                      correspond to the format specifiers in @a msg.
 *
 */
NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t category, const char *msg, ...)
{
    va_list ap;
    va_start(ap, msg);
#if WEAVE_LOG_ENABLE_DYNAMIC_LOGING_FUNCTION
    gLogFunct(module, category, msg, ap);
#else
    DefaultLogMessage(module, category, msg, ap);
#endif
    va_end(ap);
}

#if WEAVE_LOG_ENABLE_DYNAMIC_LOGING_FUNCTION

NL_DLL_EXPORT void SetLogFunct(LogMessageFunct logFunct)
{
    gLogFunct = (logFunct != NULL) ? logFunct : DefaultLogMessage;
}

#endif // WEAVE_LOG_ENABLE_DYNAMIC_LOGING_FUNCTION

#endif /* !WEAVE_LOGGING_STYLE_EXTERNAL */

NL_DLL_EXPORT uint8_t GetLogFilter()
{
#if WEAVE_LOG_FILTERING
    return gLogFilter;
#else
    return kLogCategory_Max;
#endif
}

NL_DLL_EXPORT void SetLogFilter(uint8_t category)
{
#if WEAVE_LOG_FILTERING
    gLogFilter = category;
#endif
}

#endif /* _WEAVE_USE_LOGGING */

} // namespace Logging
} // namespace Weave
} // namespace nl


text:
title: "Dashboard"
excerpt: ""
---
[block:callout]
{
  "type": "danger",
  "title": "The Dashboard tab is only available for administrators!"
}
[/block]

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/94b051c-dashboard_220.png",
        "dashboard_220.png",
        1278,
        677,
        "#146cb3"
      ]
    }
  ]
}
[/block]
Once you have logged in, you can see your dashboard.

On the dashboard are displayed:
  * the number of registered users,
  * the number of online users (using applications or a VDI),
  * the number of published applications,
  * the number of machines which are up,
  * the number of uploaded files,
  * the number of images.


text:
<?php
/**
 * @version    $Id$
 */
require_once 'TestCase.php';
class ModelTestCase extends TestCase
{
    /**
     * model
     *
     * @param string $name
     * @param string $base
     * @return mixed
     */
    public function model($name, $base = 'ftt')
    {
        return Model::factory($name, $base);
    }
}
// End of file : ModelTestCase.php


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of det in UD_Upper_Sorbian-UFAL</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Upper_Sorbian-UFAL: Relations: det

This relation is universal.
There are 1 language-specific subtypes of det: <tt>det:numgov</tt>.

218 nodes (2%) are attached to their parents as det.

216 instances of det (99%) are right-to-left (child precedes parent).
Average distance between parent and child is 1.58715596330275.

The following 3 pairs of parts of speech are connected with det: <tt>NOUN</tt>-<tt>DET</tt> (216; 99% instances), <tt>ADJ</tt>-<tt>DET</tt> (1; 0% instances), <tt>VERB</tt>-<tt>DET</tt> (1; 0% instances).

# visual-style 2	bgColor:blue
# visual-style 2	fgColor:white
# visual-style 4	bgColor:blue
# visual-style 4	fgColor:white
# visual-style 4 2 det	color:blue
1	Po	po	ADP	_	_	4	case	_	_
2	swojej	swój	DET	_	Case=Loc|Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs|Reflex=Yes	4	det	_	_
3	prawniskej	prawniski	ADJ	_	Case=Loc|Gender=Fem|Number=Sing	4	amod	_	_
4	formje	forma	NOUN	_	Case=Loc|Gender=Fem|Number=Sing	8	nmod	_	_
5	je	być	AUX	_	Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin	8	cop	_	_
6	wón	wón	PRON	_	Case=Nom|Gender=Masc|Number=Sing|Person=3|PronType=Prs	8	nsubj	_	_
7	zapisane	zapisany	ADJ	_	Case=Nom|Gender=Neut|Number=Sing|VerbForm=Part|Voice=Pass	8	amod	_	_
8	towarstwo	towarstwo	NOUN	_	Case=Nom|Gender=Neut|Number=Sing	0	root	_	SpaceAfter=No
9	.	.	PUNCT	_	_	8	punct	_	_

# visual-style 19	bgColor:blue
# visual-style 19	fgColor:white
# visual-style 20	bgColor:blue
# visual-style 20	fgColor:white
# visual-style 20 19 det	color:blue
1	Tuta	tutón	DET	_	Case=Nom|Gender=Fem|Number=Sing|PronType=Dem	2	det	_	_
2	definicija	definicija	NOUN	_	Case=Nom|Gender=Fem|Number=Sing	9	nsubj	_	_
3	njeje	być	AUX	_	Mood=Ind|Number=Sing|Person=3|Polarity=Neg|Tense=Pres|VerbForm=Fin	9	cop	_	_
4	pak	pak	CCONJ	_	_	9	cc	_	_
5	geografisce	geografisce	ADV	_	Degree=Pos	9	advmod	_	_
6	ale	ale	CCONJ	_	_	8	cc	_	_
7	tež	tež	ADV	_	_	6	fixed	_	_
8	tektonisce	tektonisce	ADV	_	Degree=Pos	5	conj	_	_
9	prawa	prawy	ADJ	_	Case=Nom|Gender=Fem|Number=Sing	0	root	_	SpaceAfter=No
10	,	,	PUNCT	_	_	22	punct	_	_
11	dokelž	dokelž	SCONJ	_	_	22	mark	_	_
12	teritorije	teritorij	NOUN	_	Animacy=Inan|Case=Nom|Gender=Masc|Number=Plur	22	nsubj	_	_
13	pak	pak	CCONJ	_	_	22	cc	_	_
14	na	na	ADP	_	_	21	case	_	_
15	awstralskej	awstralski	ADJ	_	Case=Loc|Gender=Fem|Number=Sing	22	obl	_	SpaceAfter=No
16	,	,	PUNCT	_	_	17	punct	_	_
17	pacifiskej	pacifiski	ADJ	_	Case=Loc|Gender=Fem|Number=Sing	15	conj	_	_
18	a	a	CCONJ	_	_	20	cc	_	_
19	někotrych	někotry	DET	_	Case=Loc|Gender=Fem|Number=Plur|PronType=Ind	20	det	_	_
20	mjeńšich	mały	ADJ	_	Case=Loc|Degree=Cmp|Gender=Fem|Number=Plur	15	conj	_	_
21	platach	plata	NOUN	_	Case=Loc|Gender=Fem|Number=Plur	15	conj	_	_
22	leža	ležeć	VERB	_	Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin	9	advcl	_	SpaceAfter=No
23	.	.	PUNCT	_	_	9	punct	_	_

# visual-style 15	bgColor:blue
# visual-style 15	fgColor:white
# visual-style 21	bgColor:blue
# visual-style 21	fgColor:white
# visual-style 21 15 det	color:blue
1	Kruta	kruty	ADJ	_	Case=Nom|Gender=Fem|Number=Sing	2	amod	_	_
2	faza	faza	NOUN	_	Case=Nom|Gender=Fem|Number=Sing	5	nsubj	_	_
3	je	być	AUX	_	Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin	5	cop	_	_
4	mjenje	mało	ADV	_	Degree=Cmp|NumType=Card|PronType=Ind	5	advmod	_	_
5	husta	husty	ADJ	_	Case=Nom|Gender=Fem|Number=Sing	0	root	_	_
6	hač	hač	SCONJ	_	_	8	case	_	_
7	kapalna	kapalny	ADJ	_	Case=Nom|Gender=Fem|Number=Sing	8	amod	_	_
8	woda	woda	NOUN	_	Case=Nom|Gender=Fem|Number=Sing	5	nmod	_	SpaceAfter=No
9	,	,	PUNCT	_	_	11	punct	_	_
10	dla	dla	ADP	_	_	11	case	_	_
11	geometrije	geometrija	NOUN	_	Case=Gen|Gender=Fem|Number=Sing	5	nmod	_	_
12	sylnych	sylny	ADJ	_	Case=Gen|Gender=Fem|Number=Plur	14	amod	_	_
13	wodźikowych	wodźikowy	ADJ	_	Case=Gen|Gender=Fem|Number=Plur	14	amod	_	_
14	wjazbow	wjazba	NOUN	_	Case=Gen|Gender=Fem|Number=Plur	11	nmod	_	_
15	kotrež	kotryž	DET	_	Case=Nom|Gender=Fem|Number=Plur|PronType=Rel	21	det	_	_
16	so	so	PRON	_	Case=Acc|PronType=Prs|Reflex=Yes	21	expl:pass	_	_
17	jenož	jenož	PART	_	_	20	advmod:emph	_	_
18	při	při	ADP	_	_	20	case	_	_
19	niskich	niski	ADJ	_	Case=Loc|Gender=Fem|Number=Plur	20	amod	_	_
20	temperaturach	temperatura	NOUN	_	Case=Loc|Gender=Fem|Number=Plur	21	obl	_	_
21	zdźěłuja	zdźěłować	VERB	_	Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin	14	acl	_	SpaceAfter=No
22	.	.	PUNCT	_	_	5	punct	_	_

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
import * as _ from '../../';
import {expect} from 'chai';

describe('#Parser.booleanLiteral', () => {

	describe('parse()', () => {

		it('should parse true', () => {
			let ast = _.Parser.createFromString('true').parse();

			expect(ast).to.be.eql(
				new _.ASTProgram([
					new _.ASTBooleanLiteral(true),
				])
			);
		});

		it('should parse false', () => {
			let ast = _.Parser.createFromString('false').parse();

			expect(ast).to.be.eql(
				new _.ASTProgram([
					new _.ASTBooleanLiteral(false),
				])
			);
		});

	});

});


text:
package org.innovateuk.ifs.invite.controller;

import org.innovateuk.ifs.commons.rest.RestResult;
import org.innovateuk.ifs.commons.security.SecuredBySpring;
import org.innovateuk.ifs.competition.publiccontent.resource.PublicContentItemResource;
import org.innovateuk.ifs.competition.resource.CompetitionOrganisationConfigResource;
import org.innovateuk.ifs.competition.service.CompetitionOrganisationConfigRestService;
import org.innovateuk.ifs.invite.constant.InviteStatus;
import org.innovateuk.ifs.invite.populator.AcceptRejectApplicationInviteModelPopulator;
import org.innovateuk.ifs.invite.populator.ConfirmOrganisationInviteModelPopulator;
import org.innovateuk.ifs.invite.service.InviteRestService;
import org.innovateuk.ifs.invite.viewmodel.AcceptRejectApplicationInviteViewModel;
import org.innovateuk.ifs.organisation.resource.OrganisationResource;
import org.innovateuk.ifs.organisation.viewmodel.ConfirmOrganisationInviteOrganisationViewModel;
import org.innovateuk.ifs.publiccontent.service.PublicContentItemRestService;
import org.innovateuk.ifs.registration.controller.RegistrationController;
import org.innovateuk.ifs.user.resource.UserResource;
import org.innovateuk.ifs.user.service.OrganisationRestService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static org.innovateuk.ifs.exception.ErrorControllerAdvice.URL_HASH_INVALID_TEMPLATE;
import static org.innovateuk.ifs.invite.constant.InviteStatus.ACCEPTED;
import static org.innovateuk.ifs.invite.constant.InviteStatus.SENT;

/**
 * This class is used as an entry point to accept an invite, to an application.
 */
@Controller
@SecuredBySpring(value = "Controller",
        description = "All users with a valid invite hash are able to view and accept the corresponding invite",
        securedType = AcceptInviteController.class)
@PreAuthorize("permitAll")
public class AcceptInviteController extends AbstractAcceptInviteController {

    private OrganisationRestService organisationRestService;
    private InviteRestService inviteRestService;
    private AcceptRejectApplicationInviteModelPopulator acceptRejectApplicationInviteModelPopulator;
    private ConfirmOrganisationInviteModelPopulator confirmOrganisationInviteModelPopulator;
    private CompetitionOrganisationConfigRestService organisationConfigRestService;
    private PublicContentItemRestService publicContentItemRestService;

    private static final String ACCEPT_INVITE_NEW_USER_VIEW = "registration/accept-invite-new-user";
    private static final String ACCEPT_INVITE_EXISTING_USER_VIEW = "registration/accept-invite-existing-user";

    public AcceptInviteController(final OrganisationRestService organisationRestService,
                                  final InviteRestService inviteRestService,
                                  final AcceptRejectApplicationInviteModelPopulator acceptRejectApplicationInviteModelPopulator,
                                  final ConfirmOrganisationInviteModelPopulator confirmOrganisationInviteModelPopulator,
                                  final CompetitionOrganisationConfigRestService organisationConfigRestService,
                                  final PublicContentItemRestService publicContentItemRestService) {
        this.organisationRestService = organisationRestService;
        this.inviteRestService = inviteRestService;
        this.acceptRejectApplicationInviteModelPopulator = acceptRejectApplicationInviteModelPopulator;
        this.confirmOrganisationInviteModelPopulator = confirmOrganisationInviteModelPopulator;
        this.organisationConfigRestService = organisationConfigRestService;
        this.publicContentItemRestService = publicContentItemRestService;
    }

    @GetMapping("/accept-invite/{hash}")
    public String inviteEntryPage(
            @PathVariable("hash") final String hash,
            UserResource loggedInUser,
            HttpServletResponse response,
            Model model) {

        registrationCookieService.deleteAllRegistrationJourneyCookies(response);

        RestResult<String> view = inviteRestService.getInviteByHash(hash).andOnSuccess(invite ->
                inviteRestService.getInviteOrganisationByHash(hash).andOnSuccessReturn(inviteOrganisation -> {
                            if (!SENT.equals(invite.getStatus())) {
                                return alreadyAcceptedView(response);
                            }
                            if (loggedInAsNonInviteUser(invite, loggedInUser)) {
                                return LOGGED_IN_WITH_ANOTHER_USER_VIEW;
                            }

                            PublicContentItemResource publicContent = publicContentItemRestService.getItemByCompetitionId(invite.getCompetitionId()).getSuccess();

                            // Success
                            registrationCookieService.saveToInviteHashCookie(hash, response);// Add the hash to a cookie for later flow lookup.
                            AcceptRejectApplicationInviteViewModel acceptRejectApplicationInviteViewModel = acceptRejectApplicationInviteModelPopulator.populateModel(invite, inviteOrganisation, publicContent.getPublicContentResource().getHash());
                            model.addAttribute("model", acceptRejectApplicationInviteViewModel);
                            CompetitionOrganisationConfigResource organisationConfigResource = organisationConfigRestService.findByCompetitionId(acceptRejectApplicationInviteViewModel.getCompetitionId()).getSuccess();
                            boolean international = organisationConfigResource.areInternationalApplicantsAllowed();
                            model.addAttribute("internationalCompetition", international);
                            invite.setStatus(InviteStatus.OPENED);
                            inviteRestService.acceptInvite(invite);
                            return invite.getUser() == null ? ACCEPT_INVITE_NEW_USER_VIEW : ACCEPT_INVITE_EXISTING_USER_VIEW;
                        }
                )
        ).andOnFailure(clearDownInviteFlowCookiesFn(response));
        return view.getStatusCode().is4xxClientError() ? URL_HASH_INVALID_TEMPLATE : view.getSuccess();
    }

    @GetMapping("/accept-invite/confirm-invited-organisation")
    public String confirmInvitedOrganisation(HttpServletResponse response,
                                             HttpServletRequest request,
                                             UserResource loggedInUser,
                                             Model model) {
        String hash = registrationCookieService.getInviteHashCookieValue(request).orElse(null);
        RestResult<String> view = inviteRestService.getInviteByHash(hash).andOnSuccess(invite ->
                inviteRestService.getInviteOrganisationByHash(hash).andOnSuccessReturn(inviteOrganisation -> {
                    if (!SENT.equals(invite.getStatus())) {
                        return alreadyAcceptedView(response);
                    }
                    if (loggedInAsNonInviteUser(invite, loggedInUser)) {
                        return LOGGED_IN_WITH_ANOTHER_USER_VIEW;
                    }
                    OrganisationResource organisation =
                            organisationRestService.getOrganisationByIdForAnonymousUserFlow(
                                    inviteOrganisation.getOrganisation()).getSuccess();
                    registrationCookieService.saveToOrganisationIdCookie(inviteOrganisation.getOrganisation()
                            , response);
                    ConfirmOrganisationInviteOrganisationViewModel viewModel =
                            confirmOrganisationInviteModelPopulator.populate(invite, organisation,
                                    RegistrationController.BASE_URL);
                    model.addAttribute("model", viewModel);
                    invite.setStatus(ACCEPTED);
                    inviteRestService.acceptInvite(invite);
                    return "registration/confirm-invited-organisation";
                })
        ).andOnFailure(clearDownInviteFlowCookiesFn(response));
        return view.getSuccess();
    }
}


text:
<!DOCTYPE HTML>

    <title>WebGL Globe</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="orbit.css">

    using  WebGL Globe • Created by the Arch Team

	Gravity Map uses WebGL to create virtual earth that visualizes value of gravity at different locations on the surface of earth.
	[code]

    Gravity
	  #visulization #earth


text:
package hudson.util.io;

import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeNoException;

import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher.LocalLauncher;
import hudson.Util;
import hudson.model.TaskListener;
import hudson.util.NullStream;
import hudson.util.StreamTaskListener;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.Arrays;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.Issue;

public class TarArchiverTest {

    @Rule public TemporaryFolder tmp = new TemporaryFolder();

    /**
     * Makes sure that permissions are properly stored in the tar file.
     */
    @Issue("JENKINS-9397")
    @Test public void permission() throws Exception {
        assumeFalse(Functions.isWindows());

        File tar = File.createTempFile("test", "tar");
        File zip = File.createTempFile("test", "zip");

        FilePath dir = new FilePath(File.createTempFile("test", "dir"));

        try {
            dir.delete();
            dir.child("subdir").mkdirs();

            FilePath f = dir.child("a.txt");
            f.touch(0);
            f.chmod(0755);

            f = dir.child("subdir/b.txt");
            f.touch(0);
            f.chmod(0644);
            int dirMode = dir.child("subdir").mode();

            dir.tar(Files.newOutputStream(tar.toPath()), "**/*");
            dir.zip(Files.newOutputStream(zip.toPath()));

            FilePath e = dir.child("extract");
            e.mkdirs();

            // extract via the tar command
            run(e, "tar", "xvpf", tar.getAbsolutePath());

            assertEquals(0755, e.child("a.txt").mode());
            assertEquals(dirMode, e.child("subdir").mode());
            assertEquals(0644, e.child("subdir/b.txt").mode());

            // extract via the zip command
            e.deleteContents();
            run(e, "unzip", zip.getAbsolutePath());
            e = e.listDirectories().get(0);

            assertEquals(0755, e.child("a.txt").mode());
            assertEquals(dirMode, e.child("subdir").mode());
            assertEquals(0644, e.child("subdir/b.txt").mode());
        } finally {
            tar.delete();
            zip.delete();
            dir.deleteRecursive();
        }
    }

    private static void run(FilePath dir, String... cmds) throws InterruptedException {
        try {
            assertEquals(0, new LocalLauncher(StreamTaskListener.fromStdout()).launch().cmds(cmds).pwd(dir).join());
        } catch (IOException x) { // perhaps restrict to x.message.contains("Cannot run program")? or "error=2, No such file or directory"?
            assumeNoException("failed to run " + Arrays.toString(cmds), x);
        }
    }

    @Issue("JENKINS-14922")
    @Test public void brokenSymlinks() throws Exception {
        assumeFalse(Functions.isWindows());
        File dir = tmp.getRoot();
        Util.createSymlink(dir, "nonexistent", "link", TaskListener.NULL);
        new FilePath(dir).tar(new NullStream(), "**");
    }

    /**
     * Test backing up an open file
     */

    @Issue("JENKINS-20187")
    @Test public void growingFileTar() throws Exception {
        File file = new File(tmp.getRoot(), "growing.file");
        GrowingFileRunnable runnable1 = new GrowingFileRunnable(file);
        Thread t1 = new Thread(runnable1);
        t1.start();

        new FilePath(tmp.getRoot()).tar(new NullStream(), "**");

        runnable1.doFinish();
        t1.join();
    }

    private static class GrowingFileRunnable implements Runnable {
        private boolean finish = false;
        private Exception ex = null;
        private File file;

        GrowingFileRunnable(File file) {
            this.file = file;
        }

        @Override
        public void run() {
            File openFile = file;
            try {
                openFile.createNewFile();
                try (OutputStream fos = Files.newOutputStream(openFile.toPath())) {
                    for (int i = 0; !finish && i < 5000000; i++) { // limit the max size, just in case.
                        fos.write(0);
                        // Thread.sleep(5);
                    }
                }
            } catch (Exception e) {
                ex = e;
            }
        }

        public void doFinish() throws Exception {
            finish = true;
            if (ex != null) {
                throw ex;
            }
        }
    }

}


text:
Login

<form id="login" action="<?php echo MVC_ACTION_URL?>" method="post">

		<?php echo __('Username')?>:
		<input type="text" name="username" value="<?php echo $FV->username?>">
		<?php echo $FV->username_error?>

		<?php echo __('Password')?>:
		<input type="password" name="password">
		<?php echo $FV->password_error?>

	<input type="hidden" name="token" value="<?php echo securityGetToken()?>" />
	<input type="hidden" name="return" value="<?php echo (!empty($FV->return) ? $FV->return : $return)?>" />
	<input type="submit" value="<?php echo __('Login')?>" />
</form>
<?php echo $FV->_js_code;?>


text:
package com.zeropush.model.token;

import java.util.regex.Pattern;

import com.zeropush.model.Platform;
import com.zeropush.model.notification.exception.InvalidDeviceTokenException;

/**
 * Validates if a device token for some platform is valid or not.
 *
 * @author Stefan Miklosovic
 *
 */
public class TokenValidator
{
    private static final Pattern ANDROID_DEVICE_TOKEN = Pattern.compile("(?i)[0-9a-z\\-_]{100,}");

    private static final Pattern IOS_DEVICE_TOKEN = Pattern.compile("(?i)[a-f0-9 -]{64,}");

    /**
     * Validates a token for given platform.
     *
     * @param platform platform of a token to validate
     * @param token token to validate
     * @throws InvalidDeviceTokenException if token is not valid
     * @throws IllegalArgumentException if token is a null object or an empty String
     */
    public void validate(Platform platform, String token) throws InvalidDeviceTokenException
    {
        if (token == null || token.isEmpty())
        {
            throw new IllegalArgumentException("Token to validate is a null object or an empty String!");
        }

        boolean valid = false;

        switch (platform)
        {
            case ANDROID_GCM:
                valid = ANDROID_DEVICE_TOKEN.matcher(token).matches();
                break;
            case SAFARI:
            case IOS:
                valid = IOS_DEVICE_TOKEN.matcher(token).matches();
                break;
            default:
                throw new IllegalStateException(
                    String.format("Unable to determine platform for validation. You entered: %s" , platform.name()));
        }

        if (!valid)
        {
            throw new InvalidDeviceTokenException(String.format("Token %s is not valid", token));
        }
    }
}


text:
using System;
using System.Collections.Generic;
using Xunit;

namespace System.Linq.Tests
{
    public class OrderByTests : EnumerableTests
    {
        private class BadComparer1 : IComparer<int>
        {
            public int Compare(int x, int y)
            {
                return 1;
            }
        }

        private class BadComparer2 : IComparer<int>
        {
            public int Compare(int x, int y)
            {
                return -1;
            }
        }

        [Fact]
        public void SameResultsRepeatCallsIntQuery()
        {
            var q = from x1 in new int[] { 1, 6, 0, -1, 3 }
                             from x2 in new int[] { 55, 49, 9, -100, 24, 25 }
                             select new { a1 = x1, a2 = x2 };

            Assert.Equal(q.OrderBy(e => e.a1).ThenBy(f => f.a2), q.OrderBy(e => e.a1).ThenBy(f => f.a2));
        }

        [Fact]
        public void SameResultsRepeatCallsStringQuery()
        {
            var q = from x1 in new[] { 55, 49, 9, -100, 24, 25, -1, 0 }
                             from x2 in new[] { "!@#$%^", "C", "AAA", "", null, "Calling Twice", "SoS", String.Empty }
                             where !String.IsNullOrEmpty(x2)
                             select new { a1 = x1, a2 = x2 };

            Assert.Equal(q.OrderBy(e => e.a1), q.OrderBy(e => e.a1));
        }

        [Fact]
        public void SourceEmpty()
        {
            int[] source = { };
            Assert.Empty(source.OrderBy(e => e));
        }

        //FIXME: This will hang with a larger source. Do we want to deal with that case?
        [Fact]
        public void SurviveBadComparerAlwaysReturnsNegative()
        {
            int[] source = { 1 };
            int[] expected = { 1 };

            Assert.Equal(expected, source.OrderBy(e => e, new BadComparer2()));
        }

        [Fact]
        public void KeySelectorReturnsNull()
        {
            int?[] source = { null, null, null };
            int?[] expected = { null, null, null };

            Assert.Equal(expected, source.OrderBy(e => e));
        }

        [Fact]
        public void ElementsAllSameKey()
        {
            int?[] source = { 9, 9, 9, 9, 9, 9 };
            int?[] expected = { 9, 9, 9, 9, 9, 9 };

            Assert.Equal(expected, source.OrderBy(e => e));
        }

        [Fact]
        public void KeySelectorCalled()
        {
            var source = new[]
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 45 },
                new { Name = "Prakash", Score = 99 }
            };
            var expected = new[]
            {
                new { Name = "Prakash", Score = 99 },
                new { Name = "Robert", Score = 45 },
                new { Name = "Tim", Score = 90 }
            };

            Assert.Equal(expected, source.OrderBy(e => e.Name, null));
        }

        [Fact]
        public void FirstAndLastAreDuplicatesCustomComparer()
        {
            string[] source = { "Prakash", "Alpha", "dan", "DAN", "Prakash" };
            string[] expected = { "Alpha", "dan", "DAN", "Prakash", "Prakash" };

            Assert.Equal(expected, source.OrderBy(e => e, StringComparer.OrdinalIgnoreCase));
        }

        [Fact]
        public void FirstAndLastAreDuplicatesNullPassedAsComparer()
        {
            int[] source = { 5, 1, 3, 2, 5 };
            int[] expected = { 1, 2, 3, 5, 5 };

            Assert.Equal(expected, source.OrderBy(e => e, null));
        }

        [Fact]
        public void SourceReverseOfResultNullPassedAsComparer()
        {
            int?[] source = { 100, 30, 9, 5, 0, -50, -75, null };
            int?[] expected = { null, -75, -50, 0, 5, 9, 30, 100 };

            Assert.Equal(expected, source.OrderBy(e => e, null));
        }

        [Fact]
        public void SameKeysVerifySortStable()
        {
            var source = new[]
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 90 },
                new { Name = "Prakash", Score = 90 },
                new { Name = "Jim", Score = 90 },
                new { Name = "John", Score = 90 },
                new { Name = "Albert", Score = 90 },
            };
            var expected = new[]
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 90 },
                new { Name = "Prakash", Score = 90 },
                new { Name = "Jim", Score = 90 },
                new { Name = "John", Score = 90 },
                new { Name = "Albert", Score = 90 },
            };

            Assert.Equal(expected, source.OrderBy(e => e.Score));
        }

        [Fact]
        public void OrderedToArray()
        {
            var source = new []
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 90 },
                new { Name = "Prakash", Score = 90 },
                new { Name = "Jim", Score = 90 },
                new { Name = "John", Score = 90 },
                new { Name = "Albert", Score = 90 },
            };
            var expected = new []
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 90 },
                new { Name = "Prakash", Score = 90 },
                new { Name = "Jim", Score = 90 },
                new { Name = "John", Score = 90 },
                new { Name = "Albert", Score = 90 },
            };

            Assert.Equal(expected, source.OrderBy(e => e.Score).ToArray());
        }

        [Fact]
        public void EmptyOrderedToArray()
        {
            Assert.Empty(Enumerable.Empty<int>().OrderBy(e => e).ToArray());
        }

        [Fact]
        public void OrderedToList()
        {
            var source = new[]
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 90 },
                new { Name = "Prakash", Score = 90 },
                new { Name = "Jim", Score = 90 },
                new { Name = "John", Score = 90 },
                new { Name = "Albert", Score = 90 },
            };
            var expected = new[]
            {
                new { Name = "Tim", Score = 90 },
                new { Name = "Robert", Score = 90 },
                new { Name = "Prakash", Score = 90 },
                new { Name = "Jim", Score = 90 },
                new { Name = "John", Score = 90 },
                new { Name = "Albert", Score = 90 },
            };

            Assert.Equal(expected, source.OrderBy(e => e.Score).ToList());
        }

        [Fact]
        public void EmptyOrderedToList()
        {
            Assert.Empty(Enumerable.Empty<int>().OrderBy(e => e).ToList());
        }

        //FIXME: This will hang with a larger source. Do we want to deal with that case?
        [Fact]
        public void SurviveBadComparerAlwaysReturnsPositive()
        {
            int[] source = { 1 };
            int[] expected = { 1 };

            Assert.Equal(expected, source.OrderBy(e => e, new BadComparer1()));
        }

        private class ExtremeComparer : IComparer<int>
        {
            public int Compare(int x, int y)
            {
                if (x == y)
                    return 0;
                if (x < y)
                    return int.MinValue;
                return int.MaxValue;
            }
        }

        [Fact]
        public void OrderByExtremeComparer()
        {
            var outOfOrder = new[] { 7, 1, 0, 9, 3, 5, 4, 2, 8, 6 };
            Assert.Equal(Enumerable.Range(0, 10), outOfOrder.OrderBy(i => i, new ExtremeComparer()));
        }

        [Fact]
        public void NullSource()
        {
            IEnumerable<int> source = null;
            Assert.Throws<ArgumentNullException>("source", () => source.OrderBy(i => i));
        }

        [Fact]
        public void NullKeySelector()
        {
            Func<DateTime, int> keySelector = null;
            Assert.Throws<ArgumentNullException>("keySelector", () => Enumerable.Empty<DateTime>().OrderBy(keySelector));
        }

        [Fact]
        public void FirstOnOrdered()
        {
            Assert.Equal(0, Enumerable.Range(0, 10).Shuffle().OrderBy(i => i).First());
            Assert.Equal(9, Enumerable.Range(0, 10).Shuffle().OrderByDescending(i => i).First());
            Assert.Equal(10, Enumerable.Range(0, 100).Shuffle().OrderByDescending(i => i.ToString().Length).ThenBy(i => i).First());
        }

        [Fact]
        public void FirstOnEmptyOrderedThrows()
        {
            Assert.Throws<InvalidOperationException>(() => Enumerable.Empty<int>().OrderBy(i => i).First());
        }

        [Fact]
        public void FirstOrDefaultOnOrdered()
        {
            Assert.Equal(0, Enumerable.Range(0, 10).Shuffle().OrderBy(i => i).FirstOrDefault());
            Assert.Equal(9, Enumerable.Range(0, 10).Shuffle().OrderByDescending(i => i).FirstOrDefault());
            Assert.Equal(10, Enumerable.Range(0, 100).Shuffle().OrderByDescending(i => i.ToString().Length).ThenBy(i => i).FirstOrDefault());
            Assert.Equal(0, Enumerable.Empty<int>().OrderBy(i => i).FirstOrDefault());
        }

        [Fact]
        public void LastOnOrdered()
        {
            Assert.Equal(9, Enumerable.Range(0, 10).Shuffle().OrderBy(i => i).Last());
            Assert.Equal(0, Enumerable.Range(0, 10).Shuffle().OrderByDescending(i => i).Last());
            Assert.Equal(10, Enumerable.Range(0, 100).Shuffle().OrderBy(i => i.ToString().Length).ThenByDescending(i => i).Last());
        }

        [Fact]
        public void LastOnEmptyOrderedThrows()
        {
            Assert.Throws<InvalidOperationException>(() => Enumerable.Empty<int>().OrderBy(i => i).Last());
        }

        [Fact]
        public void LastOrDefaultOnOrdered()
        {
            Assert.Equal(9, Enumerable.Range(0, 10).Shuffle().OrderBy(i => i).LastOrDefault());
            Assert.Equal(0, Enumerable.Range(0, 10).Shuffle().OrderByDescending(i => i).LastOrDefault());
            Assert.Equal(10, Enumerable.Range(0, 100).Shuffle().OrderBy(i => i.ToString().Length).ThenByDescending(i => i).LastOrDefault());
            Assert.Equal(0, Enumerable.Empty<int>().OrderBy(i => i).LastOrDefault());
        }

        [Fact]
        public void EnumeratorDoesntContinue()
        {
            var enumerator = NumberRangeGuaranteedNotCollectionType(0, 3).Shuffle().OrderBy(i => i).GetEnumerator();
            while (enumerator.MoveNext()) { }
            Assert.False(enumerator.MoveNext());
        }
    }
}


text:
package com.derangementinc.gradespeedmobile.dialogs;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class QuestionDialog extends DialogFragment {
	String positive = "";
	String negative = "";
	String question = "";

	private int     index;
	private boolean isCustom;

	public interface QuestionDialogListener {
		public void onQuestionDialogAnswer(QuestionDialog dialog, boolean answerPositive);
	}

	QuestionDialogListener mListener;

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);

		try {
			mListener = (QuestionDialogListener) activity;
		}
		catch (ClassCastException err) {
			throw new ClassCastException(activity.toString()
					+ " has to implement QuestionDialogListener interface");
		}
	}

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		builder.setMessage(question)
			   .setPositiveButton(positive, new DialogInterface.OnClickListener() {

				   @Override
				   public void onClick(DialogInterface dialog, int which) {
					   mListener.onQuestionDialogAnswer(QuestionDialog.this, true);
				   }
			   })
			   .setNegativeButton(negative, new DialogInterface.OnClickListener() {

				   @Override
				   public void onClick(DialogInterface dialog, int which) {
					   mListener.onQuestionDialogAnswer(QuestionDialog.this, false);
				   }
			   });
		return builder.create();
	}

	public void setQuestion(String question, String posAnswer, String negAnswer) {
		this.question = question;
		this.positive = posAnswer;
		this.negative = negAnswer;
	}

	public void setDistrictMetadata(int index, boolean isCustom) {
		this.index = index;
		this.isCustom = isCustom;
	}

	public int getIndex() {
		return index;
	}

	public boolean isCustomDistrict() {
		return isCustom;
	}
}


text:
Ticker timer;
int binIndex;

InterruptIn leftSensor(PTA4);
InterruptIn rightSensor(PTA5);
int leftCounts[NUM_SAMPLES];
int rightCounts[NUM_SAMPLES];
float weights[NUM_SAMPLES];

void incLeftCount() {
    leftCounts[binIndex % NUM_SAMPLES]++;
}

void incRightCount() {
    rightCounts[binIndex % NUM_SAMPLES]++;
}

void incBinIndex() {
    binIndex++;
    leftCounts[binIndex % NUM_SAMPLES] = 0;
    rightCounts[binIndex % NUM_SAMPLES] = 0;
}

void initWeights() {
    float timeRate = 0.5; // seconds
    float rate = SAMPLE_TIME / timeRate;
    for (int i = 0; i < NUM_SAMPLES; i++) {
        weights[i] = exp(-rate * (float) i);
    }
    float sum = 0;
    for (int i = 0; i < NUM_SAMPLES; i++) {
        sum += weights[i];
    }
    for (int i = 0; i < NUM_SAMPLES; i++) {
        weights[i] /= sum;
    }
}

extern "C" void rpmInit() {
    for (int i = 0; i < NUM_SAMPLES; i++) {
        leftCounts[i]  = 0;
        rightCounts[i] = 0;
    }
    initWeights();
    leftSensor.fall(&incLeftCount);
    rightSensor.fall(&incRightCount);
    timer.attach(&incBinIndex, SAMPLE_TIME);
}

float getRpm(int* counts) {
    float total = 0;
    for (int i = 0; i < NUM_SAMPLES; i++) {
        total += weights[i] * (float) counts[(binIndex - i) % NUM_SAMPLES];
    }
    float freq = (float) total / SAMPLE_TIME;
    return 60 * freq / NUM_TRIGGERS;
}

extern "C" float getLeftRpm() {
    return getRpm(leftCounts);
}

extern "C" float getRightRpm() {
    return getRpm(rightCounts);
}

extern "C" void rpmRelease() {
    timer.detach();
}


text:
<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glDrawElements">
    <info>
        <copyright>
            <year>1991-2006</year>
            <holder>Silicon Graphics, Inc.</holder>
        </copyright>
        <copyright>
            <year>2010-2014</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>glDrawElements</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glDrawElements</refname>
        <refpurpose>render primitives from array data</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glDrawElements</function></funcdef>
                <paramdef>GLenum <parameter>mode</parameter></paramdef>
                <paramdef>GLsizei <parameter>count</parameter></paramdef>
                <paramdef>GLenum <parameter>type</parameter></paramdef>
                <paramdef>const void * <parameter>indices</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>mode</parameter></term>
            <listitem>
                <para>
                    Specifies what kind of primitives to render.
                    Symbolic constants
                    <constant>GL_POINTS</constant>,
                    <constant>GL_LINE_STRIP</constant>,
                    <constant>GL_LINE_LOOP</constant>,
                    <constant>GL_LINES</constant>,
                    <constant>GL_LINE_STRIP_ADJACENCY</constant>,
                    <constant>GL_LINES_ADJACENCY</constant>,
                    <constant>GL_TRIANGLE_STRIP</constant>,
                    <constant>GL_TRIANGLE_FAN</constant>,
                    <constant>GL_TRIANGLES</constant>,
                    <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant>,
                    <constant>GL_TRIANGLES_ADJACENCY</constant> and <constant>GL_PATCHES</constant>
                    are accepted.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>count</parameter></term>
            <listitem>
                <para>
                    Specifies the number of elements to be rendered.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>type</parameter></term>
            <listitem>
                <para>
                    Specifies the type of the values in <parameter>indices</parameter>. Must be one of
                    <constant>GL_UNSIGNED_BYTE</constant>, <constant>GL_UNSIGNED_SHORT</constant>, or
                    <constant>GL_UNSIGNED_INT</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>indices</parameter></term>
            <listitem>
                <para>
                    Specifies a pointer to the location where the indices are stored.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            <function>glDrawElements</function> specifies multiple geometric primitives
            with very few subroutine calls. Instead of calling a GL function
            to pass each individual vertex, normal, texture coordinate, edge
            flag, or color, you can prespecify
            separate arrays of vertices, normals, and so on, and use them to
            construct a sequence of primitives with a single
            call to <function>glDrawElements</function>.
        </para>
        <para>
            When <function>glDrawElements</function> is called, it uses <parameter>count</parameter> sequential elements from an
            enabled array, starting at <parameter>indices</parameter> to construct a sequence of
            geometric primitives. <parameter>mode</parameter> specifies what kind of primitives are
            constructed and how the array elements construct these primitives. If
            more than one array is enabled, each is used.
        </para>
        <para>
            Vertex attributes that are modified by <function>glDrawElements</function> have an
            unspecified value after <function>glDrawElements</function> returns.  Attributes that aren't
            modified maintain their previous values.
        </para>
    </refsect1>
    <refsect1 xml:id="notes"><title>Notes</title>
        <para>
            <constant>GL_LINE_STRIP_ADJACENCY</constant>,
            <constant>GL_LINES_ADJACENCY</constant>,
            <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant> and
            <constant>GL_TRIANGLES_ADJACENCY</constant>
            are available only if the GL version is 3.2 or greater.
        </para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value.
        </para>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>count</parameter> is negative.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if a geometry shader is active and <parameter>mode</parameter>
            is incompatible with the input primitive type of the geometry shader in the currently installed program object.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an
            enabled array or the element array and the buffer object's data store is currently mapped.
        </para>
    </refsect1>
    <refsect1 xml:id="versions"><title>Version Support</title>
        <informaltable>
            <tgroup cols="13" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry><function>glDrawElements</function></entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='20']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawElementsInstanced</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawElementsBaseVertex</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 1991-2006 Silicon Graphics, Inc.
            Copyright <trademark class="copyright"/> 2010-2014 Khronos Group.
            This document is licensed under the SGI Free Software B License.
            For details, see
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://khronos.org/registry/OpenGL-Refpages/LICENSES/LicenseRef-FreeB.txt">https://khronos.org/registry/OpenGL-Refpages/LICENSES/LicenseRef-FreeB.txt</link>.
        </para>
    </refsect1>
</refentry>


text:
import scala.collection.JavaConverters._

import scala.beans.BeanProperty

import javax.persistence.{Column, Entity, Id, Persistence, Table, Version}

import org.infinispan.CacheException
import org.infinispan.manager.DefaultCacheManager

object InfinispanCacheStoreJpaExample {
  def main(args: Array[String]): Unit = {
    val manager = new DefaultCacheManager("infinispan.xml")

    try {
      println("===== Create Cache =====")
      val cache = manager.getCache[Int, User]("cacheStoreJpa")
      println("===== Created Cache =====")

      // Cache#clearすると、全データをDELETEします
      cache.clear()

      val user = User(1, "カツオ", "磯野", 11)
      cache.put(user.id, user)

      println("===== Current Cache1 =====")
      println(cache.get(user.id))
      require(cache.get(user.id).age == 11)
      println("===== Current Cache1 =====")

      /*
      // JPAで直接更新
      println("===== JPA Update =====")
      val entityManagerFactory = Persistence.createEntityManagerFactory("infinispan.cachestore.jpa.example")
      val entityManager = entityManagerFactory.createEntityManager()
      val emTx = entityManager.getTransaction

      emTx.begin()

      val query = entityManager.createQuery("SELECT u FROM User u")

      query.getResultList.asScala.foreach {
        case u: User =>
          println(s"Selected JPA: $u")
          u.age += 1
          // ここで更新
          entityManager.merge(u)
          println(s"Updated JPA: $u")

          // 年齢は増えている
          require(u.age == 12)
      }

      emTx.commit()

      entityManager.close()
      entityManagerFactory.close()
      println("===== JPA Updated =====")
      */

      // JPAを直接使って更新してしまうと、実はここでロードしようとしてもCacheからはズレてしまう…
      println("===== Current Cache2 =====")
      println(cache.get(user.id))
      require(cache.get(user.id).age == 11)  // 年齢が増えていない
      println("===== Current Cache2 =====")

      try {
        val u = cache.get(user.id)
        u.age += 1
        cache.put(u.id, u)

        require(cache.get(u.id).age == 12)
      } catch {
        // 上記JPAのコードを実行した場合は、
        // 管理されている状態とズレているので、例外となる
        case e: CacheException => println(s"Exception => ${e.getMessage}")
      }

      //cache.remove(user.id)

      cache.stop()
    } finally {
      manager.stop()
    }
  }
}

object User {
  def apply(id: Int, firstName: String, lastName: String, age: Int): User = {
    val user = new User
    user.id = id
    user.firstName = firstName
    user.lastName = lastName
    user.age = age
    user
  }
}

@SerialVersionUID(1L)
@Entity
@Table(name = "user")
class User extends Serializable {
  @Id
  @BeanProperty
  var id: Int = _

  @Column(name = "first_name")
  @BeanProperty
  var firstName: String = _

  @Column(name = "last_name")
  @BeanProperty var lastName: String = _

  @Column
  @BeanProperty
  var age: Int = _

  @Column(name = "version_no")
  @Version
  @BeanProperty
  var versionNo: Int = _

  override def toString(): String =
    s"id = $id, firstName = $firstName, lastName = $lastName, age = $age, versionNo = $versionNo"
}


text:
package com.google.gerrit.acceptance.api.change;

import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.reviewdb.client.Patch.MERGE_LIST;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.Constants.HEAD;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.common.RawInputUtil;
import com.google.gerrit.extensions.api.changes.RevisionApi;
import com.google.gerrit.extensions.common.CommitInfo;
import com.google.gerrit.extensions.common.DiffInfo;
import com.google.gerrit.extensions.restapi.BinaryResult;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.Set;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Before;
import org.junit.Test;

@NoHttpd
public class MergeListIT extends AbstractDaemonTest {

  private String changeId;
  private RevCommit merge;
  private RevCommit parent1;
  private RevCommit grandParent1;
  private RevCommit parent2;
  private RevCommit grandParent2;

  @Before
  public void setup() throws Exception {
    ObjectId initial = repo().exactRef(HEAD).getLeaf().getObjectId();

    PushOneCommit.Result gp1 =
        pushFactory
            .create(
                db,
                admin.getIdent(),
                testRepo,
                "grand parent 1",
                ImmutableMap.of("foo", "foo-1.1", "bar", "bar-1.1"))
            .to("refs/for/master");
    grandParent1 = gp1.getCommit();

    PushOneCommit.Result p1 =
        pushFactory
            .create(
                db,
                admin.getIdent(),
                testRepo,
                "parent 1",
                ImmutableMap.of("foo", "foo-1.2", "bar", "bar-1.2"))
            .to("refs/for/master");
    parent1 = p1.getCommit();

    // reset HEAD in order to create a sibling of the first change
    testRepo.reset(initial);

    PushOneCommit.Result gp2 =
        pushFactory
            .create(
                db,
                admin.getIdent(),
                testRepo,
                "grand parent 2",
                ImmutableMap.of("foo", "foo-2.1", "bar", "bar-2.1"))
            .to("refs/for/master");
    grandParent2 = gp2.getCommit();

    PushOneCommit.Result p2 =
        pushFactory
            .create(
                db,
                admin.getIdent(),
                testRepo,
                "parent 2",
                ImmutableMap.of("foo", "foo-2.2", "bar", "bar-2.2"))
            .to("refs/for/master");
    parent2 = p2.getCommit();

    PushOneCommit m =
        pushFactory.create(
            db,
            admin.getIdent(),
            testRepo,
            "merge",
            ImmutableMap.of("foo", "foo-1", "bar", "bar-2"));
    m.setParents(ImmutableList.of(p1.getCommit(), p2.getCommit()));
    PushOneCommit.Result result = m.to("refs/for/master");
    result.assertOkStatus();
    merge = result.getCommit();
    changeId = result.getChangeId();
  }

  @Test
  public void getMergeList() throws Exception {
    List<CommitInfo> mergeList = current(changeId).getMergeList().get();
    assertThat(mergeList).hasSize(2);
    assertThat(mergeList.get(0).commit).isEqualTo(parent2.name());
    assertThat(mergeList.get(1).commit).isEqualTo(grandParent2.name());

    mergeList = current(changeId).getMergeList().withUninterestingParent(2).get();
    assertThat(mergeList).hasSize(2);
    assertThat(mergeList.get(0).commit).isEqualTo(parent1.name());
    assertThat(mergeList.get(1).commit).isEqualTo(grandParent1.name());
  }

  @Test
  public void getMergeListContent() throws Exception {
    BinaryResult bin = current(changeId).file(MERGE_LIST).content();
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    bin.writeTo(os);
    String content = new String(os.toByteArray(), UTF_8);
    assertThat(content).isEqualTo(getMergeListContent(parent2, grandParent2));
  }

  @Test
  public void getFileList() throws Exception {
    assertThat(getFiles(changeId)).contains(MERGE_LIST);
    assertThat(getFiles(changeId, 1)).contains(MERGE_LIST);
    assertThat(getFiles(changeId, 2)).contains(MERGE_LIST);

    assertThat(getFiles(createChange().getChangeId())).doesNotContain(MERGE_LIST);
  }

  @Test
  public void getDiffForMergeList() throws Exception {
    DiffInfo diff = getMergeListDiff(changeId);
    assertDiffForNewFile(diff, merge, MERGE_LIST, getMergeListContent(parent2, grandParent2));

    diff = getMergeListDiff(changeId, 1);
    assertDiffForNewFile(diff, merge, MERGE_LIST, getMergeListContent(parent2, grandParent2));

    diff = getMergeListDiff(changeId, 2);
    assertDiffForNewFile(diff, merge, MERGE_LIST, getMergeListContent(parent1, grandParent1));
  }

  @Test
  public void editMergeList() throws Exception {
    gApi.changes().id(changeId).edit().create();

    exception.expect(ResourceConflictException.class);
    exception.expectMessage("Invalid path: " + MERGE_LIST);
    gApi.changes().id(changeId).edit().modifyFile(MERGE_LIST, RawInputUtil.create("new content"));
  }

  @Test
  public void deleteMergeList() throws Exception {
    gApi.changes().id(changeId).edit().create();

    exception.expect(ResourceConflictException.class);
    exception.expectMessage("no changes were made");
    gApi.changes().id(changeId).edit().deleteFile(MERGE_LIST);
  }

  private String getMergeListContent(RevCommit... commits) {
    StringBuilder mergeList = new StringBuilder("Merge List:\n\n");
    for (RevCommit c : commits) {
      mergeList
          .append("* ")
          .append(c.abbreviate(8).name())
          .append(" ")
          .append(c.getShortMessage())
          .append("\n");
    }
    return mergeList.toString();
  }

  private Set<String> getFiles(String changeId) throws Exception {
    return current(changeId).files().keySet();
  }

  private Set<String> getFiles(String changeId, int parent) throws Exception {
    return current(changeId).files(parent).keySet();
  }

  private DiffInfo getMergeListDiff(String changeId) throws Exception {
    return current(changeId).file(MERGE_LIST).diff();
  }

  private DiffInfo getMergeListDiff(String changeId, int parent) throws Exception {
    return current(changeId).file(MERGE_LIST).diff(parent);
  }

  private RevisionApi current(String changeId) throws Exception {
    return gApi.changes().id(changeId).current();
  }
}


text:
/**
 *
 *  LICENSING: See LICENSE.txt or http://opensource.org/licenses/MIT
 **/

#include "BigNum.h"

BigNum BigNum::Gcd(const BigNum &other) const {
    BigNum result;
    mp_gcd(*this, other, result);
    return result;
}

BigNum BigNum::Lcm(const BigNum &other) const {
    BigNum result;
    mp_lcm(*this, other, result);
    return result;
}

BigNum BigNum::ExtendedGcd(const BigNum &other, BigNum &u, BigNum &v) const {
    BigNum result;
    mp_exteuclid(*this, other, u, v, result);
    return result;
}


text:
{
  propertie = depend.properties[propertie];
  const propertieType = getType(propertie);

  if (propertieType !== type) {
    _getRefModels(propertie, swaggerInfo);
  }
}


text:
package org.opentradingsolutions.log4fix.ui.messages;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.event.MouseInputAdapter;
import javax.swing.event.MouseInputListener;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;

/**
 * @author Brian M. Coyner
 */
public class MessageSearchField extends JTextField {
    private static final Border CANCEL_BORDER = new CancelBorder();

    public boolean armed;

    public MessageSearchField() {
        super(15);
        initCancelButtonBorder();
        initEscapeKeyListener();
    }

    private void initCancelButtonBorder() {
        setBorder(new CompoundBorder(getBorder(), CANCEL_BORDER));

        MouseInputListener mouseInputListener = new ClearSearchFieldMouseListener();
        addMouseListener(mouseInputListener);
        addMouseMotionListener(mouseInputListener);
    }

    private void initEscapeKeyListener() {
        addKeyListener(new KeyAdapter() {
            public void keyReleased(KeyEvent e) {
                if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    cancel();
                } else {
                    postActionEvent();
                }
            }
        });
    }

    private void cancel() {
        setText("");
        postActionEvent();
    }

    private static class CancelBorder extends EmptyBorder {

        private static final Color ARMED_COLOR = Color.GRAY.darker();

        CancelBorder() {
            super(0, 0, 0, 15);
        }

        public void paintBorder(Component c, Graphics oldGraphics, int x, int y,
                                int width, int height) {
            MessageSearchField field = (MessageSearchField) c;
            if (field.getText().length() == 0) {
                return;
            }

            Graphics2D g = (Graphics2D) oldGraphics;
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);

            final int circleL = 14;
            final int circleX = x + width - circleL;
            final int circleY = y + (height - 1 - circleL) / 2;
            g.setColor(field.armed ? ARMED_COLOR : Color.GRAY);
            g.fillOval(circleX, circleY, circleL, circleL);

            final int lineL = circleL - 8;
            final int lineX = circleX + 4;
            final int lineY = circleY + 4;
            g.setColor(Color.WHITE);
            g.drawLine(lineX, lineY, lineX + lineL, lineY + lineL);
            g.drawLine(lineX, lineY + lineL, lineX + lineL, lineY);
        }
    }

    private class ClearSearchFieldMouseListener extends MouseInputAdapter {

        public void mouseDragged(MouseEvent e) {
            arm(e);
        }

        public void mouseEntered(MouseEvent e) {
            arm(e);
        }

        public void mouseExited(MouseEvent e) {
            disarm();
        }

        public void mousePressed(MouseEvent e) {
            arm(e);
        }

        public void mouseReleased(MouseEvent e) {
            if (armed) {
                cancel();
            }
            disarm();
        }

        private void arm(MouseEvent e) {
            armed = (isOverButton(e) && SwingUtilities.isLeftMouseButton(e));
            repaint();
        }

        private void disarm() {
            armed = false;
            repaint();
        }

        private boolean isOverButton(MouseEvent e) {
            if (!contains(e.getPoint())) {
                return false;
            }

            Rectangle rectangle = SwingUtilities.calculateInnerArea(
                    MessageSearchField.this, null);
            return !rectangle.contains(e.getPoint());
        }
    }
}


text:
/**
 * (created at 2011-5-19)
 */
package com.alibaba.cobar.parser.ast.expression.primary;

/**
 * @author QIU Shuo
 */
public abstract class VariableExpression extends PrimaryExpression {
}