text:
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//See the NOTICE file distributed with this work for additional
//information regarding copyright ownership.
//You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
using OpenQA.Selenium.Appium.Interfaces;
using System.Collections.Generic;
using System.Reflection;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Internal;

namespace OpenQA.Selenium.Appium.MultiTouch
{

    public class TouchAction : ITouchAction
    {
        internal class Step
        {
            private Dictionary<string, object> parameters = new Dictionary<string, object>();

            private string GetIdForElement(IWebElement el)
            {

                RemoteWebElement remoteWebElement = el as RemoteWebElement;
                if (remoteWebElement != null)
                    return (string)typeof(OpenQA.Selenium.Remote.RemoteWebElement).GetProperty("Id",
                        BindingFlags.NonPublic |
                        BindingFlags.Instance).GetValue(el, null);

                IWrapsElement elementWrapper = el as IWrapsElement;
                if (elementWrapper != null)
                    return GetIdForElement(elementWrapper.WrappedElement);

                return null;
            }

            public Step(string action)
            {
                parameters.Add("action", action);
            }

            public Step AddOpt(string name, object value)
            {
                if (value != null)
                {
                    if (!parameters.ContainsKey("options")) parameters.Add("options", new Dictionary<string, object>());
                    if (value is IWebElement)
                    {
                        string id = GetIdForElement((IWebElement) value);
                        ((Dictionary<string, object>)this.parameters["options"]).Add(name, id);
                    }
                    else if (value is double)
                    {
                        double doubleValue = (double) value;
                        if (doubleValue == (int)doubleValue)
                        {
                            ((Dictionary<string, object>) parameters["options"])
                                .Add(name, (int)doubleValue);
                        }
                        else
                        {
                            ((Dictionary<string, object>) parameters["options"])
                                .Add(name, doubleValue);
                        }
                    }
                    else
                    {
                        ((Dictionary<string, object>) parameters["options"]).Add(name, value);
                    }
                }
                return this;
            }

            public Dictionary<string, object> GetParameters()
            {
                return parameters;
            }
        }

        private IPerformsTouchActions TouchActionPerformer;
        private List<Step> steps = new List<Step>();

        public TouchAction(IPerformsTouchActions touchActionPerformer)
        {
            this.TouchActionPerformer = touchActionPerformer;
        }

        /// <summary>
        /// Press at the specified location in the element until the  context menu appears.
        /// </summary>
        /// <param name="element">The target element.</param>
        /// <param name=x>The x coordinate relative to the element.</param>
        /// <param name=y>The y coordinate relative to the element.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction LongPress(IWebElement element, double? x = null, double? y = null)
        {
            Step longPressStep = new Step("longPress");
            longPressStep
                .AddOpt("element", element)
                .AddOpt("x", x)
                .AddOpt("y", y);
            steps.Add(longPressStep);
            return this;
        }

        /// <summary>
        /// Press at the specified location in the element until the  context menu appears.
        /// </summary>
        /// <param name="element">The target element.</param>
        /// <param name=x>The x coordinate relative to the element.</param>
        /// <param name=y>The y coordinate relative to the element.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction LongPress(double x, double y)
        {
            Step longPressStep = new Step("longpress");
            longPressStep
                .AddOpt("x", x)
                .AddOpt("y", y);
            steps.Add(longPressStep);
            return this;
        }

        /// <summary>
        /// Move to the specified location in the element.
        /// </summary>
        /// <param name="element">The target element.</param>
        /// <param name=x>The x coordinate relative to the element.</param>
        /// <param name=y>The y coordinate relative to the element.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction MoveTo(IWebElement element, double? x = null, double? y = null)
        {
            Step moveToStep = new Step("moveTo");
            moveToStep
                .AddOpt("element", element)
                .AddOpt("x", x)
                .AddOpt("y", y);
            steps.Add(moveToStep);
            return this;
        }

        /// <summary>
        /// Move to the specified location.
        /// </summary>
        /// <param name=x>The x coordinate.</param>
        /// <param name=y>The y coordinate.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction MoveTo(double x, double y)
        {
            Step moveToStep = new Step("moveTo");
            moveToStep
                .AddOpt("x", x)
                .AddOpt("y", y);
            steps.Add(moveToStep);
            return this;
        }

        /// <summary>
        /// Press at the specified location in the element.
        /// </summary>
        /// <param name="element">The target element.</param>
        /// <param name=x>The x coordinate relative to the element.</param>
        /// <param name=y>The y coordinate relative to the element.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction Press(IWebElement element, double? x = null, double? y = null)
        {
            Step pressStep = new Step("press");
            pressStep
                .AddOpt("element", element)
                .AddOpt("x", x)
                .AddOpt("y", y);
            steps.Add(pressStep);
            return this;
        }

        /// <summary>
        /// Press at the specified location.
        /// </summary>
        /// <param name=x>The x coordinate.</param>
        /// <param name=y>The y coordinate.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction Press(double x, double y)
        {
            Step pressStep = new Step("press");
            pressStep
                .AddOpt("x", x)
                .AddOpt("y", y);
            steps.Add(pressStep);
            return this;
        }

        /// <summary>
        /// Release the pressure.
        /// </summary>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction Release()
        {
            Step releaseStep = new Step("release");
            steps.Add(releaseStep);
            return this;
        }

        /// <summary>
        /// Tap at the specified location in the element.
        /// </summary>
        /// <param name="element">The target element.</param>
        /// <param name="x">The x coordinate relative to the element.</param>
        /// <param name="y">The y coordinate relative to the element.</param>
        /// <param name="count">The number of times to tap.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction Tap(IWebElement element, double? x = null, double? y = null, long? count = null)
        {
            Step tapStep = new Step("tap");
            tapStep
                .AddOpt("element", element)
                .AddOpt("x", x)
                .AddOpt("y", y)
                .AddOpt("count", count);
            steps.Add(tapStep);
            return this;
        }

        /// <summary>
        /// Tap at the specified location.
        /// </summary>
        /// <param name="x">The x coordinate relative to the element.</param>
        /// <param name="y">The y coordinate relative to the element.</param>
        /// <param name="count">The number of times to tap.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction Tap(double x, double y, long? count = null)
        {
            Step tapStep = new Step("tap");
            tapStep
                .AddOpt("x", x)
                .AddOpt("y", y)
                .AddOpt("count", count);
            steps.Add(tapStep);
            return this;
        }

        /// <summary>
        /// Wait for the given duration.
        /// </summary>
        /// <param name="ms">The amount of time to wait in milliseconds.</param>
        /// <returns>A self-reference to this <see cref="ITouchAction"/>.</returns>
        public ITouchAction Wait(long? ms = null)
        {
            Step waitStep = new Step("wait");
            waitStep
                .AddOpt("ms", ms);
            steps.Add(waitStep);
            return this;
        }

        public List<Dictionary<string, object>> GetParameters()
        {
            List<Dictionary<string, object>> parameters = new List<Dictionary<string, object>>();
            for (int i = 0; i < this.steps.Count; i++)
            {
                parameters.Add(steps[i].GetParameters());
            }
            return parameters;
        }

        /// <summary>
        /// Cancels the Touch Action
        /// </summary>
        public void Cancel()
        {
            steps.Clear();
        }

        /// <summary>
        /// Executes the Touch Action
        /// </summary>
        public void Perform()
        {
            TouchActionPerformer.PerformTouchAction(this);
        }

    }
}


text:
import React from 'react';
import classNames from 'classnames';

/*
|--------------------------------------------------------------------------
| NotificationsList
|--------------------------------------------------------------------------
|
| Stateless component
|
*/

const NotificationsList = props => (
    <div
        className={classNames(
            'scrollable',
        )}
    >
        <ul
            className={classNames(
                'list-group',
                'list-group-gap',
                'm-a-0',
            )}
        >
            {props.children}
        </ul>
    </div>
);

NotificationsList.propTypes = {
    children: React.PropTypes.node,
};

export default NotificationsList;

redpajama_set_name: RedPajamaGithub


text:
package v1

import (
	"context"
)

// PodSpecDefaulter is a callback to validate a PodSpecable.
type PodSpecDefaulter func(context.Context, *WithPod)

// SetDefaults implements apis.Defaultable
func (wp *WithPod) SetDefaults(ctx context.Context) {
	if psd := GetPodSpecDefaulter(ctx); psd != nil {
		psd(ctx, wp)
	}
}

// psdKey is used for associating a PodSpecDefaulter with a context.Context
type psdKey struct{}

func WithPodSpecDefaulter(ctx context.Context, psd PodSpecDefaulter) context.Context {
	return context.WithValue(ctx, psdKey{}, psd)
}

// GetPodSpecDefaulter extracts the PodSpecDefaulter from the context.
func GetPodSpecDefaulter(ctx context.Context) PodSpecDefaulter {
	untyped := ctx.Value(psdKey{})
	if untyped == nil {
		return nil
	}
	return untyped.(PodSpecDefaulter)
}

// PodDefaulter is a callback to validate a Pod.
type PodDefaulter func(context.Context, *Pod)

