text:
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */

/**
 * PHP version 5.3
 *
 * Copyright (c) 2012 KUBO Atsuhiro <kubo@iteman.jp>,
 * 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.
 *
 * 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 OWNER 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.
 *
 * @package    Piece_Questetra
 * @copyright  2012 KUBO Atsuhiro <kubo@iteman.jp>
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @version    Release: @package_version@
 * @since      File available since Release 0.1.0
 */

namespace Piece\Questetra\API;

use Guzzle\Http\Message\Response;

use Piece\Questetra\API\Response\ErrorEntry;
use Piece\Questetra\Core\QuestetraClient;
use Piece\Questetra\Core\RequestContext;
use Piece\Questetra\Core\ServiceException;

/**
 * @package    Piece_Questetra
 * @copyright  2012 KUBO Atsuhiro <kubo@iteman.jp>
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @version    Release: @package_version@
 * @since      Class available since Release 0.1.0
 */
abstract class API
{
    /**
     * @var \Piece\Questetra\Core\QuestetraClient
     */
    protected $questetraClient;

    /**
     * @param \Piece\Questetra\Core\QuestetraClient $questetraClient
     */
    public function __construct(QuestetraClient $questetraClient)
    {
        $this->questetraClient = $questetraClient;
    }

    /**
     * @param \Piece\Questetra\Core\RequestContext $requestContext
     */
    public function setRequestContext(RequestContext $requestContext)
    {
        $this->questetraClient->setRequestContext($requestContext);
    }

    /**
     * @return \Piece\Questetra\Core\RequestContext
     */
    public function getRequestContext()
    {
        return $this->questetraClient->getRequestContext();
    }

    /**
     * @param array $data
     * @param mixed $object
     * @throws \UnexpectedValueException
     */
    protected function transformToObject(array $data, $object)
    {
        foreach ($data as $attribute => $value) {
            $setter = 'set' . $attribute;
            if (method_exists($object, $setter)) {
                call_user_func(array($object, $setter), $value);
            }
        }
    }

    /**
     * @param \use Piece\Questetra\Core\ServiceException $e
     * @return \Piece\Questetra\API\ErrorResponseException
     * @throws \UnexpectedValueException
     */
    protected function createErrorResponseException(ServiceException $serviceException)
    {
        $data = $this->parseJSON($serviceException->getResponse());
        if (!array_key_exists('errors', $data)) {
            throw new \UnexpectedValueException(sprintf("The key 'errors' is not found in the data that is returned from [ %s ].",
                $serviceException->getRequest()->getUrl()
            ));
        }
        if (!is_array($data['errors'])) {
            throw new \UnexpectedValueException("The value of the key 'errors' is not an array.");
        }

        $errors = array();
        foreach ($data['errors'] as $error) {
            $errorEntry = new ErrorEntry();
            $this->transformToObject($error, $errorEntry);
            $errors[] = $errorEntry;
        }

        $errorResponseException = new ErrorResponseException($serviceException->getMessage());
        $errorResponseException->setRequestContext($serviceException->getRequestContext());
        $errorResponseException->setRequest($serviceException->getRequest());
        $errorResponseException->setResponse($serviceException->getResponse());
        $errorResponseException->setErrors($errors);
        return $errorResponseException;
    }

    /**
     * @param \Guzzle\Http\Message\Response $response
     * @return array
     */
    protected function parseJSONResponse(Response $response)
    {
        return json_decode($response->getBody(true), true);
    }

    /**
     * @param \Guzzle\Http\Message\Response $response
     * @return \SimpleXMLElement
     */
    protected function parseXMLResponse(Response $response)
    {
        return simplexml_load_string($response->getBody(true));
    }
}

/*
 * Local Variables:
 * mode: php
 * coding: iso-8859-1
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * indent-tabs-mode: nil
 * End:
 */


text:
package org.openehealth.ipf.commons.ihe.xds.rad75.asyncresponse;

import org.apache.cxf.annotations.DataBinding;
import org.openehealth.ipf.commons.ihe.xds.core.XdsJaxbDataBinding;
import org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.RetrieveDocumentSetResponseType;

import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.Action;

/**
 * RAD-75 SEI for asynchronous response receiver.
 */
@WebService(targetNamespace = "urn:ihe:rad:xdsi-b:2009", name = "InitiatingGateway_PortType", portName = "InitiatingGateway_Port")
@XmlSeeAlso({
    org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.ObjectFactory.class,
    org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.ObjectFactory.class,
    org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.ObjectFactory.class,
    org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.ObjectFactory.class })
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@DataBinding(XdsJaxbDataBinding.class)
public interface Rad75AsyncResponsePortType
{

    @Oneway
    @Action(input = "urn:ihe:rad:2011:CrossGatewayRetrieveImagingDocumentSetResponse")
    @WebMethod(operationName = "InitiatingGateway_Async_CrossGatewayRetrieveImagingDocumentSet")
    void documentRepositoryRetrieveImagingDocumentSet(
            @WebParam(partName = "body",
                    name = "RetrieveDocumentSetResponse",
                    targetNamespace = "urn:ihe:iti:xds-b:2007")
                    RetrieveDocumentSetResponseType body
    );
}

redpajama_set_name: RedPajamaGithub