// SetDefaults implements apis.Defaultable
func (p *Pod) SetDefaults(ctx context.Context) {
	if pd := GetPodDefaulter(ctx); pd != nil {
		pd(ctx, p)
	}
}

// pdKey is used for associating a PodDefaulter with a context.Context
type pdKey struct{}

func WithPodDefaulter(ctx context.Context, pd PodDefaulter) context.Context {
	return context.WithValue(ctx, pdKey{}, pd)
}

// GetPodDefaulter extracts the PodDefaulter from the context.
func GetPodDefaulter(ctx context.Context) PodDefaulter {
	untyped := ctx.Value(pdKey{})
	if untyped == nil {
		return nil
	}
	return untyped.(PodDefaulter)
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
AASP Contributions Series (Dallas) 39: 190 (2000)

#### Original name
Multicellaesporites desmodes P. Ke & Z.Y. Shi

### Remarks
null


text:
static char scriptPath[LEN_PATHNAME];
static BOOL pathSet=FALSE;
static int scriptErrcode=0;
static LPSTR lpTranslate=NULL;
static LPSTR lpFormatBuff=NULL;

int FAR PASCAL _EXPORT lastScriptError(HSCRIPT hScript)
{
    LPScript lpScript=(LPScript)hScript;

    return(lpScript ? lpScript->scriptErrcode : scriptErrcode);
}

HSCRIPT FAR PASCAL _EXPORT initScript(LPCSTR prefix, BOOL bSuspend)
{
    LPScript lpScript=(LPScript)gmalloc(sizeof(Script));
    char fnScript[LEN_PATHNAME+LEN_FILENAME];
    int status=0;
    int nPtr;

    if (!pathSet) {
	char setupIniFile[256];

	GetInitialisationFile(setupIniFile);

	AmGetPrivateProfileString("Directories", "script", "\\ameol\\script",
				  scriptPath, LEN_PATHNAME-1, setupIniFile);

	pathSet=TRUE;
    }

    if (!lpTranslate)
	{
		lpTranslate=(LPSTR)gmalloc(257);
	}

	if (lpTranslate) {

	    for (nPtr=0; nPtr<256; nPtr++)
		lpTranslate[nPtr]=(char)nPtr;

	    lpTranslate['`']='"';
	    lpTranslate[(BYTE)'¬']='\n';
	}

    if (!lpScript || !lpTranslate)
	{
		if (lpScript)
		{
			gfree(lpScript);	lpScript = NULL;
		}

		scriptErrcode=ERR_SCRIPT_MEMORY;
		return(NULL);
    }

    lstrcpy(lpScript->scriptPrefix, prefix);
    lpScript->scriptIndex=0;

    do {
        wsprintf(fnScript, "%s\\%s.%03d", (LPSTR)scriptPath, lpScript->scriptPrefix, lpScript->scriptIndex);
        lpScript->scriptStream=openFile(fnScript, OF_READ);

        if (lpScript->scriptStream)
            closeFile(lpScript->scriptStream);

    } while (lpScript->scriptStream && ++lpScript->scriptIndex<1000);

    if (lpScript->scriptStream)
        status=ERR_SCRIPT_NAME_OVERFLOW;
    else if (!(lpScript->scriptStream=openFile(fnScript, OF_WRITE|OF_CRLFCONVERT)))
        status=ERR_SCRIPT_CREATE;

    if (status)
	{
        scriptErrcode=status;
        gfree(lpScript);	lpScript = NULL;
		return(NULL);
    }
	else
	{
		lpScript->scriptEmpty=TRUE;
		lpScript->scriptSuspend=bSuspend;

		if (bSuspend)
			suspendFile(lpScript->scriptStream);

		return((HSCRIPT)lpScript);
    }
}

LPCSTR FAR PASCAL _EXPORT scriptFile(HSCRIPT hScript, WORD wSelect)
{
    LPScript lpScript=(LPScript)hScript;

    if (!lpScript) {
        scriptErrcode=ERR_SCRIPT_NOT_OPEN;
        return(NULL);
    } else
        switch (wSelect) {

        case 0:
            return(openFileName(lpScript->scriptStream));

        case 1: {
            static char name[13];

            wsprintf(name, "%s.%03d", lpScript->scriptPrefix, lpScript->scriptIndex);
            return(name);
        }

        case 2: {
            static char ext[4];

            wsprintf(ext, "%03d", lpScript->scriptIndex);
            return(ext);
        }

        default:
            return(NULL);

        }

}

int FAR _EXPORT addToScript(HSCRIPT hScript, LPCSTR lpcFormat,...)
{
    LPScript lpScript=(LPScript)hScript;
    int nStatus=0;

    if (!lpScript) {
        scriptErrcode=ERR_SCRIPT_NOT_OPEN;
        return(ERR_SCRIPT_NOT_OPEN);
    }

    if (reopenFile(lpScript->scriptStream))
        nStatus=ERR_SCRIPT_REOPEN;
    else {
        if (!lpFormatBuff) {
            lpFormatBuff=(LPSTR)gmalloc(1024);

            if (!lpFormatBuff)
                nStatus=ERR_SCRIPT_MEMORY;

        }

        if (nStatus==0) {
            va_list args;
            LPSTR lpPtrOut;

            va_start(args, lpcFormat);

            if (lstrcmp(lpcFormat, "%s")==0) {
                LPSTR lpPtrIn=va_arg(args, LPSTR);

                if (!lpPtrIn)
                    nStatus=ERR_SCRIPT_INVALID_ARGUMENT;
                else {
                    for (lpPtrOut=lpFormatBuff;
                         *lpPtrIn;
                         *lpPtrOut++ =lpTranslate[(BYTE)*lpPtrIn++]);

                    *lpPtrOut='\0';
                }
            } else {
                wvsprintf(lpFormatBuff, lpcFormat, args);

                for (lpPtrOut=lpFormatBuff;
                     *lpPtrOut;
                     *lpPtrOut++ =lpTranslate[(BYTE)*lpPtrOut]);

            }

            va_end(args);

            if (nStatus==0) {
                if (writeLine(lpScript->scriptStream, "%s", lpFormatBuff))
                    nStatus=ERR_SCRIPT_WRITE;
                else if (lpScript->scriptEmpty)
                    lpScript->scriptEmpty=FALSE;

            }
        }

        if (lpScript->scriptSuspend)
            if (suspendFile(lpScript->scriptStream))
                if (!nStatus)
                    nStatus=ERR_SCRIPT_SUSPEND;
    }

    if (nStatus)
        lpScript->scriptErrcode=nStatus;

    return(nStatus);
}

HOOB FAR _EXPORT actionScript(HSCRIPT hScript, BYTE byScriptType, LPCSTR lpcFormat,...)
{
    LPScript lpScript=(LPScript)hScript;
    int status=0;
    HOOB hoob=NULL;

    if (!lpScript)
        status=ERR_SCRIPT_NOT_OPEN;
    else if (byScriptType!=OT_INLINE &&
             byScriptType!=OT_INCLUDE &&
             byScriptType!=OT_PREINCLUDE)
	{
        status=ERR_SCRIPT_INVALID_ARGUMENT;
        suspendFile(lpScript->scriptStream);
        _unlink(openFileName(lpScript->scriptStream));
        closeFile(lpScript->scriptStream);
        gfree(lpScript);	lpScript = NULL;
    }
	else if (lpScript->scriptEmpty)
	{
        suspendFile(lpScript->scriptStream);
        _unlink(openFileName(lpScript->scriptStream));
        closeFile(lpScript->scriptStream);
        gfree(lpScript);	lpScript = NULL;
    }
	else
	{
        //  Note that this assumes that INLINEOBJECT and INCLUDEOBJECT are identical...
        va_list args;
        INCLUDEOBJECT io;
        char szDescription[256];
        LPSTR ptr=szDescription;

        InitObject(&io, byScriptType, INCLUDEOBJECT);
        lstrcpy(io.szFileName, openFileName(lpScript->scriptStream));

        ptr+=wsprintf(szDescription, "%s [%03d] - ",
                      lpScript->scriptPrefix, lpScript->scriptIndex);

        va_start(args, lpcFormat);
        wvsprintf(ptr, lpcFormat, args);
        va_end(args);
        szDescription[LEN_DESCRIPTION-1]='\0';
        lstrcpy(io.szDescription, szDescription);
        hoob=PutObject(NULL, &io, NULL);

        if (!hoob)
            status=ERR_SCRIPT_ACTION;

        closeFile(lpScript->scriptStream);
        gfree(lpScript);	lpScript = NULL;
		if(lpTranslate)
		{
			gfree(lpTranslate);	lpTranslate = NULL;
		}
    }

    if (status)
        scriptErrcode=status;

    return(hoob);
}

int FAR PASCAL _EXPORT abandonScript(HSCRIPT hScript)
{
    LPScript lpScript=(LPScript)hScript;

    if (!lpScript) {
        scriptErrcode=ERR_SCRIPT_NOT_OPEN;
        return(ERR_SCRIPT_NOT_OPEN);
    }

    suspendFile(lpScript->scriptStream);
    _unlink(openFileName(lpScript->scriptStream));
    closeFile(lpScript->scriptStream);
    gfree(lpScript);	lpScript = NULL;
	if(lpTranslate)
	{
		gfree(lpTranslate);	lpTranslate = NULL;
	}
    return(0);
}


text:
require 'spec_helper'

describe UKMail::Service::ServiceBase, '#handle_uk_mail_errors' do
  let(:service) { UKMail::Service::ServiceBase.new(nil) }
  let(:response) do
    UKMail::SoapService::Collection::UKMAddCollectionWebResponse.new(errors, nil,nil,nil,nil)
  end
  let(:errors) do
    [ UKMail::SoapService::Collection::UKMWebError.new('1234', 'Error one'),
      UKMail::SoapService::Collection::UKMWebError.new('5678', 'Error two') ]
  end

  subject { service.__send__(:handle_uk_mail_errors, response) }

  it 'raises an exception with all error codes and messages' do
    expect{subject}.to raise_error(UKMail::UKMailError, "1234: Error one\n5678: Error two")
  end
end


text:
import * as Redux from "redux";
import Board from "../../../shared/domain/model/board/Board";
import BoardId from "../../../shared/domain/model/board/BoardId";
import { getState } from "../../../shared/infractructure/persistence/reduxstore/ReduxStore";

export default class KanbanBoardQueryService {

    public viewBoard(boardId: BoardId): Board {
        return getState().boards.find((board: Board) => board.id.equals(boardId));
    }

}

export const kanbanBoardQueryService = new KanbanBoardQueryService();


text:
// Copyright (c) 2016, Danilo Peixoto and Gabriel Gustavo. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
//   list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
//   contributors may be used to endorse or promote products derived from
//   this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "tetrahedralMeshGenerator.h"
#include <vector>
#include <tetgen.h>

VIRGO_NAMESPACE_BEGIN

using namespace std;

TetrahedralMeshGenerator::TetrahedralMeshGenerator() {}
TetrahedralMeshGenerator::~TetrahedralMeshGenerator() {}

void TetrahedralMeshGenerator::tetrahedralizeMesh(Geometry * geometry, size_t index,
    float radiusEdgeRatio) const {
    Mesh * mesh = geometry->getMeshByIndex(index);

    if (mesh == nullptr)
        return;

    vector<Vector *> points;
    vector<Triangle *> triangles;

    geometry->getMeshDataByIndex(index, points, triangles);

    size_t offset = geometry->getVertexCount();

    tetgenio * input = new tetgenio;
    tetgenio * output = new tetgenio;

    input->firstnumber = 1;
    output->firstnumber = 1;

    tetgenio::facet * facet = nullptr;
    tetgenio::polygon * polygon = nullptr;

    tetgenbehavior behavior;
    behavior.plc = 1;
    behavior.quality = 1;
    behavior.order = 0;
    behavior.facesout = 1;
    behavior.quiet = 1;
    behavior.minratio = radiusEdgeRatio;

    input->numberofpoints = (int)points.size();
    input->pointlist = new double[input->numberofpoints * 3];

    for (int i = 0; i < input->numberofpoints; i++) {
        input->pointlist[i * 3] = points[i]->x;
        input->pointlist[i * 3 + 1] = points[i]->y;
        input->pointlist[i * 3 + 2] = points[i]->z;
    }

    input->numberoffacets = (int)triangles.size();
    input->facetlist = new tetgenio::facet[input->numberoffacets];

    for (int i = 0; i < input->numberoffacets; i++) {
        facet = &input->facetlist[i];
        facet->numberofpolygons = 1;
        facet->polygonlist = new tetgenio::polygon[facet->numberofpolygons];
        facet->numberofholes = 0;
        facet->holelist = nullptr;

        polygon = &facet->polygonlist[0];
        polygon->numberofvertices = 3;
        polygon->vertexlist = new int[polygon->numberofvertices];
        polygon->vertexlist[0] = (int)triangles[i]->v1;
        polygon->vertexlist[1] = (int)triangles[i]->v2;
        polygon->vertexlist[2] = (int)triangles[i]->v3;
    }

    for (size_t i = 0; i < points.size(); i++) {
        if (points[i] != nullptr)
            delete points[i];
    }

    for (size_t i = 0; i < triangles.size(); i++) {
        if (triangles[i] != nullptr)
            delete triangles[i];
    }

    points.clear();
    triangles.clear();

    for (size_t i = 0; i < mesh->triangles.size(); i++) {
        if (mesh->triangles[i] != nullptr)
            delete mesh->triangles[i];
    }

    mesh->triangles.clear();

    tetrahedralize(&behavior, input, output);

    Vector * point = nullptr;
    Triangle * triangle = nullptr;

    for (int i = 0; i < output->numberofpoints; i++) {
        point = new Vector;

        point->x = output->pointlist[i * 3];
        point->y = output->pointlist[i * 3 + 1];
        point->z = output->pointlist[i * 3 + 2];

        geometry->points.push_back(point);
    }

    for (int i = 0; i < output->numberoftrifaces; i++) {
        triangle = new Triangle;

        triangle->v1 = (size_t)output->trifacelist[i * 3 + 2] + offset;
        triangle->v2 = (size_t)output->trifacelist[i * 3 + 1] + offset;
        triangle->v3 = (size_t)output->trifacelist[i * 3] + offset;

        mesh->triangles.push_back(triangle);
    }

    delete input;
    delete output;
}

VIRGO_NAMESPACE_END


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.camunda.bpm.example</groupId>
  <artifactId>external-task-worker-process</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <packaging>war</packaging>

  <name>External Task Worker Process</name>
  <description>An example on using a BPMN process as an External Task Worker for [Camunda BPM](http://docs.camunda.org). [The project has been generated by the Maven archetype 'camunda-archetype-servlet-war-7.10.1-SNAPSHOT']</description>

  <properties>
    <camunda.version>7.11.0</camunda.version>
    <!--
    Adjust if you want to use Camunda Enterprise Edition (EE):
    <camunda.version>7.11.0-ee</camunda.version>
    Make sure you also switch to EE repository below
    -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <failOnMissingWebXml>false</failOnMissingWebXml>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-bom</artifactId>
        <version>${camunda.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <!-- process engine, needs to be 'provided' because it's already a shared library in the container -->
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <!-- AssertJ Testing Library -->
      <groupId>org.camunda.bpm.extension</groupId>
      <artifactId>camunda-bpm-assert</artifactId>
      <version>1.2</version>
      <scope>test</scope>
    </dependency>

    <!-- Required to use Spin dataformat support in unit tests -->
    <dependency>
      <groupId>org.camunda.spin</groupId>
      <artifactId>camunda-spin-dataformat-all</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine-plugin-spin</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Required to use Templates in unit tests -->
    <dependency>
      <groupId>org.camunda.template-engines</groupId>
      <artifactId>camunda-template-engines-freemarker</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.template-engines</groupId>
      <artifactId>camunda-template-engines-velocity</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- Needed for InMemoryH2Test -->
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.4.197</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- Used to generate test coverage reports, see https://github.com/camunda/camunda-consulting/tree/master/snippets/camunda-bpm-process-test-coverage -->
      <groupId>org.camunda.bpm.extension</groupId>
      <artifactId>camunda-bpm-process-test-coverage</artifactId>
      <version>0.3.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- use logback as logger -->
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.1.3</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <!-- apache commons logging => slf4j -->
      <artifactId>jcl-over-slf4j</artifactId>
      <version>1.7.25</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!--  java util logging => slf4j -->
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <version>1.7.25</version>
      <scope>test</scope>
    </dependency>

    <!-- Add your own dependencies here, if in compile scope, they are added to the war -->

  </dependencies>

  <repositories>
    <repository>
      <id>camunda-bpm-nexus</id>
      <name>Camunda Maven Repository</name>
      <url>https://app.camunda.com/nexus/content/groups/public</url>
    </repository>
    <!-- enable this for EE dependencies (requires credentials in ~/.m2/settings.xml)
    <repository>
      <id>camunda-bpm-nexus-ee</id>
      <name>Camunda Enterprise Maven Repository</name>
      <url>https://app.camunda.com/nexus/content/repositories/camunda-bpm-ee</url>
    </repository>
    -->
  </repositories>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <!-- Deploy to Tomcat using: mvn clean package antrun:run
             Follow the instructions in build.properties.example to make it work!-->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <configuration>
          <tasks>
            <ant antfile="${basedir}/build.xml">
              <target name="copy.war.into.tomcat" />
            </ant>
          </tasks>
        </configuration>
      </plugin>
      <!-- Tomcat Maven Plugin

      Deploy to Tomcat using:
      mvn clean tomcat7:deploy

      Redeploy:
      mvn clean tomcat7:redeploy

      Undeploy:
      mvn tomcat7:undeploy

           To use this plugin, add these lines to your tomcat-users.xml: (inside the <tomcat-users>-tag)
           <role rolename="manager-script"/>
           <user username="admin" password="admin" roles="manager-script"/>

       -->
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <url>http://localhost:8080/manager/text</url>
          <username>admin</username>
          <password>admin</password>
        </configuration>
      </plugin>
      <plugin>
        <!-- Deploy to JBoss AS7: mvn clean jboss-as:deploy See also: https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html -->
        <groupId>org.jboss.as.plugins</groupId>
        <artifactId>jboss-as-maven-plugin</artifactId>
        <version>7.9.Final</version>
      </plugin>
      <plugin>
        <!-- Deploy to Wildfly: mvn clean wildfly:deploy See also: https://docs.jboss.org/wildfly/plugins/maven/latest/examples/deployment-example.html -->
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin</artifactId>
        <version>2.0.1.Final</version>
      </plugin>
    </plugins>
  </build>
</project>


text:
layout: post
title: 简历
description: "以梦为马"
tags: [sample post]
image:
  background: triangular.png

---

<figure class="half">
	<img src="/images/image-filename-1.jpg" alt="">

</figure>


text:
using System.Collections.Generic;
using CallrApi.Exception;
using CallrApi.Objects;

namespace CallrApi.Helper
{
    /// <summary>
    /// This class allows you to create a dictonary of objects in their internal types.
    /// </summary>
    /// <typeparam name="K">The dictionary key type (must be string or int).</typeparam>
    /// <typeparam name="T">The dictionary value type.</typeparam>
    internal class DictionaryCreator<K, T>
        where T : BaseClass, new()
    {
        /// <summary>
        /// This method returns an object value dictionary casted in the expected type.
        /// </summary>
        /// <param name="obj">Object to cast.</param>
        /// <param name="property">Property name (used in case of error).</param>
        /// <returns>A dictionary of key/value pairs of type K/T corresponding to the key associted value, otherwise the Dictionary with key / value pairs K / T type default value.</returns>
        public static Dictionary<K, T> Object(object obj, string property)
        {
            Dictionary<K, T> obj_dico = default(Dictionary<K, T>);
            if (obj != null)
            {
                if (obj.GetType() != typeof(Dictionary<string, object>))
                    throw new LocalApiException(string.Format("The '{0}' type of '{1}' property does not match the expected 'Dictionary<string, object>' type.", obj.GetType(), property));
                obj_dico = new Dictionary<K, T>();
                T new_obj;
                foreach (KeyValuePair<string, object> obj_loop in (Dictionary<string, object>)obj)
                {
                    new_obj = Helper.Creator<T>.Object(obj_loop.Value, string.Format("{0} (iteration)", property));
                    if (new_obj != null)
                        obj_dico.Add(Converter<K>.ToObject(obj_loop.Key, "key"), new_obj);
                }
            }
            return obj_dico;
        }
    }
}


text:
package com.getbase.android.autoprovider;

import com.google.common.collect.Lists;

import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;

public class DelegatingContentUriHandler implements ContentUriHandler {
  private final LinkedList<ContentUriHandler> mHandlers = Lists.newLinkedList();

  private ContentUriHandler getHandler(Uri uri, ContentUriAction action) {
    return getContentUriHandler(mHandlers.iterator(), uri, action);
  }

  private ContentUriHandler getContentUriHandler(Iterator<ContentUriHandler> iterator, Uri uri, ContentUriAction action) {
    while (iterator.hasNext()) {
      ContentUriHandler handler = iterator.next();
      if (handler.canHandle(uri, action)) {
        return handler;
      }
    }

    return null;
  }

  public void addHandlers(ContentUriHandler... handlers) {
    Collections.addAll(mHandlers, handlers);
  }

  public ContentUriHandler getDelegateHandler(Uri uri, ContentUriAction action, ContentUriHandler skipPast) {
    return getContentUriHandler(Utils.advancePast(mHandlers.iterator(), skipPast), uri, action);
  }

  @Override
  public boolean canHandle(Uri uri, ContentUriAction action) {
    return getHandler(uri, action) != null;
  }

  @Override
  public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    return getHandler(uri, ContentUriAction.QUERY).query(uri, projection, selection, selectionArgs, sortOrder);
  }

  @Override
  public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    return getHandler(uri, ContentUriAction.UPDATE).update(uri, values, selection, selectionArgs);
  }

  @Override
  public Uri insert(Uri uri, ContentValues values) {
    return getHandler(uri, ContentUriAction.INSERT).insert(uri, values);
  }

  @Override
  public int delete(Uri uri, String selection, String[] selectionArgs) {
    return getHandler(uri, ContentUriAction.DELETE).delete(uri, selection, selectionArgs);
  }

  @Override
  public String getType(Uri uri) {
    return getHandler(uri, ContentUriAction.GET_TYPE).getType(uri);
  }
}


text:
package com.hctrom.romcontrol.logcat.reader;

import android.os.AsyncTask;

import com.hctrom.romcontrol.logcat.util.UtilLogger;

import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * Combines multipe buffered readers into a single reader that merges all input synchronously.
 * @author nolan
 *
 */
public class MultipleLogcatReader extends AbsLogcatReader {

	private static UtilLogger log = new UtilLogger(MultipleLogcatReader.class);

	private static final String DUMMY_NULL = new String("");

	private List<ReaderThread> readerThreads = new LinkedList<ReaderThread>();
	private BlockingQueue<String> queue = new ArrayBlockingQueue<String>(1);

	public MultipleLogcatReader(boolean recordingMode,
			Map<String,String> lastLines) throws IOException {
		super(recordingMode);
		// read from all three buffers at once
		for (Entry<String,String> entry : lastLines.entrySet()) {
			String logBuffer = entry.getKey();
			String lastLine = entry.getValue();
			ReaderThread readerThread = new ReaderThread(logBuffer, lastLine);
			readerThread.start();
			readerThreads.add(readerThread);
		}
	}

	public String readLine() throws IOException {

		try {
			String value = queue.take();
			if (value != DUMMY_NULL) {
				return value;
			}
		} catch (InterruptedException e) {
			log.d(e, "");
		}
		return null;
	}

	@Override
	public boolean readyToRecord() {
		for (ReaderThread thread : readerThreads) {
			if (!thread.reader.readyToRecord()) {
				return false;
			}
		}
		return true;
	}

	@Override
	public void killQuietly() {
		for (ReaderThread thread : readerThreads) {
			thread.killed = true;
		}

		// do in background, because otherwise we might hang
		new AsyncTask<Void, Void, Void>(){

			@Override
			protected Void doInBackground(Void... params) {
				for (ReaderThread thread : readerThreads) {
					thread.reader.killQuietly();
				}
				queue.offer(DUMMY_NULL);
				return null;
			}
		}.execute((Void)null);
	}

	@Override
	public List<Process> getProcesses() {
		List<Process> result = new ArrayList<Process>();
		for (ReaderThread thread : readerThreads) {
			result.addAll(thread.reader.getProcesses());
		}
		return result;
	}

	private class ReaderThread extends Thread {

		SingleLogcatReader reader;

		private boolean killed;

		public ReaderThread(String logBuffer, String lastLine) throws IOException {
			this.reader = new SingleLogcatReader(recordingMode, logBuffer, lastLine);
		}

		@Override
		public void run() {
			String line;

			try {
				while (!killed && (line = reader.readLine()) != null && !killed) {
					queue.put(line);
				}
			} catch (IOException e) {
				log.d(e, "exception");
			} catch (InterruptedException e) {
				log.d(e, "exception");
			}
			log.d("thread died");
		}
	}
}


text:
package com.hz.pet.bexchange;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = BexchangeApplication.class)
@WebAppConfiguration
public class BexchangeApplicationTests {