text:
namespace variables {

// Builtin vars ----------------------------------------------------------------

extern const char kBuildCpuArch[];
extern const char kBuildCpuArch_HelpShort[];
extern const char kBuildCpuArch_Help[];

extern const char kBuildOs[];
extern const char kBuildOs_HelpShort[];
extern const char kBuildOs_Help[];

extern const char kComponentMode[];
extern const char kComponentMode_HelpShort[];
extern const char kComponentMode_Help[];

extern const char kCpuArch[];
extern const char kCpuArch_HelpShort[];
extern const char kCpuArch_Help[];

extern const char kCurrentToolchain[];
extern const char kCurrentToolchain_HelpShort[];
extern const char kCurrentToolchain_Help[];

extern const char kDefaultToolchain[];
extern const char kDefaultToolchain_HelpShort[];
extern const char kDefaultToolchain_Help[];

extern const char kOs[];
extern const char kOs_HelpShort[];
extern const char kOs_Help[];

extern const char kPythonPath[];
extern const char kPythonPath_HelpShort[];
extern const char kPythonPath_Help[];

extern const char kRootBuildDir[];
extern const char kRootBuildDir_HelpShort[];
extern const char kRootBuildDir_Help[];

extern const char kRootGenDir[];
extern const char kRootGenDir_HelpShort[];
extern const char kRootGenDir_Help[];

extern const char kRootOutDir[];
extern const char kRootOutDir_HelpShort[];
extern const char kRootOutDir_Help[];

extern const char kTargetGenDir[];
extern const char kTargetGenDir_HelpShort[];
extern const char kTargetGenDir_Help[];

extern const char kTargetOutDir[];
extern const char kTargetOutDir_HelpShort[];
extern const char kTargetOutDir_Help[];

// Target vars -----------------------------------------------------------------

extern const char kAllDependentConfigs[];
extern const char kAllDependentConfigs_HelpShort[];
extern const char kAllDependentConfigs_Help[];

extern const char kArgs[];
extern const char kArgs_HelpShort[];
extern const char kArgs_Help[];

extern const char kCflags[];
extern const char kCflags_HelpShort[];
extern const char* kCflags_Help;

extern const char kCflagsC[];
extern const char kCflagsC_HelpShort[];
extern const char* kCflagsC_Help;

extern const char kCflagsCC[];
extern const char kCflagsCC_HelpShort[];
extern const char* kCflagsCC_Help;

extern const char kCflagsObjC[];
extern const char kCflagsObjC_HelpShort[];
extern const char* kCflagsObjC_Help;

extern const char kCflagsObjCC[];
extern const char kCflagsObjCC_HelpShort[];
extern const char* kCflagsObjCC_Help;

extern const char kConfigs[];
extern const char kConfigs_HelpShort[];
extern const char kConfigs_Help[];

extern const char kData[];
extern const char kData_HelpShort[];
extern const char kData_Help[];

extern const char kDatadeps[];
extern const char kDatadeps_HelpShort[];
extern const char kDatadeps_Help[];

extern const char kDefines[];
extern const char kDefines_HelpShort[];
extern const char kDefines_Help[];

extern const char kDepfile[];
extern const char kDepfile_HelpShort[];
extern const char kDepfile_Help[];

extern const char kDeps[];
extern const char kDeps_HelpShort[];
extern const char kDeps_Help[];

extern const char kDirectDependentConfigs[];
extern const char kDirectDependentConfigs_HelpShort[];
extern const char kDirectDependentConfigs_Help[];

extern const char kForwardDependentConfigsFrom[];
extern const char kForwardDependentConfigsFrom_HelpShort[];
extern const char kForwardDependentConfigsFrom_Help[];

extern const char kIncludeDirs[];
extern const char kIncludeDirs_HelpShort[];
extern const char kIncludeDirs_Help[];

extern const char kInputs[];
extern const char kInputs_HelpShort[];
extern const char kInputs_Help[];

extern const char kLdflags[];
extern const char kLdflags_HelpShort[];
extern const char kLdflags_Help[];

extern const char kLibDirs[];
extern const char kLibDirs_HelpShort[];
extern const char kLibDirs_Help[];

extern const char kLibs[];
extern const char kLibs_HelpShort[];
extern const char kLibs_Help[];

extern const char kOutputExtension[];
extern const char kOutputExtension_HelpShort[];
extern const char kOutputExtension_Help[];

extern const char kOutputName[];
extern const char kOutputName_HelpShort[];
extern const char kOutputName_Help[];

extern const char kOutputs[];
extern const char kOutputs_HelpShort[];
extern const char kOutputs_Help[];

extern const char kPublic[];
extern const char kPublic_HelpShort[];
extern const char kPublic_Help[];

extern const char kScript[];
extern const char kScript_HelpShort[];
extern const char kScript_Help[];

extern const char kSources[];
extern const char kSources_HelpShort[];
extern const char kSources_Help[];

extern const char kVisibility[];
extern const char kVisibility_HelpShort[];
extern const char kVisibility_Help[];

// -----------------------------------------------------------------------------

struct VariableInfo {
  VariableInfo();
  VariableInfo(const char* in_help_short,
               const char* in_help);

  const char* help_short;
  const char* help;
};

typedef std::map<base::StringPiece, VariableInfo> VariableInfoMap;

// Returns the built-in readonly variables.
// Note: this is used only for help so this getter is not threadsafe.
const VariableInfoMap& GetBuiltinVariables();

// Returns the variables used by target generators.
// Note: this is used only for help so this getter is not threadsafe.
const VariableInfoMap& GetTargetVariables();

}  // namespace variables

#endif  // TOOLS_GN_VARIABLES_H_


text:
#pragma once
#include <vector>
#include <glm/glm.hpp>
#include"../Model.h"
#include "../Vertex.h"
using glm::vec4;
using glm::ivec4;
using std::vector;

struct Vertex{
	vec4 Position;
	vec4 Normal;
	vec4 TexCoord;
	vec4 Tangent;
};
/*
struct Mesh{
uint VertexBufferOffset;
uint IndexBufferOffset;
uint Indices;
uint Material;
};
*/
struct ShaderModel{
	ivec4 IndexVertexSizeISizeV;
	ivec4 MaterialSizeM;
	/*
	uint IndexHandle; //place in ModelIndexBuffer
	uint VertexHandle; //place in ModelVertexBuffer
	uint NumVertices;
	uint NumIndices;
	uint MaterialBasePointer;
	uint NrOfMeshes;
	*/
	vec4 ModelMinBounds;
	vec4 ModelMaxBounds;
	ivec4 Meshes[20]; //Mesh struct broken down to 4 ints
	ivec4 MeshTextures[20];
	vec4 MeshMinBounds[20];
	vec4 MeshMaxBounds[20];

};

#define MaxNrOfModels 50
#define MaxNrIndices 100000
#define MaxNrVertices 50000
#define ModelBufferSize sizeof(unsigned int) * MaxNrIndices + sizeof(Vertex) * MaxNrVertices + sizeof(ShaderModel) * MaxNrOfModels

#define ModelBufferPos 0
#define IndicesBufferPos ModelBufferPos + sizeof(ShaderModel) * MaxNrOfModels
#define VerticesBuffferPos IndicesBufferPos + sizeof(unsigned int) * MaxNrIndices

class ModelBuffer{
public:
	ModelBuffer();
	~ModelBuffer();
	void Init();
	void Build();
	void Bind(GLuint program, GLuint blockBinding);

	GLuint GetBuffer();
	void AddModels(vector<Model>& models, vector<VertexPosNormalTexTangent>& vertices, vector<unsigned int>& indices);
private:
	vector<ShaderModel>			m_Models;
	vector<Vertex>			m_Vertices;
	vector<unsigned int>	m_Indices;
	GLuint					m_Buffer;
};


text:
package com.sonymobile.seeder.internal.drm;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import android.media.MediaCrypto;
import android.media.MediaCryptoException;
import android.media.MediaDrm;
import android.media.NotProvisionedException;
import android.media.ResourceBusyException;
import android.media.UnsupportedSchemeException;
import android.util.Log;

import com.sonymobile.seeder.MediaError;
import com.sonymobile.seeder.internal.Configuration;

public class MsDrmSession extends DrmSession {

    private static final boolean DEBUG_ENABLED = Configuration.DEBUG || false;

    private static final String TAG = "MsDrmSession";

    private HashMap<String, MediaCrypto> mMediaCryptoMap;

    public MsDrmSession(Map<UUID, byte[]> psshInfo) throws UnsupportedSchemeException,
            IllegalArgumentException {

        if (psshInfo == null) {
            throw new IllegalArgumentException("No valid initialization data");
        }

        mPsshInfo = psshInfo;
        mMediaDrm = new MediaDrm(DrmUUID.PLAY_READY);
        mOutputController = null;
        mMediaCryptoMap = new HashMap<String, MediaCrypto>();
    }

    @Override
    public synchronized void open() throws DrmLicenseException {
        if (++mOpenCount == 1) {
            mState = STATE_OPENING;

            byte[] initData = mPsshInfo.get(DrmUUID.PLAY_READY);
            if (initData != null) {
                try {
                    mSessionId = mMediaDrm.openSession();
                    mState = STATE_OPENED;
                    mMediaDrm.restoreKeys(mSessionId, initData);
                    mDrmInfo = mMediaDrm.queryKeyStatus(mSessionId);
                    String validLicense = mDrmInfo.get("valid_license");
                    if (!validLicense.equals("true")) {
                        mState = STATE_ERROR;
                        if (mDrmInfo.containsKey("license_start_time")) {
                            throw new DrmLicenseException(MediaError.DRM_LICENSE_FUTURE);
                        } else {
                            throw new DrmLicenseException(MediaError.DRM_NO_LICENSE);
                        }
                    }
                    mState = STATE_OPENED_WITH_KEYS;
                } catch (NotProvisionedException e) {
                    mState = STATE_ERROR;
                    throw new DrmLicenseException(MediaError.DRM_UNKNOWN);
                } catch (ResourceBusyException e) {
                    mState = STATE_ERROR;
                    throw new DrmLicenseException(MediaError.DRM_UNKNOWN);
                }
            }
        }
    }