	@Test
	public void contextLoads() {
	}

}


text:
var AphinityValidationRule=
{
    setValidationRule:function()
    {
        this.sizeInvCompEvent();
        this.pathologicalStageEvent();
        this.IHCPositivityEvent();
    },

    displayMessageIfNotValidPatternAndReturnFlag:function(CutoffValue,message)
    {
        if (CutoffValue.isValidPattern())
            return true;
        else
        {
            return false;
        }
    },

    displayAllWarningMessage:function()
    {
      this.pathologicalStageBusiness();
      this.sizeInvCompBusiness();
      this.IHCPositivityBusiness();
    },
    pathologicalStageEvent:function()
    {
        $(AphinityToolTip.tips.pathologicalStage.id).change(function()
        {
               AphinityValidationRule.pathologicalStageBusiness();
        });
    },

    pathologicalStageBusiness:function()
    {
        try
        {
            var pathologicalStage=$(AphinityToolTip.tips.pathologicalStage.id).val();
            if (pathologicalStage== "Stage IIIB")
                AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.pathologicalStage.id,AphinityToolTip.tips.pathologicalStage.classID,AphinityToolTip.tips.pathologicalStage.warningMessageIIIB);
            else
                AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.pathologicalStage.classID);
        }
        catch (err)
        {

        }
    },

    sizeInvCompEvent:function()
    {
        $(AphinityToolTip.tips.sizeInvComp.id).focusout(function()
        {
           AphinityValidationRule.sizeInvCompBusiness();
        });
    },

    sizeInvCompBusiness:function()
    {
        try
        {
            var sizeInvComp=$(AphinityToolTip.tips.sizeInvComp.id).val();
            var val=parseFloat(sizeInvComp);
            if (val<0)
                AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.sizeInvComp.id,AphinityToolTip.tips.sizeInvComp.classID,AphinityToolTip.tips.sizeInvComp.warningMessageSizeBelow0);
            else if (val >50)
                AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.sizeInvComp.id,AphinityToolTip.tips.sizeInvComp.classID,AphinityToolTip.tips.sizeInvComp.warningMessageSizeGreater50);
            else
                AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.sizeInvComp.classID);
        }
        catch(err)
        {

        }
    },

    IHCPositivityEvent:function()
    {
        $(AphinityToolTip.tips.IHCCellPos.id).focusout(function()
        {
            AphinityValidationRule.IHCPositivityBusiness();
        });
    },

    IHCPositivityBusiness:function()
    {
        try
        {
            var IHCLocalGuidelines = $("#AphinityLocalForm_IHCLocalGuidelines").find("option:selected").val();
            var IHCPositivity=$("#AphinityLocalForm_IHCPositivity").find(":checked").val();
            IHCLocalGuidelines=IHCLocalGuidelines.toUpperCase();
            IHCPositivity=IHCPositivity.toUpperCase();
            var value=$(AphinityToolTip.tips.IHCCellPos.id).val();
            if (value)
            {
                CutoffValue.setValue(value);
                if (IHCPositivity.indexOf("ASCO/CAP")!==-1)
                {
                    if (IHCLocalGuidelines.indexOf("NEGATIVE")!==-1)
                    {
                        if (CutoffValue.convertCutOffValue()>30)
                             AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.IHCCellPos.id, AphinityToolTip.tips.IHCCellPos.classID, AphinityToolTip.tips.IHCCellPos.warningMessageAsco);
                        else
                             AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.IHCCellPos.classID);
                    }
                    else if (IHCLocalGuidelines.indexOf("POSITIVE")!==-1)
                    {
                        if (CutoffValue.convertCutOffValue()<30)
                             AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.IHCCellPos.id, AphinityToolTip.tips.IHCCellPos.classID, AphinityToolTip.tips.IHCCellPos.warningMessageAsco);
                         else
                             AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.IHCCellPos.classID);
                    }
                    else;
                }
                else if (IHCPositivity.indexOf("APPROVED LABEL")!==-1)
                {
                    if (IHCLocalGuidelines.indexOf("NEGATIVE")!==-1 )
                    {
                        if (CutoffValue.convertCutOffValue()>10)
                             AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.IHCCellPos.id, AphinityToolTip.tips.IHCCellPos.classID, AphinityToolTip.tips.IHCCellPos.warningMessageApprovedLabel);
                         else
                             AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.IHCCellPos.classID);
                    }

                    else if (IHCLocalGuidelines.indexOf("POSITIVE")!==-1)
                    {
                        if (CutoffValue.convertCutOffValue()<10)
                             AphinityToolTip.displayWarningMessage(AphinityToolTip.tips.IHCCellPos.id, AphinityToolTip.tips.IHCCellPos.classID, AphinityToolTip.tips.IHCCellPos.warningMessageApprovedLabel);
                         else
                             AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.IHCCellPos.classID);
                    }
                    else;
                }
                else
                    AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.IHCCellPos.classID);
            }
            else
                AphinityToolTip.removeWarningMessage(AphinityToolTip.tips.IHCCellPos.classID);
        }
        catch (err)
        {

        }

    }
}


text:
package commandGenerator.gui.helper.components.spinner;

import commandGenerator.gui.helper.components.icomponent.ISpin;

@SuppressWarnings("serial")
public class CSpinner extends BaseSpinner
{
	private int min, max;

	public CSpinner(int min, int max, ISpin parent)
	{
		super(min, max, parent);
	}

	public int getMin()
	{
		return this.min;
	}

	public int getMax()
	{
		return this.max;
	}

	public void setValues(int min, int max)
	{
		this.min = min;
		this.max = max;
		int value = (int) this.getValue();
		super.setValues(min, max);
		if (value >= this.min && value <= this.max) this.setValue(value);
	}

}


text:
class Point
{
   private:

     public:
     int x;
     int y;
     Point();
     Point(int, int);
     ~Point();
     friend std::ostream& operator << (std::ostream&, Point&);

     void *operator new(size_t , void*);
     void *operator new(size_t);
     void operator delete(void *);

};


text:
package com.example.myaddon;

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class MyAddonServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");
		resp.getWriter().println("Hello, world");
	}
}


text:
package com.adenops.moustack.agent.model.openstack.keystone;

import com.adenops.moustack.agent.model.openstack.OSEntity;

public class User extends OSEntity {
	// TODO: should be configurable
	public static final String DEFAULT_DOMAIN_ID = "default";
	private String name;
	private String description;
	private String email;
	private String password;
	private String default_project_id;
	private String domain_id = DEFAULT_DOMAIN_ID;
	private boolean enabled = true;