    public synchronized MediaCrypto getMediaCrypto(String key) throws IllegalStateException,
            MediaCryptoException {
        if (mState != STATE_OPENED && mState != STATE_OPENED_WITH_KEYS) {
            throw new IllegalStateException("Illegal state. Was a DRM session opened?");
        }

        MediaCrypto mediaCrypto = mMediaCryptoMap.get(key);
        if (mediaCrypto == null) {
            mediaCrypto = new MediaCrypto(DrmUUID.PLAY_READY, mSessionId);
            mMediaCryptoMap.put(key, mediaCrypto);
        }

        return mediaCrypto;
    }

    public synchronized void releaseMediaCrypto(String key) throws MediaCryptoException {
        MediaCrypto mediaCrypto = mMediaCryptoMap.get(key);
        if (mediaCrypto != null) {
            mMediaCryptoMap.remove(key);
            mediaCrypto.release();
        }
    }

    @Override
    public synchronized void close() {
        mOpenCount--;

        if (DEBUG_ENABLED) Log.d(TAG, "Close count = " + mOpenCount + " state = " + mState);

        if (mOpenCount == 0) {
            if(mMediaCryptoMap.size() != 0) {
                releaseAllMediaCryptos();
            }
            if (mSessionId != null) {
                mMediaDrm.closeSession(mSessionId);
            }
            mMediaDrm = null;
            mState = STATE_CLOSED;
            if (mOutputController != null) {
                mOutputController.release();
            }
        }
    }

    private synchronized void releaseAllMediaCryptos() {
        if (DEBUG_ENABLED) Log.d(TAG, "Open MediaCryptos: " + mMediaCryptoMap.size());

        Set<String> keys = mMediaCryptoMap.keySet();
        for (String key : keys) {
            MediaCrypto mediaCrypto = mMediaCryptoMap.get(key);
            mediaCrypto.release();
        }
        mMediaCryptoMap.clear();
    }
}


text:
package org.apache.flink.table.plan.nodes.datastream

import org.apache.calcite.plan._
import org.apache.calcite.rel.`type`.RelDataType
import org.apache.calcite.rel.core.{JoinInfo, JoinRelType}
import org.apache.calcite.rel.{BiRel, RelNode, RelWriter}
import org.apache.calcite.rex.RexNode
import org.apache.flink.streaming.api.datastream.DataStream
import org.apache.flink.table.api.{StreamQueryConfig, TableException}
import org.apache.flink.table.plan.nodes.CommonJoin
import org.apache.flink.table.plan.schema.RowSchema
import org.apache.flink.table.planner.StreamPlanner
import org.apache.flink.table.runtime.types.{CRow, CRowTypeInfo}

import scala.collection.JavaConversions._

/**
  * RelNode for a non-windowed stream join.
  */
class DataStreamJoin(
    cluster: RelOptCluster,
    traitSet: RelTraitSet,
    leftNode: RelNode,
    rightNode: RelNode,
    joinCondition: RexNode,
    joinInfo: JoinInfo,
    joinType: JoinRelType,
    leftSchema: RowSchema,
    rightSchema: RowSchema,
    schema: RowSchema,
    ruleDescription: String)
  extends BiRel(cluster, traitSet, leftNode, rightNode)
  with CommonJoin
  with DataStreamRel {

  override def deriveRowType(): RelDataType = schema.relDataType

  override def needsUpdatesAsRetraction: Boolean = true

  // outer join will generate retractions
  override def producesRetractions: Boolean = joinType != JoinRelType.INNER

  override def copy(traitSet: RelTraitSet, inputs: java.util.List[RelNode]): RelNode = {
    new DataStreamJoin(
      cluster,
      traitSet,
      inputs.get(0),
      inputs.get(1),
      joinCondition,
      joinInfo,
      joinType,
      leftSchema,
      rightSchema,
      schema,
      ruleDescription)
  }

  def getJoinInfo: JoinInfo = joinInfo

  def getJoinType: JoinRelType = joinType

  override def toString: String = {
    joinToString(
      schema.relDataType,
      joinCondition,
      joinType,
      getExpressionString)
  }

  override def explainTerms(pw: RelWriter): RelWriter = {
    joinExplainTerms(
      super.explainTerms(pw),
      schema.relDataType,
      joinCondition,
      joinType,
      getExpressionString)
  }

  override def translateToPlan(
      planner: StreamPlanner,
      queryConfig: StreamQueryConfig): DataStream[CRow] = {

    validateKeyTypes()

    val leftDataStream =
      left.asInstanceOf[DataStreamRel].translateToPlan(planner, queryConfig)
    val rightDataStream =
      right.asInstanceOf[DataStreamRel].translateToPlan(planner, queryConfig)

    val connectOperator = leftDataStream.connect(rightDataStream)

    val joinTranslator = createTranslator(planner)

    val joinOpName = joinToString(getRowType, joinCondition, joinType, getExpressionString)
    val joinOperator = joinTranslator.getJoinOperator(
      joinType,
      schema.fieldNames,
      ruleDescription,
      queryConfig)
    connectOperator
      .keyBy(
        joinTranslator.getLeftKeySelector(),
        joinTranslator.getRightKeySelector())
      .transform(
        joinOpName,
        CRowTypeInfo(schema.typeInfo),
        joinOperator)
  }

  private def validateKeyTypes(): Unit = {
    // at least one equality expression
    val leftFields = left.getRowType.getFieldList
    val rightFields = right.getRowType.getFieldList

    joinInfo.pairs().toList.foreach(pair => {
      val leftKeyType = leftFields.get(pair.source).getType.getSqlTypeName
      val rightKeyType = rightFields.get(pair.target).getType.getSqlTypeName
      // check if keys are compatible
      if (leftKeyType != rightKeyType) {
        throw new TableException(
          "Equality join predicate on incompatible types.\n" +
            s"\tLeft: $left,\n" +
            s"\tRight: $right,\n" +
            s"\tCondition: (${joinConditionToString(schema.relDataType,
              joinCondition, getExpressionString)})"
        )
      }
    })
  }

  protected def createTranslator(
      planner: StreamPlanner): DataStreamJoinToCoProcessTranslator = {
    new DataStreamJoinToCoProcessTranslator(
      planner.getConfig,
      schema.typeInfo,
      leftSchema,
      rightSchema,
      joinInfo,
      cluster.getRexBuilder)
  }
}


text:
<?xml version="1.0"?><!--
  ~ Copyright 2017 Sascha Peilicke
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<resources>

    <string name="feedback_mail_subject_template">Обратная связь для %s</string>
    <string name="follow">следить</string>
    <string name="follow_on_twitter">Следуйте за нами на Twitter</string>
    <string name="get_the_app_template">Получить %s в приложение для Android</string>
    <string name="provide_feedback">Обеспечить обратную связь</string>
    <string name="rate_us_in_the_play_store">Оцените нас в Play Store</string>
    <string name="recommend_to_a_friend">Рекомендовать другу</string>
    <string name="send_email">Отправить по электронной почте …</string>
    <string name="share_via">Отправить по…</string>
    <string name="support_us">Поддерживать нас</string>