	public User() {
	}

	public User(String name, String description, String email, String password, String default_project_id,
			String domain_id) {
		this.name = name;
		this.description = description;
		this.email = email;
		this.password = password;
		this.default_project_id = default_project_id;
		this.domain_id = domain_id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDomain_id() {
		return domain_id;
	}

	public void setDomain_id(String domain_id) {
		this.domain_id = domain_id;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getDefault_project_id() {
		return default_project_id;
	}

	public void setDefault_project_id(String default_project_id) {
		this.default_project_id = default_project_id;
	}
}


text:
package io.github.bonigarcia;

import static java.util.concurrent.TimeUnit.MILLISECONDS;

import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;

public class TestRuleTimeout {

    @Rule
    public Timeout globalTimeout = new Timeout(100, MILLISECONDS);

    @Ignore
    @Test
    public void testInfiniteLoop() {
        while (true)
            ;
    }

    @Test
    public void testDoNothing() {
    }
}


text:
import { EventStream, default as Observable, Property } from "./observable";
/** @hidden */
export declare function holdWhen<V>(src: Observable<V>, valve: Property<boolean>): EventStream<V>;


text:
document.addEventListener("DOMContentLoaded", () => {
  "use strict";

  const root = (() => {
    if ("scrollingElement" in document) return document.scrollingElement;
    const html = document.documentElement;
    const start = html.scrollTop;
    html.scrollTop = start + 1;
    const end = html.scrollTop;
    html.scrollTop = start;
    return end > start ? html : document.body;
  })();

  const ease = (duration, elapsed, start, end) =>
    Math.round(end * (-Math.pow(2, -10 * elapsed/duration) + 1) + start);

  const getCoordinates = hash => {
    const start = root.scrollTop;
    const delta = (() => {
      if (hash.length < 2) return -start;
      const target = document.querySelector(hash);
      if (!target) return;
      const top = target.getBoundingClientRect().top;
      const max = root.scrollHeight - window.innerHeight;
      return start + top < max ? top : max - start;
    })();
    if (delta) return new Map([["start", start], ["delta", delta]]);
  };

  const scroll = link => {
    const hash = link.getAttribute("href");
    const coordinates = getCoordinates(hash);
    if (!coordinates) return;

    const tick = timestamp => {
      progress.set("elapsed", timestamp - start);
      root.scrollTop = ease(...progress.values(), ...coordinates.values());
      progress.get("elapsed") < progress.get("duration")
      ? requestAnimationFrame(tick)
      : complete(hash, coordinates);
    };

    const progress = new Map([["duration", 800]]);
    const start = performance.now();
    requestAnimationFrame(tick);
  };

  const complete = (hash, coordinates) => {
    history.pushState(null, null, hash);
    root.scrollTop = coordinates.get("start") + coordinates.get("delta");
  };

  const attachHandler = (links, index) => {
    const link = links.item(index);
    link.addEventListener("click", event => {
      // event.preventDefault();
      scroll(link);
    });
    if (index) return attachHandler(links, index - 1);
  };

  const links = document.querySelectorAll("a.scroll");
  const last = links.length - 1;
  if (last < 0) return;
  attachHandler(links, last);
});


text:
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0">
    <title>
        {% if page.title %}{{ page.title | escape }}
        {% else %}{{ site.title | escape }}{% endif %}
    </title>
  <link rel="stylesheet" href="{{ site.baseurl }}/css/main.css">
    <script src="{{ site.baseurl }}/js/jquery.min.js"></script>
    <script src="{{ site.baseurl }}/js/ios7.js"></script>
    <script src="{{ site.baseurl }}/js/main.js"></script>
</head>


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WorkbenchItemRepository.cs" company="None">
//   None
// </copyright>
// <summary>
//   Defines the WorkbenchItemRepository type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace TfsWorkbench.Core.Services
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;

    using TfsWorkbench.Core.EventArgObjects;
    using TfsWorkbench.Core.Helpers;
    using TfsWorkbench.Core.Interfaces;

    /// <summary>
    /// The workbench item repository.
    /// </summary>
    internal class WorkbenchItemRepository : IWorkbenchItemRepository
    {
        private readonly IFilterService filterService;

        /// <summary>
        /// The workbench item collection.
        /// </summary>
        private readonly Collection<IWorkbenchItem> workbenchItemCollection = new Collection<IWorkbenchItem>();

        /// <summary>
        /// Initializes a new instance of the <see cref="WorkbenchItemRepository"/> class.
        /// </summary>
        public WorkbenchItemRepository()
            : this(ServiceManager.Instance.GetService<ILinkManagerService>(), ServiceManager.Instance.GetService<IFilterService>())
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="WorkbenchItemRepository"/> class.
        /// </summary>
        /// <param name="linkManagerService">The link manager service.</param>
        /// <param name="filterService">The filter service.</param>
        public WorkbenchItemRepository(ILinkManagerService linkManagerService, IFilterService filterService)
        {
            if (linkManagerService == null)
            {
                throw new ArgumentNullException("linkManagerService");
            }
            if (filterService == null)
            {
                throw new ArgumentNullException("filterService");
            }

            this.filterService = filterService;

            linkManagerService.LinkAdded += this.OnLinkAdded;
            linkManagerService.LinkRemoved += this.OnLinkRemoved;
            this.filterService.FiltersChanged += this.OnFiltersChanged;
        }

        /// <summary>
        /// Occurs when [link change].
        /// </summary>
        public event EventHandler<ItemLinkChangeEventArgs> LinkChanged;

        /// <summary>
        /// Occurs when [item state changed].
        /// </summary>
        public event EventHandler<ItemStateChangeEventArgs> ItemStateChanged;

        /// <summary>
        /// Occurs when [filters changed].
        /// </summary>
        public event EventHandler FiltersChanged;

        /// <summary>
        /// Occurs when the collection changes.
        /// </summary>
        public event EventHandler<RepositoryChangedEventArgs<IWorkbenchItem>> CollectionChanged;

        /// <summary>
        /// Gets the unfiltered workbench items.
        /// </summary>
        /// <value>The unfiltered workbench items.</value>
        public IEnumerable<IWorkbenchItem> UnfilteredList
        {
            get
            {
                return this.workbenchItemCollection;
            }
        }

        /// <summary>
        /// Adds the specified workbench item.
        /// </summary>
        /// <param name="workbenchItem">The workbench item.</param>
        /// <exception cref="ArgumentNullException" />
        public void Add(IWorkbenchItem workbenchItem)
        {
            if (workbenchItem == null)
            {
                throw new ArgumentNullException("workbenchItem");
            }

            if (this.TryAddWorkbenchItem(workbenchItem) && this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new RepositoryChangedEventArgs<IWorkbenchItem>(ChangeActionOption.Add, new[] { workbenchItem }));
            }
        }

        /// <summary>
        /// Adds the range.
        /// </summary>
        /// <param name="workbenchItems">The workbench items.</param>
        /// <exception cref="ArgumentNullException" />
        public void AddRange(IEnumerable<IWorkbenchItem> workbenchItems)
        {
            if (workbenchItems == null)
            {
                throw new ArgumentNullException("workbenchItems");
            }

            var addedItems = workbenchItems.Where(this.TryAddWorkbenchItem).ToArray();

            if (addedItems.Any() && this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new RepositoryChangedEventArgs<IWorkbenchItem>(ChangeActionOption.Add, addedItems));
            }
        }