</resources>


text:
import type Set from "../Set.js";
import everySet from "./everySet";

function equalsSet<T>(one: Set<T>, two: Set<T>): boolean {
	if (one.size !== two.size) {
		return false;
	}
	return everySet(one, value => two.has(value));
}

export default equalsSet;


text:
package org.semagrow.http.views;

import org.eclipse.rdf4j.http.server.repository.QueryResultView;
import org.eclipse.rdf4j.query.BooleanQuery;
import org.eclipse.rdf4j.query.QueryResultHandlerException;
import org.eclipse.rdf4j.query.resultio.BooleanQueryResultFormat;
import org.eclipse.rdf4j.query.resultio.BooleanQueryResultWriter;
import org.eclipse.rdf4j.query.resultio.BooleanQueryResultWriterFactory;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * Created by angel on 22/6/2016.
 */
public class BooleanQueryResultView extends QueryResultView {

    private static final BooleanQueryResultView INSTANCE = new BooleanQueryResultView();

    public static BooleanQueryResultView getInstance() {
        return INSTANCE;
    }

    private BooleanQueryResultView() {
    }

    public String getContentType() {
        return null;
    }

    protected void renderInternal(Map model, HttpServletRequest request, HttpServletResponse response) throws IOException {
        BooleanQueryResultWriterFactory brWriterFactory = (BooleanQueryResultWriterFactory)model.get("factory");
        BooleanQueryResultFormat brFormat = brWriterFactory.getBooleanQueryResultFormat();
        response.setStatus(200);
        this.setContentType(response, brFormat);
        this.setContentDisposition(model, response, brFormat);
        boolean headersOnly = ((Boolean)model.get("headersOnly")).booleanValue();
        if(!headersOnly) {
            ServletOutputStream out = response.getOutputStream();

            try {
                BooleanQueryResultWriter e = brWriterFactory.getWriter(out);
                BooleanQuery query = ((BooleanQuery)model.get("queryResult"));
                boolean value = query.evaluate();
                e.handleBoolean(value);
            } catch (QueryResultHandlerException var13) {
                if(var13.getCause() != null && var13.getCause() instanceof IOException) {
                    throw (IOException)var13.getCause();
                }

                throw new IOException(var13);
            } finally {
                out.close();
            }
        }

        this.logEndOfRequest(request);
    }
}


text: NSString* urlEncode(NSString *url);


text:
package com.lmax.disruptor;

import com.lmax.disruptor.alternatives.SequenceVarHandleBarrier;
import org.openjdk.jcstress.annotations.Actor;
import org.openjdk.jcstress.annotations.Arbiter;
import org.openjdk.jcstress.annotations.JCStressTest;
import org.openjdk.jcstress.annotations.Outcome;
import org.openjdk.jcstress.annotations.Ref;
import org.openjdk.jcstress.annotations.State;
import org.openjdk.jcstress.infra.results.JJ_Result;
import org.openjdk.jcstress.infra.results.J_Result;
import org.openjdk.jcstress.infra.results.ZZJ_Result;

import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE;
import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE_INTERESTING;
import static org.openjdk.jcstress.annotations.Expect.FORBIDDEN;

public class SequenceStressVarHandleBarrier
{
    /**
     * `com.lmax.disruptor.alternatives.SequenceVarHandleBarrier::incrementAndGet` is atomic and should never lose an update, even with multiple threads racing.
     */
    @JCStressTest
    @Outcome(id = "1", expect = FORBIDDEN, desc = "One update lost.")
    @Outcome(id = "2", expect = ACCEPTABLE, desc = "Both updates.")
    @State
    public static class IncrementAndGet
    {
        SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1()
        {
            sequence.incrementAndGet();
        }

        @Actor
        public void actor2()
        {
            sequence.incrementAndGet();
        }

        @Arbiter
        public void arbiter(final J_Result r)
        {
            r.r1 = sequence.get();
        }
    }

    /**
     * `SequenceVarHandleBarrier::compareAndSet` is atomic and should never lose an update, even with multiple threads racing.
     */
    @JCStressTest
    @Outcome(id = {"true, false, 10", "false, true, 20"}, expect = ACCEPTABLE, desc = "Either updated.")
    @Outcome(expect = FORBIDDEN, desc = "Other cases are forbidden.")
    @State
    public static class CompareAndSet
    {
        SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1(final ZZJ_Result r)
        {
            r.r1 = sequence.compareAndSet(0, 10);
        }

        @Actor
        public void actor2(final ZZJ_Result r)
        {
            r.r2 = sequence.compareAndSet(0, 20);
        }

        @Arbiter
        public void arbiter(final ZZJ_Result r)
        {
            r.r3 = sequence.get();
        }
    }

    /**
     * `SequenceVarHandleBarrier::addAndGet` is atomic and should never lose an update, even with multiple threads racing.
     */
    @JCStressTest
    @Outcome(id = "10", expect = FORBIDDEN, desc = "One update lost.")
    @Outcome(id = "20", expect = FORBIDDEN, desc = "One update lost.")
    @Outcome(id = "30", expect = ACCEPTABLE, desc = "Both updates.")
    @State
    public static class AddAndGet
    {
        SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1()
        {
            sequence.addAndGet(10);
        }

        @Actor
        public void actor2()
        {
            sequence.addAndGet(20);
        }

        @Arbiter
        public void arbiter(final J_Result r)
        {
            r.r1 = sequence.get();
        }
    }

    /**
     * Updates to non-volatile long values in Java are issued as two separate 32-bit writes.
     * SequenceVarHandleBarrier should store its underlying value as a volatile long and therefore should not experience this effect
     * even when a non-volatile UNSAFE set method is used.
     */
    @JCStressTest
    @Outcome(id = "0", expect = ACCEPTABLE, desc = "Seeing the default value: writer had not acted yet.")
    @Outcome(id = "-1", expect = ACCEPTABLE, desc = "Seeing the full value.")
    @Outcome(expect = FORBIDDEN, desc = "Other cases are forbidden.")
    @Ref("https://docs.oracle.com/javase/specs/jls/se11/html/jls-17.html#jls-17.7")
    @State
    public static class LongFullSet
    {
        SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);

        @Actor
        public void writer()
        {
            sequence.set(0xFFFFFFFF_FFFFFFFFL);
        }

        @Actor
        public void reader(final J_Result r)
        {
            r.r1 = sequence.get();
        }
    }

    /**
     * Updates to non-volatile long values in Java are issued as two separate 32-bit writes.
     * SequenceVarHandleBarrier should store its underlying value as a volatile long and therefore should not experience this effect.
     */
    @JCStressTest
    @Outcome(id = "0", expect = ACCEPTABLE, desc = "Seeing the default value: writer had not acted yet.")
    @Outcome(id = "-1", expect = ACCEPTABLE, desc = "Seeing the full value.")
    @Outcome(expect = FORBIDDEN, desc = "Other cases are forbidden.")
    @Ref("https://docs.oracle.com/javase/specs/jls/se11/html/jls-17.html#jls-17.7")
    @State
    public static class LongFullSetVolatile
    {
        SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);

        @Actor
        public void writer()
        {
            sequence.setVolatile(0xFFFFFFFF_FFFFFFFFL);
        }

        @Actor
        public void reader(final J_Result r)
        {
            r.r1 = sequence.get();
        }
    }

    /**
     * Updates to non-volatile long values in Java are issued as two separate 32-bit writes.
     * SequenceVarHandleBarrier should store its underlying value as a volatile long and therefore should not experience this effect.
     */
    @JCStressTest
    @Outcome(id = "0", expect = ACCEPTABLE, desc = "Seeing the default value: writer had not acted yet.")
    @Outcome(id = "-1", expect = ACCEPTABLE, desc = "Seeing the full value.")
    @Outcome(expect = FORBIDDEN, desc = "Other cases are forbidden.")
    @Ref("https://docs.oracle.com/javase/specs/jls/se11/html/jls-17.html#jls-17.7")
    @State
    public static class LongFullCompareAndSet
    {
        SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);

        @Actor
        public void writer()
        {
            sequence.compareAndSet(0, 0xFFFFFFFF_FFFFFFFFL);
        }

        @Actor
        public void reader(final J_Result r)
        {
            r.r1 = sequence.get();
        }
    }

    /**
     * In absence of synchronization, the order of independent reads is undefined.
     * In our case, the value in SequenceVarHandleBarrier is volatile which mandates the writes to the same
     * variable to be observed in a total order (that implies that _observers_ are also ordered)
     */
    @JCStressTest
    @Outcome(id = "0, 0", expect = ACCEPTABLE, desc = "Doing both reads early.")
    @Outcome(id = "1, 1", expect = ACCEPTABLE, desc = "Doing both reads late.")
    @Outcome(id = "0, 1", expect = ACCEPTABLE, desc = "Doing first read early, not surprising.")
    @Outcome(id = "1, 0", expect = FORBIDDEN, desc = "Violates coherence.")
    @State
    public static class SameVolatileRead
    {
        private final Holder h1 = new Holder();
        private final Holder h2 = h1;

        private static class Holder
        {
            SequenceVarHandleBarrier sequence = new SequenceVarHandleBarrier(0);
        }

        @Actor
        public void actor1()
        {
            h1.sequence.set(1);
        }

        @Actor
        public void actor2(final JJ_Result r)
        {
            Holder h1 = this.h1;
            Holder h2 = this.h2;

            r.r1 = h1.sequence.get();
            r.r2 = h2.sequence.get();
        }
    }

    /**
     * The value field in SequenceVarHandleBarrier is volatile so we should never see an update to it without seeing the update to a
     * previously set value also.
     *
     *
If the value was not volatile there would be no ordering rules stopping it being seen updated before the
     * other value.
     */
    @JCStressTest
    @Outcome(id = "0, 0", expect = ACCEPTABLE, desc = "Doing both reads early.")
    @Outcome(id = "1, 1", expect = ACCEPTABLE, desc = "Doing both reads late.")
    @Outcome(id = "0, 1", expect = ACCEPTABLE, desc = "Caught in the middle: $x is visible, $y is not.")
    @Outcome(id = "1, 0", expect = FORBIDDEN, desc = "Seeing $y, but not $x!")
    @State
    public static class SetVolatileGuard
    {
        long x = 0;
        SequenceVarHandleBarrier y = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1()
        {
            x = 1;
            y.setVolatile(1);
        }

        @Actor
        public void actor2(final JJ_Result r)
        {
            r.r1 = y.get();
            r.r2 = x;
        }
    }

    /**
     * The value field in SequenceVarHandleBarrier is volatile so we should never see an update to it without seeing the update to a
     * previously set value also.
     *
     *
If the value was not volatile there would be no ordering rules stopping it being seen updated before the
     * other value.
     *
     *
This is a property of the field, not a property of the method used to set the value of it.
     */
    @JCStressTest
    @Outcome(id = "0, 0", expect = ACCEPTABLE, desc = "Doing both reads early.")
    @Outcome(id = "1, 1", expect = ACCEPTABLE, desc = "Doing both reads late.")
    @Outcome(id = "0, 1", expect = ACCEPTABLE, desc = "Caught in the middle: $x is visible, $y is not.")
    @Outcome(id = "1, 0", expect = FORBIDDEN, desc = "Seeing $y, but not $x!")
    @State
    public static class SetGuard
    {
        long x = 0;
        SequenceVarHandleBarrier y = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1()
        {
            x = 1;
            y.set(1);
        }

        @Actor
        public void actor2(final JJ_Result r)
        {
            r.r1 = y.get();
            r.r2 = x;
        }
    }

    /**
     * Volatile setting will experience total ordering.
     */
    @JCStressTest
    @Outcome(id = {"0, 1", "1, 0", "1, 1"}, expect = ACCEPTABLE, desc = "Trivial under sequential consistency")
    @Outcome(id = "0, 0", expect = FORBIDDEN, desc = "Violates sequential consistency")
    @State
    public static class SetVolatileDekker
    {
        SequenceVarHandleBarrier x = new SequenceVarHandleBarrier(0);
        SequenceVarHandleBarrier y = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1(final JJ_Result r)
        {
            x.setVolatile(1);
            r.r1 = y.get();
        }

        @Actor
        public void actor2(final JJ_Result r)
        {
            y.setVolatile(1);
            r.r2 = x.get();

        }
    }

    /**
     * Non-volatile setting will not experience total ordering, those gets can be re-ordered and happen before either set.
     */
    @JCStressTest
    @Outcome(id = {"0, 1", "1, 0", "1, 1"}, expect = ACCEPTABLE, desc = "Trivial under sequential consistency")
    @Outcome(id = "0, 0", expect = ACCEPTABLE_INTERESTING, desc = "Violates sequential consistency")
    @State
    public static class SetDekker
    {
        SequenceVarHandleBarrier x = new SequenceVarHandleBarrier(0);
        SequenceVarHandleBarrier y = new SequenceVarHandleBarrier(0);

        @Actor
        public void actor1(final JJ_Result r)
        {
            x.set(1);
            r.r1 = y.get();
        }

        @Actor
        public void actor2(final JJ_Result r)
        {
            y.set(1);
            r.r2 = x.get();
        }
    }
}


text:
require_relative 'spec_helper'
require_relative 'fake_tests'

describe 'timings are accumulated for multiple tests' do
  let(:err) { FakeError.new }
  let(:bad) { FakeFailer.new }
  let(:ok) { FakePasser.new }
  let(:rpt) { Minitest::Reporters::JsonReporter.new }
  before do
    rpt.start
    rpt.record(bad)
    rpt.record(err)
    rpt.record(ok)
  end
  subject { rpt.report }

  it 'should have timings > 0' do
    subject

    rpt.storage[:timings][:total_seconds].must_be :>, 0.0
  end

  #  it 'should be near 0.3' do
  #    subject
  #    rpt.storage[:timings][:total_seconds].must_be :>=, 0.3
  #  end
end


text:
#ifndef INCLUDED_cpp_vm_Gc
#define INCLUDED_cpp_vm_Gc

#ifndef HXCPP_H
#include <hxcpp.h>
#endif

HX_DECLARE_CLASS2(cpp,vm,Gc)
namespace cpp{
namespace vm{

class HXCPP_CLASS_ATTRIBUTES  Gc_obj : public hx::Object{
	public:
		typedef hx::Object super;
		typedef Gc_obj OBJ_;
		Gc_obj();
		Void __construct();

	public:
		inline void *operator new( size_t inSize, bool inContainer=false)
			{ return hx::Object::operator new(inSize,inContainer); }
		static hx::ObjectPtr< Gc_obj > __new();
		static Dynamic __CreateEmpty();
		static Dynamic __Create(hx::DynamicArray inArgs);
		//~Gc_obj();

		HX_DO_RTTI;
		static void __boot();
		static void __register();
		::String __ToString() const { return HX_CSTRING("Gc"); }