        /// <summary>
        /// Removes the specified workbench item.
        /// </summary>
        /// <param name="workbenchItem">The workbench item.</param>
        /// <exception cref="ArgumentNullException" />
        public void Remove(IWorkbenchItem workbenchItem)
        {
            if (workbenchItem == null)
            {
                throw new ArgumentNullException("workbenchItem");
            }

            if (this.TryRemoveWorkbenchItem(workbenchItem) && this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new RepositoryChangedEventArgs<IWorkbenchItem>(ChangeActionOption.Remove, new[] { workbenchItem }));
            }

            ReleaseWorkbenchItemResources(workbenchItem);
        }

        /// <summary>
        /// Removes the range.
        /// </summary>
        /// <param name="workbenchItems">The workbench items.</param>
        /// <exception cref="ArgumentNullException" />
        public void RemoveRange(IEnumerable<IWorkbenchItem> workbenchItems)
        {
            if (workbenchItems == null)
            {
                throw new ArgumentNullException("workbenchItems");
            }

            var removedItems = workbenchItems.Where(this.TryRemoveWorkbenchItem).ToArray();

            if (removedItems.Any() && this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new RepositoryChangedEventArgs<IWorkbenchItem>(ChangeActionOption.Remove, removedItems));
            }

            ReleaseWorkbenchItemResources(workbenchItems);
        }

        /// <summary>
        /// Clears this instance.
        /// </summary>
        public void Clear()
        {
            var clearedItems = this.workbenchItemCollection.ToArray();

            this.workbenchItemCollection.Clear();

            foreach (var workbenchItem in clearedItems)
            {
                workbenchItem.StateChanged -= this.OnItemStateChanged;
            }

            if (this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new RepositoryChangedEventArgs<IWorkbenchItem>(ChangeActionOption.Clear, clearedItems));
            }

            ReleaseWorkbenchItemResources(clearedItems);
        }

        /// <summary>
        /// Returns an enumerator that iterates through the collection.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
        /// </returns>
        /// <filterpriority>1</filterpriority>
        public IEnumerator<IWorkbenchItem> GetEnumerator()
        {
            return this.filterService.HasFilter
                ? this.filterService.ApplyFilter(this.workbenchItemCollection).GetEnumerator()
                : this.workbenchItemCollection.GetEnumerator();
        }

        /// <summary>
        /// Returns an enumerator that iterates through a collection.
        /// </summary>
        /// <returns>
        /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this.GetEnumerator();
        }

        /// <summary>
        /// Called when [refresh collection].
        /// </summary>
        public void OnRefreshCollection()
        {
            if (this.CollectionChanged == null)
            {
                return;
            }

            this.CollectionChanged(this, new RepositoryChangedEventArgs<IWorkbenchItem>(ChangeActionOption.Refresh, this));
        }

        /// <summary>
        /// Called when [workbench item state changed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="TfsWorkbench.Core.EventArgObjects.ItemStateChangeEventArgs"/> instance containing the event data.</param>
        public void OnItemStateChanged(object sender, ItemStateChangeEventArgs e)
        {
            if (this.ItemStateChanged == null)
            {
                return;
            }

            this.ItemStateChanged(sender, e);
        }

        /// <summary>
        /// Releases the workbench item resources.
        /// </summary>
        /// <param name="workbenchItem">The workbench item.</param>
        private static void ReleaseWorkbenchItemResources(IWorkbenchItem workbenchItem)
        {
            // Destroy any existing links.
            workbenchItem.ClearLinks();

            // Kill the referenced resources.
            workbenchItem.ReleaseResources();
        }

        /// <summary>
        /// Releases the workbench item resources.
        /// </summary>
        /// <param name="workbenchItems">The workbench items.</param>
        private static void ReleaseWorkbenchItemResources(IEnumerable<IWorkbenchItem> workbenchItems)
        {
            foreach (var workbenchItem in workbenchItems)
            {
                ReleaseWorkbenchItemResources(workbenchItem);
            }
        }

        /// <summary>
        /// Called when [link added].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="TfsWorkbench.Core.EventArgObjects.LinkChangeEventArgs"/> instance containing the event data.</param>
        private void OnLinkAdded(object sender, LinkChangeEventArgs e)
        {
            if (this.LinkChanged == null)
            {
                return;
            }

            this.LinkChanged(this, new ItemLinkChangeEventArgs(e.Context.Parent, null, e.Context));
        }

        /// <summary>
        /// Called when [link removed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="TfsWorkbench.Core.EventArgObjects.LinkChangeEventArgs"/> instance containing the event data.</param>
        private void OnLinkRemoved(object sender, LinkChangeEventArgs e)
        {
            if (this.LinkChanged == null)
            {
                return;
            }

            this.LinkChanged(this, new ItemLinkChangeEventArgs(e.Context.Parent, e.Context, null));
        }

        /// <summary>
        /// Called when [filters changed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OnFiltersChanged(object sender, EventArgs e)
        {
            this.OnRefreshCollection();

            if (this.FiltersChanged != null)
            {
                this.FiltersChanged(sender, e);
            }
        }

        /// <summary>
        /// Tries to add the specified workbench item.
        /// </summary>
        /// <param name="workbenchItem">The workbench item.</param>
        /// <returns><c>True</c> if the item is added; otherwise <c>false</c>.</returns>
        private bool TryAddWorkbenchItem(IWorkbenchItem workbenchItem)
        {
            if (this.workbenchItemCollection.Contains(workbenchItem))
            {
                return false;
            }

            workbenchItem.StateChanged += this.OnItemStateChanged;

            this.workbenchItemCollection.Add(workbenchItem);

            return true;
        }

        /// <summary>
        /// Tries to remove the specified workbench item.
        /// </summary>
        /// <param name="workbenchItem">The workbench item.</param>
        /// <returns><c>True</c> if the item is removed; otherwise <c>false</c>.</returns>
        private bool TryRemoveWorkbenchItem(IWorkbenchItem workbenchItem)
        {
            if (!this.workbenchItemCollection.Contains(workbenchItem))
            {
                return false;
            }

            workbenchItem.StateChanged -= this.OnItemStateChanged;

            this.workbenchItemCollection.Remove(workbenchItem);

            return true;
        }
    }
}


text:
<?php

namespace Magento\Store\Test\Constraint;

use Magento\Backend\Test\Page\Adminhtml\StoreIndex;
use Magento\Mtf\Constraint\AbstractConstraint;

/**
 * Class AssertWebsiteSuccessDeleteMessage
 * Assert that after website delete successful message appears
 */
class AssertWebsiteSuccessDeleteMessage extends AbstractConstraint
{
    /**
     * Success website delete message
     */
    const SUCCESS_DELETE_MESSAGE = 'You deleted the website.';

    /**
     * Assert that success message is displayed after deleting website
     *
     * @param StoreIndex $storeIndex
     * @return void
     */
    public function processAssert(StoreIndex $storeIndex)
    {
        \PHPUnit_Framework_Assert::assertEquals(
            self::SUCCESS_DELETE_MESSAGE,
            $storeIndex->getMessagesBlock()->getSuccessMessage(),
            'Wrong success delete message is displayed.'
        );
    }

    /**
     * Returns a string representation of the object
     *
     * @return string
     */
    public function toString()
    {
        return 'Website success delete message is present.';
    }
}


text:
package co.cask.cdap.data2.dataset2.lib.kv;

import co.cask.cdap.api.common.Bytes;
import co.cask.cdap.api.dataset.DatasetAdmin;
import co.cask.cdap.api.dataset.DatasetContext;
import co.cask.cdap.api.dataset.DatasetProperties;
import co.cask.cdap.api.dataset.DatasetSpecification;
import co.cask.cdap.api.dataset.lib.AbstractDatasetDefinition;
import co.cask.cdap.api.dataset.module.DatasetDefinitionRegistry;
import co.cask.cdap.api.dataset.module.DatasetModule;
import co.cask.cdap.common.conf.CConfiguration;
import co.cask.cdap.data2.util.TableId;
import co.cask.cdap.data2.util.hbase.HBaseTableUtil;
import co.cask.cdap.data2.util.hbase.HTableDescriptorBuilder;
import com.google.common.base.Throwables;
import com.google.inject.Inject;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;

import java.io.IOException;
import java.util.Map;
import javax.annotation.Nullable;

/**
 * Simple implementation of hbase non-tx {@link NoTxKeyValueTable}.
 */
public class HBaseKVTableDefinition extends AbstractDatasetDefinition<NoTxKeyValueTable, DatasetAdmin> {
  private static final byte[] DATA_COLUMN_FAMILY = Bytes.toBytes("d");

  @Inject
  private CConfiguration cConf;
  @Inject
  private Configuration hConf;
  @Inject
  private HBaseTableUtil tableUtil;

  public HBaseKVTableDefinition(String name) {
    super(name);
  }

  @Override
  public DatasetSpecification configure(String instanceName, DatasetProperties properties) {
    return DatasetSpecification.builder(instanceName, getName())
      .properties(properties.getProperties())
      .build();
  }

  @Override
  public DatasetAdmin getAdmin(DatasetContext datasetContext, DatasetSpecification spec,
                               ClassLoader classLoader) throws IOException {
    return new DatasetAdminImpl(datasetContext, spec.getName(), tableUtil, hConf);
  }

  @Override
  public NoTxKeyValueTable getDataset(DatasetContext datasetContext, DatasetSpecification spec,
                                      Map<String, String> arguments, ClassLoader classLoader) throws IOException {
    return new KVTableImpl(datasetContext, spec.getName(), cConf, hConf, tableUtil);
  }

  private static final class DatasetAdminImpl implements DatasetAdmin {
    private final TableId tableId;
    protected final HBaseAdmin admin;
    protected final HBaseTableUtil tableUtil;

    private DatasetAdminImpl(DatasetContext datasetContext, String tableName, HBaseTableUtil tableUtil,
                             Configuration hConf) throws IOException {
      this.admin = new HBaseAdmin(hConf);
      this.tableUtil = tableUtil;
      this.tableId = TableId.from(datasetContext.getNamespaceId(), tableName);
    }

    @Override
    public boolean exists() throws IOException {
      return tableUtil.tableExists(admin, tableId);
    }

    @Override
    public void create() throws IOException {
      HColumnDescriptor columnDescriptor = new HColumnDescriptor(DATA_COLUMN_FAMILY);
      columnDescriptor.setMaxVersions(1);
      tableUtil.setBloomFilter(columnDescriptor, HBaseTableUtil.BloomType.ROW);

      HTableDescriptorBuilder tableDescriptor = tableUtil.buildHTableDescriptor(tableId);
      tableDescriptor.addFamily(columnDescriptor);
      tableUtil.createTableIfNotExists(admin, tableId, tableDescriptor.build());
    }

    @Override
    public void drop() throws IOException {
      tableUtil.dropTable(admin, tableId);
    }

    @Override
    public void truncate() throws IOException {
      tableUtil.truncateTable(admin, tableId);
    }

    @Override
    public void upgrade() throws IOException {
      // no-op
    }

    @Override
    public void close() throws IOException {
      admin.close();
    }
  }

  private static final class KVTableImpl implements NoTxKeyValueTable {
    private static final byte[] DEFAULT_COLUMN = Bytes.toBytes("c");

    private final HBaseTableUtil tableUtil;
    private final HTable table;

    public KVTableImpl(DatasetContext datasetContext, String tableName, CConfiguration cConf, Configuration hConf,
                       HBaseTableUtil tableUtil) throws IOException {
      this.tableUtil = tableUtil;
      TableId tableId = TableId.from(datasetContext.getNamespaceId(), tableName);
      this.table = this.tableUtil.createHTable(hConf, tableId);
    }

    @Override
    public void put(byte[] key, @Nullable byte[] value) {
      try {
        if (value == null) {
          table.delete(tableUtil.buildDelete(key).build());
        } else {
          Put put = tableUtil.buildPut(key)
            .add(DATA_COLUMN_FAMILY, DEFAULT_COLUMN, value)
            .build();
          table.put(put);
        }
      } catch (IOException e) {
        throw Throwables.propagate(e);
      }
    }

    @Nullable
    @Override
    public byte[] get(byte[] key) {
      try {
        Result result = table.get(tableUtil.buildGet(key).build());
        return result.isEmpty() ? null : result.getValue(DATA_COLUMN_FAMILY, DEFAULT_COLUMN);
      } catch (IOException e) {
        throw Throwables.propagate(e);
      }
    }

    @Override
    public void close() throws IOException {
      table.close();
    }
  }

  /**
   * Registers this type as implementation for {@link NoTxKeyValueTable} using class name.
   */
  public static final class Module implements DatasetModule {
    @Override
    public void register(DatasetDefinitionRegistry registry) {
      registry.add(new HBaseKVTableDefinition(NoTxKeyValueTable.class.getName()));
    }
  }

}


text:
/** @jsxImportSource @emotion/react */

import React, { Component } from 'react';

import { updateQuery, setQueryOptions, setCustomQuery } from '@appbaseio/reactivecore/lib/actions';
import hoistNonReactStatics from 'hoist-non-react-statics';
import {
	isEqual,
	checkValueChange,
	checkSomePropChange,
	getClassName,
	getOptionsFromQuery,
	handleA11yAction,
	updateCustomQuery,
} from '@appbaseio/reactivecore/lib/utils/helper';
import types from '@appbaseio/reactivecore/lib/utils/types';
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';

import Title from '../../styles/Title';
import Container from '../../styles/Container';
import Button, { toggleButtons } from '../../styles/Button';
import { connect } from '../../utils';
import PreferencesConsumer from '../basic/PreferencesConsumer';
import ComponentWrapper from '../basic/ComponentWrapper';

class ToggleButton extends Component {
	constructor(props) {
		super(props);

		const value = props.selectedValue || props.value || props.defaultValue || [];
		const currentValue = ToggleButton.parseValue(value, props);

		this.state = {
			currentValue,
		};

		// Set custom query in store
		updateCustomQuery(props.componentId, props, currentValue);
		const hasMounted = false;

		if (currentValue.length) {
			this.handleToggle(currentValue, true, props, hasMounted);
		}
	}

	componentDidMount() {
		const { enableAppbase, index } = this.props;
		if (!enableAppbase && index) {
			console.warn(
				'Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.',
			);
		}
	}