		static Void compact( );
		static Dynamic compact_dyn();

};

} // end namespace cpp
} // end namespace vm

#endif /* INCLUDED_cpp_vm_Gc */


text:
namespace ccb { namespace config
{
    template<typename T, typename U>
    class TestProxyConfig
    {
    private:

        T value;

        std::function<T(const U&)> from;

        std::function<U(const T&)> to;

    public:

        TestProxyConfig(
            const std::function<T(const U&)>& from,
            const std::function<U(const T&)>& to)
            : from(from)
            , to(to)
        {
        }

        TestProxyConfig(
            const std::function<T(const U&)>& from,
            const std::function<U(const T&)>& to,
            const T& value)
            : from(from)
            , to(to)
            , value(value)
        {
        }

    private:

        template<typename Archive>
        void Serialize(Archive& ar)
        {
            CCB_SERIALIZE_AS(U, ar, this->value, this->from, this->to);
        }

    public:

        const T& GetValue() const
        {
            return this->value;
        }

        void SetValue(const T& value)
        {
            this->value = value;
        }

        friend class Access;
    };
} }


text:
#include "qrcode/QRFinderPatternFinder.h"
#include "qrcode/QRFinderPatternInfo.h"
#include "BitMatrix.h"
#include "DecodeHints.h"
#include "DecodeStatus.h"
#include "ZXContainerAlgorithms.h"

#include <cassert>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <algorithm>

namespace ZXing {
namespace QRCode {

static const int CENTER_QUORUM = 2;
static const int MIN_SKIP = 3; // 1 pixel/module times 3 modules/center
static const int MAX_MODULES = 97; // support up to version 20 for mobile clients

using StateCount = FinderPatternFinder::StateCount;

/**
* Given a count of black/white/black/white/black pixels just seen and an end position,
* figures the location of the center of this run.
*/
static float CenterFromEnd(const StateCount& stateCount, int end)
{
	return (float)(end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0f;
}

/**
 * @param stateCount count of black/white/black/white/black pixels just read
 * @return true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios
 *         used by finder patterns to be considered a match
 */
static bool FoundPatternDiagonal(const StateCount& stateCount) {
	int totalModuleSize = 0;
	for (int i = 0; i < 5; i++) {
		int count = stateCount[i];
		if (count == 0) {
			return false;
		}
		totalModuleSize += count;
	}
	if (totalModuleSize < 7) {
		return false;
	}
	float moduleSize = totalModuleSize / 7.0f;
	float maxVariance = moduleSize / 1.333f;
	// Allow less than 75% variance from 1-1-3-1-1 proportions
	return
		std::abs(moduleSize - stateCount[0]) < maxVariance &&
		std::abs(moduleSize - stateCount[1]) < maxVariance &&
		std::abs(3.0f * moduleSize - stateCount[2]) < 3 * maxVariance &&
		std::abs(moduleSize - stateCount[3]) < maxVariance &&
		std::abs(moduleSize - stateCount[4]) < maxVariance;
}

/**
 * After a vertical and horizontal scan finds a potential finder pattern, this method
 * "cross-cross-cross-checks" by scanning down diagonally through the center of the possible
 * finder pattern to see if the same proportion is detected.
 *
 * @param centerI row where a finder pattern was detected
 * @param centerJ center of the section that appears to cross a finder pattern
 * @param maxCount maximum reasonable number of modules that should be
 *  observed in any reading state, based on the results of the horizontal scan
 * @param originalStateCountTotal The original state count total.
 * @return true if proportions are withing expected limits
 */
static bool CrossCheckDiagonal(const BitMatrix& image, int centerI, int centerJ)
{
	StateCount stateCount = {};

	// Start counting up, left from center finding black center mass
	int i = 0;
	while (centerI >= i && centerJ >= i && image.get(centerJ - i, centerI - i)) {
		stateCount[2]++;
		i++;
	}
	if (stateCount[2] == 0) {
		return false;
	}

	// Continue up, left finding white space
	while (centerI >= i && centerJ >= i && !image.get(centerJ - i, centerI - i)) {
		stateCount[1]++;
		i++;
	}
	if (stateCount[1] == 0) {
		return false;
	}

	// Continue up, left finding black border
	while (centerI >= i && centerJ >= i && image.get(centerJ - i, centerI - i)) {
		stateCount[0]++;
		i++;
	}
	if (stateCount[0] == 0) {
		return false;
	}

	int maxI = image.height();
	int maxJ = image.width();

	// Now also count down, right from center
	i = 1;
	while (centerI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, centerI + i)) {
		stateCount[2]++;
		i++;
	}

	while (centerI + i < maxI && centerJ + i < maxJ && !image.get(centerJ + i, centerI + i)) {
		stateCount[3]++;
		i++;
	}
	if (stateCount[3] == 0) {
		return false;
	}

	while (centerI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, centerI + i)) {
		stateCount[4]++;
		i++;
	}
	if (stateCount[4] == 0) {
		return false;
	}

	return FoundPatternDiagonal(stateCount);
}

/**
*
After a horizontal scan finds a potential finder pattern, this method
* "cross-checks" by scanning down vertically through the center of the possible
* finder pattern to see if the same proportion is detected.

*
* @param startI row where a finder pattern was detected
* @param centerJ center of the section that appears to cross a finder pattern
* @param maxCount maximum reasonable number of modules that should be
* observed in any reading state, based on the results of the horizontal scan
* @return vertical center of finder pattern, or {@link Float#NaN} if not found
*/
static float CrossCheckVertical(const BitMatrix& image, int startI, int centerJ, int maxCount, int originalStateCountTotal)
{
	StateCount stateCount = {};
	int maxI = image.height();

	// Start counting up from center
	int i = startI;
	while (i >= 0 && image.get(centerJ, i)) {
		stateCount[2]++;
		i--;
	}
	if (i < 0) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (i >= 0 && !image.get(centerJ, i) && stateCount[1] <= maxCount) {
		stateCount[1]++;
		i--;
	}
	// If already too many modules in this state or ran off the edge:
	if (i < 0 || stateCount[1] > maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (i >= 0 && image.get(centerJ, i) && stateCount[0] <= maxCount) {
		stateCount[0]++;
		i--;
	}
	if (stateCount[0] > maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}

	// Now also count down from center
	i = startI + 1;
	while (i < maxI && image.get(centerJ, i)) {
		stateCount[2]++;
		i++;
	}
	if (i == maxI) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (i < maxI && !image.get(centerJ, i) && stateCount[3] < maxCount) {
		stateCount[3]++;
		i++;
	}
	if (i == maxI || stateCount[3] >= maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (i < maxI && image.get(centerJ, i) && stateCount[4] < maxCount) {
		stateCount[4]++;
		i++;
	}
	if (stateCount[4] >= maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}

	// If we found a finder-pattern-like section, but its size is more than 40% different than
	// the original, assume it's a false positive
	int stateCountTotal = Accumulate(stateCount, 0);
	if (5 * std::abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
		return std::numeric_limits<float>::quiet_NaN();
	}

	return FinderPatternFinder::FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, i) : std::numeric_limits<float>::quiet_NaN();
}

/**
*
Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
* except it reads horizontally instead of vertically. This is used to cross-cross
* check a vertical cross check and locate the real center of the alignment pattern.

*/
static float CrossCheckHorizontal(const BitMatrix& image, int startJ, int centerI, int maxCount, int originalStateCountTotal)
{
	StateCount stateCount = {};
	int maxJ = image.width();

	int j = startJ;
	while (j >= 0 && image.get(j, centerI)) {
		stateCount[2]++;
		j--;
	}
	if (j < 0) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (j >= 0 && !image.get(j, centerI) && stateCount[1] <= maxCount) {
		stateCount[1]++;
		j--;
	}
	if (j < 0 || stateCount[1] > maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (j >= 0 && image.get(j, centerI) && stateCount[0] <= maxCount) {
		stateCount[0]++;
		j--;
	}
	if (stateCount[0] > maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}

	j = startJ + 1;
	while (j < maxJ && image.get(j, centerI)) {
		stateCount[2]++;
		j++;
	}
	if (j == maxJ) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (j < maxJ && !image.get(j, centerI) && stateCount[3] < maxCount) {
		stateCount[3]++;
		j++;
	}
	if (j == maxJ || stateCount[3] >= maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}
	while (j < maxJ && image.get(j, centerI) && stateCount[4] < maxCount) {
		stateCount[4]++;
		j++;
	}
	if (stateCount[4] >= maxCount) {
		return std::numeric_limits<float>::quiet_NaN();
	}

	// If we found a finder-pattern-like section, but its size is significantly different than
	// the original, assume it's a false positive
	int stateCountTotal = Accumulate(stateCount, 0);
	if (5 * std::abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
		return std::numeric_limits<float>::quiet_NaN();
	}

	return FinderPatternFinder::FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, j) : std::numeric_limits<float>::quiet_NaN();
}

/**
* @return number of rows we could safely skip during scanning, based on the first
*         two finder patterns that have been located. In some cases their position will
*         allow us to infer that the third pattern must lie below a certain point farther
*         down in the image.
*/
static int FindRowSkip(const std::vector<FinderPattern>& possibleCenters, bool& hasSkipped)
{
	if (possibleCenters.size() <= 1) {
		return 0;
	}

	const ResultPoint* firstConfirmedCenter = nullptr;
	for (const FinderPattern& center : possibleCenters) {
		if (center.count() >= CENTER_QUORUM) {
			if (firstConfirmedCenter == nullptr) {
				firstConfirmedCenter = &center;
			}
			else {
				// We have two confirmed centers
				// How far down can we skip before resuming looking for the next
				// pattern? In the worst case, only the difference between the
				// difference in the x / y coordinates of the two centers.
				// This is the case where you find top left last.
				hasSkipped = true;
				return static_cast<int>(std::abs(firstConfirmedCenter->x() - center.x()) - std::abs(firstConfirmedCenter->y() - center.y())) / 2;
			}
		}
	}
	return 0;
}

/**
* @return true iff we have found at least 3 finder patterns that have been detected
*         at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the
*         candidates is "pretty similar"
*/
static bool HaveMultiplyConfirmedCenters(const std::vector<FinderPattern>& possibleCenters)
{
	int confirmedCount = 0;
	float totalModuleSize = 0.0f;
	//int max = possibleCenters.size();
	for (const FinderPattern& pattern : possibleCenters) {
		if (pattern.count() >= CENTER_QUORUM) {
			confirmedCount++;
			totalModuleSize += pattern.estimatedModuleSize();
		}
	}
	if (confirmedCount < 3) {
		return false;
	}
	// OK, we have at least 3 confirmed centers, but, it's possible that one is a "false positive"
	// and that we need to keep looking. We detect this by asking if the estimated module sizes
	// vary too much. We arbitrarily say that when the total deviation from average exceeds
	// 5% of the total module size estimates, it's too much.
	float average = totalModuleSize / static_cast<float>(possibleCenters.size());
	float totalDeviation = 0.0f;
	for (const FinderPattern& pattern : possibleCenters) {
		totalDeviation += std::abs(pattern.estimatedModuleSize() - average);
	}
	return totalDeviation <= 0.05f * totalModuleSize;
}

/**
*
Orders by furthest from average

*/
struct FurthestFromAverageComparator
{
	float average;

	bool operator()(const FinderPattern& center1, const FinderPattern& center2) const {
		return std::abs(center1.estimatedModuleSize() - average) > std::abs(center2.estimatedModuleSize() - average);
	}
};

/**
*
Orders by {@link FinderPattern#getCount()}, descending.

*/
struct CenterComparator
{
	float average;

	bool operator()(const FinderPattern& center1, const FinderPattern& center2) const {
		if (center2.count() == center1.count()) {
			return std::abs(center1.estimatedModuleSize() - average) < std::abs(center2.estimatedModuleSize() - average);
		}
		else {
			return center1.count() > center2.count();
		}
	}
};

/**
* @return the 3 best {@link FinderPattern}s from our list of candidates. The "best" are
*         those that have been detected at least {@link #CENTER_QUORUM} times, and whose module
*         size differs from the average among those patterns the least
* @throws NotFoundException if 3 such finder patterns do not exist
*/
static bool SelectBestPatterns(std::vector<FinderPattern>& possibleCenters)
{
	int startSize = static_cast<int>(possibleCenters.size());
	if (startSize < 3) {
		// Couldn't find enough finder patterns
		return false;
	}

	// Filter outlier possibilities whose module size is too different
	if (startSize > 3) {
		// But we can only afford to do so if we have at least 4 possibilities to choose from
		float totalModuleSize = 0.0f;
		float square = 0.0f;
		for (const FinderPattern& center : possibleCenters) {
			float size = center.estimatedModuleSize();
			totalModuleSize += size;
			square += size * size;
		}
		float average = totalModuleSize / static_cast<float>(startSize);
		float stdDev = std::sqrt(square / startSize - average * average);

		std::sort(possibleCenters.begin(), possibleCenters.end(), FurthestFromAverageComparator{ average });

		float limit = std::max(0.2f * average, stdDev);

		for (int i = 0; i < int(possibleCenters.size()) && possibleCenters.size() > 3; i++) {
			const FinderPattern& pattern = possibleCenters[i];
			if (std::abs(pattern.estimatedModuleSize() - average) > limit) {
				possibleCenters.erase(possibleCenters.begin() + i);
				i--;
			}
		}
	}

	if (possibleCenters.size() > 3) {
		// Throw away all but those first size candidate points we found.

		float totalModuleSize = 0.0f;
		for (const FinderPattern& possibleCenter : possibleCenters) {
			totalModuleSize += possibleCenter.estimatedModuleSize();
		}

		float average = totalModuleSize / static_cast<float>(possibleCenters.size());

		std::sort(possibleCenters.begin(), possibleCenters.end(), CenterComparator{ average });

		possibleCenters.resize(3);
	}
	return true;
}

/**
* Returns the z component of the cross product between vectors BC and BA.
*/
static float CrossProductZ(const ResultPoint& a, const ResultPoint& b, const ResultPoint& c)
{
	return (c.x() - b.x())*(a.y() - b.y()) - (c.y() - b.y())*(a.x() - b.x());
}

/**
* Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
* and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
*
* @param patterns array of three {@code ResultPoint} to order
*/
static void OrderBestPatterns(std::vector<FinderPattern>& patterns)
{
	assert(patterns.size() == 3);

	auto &p0 = patterns[0], &p1 = patterns[1], &p2 = patterns[2];

	// Find distances between pattern centers
	float zeroOneDistance = ResultPoint::Distance(p0, p1);
	float oneTwoDistance = ResultPoint::Distance(p1, p2);
	float zeroTwoDistance = ResultPoint::Distance(p0, p2);

	// Assume one closest to other two is B; A and C will just be guesses at first
	if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance)
		std::swap(p0, p1);
	else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance)
		; // do nothing, the order is correct
	else
		std::swap(p1, p2);