	componentDidUpdate(prevProps) {
		checkSomePropChange(this.props, prevProps, ['dataField', 'nestedField'], () => {
			this.updateQuery(this.state.currentValue, this.props);
		});

		if (!isEqual(this.props.value, prevProps.value)) {
			this.handleToggle(this.props.value, true, this.props);
		} else if (this.props.multiSelect) {
			// for multiselect selectedValue will be an array
			if (
				!isEqual(this.state.currentValue, this.props.selectedValue)
				&& !isEqual(prevProps.selectedValue, this.props.selectedValue)
			) {
				const { value, onChange } = this.props;
				if (value === undefined) {
					this.handleToggle(this.props.selectedValue || [], true, this.props);
				} else if (onChange) {
					// value prop exists
					onChange(this.props.selectedValue || '');
				} else {
					// value prop exists and onChange is not defined:
					// we need to put the current value back into the store
					// if the clear action was triggered by interacting with
					// selected-filters component
					this.handleToggle(this.state.currentValue, true, this.props);
				}
			}
		} else {
			// else selectedValue will be a string
			const currentValue = this.state.currentValue[0]
				? this.state.currentValue[0].value
				: null;
			if (
				!isEqual(currentValue, this.props.selectedValue)
				&& !isEqual(prevProps.selectedValue, this.props.selectedValue)
			) {
				const { value, onChange } = this.props;
				if (value === undefined) {
					this.handleToggle(this.props.selectedValue || [], true, this.props);
				} else if (onChange) {
					// value prop exists
					onChange(this.props.selectedValue || '');
				} else {
					// value prop exists and onChange is not defined:
					// we need to put the current value back into the store
					// if the clear action was triggered by interacting with
					// selected-filters component
					this.handleToggle(this.state.currentValue, true, this.props);
				}
			}
		}
	}

	static parseValue = (value, props) => {
		if (Array.isArray(value)) {
			if (typeof value[0] === 'string') {
				return props.data.filter(item => value.includes(item.value));
			}
			return value;
		}
		return props.data.filter(item => item.value === value);
	};

	static defaultQuery = (value, props) => {
		let query = null;
		if (value && value.length) {
			query = {
				bool: {
					boost: 1.0,
					minimum_should_match: 1,
					should: value.map(item => ({
						term: {
							[props.dataField]: item.value,
						},
					})),
				},
			};
		}

		if (query && props.nestedField) {
			return {
				nested: {
					path: props.nestedField,
					query,
				},
			};
		}
		return query;
	};

	handleToggle = (value, isDefaultValue = false, props = this.props, hasMounted = true) => {
		const { currentValue } = this.state;
		const toggleValue = value;
		let finalValue = [];

		if (isDefaultValue) {
			finalValue = ToggleButton.parseValue(toggleValue, props);
		} else if (this.props.multiSelect) {
			finalValue = currentValue.some(item => item.value === toggleValue.value)
				? currentValue.filter(item => item.value !== toggleValue.value)
				: currentValue.concat(toggleValue);
		} else {
			finalValue = currentValue.some(item => item.value === toggleValue.value)
				? []
				: [toggleValue];
		}

		this.setValue(finalValue, props, hasMounted);
	};

	setValue = (value, props = this.props, hasMounted = true) => {
		const performUpdate = () => {
			const handleUpdates = () => {
				this.updateQuery(value, props);
				if (props.onValueChange) props.onValueChange(value);
			};

			if (hasMounted) {
				this.setState(
					{
						currentValue: value,
					},
					handleUpdates,
				);
			} else {
				handleUpdates();
			}
		};
		checkValueChange(
			props.componentId,
			props.multiSelect ? value : value[0],
			props.beforeValueChange,
			performUpdate,
		);
	};

	updateQuery = (value, props) => {
		let filterValue = value;
		if (!props.multiSelect) {
			filterValue = value[0] ? value[0].value : null;
		}
		const { customQuery } = props;

		let query = ToggleButton.defaultQuery(value, props);
		let customQueryOptions;
		if (customQuery) {
			({ query } = customQuery(value, props) || {});
			customQueryOptions = getOptionsFromQuery(customQuery(value, props));
			updateCustomQuery(props.componentId, props, value);
		}

		props.setQueryOptions(props.componentId, customQueryOptions, false);
		props.updateQuery({
			componentId: props.componentId,
			query,
			value: filterValue, // sets a string in URL not array
			label: props.filterLabel,
			showFilter: props.showFilter,
			URLParams: props.URLParams,
			componentType: componentTypes.toggleButton,
		});
	};

	handleClick = (item, e) => {
		e.preventDefault();
		const { enableStrictSelection, multiSelect } = this.props;
		if (
			enableStrictSelection
			&& !multiSelect
			&& this.state.currentValue.find(stateItem => isEqual(item, stateItem))
		) {
			return false;
		}
		const { value, onChange } = this.props;
		if (value === undefined) {
			this.handleToggle(item);
		} else if (onChange) onChange(item);
		return true;
	};

	render() {
		return (
			<Container
				style={this.props.style}
				css={toggleButtons}
				className={`${this.props.className || ''}`}
			>
				{this.props.title && (
					<Title className={getClassName(this.props.innerClass, 'title') || null}>
						{this.props.title}
					</Title>
				)}
				{this.props.data.map((item) => {
					const isSelected = this.state.currentValue.some(
						value => value.value === item.value,
					);
					return (
						<Button
							className={`${getClassName(this.props.innerClass, 'button')} ${
								isSelected ? 'active' : ''
							}`}
							onClick={e => this.handleClick(item, e)}
							onKeyPress={e => handleA11yAction(e, () => this.handleClick(item, e))}
							key={item.value}
							tabIndex="0"
							primary={isSelected}
							large
						>
							{item.label}
						</Button>
					);
				})}
			</Container>
		);
	}
}

ToggleButton.propTypes = {
	updateQuery: types.funcRequired,
	selectedValue: types.selectedValue,
	setQueryOptions: types.funcRequired,
	setCustomQuery: types.funcRequired,
	enableAppbase: types.bool,
	// component props
	className: types.string,
	componentId: types.stringRequired,
	data: types.data,
	dataField: types.stringRequired,
	defaultValue: types.stringOrArray,
	value: types.stringOrArray,
	filterLabel: types.string,
	nestedField: types.string,
	innerClass: types.style,
	multiSelect: types.bool,
	onValueChange: types.func,
	onChange: types.func,
	onQueryChange: types.func,
	react: types.react,
	showFilter: types.bool,
	style: types.style,
	title: types.title,
	URLParams: types.bool,
	index: types.string,
	enableStrictSelection: types.bool,
	endpoint: types.endpoint,
};

ToggleButton.defaultProps = {
	className: null,
	multiSelect: true,
	showFilter: true,
	style: {},
	URLParams: false,
	enableStrictSelection: false,
};

// Add componentType for SSR
ToggleButton.componentType = componentTypes.toggleButton;

const mapStateToProps = (state, props) => ({
	selectedValue:
		(state.selectedValues[props.componentId]
			&& state.selectedValues[props.componentId].value)
		|| null,
	enableAppbase: state.config.enableAppbase,
});

const mapDispatchtoProps = dispatch => ({
	setCustomQuery: (component, query) => dispatch(setCustomQuery(component, query)),
	updateQuery: updateQueryObject => dispatch(updateQuery(updateQueryObject)),
	setQueryOptions: (...args) => dispatch(setQueryOptions(...args)),
});

const ConnectedComponent = connect(
	mapStateToProps,
	mapDispatchtoProps,
)(props => <ToggleButton ref={props.myForwardedRef} {...props} />);

// eslint-disable-next-line
const ForwardRefComponent = React.forwardRef((props, ref) => (
	<PreferencesConsumer userProps={props}>
		{preferenceProps => (
			<ComponentWrapper
				{...preferenceProps}
				internalComponent
				componentType={componentTypes.toggleButton}
			>
				{() => <ConnectedComponent {...preferenceProps} myForwardedRef={ref} />}
			</ComponentWrapper>
		)}
	</PreferencesConsumer>
));
hoistNonReactStatics(ForwardRefComponent, ToggleButton);

ForwardRefComponent.displayName = 'ToggleButton';
export default ForwardRefComponent;


text:
using MbUnit.Framework;
using SharpArch.Data.NHibernate;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.MbUnit.NHibernate
{
	/// <summary>
	/// Provides a behavior driven approach to unit testsing data persisted to a database.
	/// This base class creates the database from scratch using the specified connection details
	/// within NHibernate.config.  The original motivation for this class was to setup the database
	/// within an in-memory SqlLite database, although there's nothing to prevent any other target
	/// database being used.  If you'd prefer unit testing in the more traditional manner, but still
	/// using an in-memory database, then use <see cref="RepositoryTestsBase" />.  For testing against
	/// a "live" development database, such as a SQL Server instance, use <see cref="DatabaseRepositoryTestsBase" />
	/// as your test fixture base class.
	/// </summary>
	public abstract class RepositoryBehaviorSpecificationTestsBase : BehaviorSpecificationTestsBase
	{
		[SetUp]
		protected override void SetUp()
		{
			RepositoryTestsHelper.InitializeDatabase();
			base.SetUp();
		}

		[TearDown]
		public virtual void TearDown()
		{
			RepositoryTestsHelper.Shutdown();
		}

		protected void FlushSessionAndEvict(object instance)
		{
			RepositoryTestsHelper.FlushSessionAndEvict(instance);
		}
	}
}


text:
using System;
using Swagger.ObjectModel;
using Nancy.Swagger.Services;

namespace Nancy.Swagger.Demo.TagProviders
{
    public class UserTagProvider : ISwaggerTagProvider
    {
        public Tag GetTag()
        {
            return new Tag()
            {
                Description = "Operations related to users",
                Name = "Users",
                ExternalDocumentation = new ExternalDocumentation() {Description = "Check our documentation", Url = "http://nancyfx.org/"}
            };
        }
    }
}