	// Use cross product to figure out whether A and C are correct or flipped.
	// This asks whether BC x BA has a positive z component, which is the arrangement
	// we want for A, B, C. If it's negative, then we've got it flipped around and
	// should swap A and C.
	if (CrossProductZ(p0, p1, p2) < 0.0f) {
		std::swap(p0, p2);
	}
}

FinderPatternInfo FinderPatternFinder::Find(const BitMatrix& image, bool tryHarder)
{
	int maxI = image.height();
	int maxJ = image.width();
	// We are looking for black/white/black/white/black modules in
	// 1:1:3:1:1 ratio; this tracks the number of such modules seen so far

	// Let's assume that the maximum version QR Code we support takes up 1/4 the height of the
	// image, and then account for the center being 3 modules in size. This gives the smallest
	// number of pixels the center could be, so skip this often. When trying harder, look for all
	// QR versions regardless of how dense they are.
	int iSkip = (3 * maxI) / (4 * MAX_MODULES);
	if (iSkip < MIN_SKIP || tryHarder) {
		iSkip = MIN_SKIP;
	}

	bool hasSkipped = false;
	std::vector<FinderPattern> possibleCenters;

	bool done = false;
	for (int i = iSkip - 1; i < maxI && !done; i += iSkip) {
		// Get a row of black/white values
		StateCount stateCount = {};
		size_t currentState = 0;
		for (int j = 0; j < maxJ; j++) {
			if (image.get(j, i)) {
				// Black pixel
				if ((currentState & 1) == 1) { // Counting white pixels
					currentState++;
				}
				stateCount[currentState]++;
			}
			else { // White pixel
				if ((currentState & 1) == 0) { // Counting black pixels
					if (currentState == 4) { // A winner?
						if (FoundPatternCross(stateCount)) { // Yes
							bool confirmed = HandlePossibleCenter(image, stateCount, i, j, possibleCenters);
							if (confirmed) {
								// Start examining every other line. Checking each line turned out to be too
								// expensive and didn't improve performance.
								iSkip = 2;
								if (hasSkipped) {
									done = HaveMultiplyConfirmedCenters(possibleCenters);
								}
								else {
									int rowSkip = FindRowSkip(possibleCenters, hasSkipped);
									if (rowSkip > stateCount[2]) {
										// Skip rows between row of lower confirmed center
										// and top of presumed third confirmed center
										// but back up a bit to get a full chance of detecting
										// it, entire width of center of finder pattern

										// Skip by rowSkip, but back off by stateCount[2] (size of last center
										// of pattern we saw) to be conservative, and also back off by iSkip which
										// is about to be re-added
										i += rowSkip - stateCount[2] - iSkip;
										j = maxJ - 1;
									}
								}
							}
							else {
								stateCount[0] = stateCount[2];
								stateCount[1] = stateCount[3];
								stateCount[2] = stateCount[4];
								stateCount[3] = 1;
								stateCount[4] = 0;
								currentState = 3;
								continue;
							}
							// Clear state to start looking again
							currentState = 0;
							stateCount.fill(0);
						}
						else { // No, shift counts back by two
							stateCount[0] = stateCount[2];
							stateCount[1] = stateCount[3];
							stateCount[2] = stateCount[4];
							stateCount[3] = 1;
							stateCount[4] = 0;
							currentState = 3;
						}
					}
					else {
						stateCount[++currentState]++;
					}
				}
				else { // Counting white pixels
					stateCount[currentState]++;
				}
			}
		}
		if (FinderPatternFinder::FoundPatternCross(stateCount)) {
			bool confirmed = FinderPatternFinder::HandlePossibleCenter(image, stateCount, i, maxJ, possibleCenters);
			if (confirmed) {
				iSkip = stateCount[0];
				if (hasSkipped) {
					// Found a third one
					done = HaveMultiplyConfirmedCenters(possibleCenters);
				}
			}
		}
	}

	if (!SelectBestPatterns(possibleCenters))
		return {};

	OrderBestPatterns(possibleCenters);

	return {possibleCenters[0], possibleCenters[1], possibleCenters[2]};
}

/**
* @param stateCount count of black/white/black/white/black pixels just read
* @return true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios
*         used by finder patterns to be considered a match
*/
bool
FinderPatternFinder::FoundPatternCross(const StateCount& stateCount) {
	int totalModuleSize = Accumulate(stateCount, 0);
	if (totalModuleSize < 7) {
		return false;
	}
	float moduleSize = totalModuleSize / 7.0f;
	float maxVariance = moduleSize / 2.0f;
	// Allow less than 50% variance from 1-1-3-1-1 proportions
	return
		std::abs(moduleSize - stateCount[0]) < maxVariance &&
		std::abs(moduleSize - stateCount[1]) < maxVariance &&
		std::abs(3.0f * moduleSize - stateCount[2]) < 3 * maxVariance &&
		std::abs(moduleSize - stateCount[3]) < maxVariance &&
		std::abs(moduleSize - stateCount[4]) < maxVariance;
}

/**
*
This is called when a horizontal scan finds a possible alignment pattern. It will
* cross check with a vertical scan, and if successful, will, ah, cross-cross-check
* with another horizontal scan. This is needed primarily to locate the real horizontal
* center of the pattern in cases of extreme skew.
* And then we cross-cross-cross check with another diagonal scan.

*
*
If that succeeds the finder pattern location is added to a list that tracks
* the number of times each location has been nearly-matched as a finder pattern.
* Each additional find is more evidence that the location is in fact a finder
* pattern center
*
* @param stateCount reading state module counts from horizontal scan
* @param i row where finder pattern may be found
* @param j end of possible finder pattern in row
* @param pureBarcode true if in "pure barcode" mode
* @return true if a finder pattern candidate was found this time
*/
bool
FinderPatternFinder::HandlePossibleCenter(const BitMatrix& image, const StateCount& stateCount, int i, int j, std::vector<FinderPattern>& possibleCenters)
{
	int stateCountTotal = Accumulate(stateCount, 0);
	float centerJ = CenterFromEnd(stateCount, j);
	float centerI = CrossCheckVertical(image, i, static_cast<int>(centerJ), stateCount[2], stateCountTotal);
	if (std::isnan(centerI))
		return false;

	// Re-cross check
	centerJ = CrossCheckHorizontal(image, static_cast<int>(centerJ), static_cast<int>(centerI), stateCount[2],
								   stateCountTotal);
	if (std::isnan(centerJ) || !CrossCheckDiagonal(image, (int)centerI, (int)centerJ))
		return false;

	float estimatedModuleSize = stateCountTotal / 7.0f;
	auto center = ZXing::FindIf(possibleCenters, [=](const FinderPattern& center) {
		return center.aboutEquals(estimatedModuleSize, centerI, centerJ);
	});
	if (center != possibleCenters.end())
		*center = center->combineEstimate(centerI, centerJ, estimatedModuleSize);
	else
		possibleCenters.emplace_back(centerJ, centerI, estimatedModuleSize);

	return true;
}

} // QRCode
} // ZXing


text:
package com.example.mylibrary;

import android.support.annotation.NonNull;

/**
 * Created by tancho on 4/4/17.
 */

public class StringUtil {

    public
    @NonNull
    String[] splitString(@NonNull String sbstring, @NonNull String string) {
        return string.split(sbstring);
    }
}