text:
package hudson.model;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;

import hudson.EnvVars;
import hudson.model.queue.SubTask;
import hudson.tasks.BuildWrapper;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;

public class ParametersActionTest {

    private ParametersAction baseParamsAB;
    private StringParameterValue baseA;

    @Before
    public void setUp() {
        baseA = new StringParameterValue("a", "base-a");
        StringParameterValue baseB = new StringParameterValue("b", "base-b");
        baseParamsAB = new ParametersAction(baseA, baseB);
    }

    @Test
    public void mergeShouldOverrideParameters() {
        StringParameterValue overrideB = new StringParameterValue("b", "override-b");
        ParametersAction extraParams = new ParametersAction(overrideB);

        ParametersAction params = baseParamsAB.merge(extraParams);

        StringParameterValue a = (StringParameterValue) params.getParameter("a");
        StringParameterValue b = (StringParameterValue) params.getParameter("b");
        assertEquals(baseA, a);
        assertEquals(overrideB, b);
    }

    @Test
    public void mergeShouldCombineDisparateParameters() {
        StringParameterValue overrideB = new StringParameterValue("b", "override-b");
        ParametersAction extraParams = new ParametersAction(overrideB);

        ParametersAction params = baseParamsAB.merge(extraParams);

        StringParameterValue a = (StringParameterValue) params.getParameter("a");
        StringParameterValue b = (StringParameterValue) params.getParameter("b");
        assertEquals(baseA, a);
        assertEquals(overrideB, b);
    }

    @Test
    public void mergeShouldHandleEmptyOverrides() {
        ParametersAction params = baseParamsAB.merge(new ParametersAction());

        StringParameterValue a = (StringParameterValue) params.getParameter("a");
        assertEquals(baseA, a);
    }

    @Test
    public void mergeShouldHandleNullOverrides() {
        ParametersAction params = baseParamsAB.merge(null);

        StringParameterValue a = (StringParameterValue) params.getParameter("a");
        assertEquals(baseA, a);
    }

    @Test
    public void mergeShouldReturnNewInstanceWithOverride() {
        StringParameterValue overrideA = new StringParameterValue("a", "override-a");
        ParametersAction overrideParams = new ParametersAction(overrideA);

        ParametersAction params = baseParamsAB.merge(overrideParams);

        assertNotSame(baseParamsAB, params);
    }

    @Test
    public void createUpdatedShouldReturnNewInstanceWithNullOverride() {
        ParametersAction params = baseParamsAB.createUpdated(null);

        assertNotSame(baseParamsAB, params);
    }

    @Test
    @Issue("JENKINS-15094")
    public void checkNullParameterValues() {
        SubTask subtask = mock(SubTask.class);
        Build build = mock(Build.class);

        // Prepare parameters Action
        StringParameterValue A = new StringParameterValue("A", "foo");
        StringParameterValue B = new StringParameterValue("B", "bar");
        ParametersAction parametersAction = new ParametersAction(A, null, B);
        ParametersAction parametersAction2 = new ParametersAction(A, null);

        // Non existent parameter
        assertNull(parametersAction.getParameter("C"));
        assertNull(parametersAction.getAssignedLabel(subtask));

        // Interaction with build
        EnvVars vars = new EnvVars();
        parametersAction.buildEnvironment(build, vars);
        assertEquals(2, vars.size());
        parametersAction.createVariableResolver(build);

        List<BuildWrapper> wrappers = new ArrayList<>();
        parametersAction.createBuildWrappers(build, wrappers);
        assertEquals(0, wrappers.size());

        // Merges and overrides
        assertEquals(3, parametersAction.createUpdated(parametersAction2.getParameters()).getParameters().size());
        assertEquals(3, parametersAction.merge(parametersAction2).getParameters().size());
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.microsoft.azure.management.network.v2019_11_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.management.network.v2019_11_01.implementation.LoadBalancerInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.network.v2019_11_01.implementation.NetworkManager;
import java.util.List;
import java.util.Map;

/**
 * Type representing NetworkInterfaceLoadBalancer.
 */
public interface NetworkInterfaceLoadBalancer extends HasInner<LoadBalancerInner>, HasManager<NetworkManager> {
    /**
     * @return the backendAddressPools value.
     */
    List<BackendAddressPool> backendAddressPools();

    /**
     * @return the etag value.
     */
    String etag();

    /**
     * @return the frontendIPConfigurations value.
     */
    List<FrontendIPConfiguration> frontendIPConfigurations();

    /**
     * @return the id value.
     */
    String id();

    /**
     * @return the inboundNatPools value.
     */
    List<InboundNatPool> inboundNatPools();

    /**
     * @return the inboundNatRules value.
     */
    List<InboundNatRule> inboundNatRules();

    /**
     * @return the loadBalancingRules value.
     */
    List<LoadBalancingRule> loadBalancingRules();

    /**
     * @return the location value.
     */
    String location();

    /**
     * @return the name value.
     */
    String name();

    /**
     * @return the outboundRules value.
     */
    List<OutboundRule> outboundRules();

    /**
     * @return the probes value.
     */
    List<Probe> probes();

    /**
     * @return the provisioningState value.
     */
    ProvisioningState provisioningState();

    /**
     * @return the resourceGuid value.
     */
    String resourceGuid();

    /**
     * @return the sku value.
     */
    LoadBalancerSku sku();

    /**
     * @return the tags value.
     */
    Map<String, String> tags();

    /**
     * @return the type value.
     */
    String type();

}


text:
package net.ihiroky.niotty.sample;

import net.ihiroky.niotty.LoadStage;
import net.ihiroky.niotty.StageContext;

/**
 *
 */
class Dump extends LoadStage {

    private boolean echo_;

    public Dump() {
        echo_ = false;
    }

    public Dump(boolean echo) {
        echo_ = echo;
    }

    @Override
    public void loaded(StageContext context, Object message, Object parameter) {
        System.out.println("remote: " + context.transport().remoteAddress() + " - " + message);
        if (echo_) {
            context.transport().write(message);
        }
    }

    @Override
    public void exceptionCaught(StageContext context, Exception exception) {
        exception.printStackTrace();
    }

    @Override
    public void activated(StageContext context) {
    }

    @Override
    public void deactivated(StageContext context) {
        context.transport().close();
    }

    @Override
    public void eventTriggered(StageContext context, Object event) {
    }
}


text:
A CLI for my life.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'jimsy'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install jimsy

## Usage

```
$ jimsy
Commands:
  jimsy bus             # List the next bunch of busses for a given stop
  jimsy clone URI       # clone A git repo
  jimsy help [COMMAND]  # Describe available commands or one specific command
```

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
package org.apache.commons.io.filefilter;

import java.io.File;

/**
 * An abstract class which implements the Java FileFilter and FilenameFilter
 * interfaces via the IOFileFilter interface.
 *

 * Note that a subclass must override one of the accept methods,
 * otherwise your class will infinitely loop.
 *
 * @since Commons IO 1.0
 * @version $Revision: 736891 $ $Date: 2009-01-23 02:22:33 +0000 (Fri, 23 Jan 2009) $
 *
 * @author Stephen Colebourne
 */
public abstract class AbstractFileFilter implements IOFileFilter {

    /**
     * Checks to see if the File should be accepted by this filter.
     *
     * @param file  the File to check
     * @return true if this file matches the test
     */
    public boolean accept(File file) {
        return accept(file.getParentFile(), file.getName());
    }

    /**
     * Checks to see if the File should be accepted by this filter.
     *
     * @param dir  the directory File to check
     * @param name  the filename within the directory to check
     * @return true if this file matches the test
     */
    public boolean accept(File dir, String name) {
        return accept(new File(dir, name));
    }

    /**
     * Provide a String representaion of this file filter.
     *
     * @return a String representaion
     */
    @Override
    public String toString() {
        return getClass().getSimpleName();
    }

}


text:
/*   $NetBSD: in_wchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $ */

/*
 * Copyright (c) 2005 The NetBSD Foundation Inc.
 * All rights reserved.
 *
 * This code is derived from code donated to the NetBSD Foundation
 * by Ruibiao Qiu <ruibiao@arl.wustl.edu,ruibiao@gmail.com>.
 *
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *	notice, this list of conditions and the following disclaimer.
 * 2. 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.
 * 3. Neither the name of the NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 REGENTS 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 <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: in_wchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $");
#endif						  /* not lint */

#include "curses.h"
#include "curses_private.h"

/*
 * in_wchstr, in_wchnstr --
 *	Return an array of wide characters at cursor position from stdscr.
 */
__warn_references(in_wchstr,
	"warning: this program uses in_wchstr(), which is unsafe.")
int
in_wchstr(cchar_t *wchstr)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	return win_wchstr(stdscr, wchstr);
#endif /* HAVE_WCHAR */
}

int
in_wchnstr(cchar_t *wchstr, int n)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	return win_wchnstr(stdscr, wchstr, n);
#endif /* HAVE_WCHAR */
}

/*
 * mvin_wchstr, mv_winchnstr --
 *  Return an array of wide characters at position (y, x) from stdscr.
 */
__warn_references(mvin_wchstr,
	"warning: this program uses mvin_wchstr(), which is unsafe.")
int
mvin_wchstr(int y, int x, cchar_t *wchstr)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	return mvwin_wchstr(stdscr, y, x, wchstr);
#endif /* HAVE_WCHAR */
}

int
mvin_wchnstr(int y, int x, cchar_t *wchstr, int n)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	return mvwin_wchnstr(stdscr, y, x, wchstr, n);
#endif /* HAVE_WCHAR */
}

/*
 * mvwin_wchstr, mvwin_wchnstr --
 *  Return an array wide characters at position (y, x) from the given window.
 */
__warn_references(mvwin_wchstr,
	"warning: this program uses mvwin_wchstr(), which is unsafe.")
int
mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wchstr)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	if (wmove(win, y, x) == ERR)
		return ERR;

	return win_wchstr(win, wchstr);
#endif /* HAVE_WCHAR */
}

int
mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wchstr, int n)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	if (wmove(win, y, x) == ERR)
		return ERR;

	return win_wchnstr(win, wchstr, n);
#endif /* HAVE_WCHAR */
}

/*
 * win_wchstr, win_wchnstr --
 *	Return an array of characters at cursor position.
 */
__warn_references(win_wchstr,
	"warning: this program uses win_wchstr(), which is unsafe.")
int
win_wchstr(WINDOW *win, cchar_t *wchstr)
{
#ifndef HAVE_WCHAR
	return ERR;
#else

	return win_wchnstr(win, wchstr, -1);
#endif /* HAVE_WCHAR */
}

/*
 * - SUSv2/xcurses doesn't document whether the trailing 0 is included
 *   in the length count or not.  For safety's sake it _is_ included.
 */
int
win_wchnstr(WINDOW *win, cchar_t *wchstr, int n)
{
#ifndef HAVE_WCHAR
	return ERR;
#else
	__LDATA	*start;
	int x = 0, cw = 0, cnt = 0;
	cchar_t *wcp;
	nschar_t *np;

	if (wchstr == NULL)
		return ERR;

	start = &win->alines[win->cury]->line[win->curx];
	x = win->curx;
	cw = WCOL(*start);
	if (cw < 0) {
		start += cw;
		x += cw;
	}
	wcp = wchstr;
	/* (n - 1) to leave room for the trailing 0 element */
	while ((x < win->maxx) && ((n < 0) || ((n > 1) && (cnt < n - 1)))) {
		cw = WCOL( *start );
		wcp->vals[ 0 ] = start->ch;
		wcp->attributes = start->attr;
		wcp->elements = 1;
		np = start->nsp;
		if (np) {
			do {
				wcp->vals[ wcp->elements++ ] = np->ch;
				np = np->next;
			} while ( np );
		}
		wcp++;
		cnt++;
		x += cw;
		if ( x < win->maxx )
			start += cw;
	}
	wcp->vals[ 0 ] = L'\0';
	wcp->elements = 1;
	wcp->attributes = win->wattr;

	return OK;
#endif /* HAVE_WCHAR */
}


text:
In order to optimize the setting of individual rubrics of FLL tournaments we did this script

###Dependences
 - `pdftotext`
 - `ghostscript`

- a primeira input deve ser o nome do pdf e a segunda o número final de páginas


text:
<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class ProfileController extends Controller
{

    public function allAction()
    {
        $user = $this->get('security.context')->getToken()->getUser();
        $em = $this->getDoctrine()->getManager();
        $allUser = $em->getRepository('UserBundle:User')->findAll();

        return $this->render('AppBundle:Profile:all.html.twig',array('allUser'=>$allUser,'user'=>$user));
    }

    public function showAction(Request $request)
    {
        $user = $this->get('security.context')->getToken()->getUser();
        return $this->render('AppBundle:Profile:show.html.twig',array('user'=>$user));
    }

    public function editAction(Request $request)
    {
        $user = $this->get('security.context')->getToken()->getUser();
        $em = $this->getDoctrine()->getManager();

        $form = $this->createForm('userbundle_user', $user);

        if($request->getMethod() == 'POST')
        {
            $form->submit($request);

            if($form->isValid())
            {
                $em->persist($user);
                $em->flush();
            }
        }

        return $this->render('AppBundle:Profile:edit.html.twig',array('form'=>$form->createView()));
    }

        /**
     *
     *
     * Permet d'ajouter un ami
     */
    public function deleteAction(Request $request)
    {
        $user = $this->get('security.context')->getToken()->getUser();

        $em = $this->getDoctrine()->getManager();
        $userToAdd =$em->getRepository('UserBundle:User')->find($request->get('id'));

        $flag = false;

        foreach($user->getMyFriends() as $u)
        {

            if($u->getEmail() == $userToAdd->getEmail())
            {

                $flag = true;
            }
        }

        if($flag !== false){
            $user->removeMyFriend($userToAdd);
            $em->persist($user);
            $em->flush();
        }

        return $this->redirectToRoute('app_bundle_profile_show_friends');
    }

    /**
     *
     *
     * Permet d'ajouter un ami
     */
    public function addAction(Request $request)
    {
        $user = $this->get('security.context')->getToken()->getUser();

        $em = $this->getDoctrine()->getManager();
        $userToAdd =$em->getRepository('UserBundle:User')->find($request->get('id'));

        $flag = false;

        foreach($user->getMyFriends() as $u)
        {
            if($u == $userToAdd)
            {
                $flag = true;
            }
        }

        if($flag !== true){
            $user->addMyFriend($userToAdd);
            $em->persist($user);
            $em->flush();
        }

        return $this->redirectToRoute('app_bundle_profile_all');
    }

    public function showFriendsAction()
    {
        $user = $this->get('security.context')->getToken()->getUser();

        return $this->render('AppBundle:Profile:show_friends.html.twig',array('userFriends'=>$user->getMyFriends()));
    }

    public function showFriendAction()
    {
        $user = $this->get('security.context')->getToken()->getUser();
        return $this->render('AppBundle:Profile:show_friend.html.twig',array('user'=>$user));
    }
}


text:
import { Components } from '../../component/factory';
import { Decorators } from '../../decorator/factory';
import { Logger } from '../../util/logger';
import Modal from './base';

/**
 * Implements a Confirmation Modal window.
 *
 * The modal window takes a callback and based on the callback configuration will
 * display a message to the user prior to the execution of the callback.
 *
 * @extends {Modal}
 */
export default class ConfirmModal extends Modal {

  /**
   * Base constructor
   *
   * @typedef {Object} options
   * @property {Boolean} options.appendTo - where the generated html/svg components will be attached to, default body
   * @property {Function} options.callbackHandler - this handler will be used to invoke actions from the menu, default console.log
   * @param {Object} context - the context of the application, usually a configuration and a rendering manager instance
   */
  constructor({ appendTo, callbackHandler }, context) {
    super({ appendTo: appendTo, callbackHandler: callbackHandler }, context);
    /**
     * Stores the element
     * @type {object}
     */
    this.element = undefined;
  }

  /**
   * This method is used to render this component
   *
   * @public
   */
  @Decorators.Initializer.initialize()
  async render() {
    let modalId = this.data.callback.id;

    Logger.debug(`(${this.context.instanceId}) Creating Confirm Modal [${modalId}]...`);

    this.element = this.holder.append('div')
      .attr('id', modalId)
      .attr('class', 'francy-modal');

    let form = this.element.append('form');

    this._buildHeader(form);

    let content = form.append('div').attr('class', 'francy-modal-content')
      .append('div').attr('class', 'francy-table')
      .append('div').attr('class', 'francy-table-body');

    let row = content.append('div').attr('class', 'francy-table-row');
    row.append('div').attr('class', 'francy-table-cell').append('label');
    row.append('div').attr('class', 'francy-table-cell').append('span').attr('id', `Confirm-${this.data.callback.id}`).text(this.data.callback.confirm);

    this._buildFooter(form);

    // disable keyboard shortcuts when using this modal in Jupyter
    if (Components.Jupyter.isAvailable) {
      Decorators.Jupyter.registerKeyboardEvents(['.francy', '.francy-overlay', '.francy-modal']);
    }

    Logger.debug(`(${this.context.instanceId}) Confirm Modal updated [${modalId}]...`);

    return this;
  }

}


text:
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.SiteClassification.Common
{
    public interface ISiteClassificationFactory
    {
        ISiteClassificationManager GetManager(ClientContext ctx);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="HCV Genie, automated interpreter for Versant HCV LiPA genotype assays.">
    <meta name="author" content="Alex Dussaq, alexdussaq.info">

    <title>HCV Genie 2.0</title>

    <link href="../css/bootstrap.min.css" rel="stylesheet">

          HCV Genie

          Open From Computer<input class="computerFile" type="file">

Drop File Here


text:
package ir.pegahtech.saas.client.shared.http;

public class NetworkFailureException extends Exception {

	/**
	 *
	 */
	private static final long serialVersionUID = 3913163106305989043L;

	public NetworkFailureException() {
		super();
	}

	public NetworkFailureException(String msg) {
		super(msg);
	}

	public NetworkFailureException(Throwable t) {
		super(t);
	}
}


text:
<?php

namespace Google\Service\Contentwarehouse;

class AssistantApiSettingsMusicFilter extends \Google\Collection
{
  protected $collection_key = 'whitelistedProviders';
  /**
   * @var string[]
   */
  public $availableProviders;
  /**
   * @var string
   */
  public $providerFilterState;
  /**
   * @var string
   */
  public $state;
  /**
   * @var string[]
   */
  public $whitelistedProviders;

  /**
   * @param string[]
   */
  public function setAvailableProviders($availableProviders)
  {
    $this->availableProviders = $availableProviders;
  }
  /**
   * @return string[]
   */
  public function getAvailableProviders()
  {
    return $this->availableProviders;
  }
  /**
   * @param string
   */
  public function setProviderFilterState($providerFilterState)
  {
    $this->providerFilterState = $providerFilterState;
  }
  /**
   * @return string
   */
  public function getProviderFilterState()
  {
    return $this->providerFilterState;
  }
  /**
   * @param string
   */
  public function setState($state)
  {
    $this->state = $state;
  }
  /**
   * @return string
   */
  public function getState()
  {
    return $this->state;
  }
  /**
   * @param string[]
   */
  public function setWhitelistedProviders($whitelistedProviders)
  {
    $this->whitelistedProviders = $whitelistedProviders;
  }
  /**
   * @return string[]
   */
  public function getWhitelistedProviders()
  {
    return $this->whitelistedProviders;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AssistantApiSettingsMusicFilter::class, 'Google_Service_Contentwarehouse_AssistantApiSettingsMusicFilter');


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

     Copyright 2005-2016 Red Hat, Inc.

     Red Hat licenses this file to you 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.

-->
<assembly>

    <id>dist</id>

    <formats>
        <format>tar.gz</format>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>False</includeBaseDirectory>
    <fileSets>
      <fileSet>
        <directory>${project.basedir}/build/enmasse-${env.IMAGE_VERSION}</directory>
        <outputDirectory>${application.bundle.prefix}-${env.IMAGE_VERSION}</outputDirectory>
        <includes>
           <include>**/*</include>
        </includes>
      </fileSet>
    </fileSets>
</assembly>


text:
<?php

namespace Aisel\ResourceBundle\Repository;

use Doctrine\ODM\MongoDB\DocumentRepository;

/**
 * CollectionRepository
 *
 * @author Ivan Proskuryakov <volgodark@gmail.com>
 */
class CollectionRepository extends DocumentRepository
{

    protected $model = '';
    protected $search = '';
    protected $locale = null;
    protected $filter = null;
    protected $node = 0;
    protected $pageCurrent = 1;
    protected $pageLimit = 1;
    protected $pageSkip = 1;
    protected $order = 'id';
    protected $orderBy = '';

    /**
     * Map request variables for later use in SQL
     *
     * @param array $params
     */
    protected function mapRequest(array $params)
    {
        $this->model = $this->getDocumentName();

        // Pagination
        if (isset($params['current'])) {
            $this->pageCurrent = (int)$params['current'];
        } else {
            $this->pageCurrent = 1;
        }

        if (isset($params['limit'])) {
            $this->pageLimit = (int)$params['limit'];
        } else {
            $this->pageLimit = 5;
        }

        if (isset($params['node'])) {
            $this->node = (int)$params['node'];
        } else {
            $this->node = 0;
        }

        // Search
        if (isset($params['query'])) {
            $this->search = $params['query'];
        }

        // Locale
        if (isset($params['locale'])) {
            $this->locale = $params['locale'];
        }

        // Order
        if (isset($params['order'])) {
            $this->order = $params['order'];
        }

        // Order By
        if (isset($params['orderBy'])) {
            switch ($params['orderBy']) {
                case 'ASC':
                    $this->orderBy = 'ASC';
                    break;

                case 'DESC':
                    $this->orderBy = 'DESC';
                    break;

                default:
                    $this->orderBy = 'ASC';
            }
        }

        // Filter
        if (isset($params['filter'])) {
            $this->filter = (array)json_decode($params['filter']);
        }
        $this->pageSkip = ($this->pageCurrent - 1) * $this->pageLimit;
    }

    /**
     * Get page total
     *
     * @param array $params
     *
     * @return int $total
     */
    public function getTotalFromRequest($params)
    {
        $this->mapRequest($params);
        $query = $this
            ->getDocumentManager()
            ->createQueryBuilder($this->model);

        if ($this->filter) {
            foreach ($this->filter as $field => $value) {
                $query->field($field)->equals($value);
            }
        }

        if ($this->locale) {
            $query->field('locale')->equals($this->locale);
        }

        if ($this->node) {
            $query->field('node')->equals($this->node);
        }

        if ($this->search != '') {
            $query->expr()->operator('content', array(
                '$search' => $this->search,
            ));
        }

        if ($params['scope'] == 'frontend') {
            $query->field('status')->equals(true);
        }

        $total = $query->count()
            ->getQuery()
            ->execute();

        if (!$total) {
            return 0;
        }

        return $total;
    }

    /**
     * Get products based on limit, current pagination and search query
     *
     * @param array $params
     *
     * @return mixed $collection
     */
    public function getCollectionFromRequest($params)
    {
        $this->mapRequest($params);
        $query = $this
            ->getDocumentManager()
            ->createQueryBuilder($this->model);

        if ($this->filter) {
            foreach ($this->filter as $field => $value) {
                $query->field($field)->equals($value);
            }
        }

        if ($this->locale) {
            $query->field('locale')->equals($this->locale);
        }

        if ($this->node) {
            $query->field('node')->equals($this->node);
        }

        if ($params['scope'] == 'frontend') {
            $query->field('status')->equals(true);
        }

        if ($this->search != '') {
            $query->expr()->operator('content', array(
                '$search' => $this->search,
            ));
        }

        $collection = $query
            ->limit($this->pageLimit)
            ->skip($this->pageSkip)
            ->sort($this->order, $this->orderBy)
            ->getQuery()
            ->toArray();

        return $collection;
    }

    /**
     * Find pages by URL
     *
     * @param string $url
     * @param int $entityId
     *
     * @return int $found
     */
    public function findTotalByURL($url, $entityId = null)
    {
        $query = $this
            ->getDocumentManager()
            ->createQueryBuilder();

        $query->select('e')
            ->from($this->model, 'e')
            ->where('e.metaUrl = :url')->setParameter('url', $url);

        if ($entityId) {
            $query->andWhere('e.id != :pageId')->setParameter('pageId', $entityId);
        }
        $found = $query->getQuery()->getSingleScalarResult();

        return $found;
    }

    /**
     * Returns enabled nodes
     *
     * @param string $params
     *
     * @return array $result
     */
    public function getNodesAsTree($params)
    {
        $this->model = $this->getDocumentName();

        $query = $this
            ->getDocumentManager()
            ->createQueryBuilder($this->model)
            ->field('parent')->exists(false)
            ->field('locale')->equals($params['locale']);

        if ($params['scope'] == 'frontend') {
            $query->field('status')->equals(true);
        }

        $result = $query
            ->sort($this->order, $this->orderBy)
            ->getQuery()
            ->toArray();

        return $result;
    }

}


text:
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
  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.github.jsonzou</groupId>
  <artifactId>jmockdata</artifactId>
  <version>4.3.0</version>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <argLine>-Dfile.encoding=UTF-8</argLine>
    <jdk.version>1.8</jdk.version>
  </properties>

  <inceptionYear>2017</inceptionYear>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>The plug-in of Jmockdata what through random algorithm mock java data</description>
  <url>https://github.com/jsonzou/jmockdata</url>

  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>jsonzou</name>
      <email>keko-boy@163.com</email>
      <organization>jsonzou</organization>
      <organizationUrl>https://github.com/jsonzou</organizationUrl>
    </developer>
  </developers>

  <contributors>
    <contributor>
      <name>jsonzou</name>
      <email>keko-boy@163.com</email>
    </contributor>
    <contributor>
      <name>TaoYu</name>
      <email>tracy5546@gmail.com</email>
    </contributor>
    <contributor>
      <name>KanYuXia</name>
      <email>kanyuxia@outlook.com</email>
    </contributor>
  </contributors>

  <scm>
    <connection>scm:git:https://github.com/jsonzou/jmockdata.git</connection>
    <developerConnection>scm:git:https://github.com/jsonzou/jmockdata.git</developerConnection>
    <url>https://github.com/jsonzou/jmockdata</url>
    <tag>jmockdata</tag>
  </scm>

  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.16.20</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.44</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>${jdk.version}</source>
          <target>${jdk.version}</target>
          <testSource>${jdk.version}</testSource>
          <testTarget>${jdk.version}</testTarget>
          <encoding>UTF-8</encoding>
          <optimize>true</optimize>
          <useIncrementalCompilation>false</useIncrementalCompilation>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.0</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eluder.coveralls</groupId>
        <artifactId>coveralls-maven-plugin</artifactId>
        <version>4.3.0</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <distributionManagement>
        <snapshotRepository>
          <id>nexus-release</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
          <id>nexus-release</id>
          <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>


text:
//using Grapher.Models;
//using System.ComponentModel;

//namespace Grapher.ViewModels.Graphs
//{

//    public class GraphViewModel : INotifyPropertyChanged
//    {

//        public event PropertyChangedEventHandler PropertyChanged;

//        public GraphViewModel(GraphModel model)
//        {
//            Model = model;
//            stage = Stages.Stage0;
//        }
//        public GraphViewModel(GraphViewModel other)
//        {
//            model  = other.model;
//            height = other.Height;
//            width  = other.Width;
//        }

//        protected void OnPropertyChanged(string PropertyName)
//        {
//            PropertyChanged?.Invoke(
//                this,
//                new PropertyChangedEventArgs(PropertyName)
//            );
//        }

//        public enum Stages
//        {
//            Stage0,
//            Stage1,
//            Stage2,
//            Stage3
//        }
//        public Stages Stage
//        {
//            get
//            {
//                return stage;
//            }
//            protected set
//            {
//                stage = value;
//                PropertyChanged?.Invoke(
//                    this,
//                    new PropertyChangedEventArgs(nameof(Stage))
//                );
//            }
//        }
//        protected Stages stage;

//        public string Label
//        {
//            get
//            {
//                return Model.Label;
//            }
//        }

//        public double Width
//        {
//            get
//            {
//                return width;
//            }
//            set
//            {
//                width = value;
//                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Width"));
//            }
//        }
//        private double width = 500;

//        public double Height
//        {
//            get
//            {
//                return height;
//            }
//            set
//            {
//                height = value;
//                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Height"));
//            }
//        }
//        public double height = 250;

//        public GraphModel Model
//        {
//            get
//            {
//                return model;
//            }
//            protected set
//            {
//                model = value;
//            }
//        }
//        private GraphModel model;

//        public virtual async void Process()
//        {
//            Stage = Stages.Stage1;
//        }

//    }

//}


text:
<?php

namespace Taskeet\MainBundle\Form\Type\Group;

use Admingenerated\TaskeetMainBundle\Form\BaseGroupType\EditType as BaseEditType;

class EditType extends BaseEditType
{
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.supakit.chapter6;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author wanchana
 */
public class WebReader {

    private String url;

    public WebReader(String url) {
        this.url = url;
    }

    public String getHtml() throws IOException {

        InputStream inputStream = null;
        Reader reader = null;
        BufferedReader bf = null;
        //String html = "";
        StringBuilder builder = new StringBuilder(); //clt. R rename

        try {

            URL urlObject = new URL(url); //class that recieves url to be stream
            inputStream = urlObject.openStream();
            reader = new InputStreamReader(inputStream);  // read only one character.
            //So Using BuffedReader.
            bf = new BufferedReader(reader);
            String data;

            while((data = bf.readLine()) != null){
               // builder = builder + data;
                builder.append(data); // change + be append
            }

        } finally {
            // attemption.
            if (bf != null){
                bf.close();
            }
            if (reader != null) {
                reader.close();
            }
            if (inputStream != null) {
                inputStream.close();
            }

        }
        //return html
        return builder.toString();
    }

    //Using Regular Expression

    public Set<String> getLinks() throws IOException{ // return links set

        Set<String> set = new HashSet<>();
        String pattern = "href=\"(.*?)\""; /*"([^\\s]+(\\.(?i)(jpg|png|gif|bmp))$)";*/
        Pattern complied = Pattern.compile(pattern);
        String html = getHtml();
        Matcher matcher = complied.matcher(getHtml());

        while(matcher.find()){
            //System.out.println("link = " + matcher.group(1)); /* group(1) mean
            //return value that it finded in 1 group was defined String pattern in line 74*/
            set.add(matcher.group());
        }
        return set;
    }
}


text:
package com.xujun.funapp.adapters;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.widget.ImageView;
import android.widget.TextView;

import com.xujun.funapp.R;
import com.xujun.funapp.beans.NewsContentlistEntity;
import com.xujun.funapp.common.APP;
import com.xujun.funapp.common.Constants;
import com.xujun.funapp.common.recyclerView.BaseRecyclerAdapter;
import com.xujun.funapp.common.recyclerView.BaseRecyclerHolder;
import com.xujun.mylibrary.utils.ListUtils;
import com.xujun.funapp.common.util.SPUtils;
import com.xujun.mylibrary.utils.StringUtils;
import com.xujun.funapp.image.ImageRequestManager;
import com.xujun.mylibrary.utils.UriUtils;

import java.util.List;

/**
 * @ explain:
 * @ author:xujun on 2016/10/28 19:26
 * @ email:gdutxiaoxu@163.com
 */
public class YYNewsListGridAdapter extends BaseRecyclerAdapter<NewsContentlistEntity> {
    Object pictureTag;

    public YYNewsListGridAdapter(Context context, List<NewsContentlistEntity> datas, Object
            pictureTag) {
        super(context, R.layout.item_yy_news_list_grid, datas);
        this.pictureTag = pictureTag;

    }

    @Override
    public void convert(BaseRecyclerHolder holder, NewsContentlistEntity item, int position) {
        TextView tvTitle = holder.getView(R.id.tv_title);
        ImageView iv = holder.getView(R.id.iv);

        String title = StringUtils.getStr(item.title);
        List<NewsContentlistEntity.ImageurlsEntity> imageurls = item.imageurls;
        boolean havePic = item.havePic;
        String picUrl = null;
        if (!ListUtils.isEmpty(imageurls)) {//有图片
            picUrl = StringUtils.getStr(imageurls.get(0).url);
        } else {//没有图片

        }

        tvTitle.setText(title);
        // 是否开启智能无图模式,true表示开启智能无图模式
        boolean isIntelligentNoPic = SPUtils.getBoolean(Constants.SPConstants.isIntelligentNoPic);
        //            WriteLogUtil.i("isIntelligentNoPic=" + isIntelligentNoPic);
        if (isIntelligentNoPic) {
            if (APP.getInstance().isWifi()) {
                display(iv, havePic, picUrl);

            } else {
                iv.setImageDrawable(new ColorDrawable(Color.GRAY));
            }

        } else {
            display(iv, havePic, picUrl);
        }
    }

    private void display(ImageView iv, boolean havePic, String picUrl) {
        if (havePic) {
            ImageRequestManager.getRequest().display(mContext, iv, picUrl);
        } else {
            ImageRequestManager.getRequest().display(mContext, iv, UriUtils.resourceIdToUri
                    (mContext, R.mipmap.tangyang11));
        }
    }
}


text:
// Accord Statistics Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © César Souza, 2009-2014
// cesarsouza at gmail.com
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2.1 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

namespace Accord.Statistics.Models.Fields.Functions
{
    using System;
    using Accord.Statistics.Models.Fields.Features;

    /// <summary>
    ///   Common interface for CRF's Potential functions.
    /// </summary>
    ///
    public interface IPotentialFunction<T> : ICloneable
    {

        /// <summary>
        ///   Gets the factor potentials (also known as clique potentials)
        ///   functions composing this potential function.
        /// </summary>
        ///
        FactorPotential<T>[] Factors { get; }

        /// <summary>
        ///   Gets the number of output classes assumed by this function.
        /// </summary>
        ///
        int Outputs { get; }

        /// <summary>
        ///   Gets or sets the set of weights for each feature function.
        /// </summary>
        ///
        /// <value>The weights for each of the feature functions.</value>
        ///
        double[] Weights { get; set; }

        /// <summary>
        ///   Gets the feature functions composing this potential function.
        /// </summary>
        ///
        IFeature<T>[] Features { get; }

        /// <summary>
        ///   Gets the feature vector for a given input and sequence of states.
        /// </summary>
        ///
        double[] GetFeatureVector(int[] states, T[] observations, int output = 0);

    }
}


text:
extern crate test;
extern crate fringe;

use fringe::{OsStack, Generator};

#[bench]
fn generate(b: &mut test::Bencher) {
  let stack = OsStack::new(0).unwrap();
  let mut identity = Generator::new(stack, move |yielder, mut input| {
    loop { input = yielder.suspend(input) }
  });

  b.iter(|| for _ in 0..10 { test::black_box(identity.resume(test::black_box(0))); });
  unsafe { identity.unsafe_unwrap(); }
}


text:
/**
 * Platform file: platform specific definitions, includes and functions
 */

#ifndef __SHT3x_PLATFORM_H__
#define __SHT3x_PLATFORM_H__

#if !defined(ESP_OPEN_RTOS)
#define ESP_OPEN_RTOS 1
#endif

#ifdef ESP_OPEN_RTOS  // ESP8266

// platform specific includes

#include "FreeRTOS.h"
#include "task.h"

#include "espressif/esp_common.h"
#include "espressif/sdk_private.h"

#include "esp/uart.h"
#include "i2c/i2c.h"

#endif // ESP_OPEN_RTOS

#endif // __SHT3x_PLATFORM_H__


text:
using namespace std;

/// see http://www.cnblogs.com/qicosmos/p/3286057.html

struct Person
{
	string name;
	int age;
	string city;
};

multimap<int, Person> GroupByAge(const vector<Person>& vt)
{
	multimap<int, Person> map;
	std::for_each(vt.begin(), vt.end(), [&map](const Person& person)
	{
		map.insert(make_pair(person.age, person));
	});

	return map;
}

multimap<string, Person> GroupByName(const vector<Person>& vt)
{
	multimap<string, Person> map;
	std::for_each(vt.begin(), vt.end(), [&map](const Person& person)
	{
		map.insert(make_pair(person.name, person));
	});

	return map;
}

//multimap<T, Person> GroupBy(const vector<Person>& vt, const std::function<T(const Person&)> keySlector)
vector<Person> vt = {
		{ "aa", 20, "shanghai" }, { "bb", 25, "beijing" }, { "cc", 25, "nanjing" }, { "dd", 20, "nanjing" } };

template<typename Fn>
multimap<typename std::result_of<Fn(Person)>::type, Person> GroupBy(const vector<Person>& vt, const Fn& keySlector)
{
	// keyµÄÀàÐÍ
	//typedef typename std::result_of<Fn(const Person&)>::type ketype;
	//typedef  decltype(std::declval<Fn>()(std::declval<const Person&>())) ketype;
	//typedef decltype(Fn(Person)) ketype;
	//typedef decltype(keySlector(Person())) ketype;
	typedef typename std::result_of<Fn(Person)>::type ketype;
	multimap<ketype, Person> map;
	std::for_each(vt.begin(), vt.end(), [&](const Person& person)
	{
		map.insert(std::make_pair(keySlector(person), person)); //keySlector·µ»ØÖµ¾ÍÊǼüÖµ£¬Í¨¹ýkeySelector²Á³ýÁËÀàÐÍ
	});

	return map;
}

int main()
{
	 vector<Person> vecs = {
			{ "aa", 20, "shanghai" }, { "bb", 25, "beijing" }, { "cc", 25, "nanjing" }, { "dd", 20, "nanjing" } };

	{
		GroupByAge(vecs);
		GroupByName(vecs);
	}

	{
		GroupBy(vecs, [](const Person& person){ return person.age; });  //°´ÄêÁä·Ö×é

		GroupBy(vecs, [](const Person& person){ return person.name; }); //°´ÐÕÃû·Ö×é

		GroupBy(vecs, [](const Person& person){ return person.city; }); //°´³ÇÊзÖ×é
	}

	system("pause");
}


text:
/**
 * Because we ascend upwards in the cwd testing inside of the project itself is
 * counter productive so we have these tools to stage fixtures inside of tmp.
 *
 * @flow
 */

import fs from 'fs';
import path from 'path';
import os from 'os';
import {exec} from 'mz/child_process';

import createDebug from 'debug';

const FIXTURES = path.join(__dirname, 'fixtures');
const debug = createDebug('silk-cli:test:fixture');

export async function create(): Promise<string> {
  let tmp = fs.realpathSync(os.tmpdir());
  let directory = path.join(
    tmp,
    `silk-cli-tests-${process.pid}`
  );
  debug('staging fixtures', directory);

  if (fs.existsSync(directory)) {
    await exec(`rm -rf ${directory}`);
  }

  await exec(`cp -R ${FIXTURES} ${directory}`);
  return directory;
}

export async function destroy(path: string): Promise<void> {
  debug('removing', path);
  await exec(`rm -rf ${path}`);
}


text:
/* global describe, it, expect */
"use strict";

var sinon = require("sinon");
var is = require("@collections/operators").is;
var extendSpyExpectation = require("../specs/spy-expectation");
var describeCollection = require("../specs/collection");
var describeSet = require("../specs/set");
var Set = require("@collections/set");

describe("Set", function () {

  describe("as Set", function () {

    extendSpyExpectation();

    function newSet(values) {
      return new Set(values);
    }

    [Set, newSet].forEach(function (Set) {
      describeCollection(Set, [1, 2, 3, 4], true);
      describeCollection(Set, [{id: 0}, {id: 1}, {id: 2}, {id: 3}], true);
      describeSet(Set);
    });

    describeCollection(function (values) {
      return Set(values, is);
    }, [{}, {}, {}, {}], true);

    it("pops and shifts", function () {
      var a = {i: 2};
      var b = {i: 1};
      var c = {i: 0};
      var set = Set([a, b, c], is);
      expect(set.pop()).toBe(c);
      expect(set.shift()).toBe(a);
    });

    it("dispatches range change on clear", function () {
      var set = Set([1, 2, 3]);
      var spy = sinon.spy();
      set.observeRangeChange(function (plus, minus, index, _set) {
        spy(plus, minus, index);
        expect(_set).toBe(set);
      });
      expect(set.clear()).toBe(3);
      expect(spy).toHaveBeenCalledWith([], [1, 2, 3], 0);
    });

    it("dispatches range change on add", function () {
      var set = Set([1, 3]);
      var spy = sinon.spy();
      set.observeRangeChange(function (plus, minus, index, _set) {
        spy(plus, minus, index);
        expect(_set).toBe(set);
      });
      set.add(2);
      expect(set.toArray()).toEqual([1, 3, 2]);
      expect(spy).toHaveBeenCalledWith([2], [], 2);
    });

    it("dispatches range change on delete", function () {
      var set = Set([1, 2, 3]);
      var spy = sinon.spy();
      set.observeRangeChange(function (plus, minus, index, _set) {
        spy(plus, minus, index);
        expect(_set).toBe(set);
      });
      set["delete"](2);
      expect(set.toArray()).toEqual([1, 3]);
      expect(spy).toHaveBeenCalledWith([], [2], 1);
    });

    it("dispatches range change on pop", function () {
      var set = Set([1, 3, 2]);
      var spy = sinon.spy();
      set.observeRangeChange(function (plus, minus, index, _set) {
        spy(plus, minus, index);
        expect(_set).toBe(set);
      });
      expect(set.pop()).toEqual(2);
      expect(set.toArray()).toEqual([1, 3]);
      expect(spy).toHaveBeenCalledWith([], [2], 2);
    });

    it("dispatches range change on shift", function () {
      var set = Set([1, 3, 2]);
      var spy = sinon.spy();
      set.observeRangeChange(function (plus, minus, index, _set) {
        spy(plus, minus, index);
        expect(_set).toBe(set);
      });
      expect(set.shift()).toEqual(1);
      expect(set.toArray()).toEqual([3, 2]);
      expect(spy).toHaveBeenCalledWith([], [1], 0);
    });

        // Need to reevaluate whether sets fully support range changes, or whether
        // they support merely set changes (no index).
    it("dispatches range change on shift then pop", function () {
      var set = Set([1, 3]);
      set.observeRangeChange(function (plus, minus, index, _set) {
        spy(plus, minus, index);
        expect(_set).toBe(set);
      });

      var spy = sinon.spy();
      expect(set.add(2)).toEqual(true);
      expect(set.toArray()).toEqual([1, 3, 2]);
      expect(spy).toHaveBeenCalledWith([2], [], 2);

      spy = sinon.spy();
      expect(set.shift()).toEqual(1);
      expect(set.toArray()).toEqual([3, 2]);
      expect(spy).toHaveBeenCalledWith([], [1], 0);

      expect(set.pop()).toEqual(2);
      expect(set.toArray()).toEqual([3]);
      expect(spy).toHaveBeenCalledWith([], [2], 1);

      spy = sinon.spy();
      expect(set.delete(3)).toEqual(true);
      expect(set.toArray()).toEqual([]);
      expect(spy).toHaveBeenCalledWith([], [3], 0);
    });

  });
});


text:
<TITLE>Review for Land and Freedom (1995)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Land and Freedom (1995)

reviewed by
T. Robin Sutherland

                                 LAND AND FREEDOM
                       A film review by T. Robin Sutherland
                        Copyright 1995 T. Robin Sutherland

     LAND AND FREEDOM is a difficult film to watch, for many reasons.
First and foremost, it is a war film and since Vietnam, war films
have typically been about skewed politics, lost idealism, the vanity of
the glory of war, and pain and death without reward.  This film is not
an exception.

     It is also initially difficult in that it is a film whose
protagonists are from many different countries: they are volunteers and
mercenaries rallied from across the world to fight Franco in the
Spanish Civil War.  This creates a very rich atmosphere for the drama
of the film as one gets used to the sporadic subtitling, outrageous
accents, and lost dialogue which is either too rapid or stilted to be
translated.

     And it is finally a difficult film to appreciate without a fairly
detailed understanding of the elements of the Spanish Civil War.  To
have known that the Poum (the faction to which the main character has
become attached) was actually a Trotskyist splinter group would have
made a significant difference to my viewing.  Many local political
problems constitute the focus of conflict on both regional and personal
levels.

     But war films are supposed to be hard to watch: war is not a
simple thing--it is the essence of politics, and in this spirit, the
film illustrates many themes.  Textbook idealism, for one, does not
translate well in the battlefield.  What you believe you are fighting
for may be utterly at odds with the politics of your group (despite
their propaganda).  Relationships which are sound and strong may be
lost in a moment over a political detail.  Loyalty wears many
uniforms.  Most of the fighting is not in the trenches.  And, of
course, people die for no comprehensible reason.  All of these points
are made strongly and specifically enough to make you regard them as
more than the cliches of war--they are experiences of each fighter, and
you must see each in its own context.

     This film is beautifully shot.  Most of it is (necessarily)
presented in picturesque outdoor locations which contrast with the
brutality of its action.  Two sequences attract particular attention.
One somewhat overlong sequence outlines the local political infighting
which takes place when the Poum tries to decide to collectivize a
captured estate.  Here it would have been interesting to contrast the
local politics of the Poum against their "official" political line, but
the confusion is indicative of the splintering which causes the
freedom-fighting factions to actually fire on each other later on.  A
second sequence involves the capture of an enemy position--the action
sequence is frantically paced and artfully executed, and creates a
novel build to the film's actual climax.

     Ian Hart has no difficulty in his role as the misplaced man from
Liverpool whose ideals exceed his understanding.  His frustration is as
thick as his loyalty to the principles for which he left his home.  His
character is incredibly honest, and places the common man's plight to
preserve freedom and decency in the world squarely in the swamp of
world politics.  He is easy to identify with, despite his obvious
distance from the audience's context, and it is impossible not to
sympathize with him without being deeply cynical.

     This was not a profound movie for me, but it was an engaging,
educating, and at times, genuinely entertaining film.  I would
recommend it, not as an art film, nor as popular fare, but perhaps as a
film which may provide an honest look at a sparsely filmed bit of
history, presented plausibly from an outsider's point of view.

--
T. Robin Sutherland
Movie Buffs Rant: http://www.interlog.com/~robin/rant/movies/movies.html

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>energy.usef.dso.workflow.altstep (usef-root-pom 1.3.6 API)</title>
<meta name="date" content="2016-09-29">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package energy.usef.dso.workflow.altstep

Class Summary

Class
Description

DsoCreateFlexRequestStubNone

Workflow step implementation for the Workflow 'Create Flex Requests'.

DsoCreateFlexRequestStubOne

Workflow step implementation for the Workflow 'Create Flex Requests'.

DsoCreateGridSafetyAnalysisStubCongestion

Workflow step implementation for the Workflow 'Create Grid Safety Analysis'.

DsoCreateGridSafetyAnalysisStubCongestionDelay

Workflow step implementation for the Workflow 'Create Grid Safety Analysis'.

DsoCreateGridSafetyAnalysisStubNoCongestion

Workflow step implementation for the Workflow 'Create Grid Safety Analysis'.

DsoCreateNonAggregatorForecastStubWithoutFeeder

Workflow step implementation for the Workflow 'Create Non Aggregator Forecast'.

DsoMonitorGridStubCongestion

Basic step implementation for the WorkflowStep doing DSO grid monitoring.

DsoMonitorGridStubNoCongestion

Basic step implementation for the WorkflowStep doing DSO grid monitoring.

DsoPlaceFlexOrdersStubNoOrder

Workflow step implementation for the Workflow 'DSO Place Flex Orders'.

DsoPlaceFlexOrdersStubOrder

Workflow step implementation for the Workflow 'DSO Place Flex Orders'.

DsoPlaceFlexOrdersStubOrderOne

Workflow step implementation for the Workflow 'DSO Place Flex Orders'.

DsoPlaceOperateFlexOrdersStubNoOrder

Workflow step implementation for the Workflow 'Place Operate Flex Orders'.

DsoPlaceOperateFlexOrdersStubOrder

Workflow step implementation for the Workflow 'Place Operate Flex Orders'.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2016. All rights reserved.


text:
class greg{
public:
	std::fstream tmp;
	samples* in;
	int32_t prev;

	greg(samples* in);

	int gUpdate();
	gregHeader* initGHead(waveHeaders* in);
	int finalize(std::ofstream& fout,waveHeaders* WIn);
	~greg();
};

#endif


text:
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>egame资源加载器</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <script>
    (function() {
        function refreshRem() {
            var width = docEl.getBoundingClientRect().width;
            rem = width / (BASE_WIDTH / ROOT_FONT_SIZE);
            docEl.style.fontSize = rem + "px";
        }
        var tid = null, docEl = document.documentElement, BASE_WIDTH = 640, ROOT_FONT_SIZE = 100;
        refreshRem();
         window.addEventListener("resize", function() {
            clearTimeout(tid);
            tid = setTimeout(refreshRem, 300);
        }, false);
    })();
    </script>
	<link rel="stylesheet" href="css/reset.css"/>
	<script type="text/javascript" src="../lib/eco.js"></script>
	<script type="text/javascript" src="../src/egameConfig.js"></script>
</head>
<body>
	<script type="text/javascript">
      egame.use(['Game','Loader','Texture','Sprite','Text','Sound','Image','Audio'],function(Game,Loader,Texture,Sprite,Text,Sound){
            //创建一个游戏对象
            var game = new Game(640,1008,document.body,egame.ScaleMode.FIXED_WIDTH);
            var load =  new Loader(game);
            //初始画面
            var loaddingStatus = {
                preload:function(){
                    //设置要加载的资源
                    load.image("mniya1","images/1.jpg");
                    // load.image("mniya2","images/notfound_img.jpg");
                    load.images(["2","3"],["images/2.jpg","images/3.jpg"]);
                    load.audio("sound1","musics/367664.mp3");

                    //加载资源界面
                    game.stage.renderer.backgroundColor = 0x1099bb;
                    var basicText = new Text('当前进度:0%');
                    basicText.x = 150;
                    basicText.y = 100;
                    game.stage.addChild(basicText);

                    //资源加载状态捕获
                    //加载资源完成时候调用
                    game.load.on("resourceCompleted",function(){
                        basicText.text ='当前进度:'+game.load.progress+'%' ;
                    });
                    game.load.on("resourceErrored",function(resourceKey){
                        alert("资源"+resourceKey+"加载失败");
                    });
                    // 所有加载资源完成时候调用
                    game.load.on("loadCompleted",function(){
                        basicText.text ='当前进度:'+game.load.progress+'%' ;
                        game.stage.removeChildren();
                    });
                },
                create:function(){
                    //设置背景色
                    game.stage.backgroundColor = 0x1099bb;

                    //使用音频资源
                    var sound = new Sound("sound1");
                    sound.play();
                    //使用图片资源
                    // var texture = Texture.fromResource('mniya1');
                    var texture = Texture.fromResource('3');
                    var mniya = new Sprite(texture);
                    mniya.anchor.x = 0.5;
                    mniya.anchor.y = 0.5;
                    mniya.scale.x =0.3;
                    mniya.scale.y =0.3;
                    mniya.position.x = 200;
                    mniya.position.y = 150;
                    this.mniya = mniya;
                    this.stage.addChild(mniya);
                },
                update:function(){
                     // this.mniya.rotation += 0.1;
                }
            };

            //添加状态并在游戏启动后自动启动
            game.state.add("loadding",loaddingStatus,true);
            game.boot();

      });
	</script>
</body>
</html>


text:
package zipkintracer

import (
	"encoding/base64"
	"fmt"
	"net"
	"sync"
	"time"

	"github.com/apache/thrift/lib/go/thrift"

	"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe"
	"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
)

const defaultScribeCategory = "zipkin"

// defaultScribeBatchInterval in seconds
const defaultScribeBatchInterval = 1

const defaultScribeBatchSize = 100

const defaultScribeMaxBacklog = 1000

// ScribeCollector implements Collector by forwarding spans to a Scribe
// service, in batches.
type ScribeCollector struct {
	logger        Logger
	category      string
	factory       func() (scribe.Scribe, error)
	client        scribe.Scribe
	batchInterval time.Duration
	batchSize     int
	maxBacklog    int
	batch         []*scribe.LogEntry
	spanc         chan *zipkincore.Span
	quit          chan struct{}
	shutdown      chan error
	sendMutex     *sync.Mutex
	batchMutex    *sync.Mutex
}

// ScribeOption sets a parameter for the StdlibAdapter.
type ScribeOption func(s *ScribeCollector)

// ScribeLogger sets the logger used to report errors in the collection
// process. By default, a no-op logger is used, i.e. no errors are logged
// anywhere. It's important to set this option in a production service.
func ScribeLogger(logger Logger) ScribeOption {
	return func(s *ScribeCollector) { s.logger = logger }
}

// ScribeBatchSize sets the maximum batch size, after which a collect will be
// triggered. The default batch size is 100 traces.
func ScribeBatchSize(n int) ScribeOption {
	return func(s *ScribeCollector) { s.batchSize = n }
}

// ScribeMaxBacklog sets the maximum backlog size,
// when batch size reaches this threshold, spans from the
// beginning of the batch will be disposed
func ScribeMaxBacklog(n int) ScribeOption {
	return func(c *ScribeCollector) { c.maxBacklog = n }
}

// ScribeBatchInterval sets the maximum duration we will buffer traces before
// emitting them to the collector. The default batch interval is 1 second.
func ScribeBatchInterval(d time.Duration) ScribeOption {
	return func(s *ScribeCollector) { s.batchInterval = d }
}

// ScribeCategory sets the Scribe category used to transmit the spans.
func ScribeCategory(category string) ScribeOption {
	return func(s *ScribeCollector) { s.category = category }
}

// NewScribeCollector returns a new Scribe-backed Collector. addr should be a
// TCP endpoint of the form "host:port". timeout is passed to the Thrift dial
// function NewTSocketFromAddrTimeout. batchSize and batchInterval control the
// maximum size and interval of a batch of spans; as soon as either limit is
// reached, the batch is sent. The logger is used to log errors, such as batch
// send failures; users should provide an appropriate context, if desired.
func NewScribeCollector(addr string, timeout time.Duration, options ...ScribeOption) (Collector, error) {
	factory := scribeClientFactory(addr, timeout)
	client, err := factory()
	if err != nil {
		return nil, err
	}
	c := &ScribeCollector{
		logger:        NewNopLogger(),
		category:      defaultScribeCategory,
		factory:       factory,
		client:        client,
		batchInterval: defaultScribeBatchInterval * time.Second,
		batchSize:     defaultScribeBatchSize,
		maxBacklog:    defaultScribeMaxBacklog,
		batch:         []*scribe.LogEntry{},
		spanc:         make(chan *zipkincore.Span),
		quit:          make(chan struct{}),
		shutdown:      make(chan error, 1),
		sendMutex:     &sync.Mutex{},
		batchMutex:    &sync.Mutex{},
	}

	for _, option := range options {
		option(c)
	}

	go c.loop()
	return c, nil
}

// Collect implements Collector.
func (c *ScribeCollector) Collect(s *zipkincore.Span) error {
	c.spanc <- s
	return nil // accepted
}

// Close implements Collector.
func (c *ScribeCollector) Close() error {
	close(c.quit)
	return <-c.shutdown
}

func scribeSerialize(s *zipkincore.Span) string {
	t := thrift.NewTMemoryBuffer()
	p := thrift.NewTBinaryProtocolTransport(t)
	if err := s.Write(p); err != nil {
		panic(err)
	}
	return base64.StdEncoding.EncodeToString(t.Buffer.Bytes())
}

func (c *ScribeCollector) loop() {
	var (
		nextSend = time.Now().Add(c.batchInterval)
		ticker   = time.NewTicker(c.batchInterval / 10)
		tickc    = ticker.C
	)
	defer ticker.Stop()

	for {
		select {
		case span := <-c.spanc:
			currentBatchSize := c.append(span)
			if currentBatchSize >= c.batchSize {
				nextSend = time.Now().Add(c.batchInterval)
				go c.send()
			}
		case <-tickc:
			if time.Now().After(nextSend) {
				nextSend = time.Now().Add(c.batchInterval)
				go c.send()
			}
		case <-c.quit:
			c.shutdown <- c.send()
			return
		}
	}
}

func (c *ScribeCollector) append(span *zipkincore.Span) (newBatchSize int) {
	c.batchMutex.Lock()
	defer c.batchMutex.Unlock()

	c.batch = append(c.batch, &scribe.LogEntry{
		Category: c.category,
		Message:  scribeSerialize(span),
	})
	if len(c.batch) > c.maxBacklog {
		dispose := len(c.batch) - c.maxBacklog
		c.logger.Log("Backlog too long, disposing spans.", "count", dispose)
		c.batch = c.batch[dispose:]
	}
	newBatchSize = len(c.batch)
	return
}

func (c *ScribeCollector) send() error {
	// in order to prevent sending the same batch twice
	c.sendMutex.Lock()
	defer c.sendMutex.Unlock()

	// Select all current spans in the batch to be sent
	c.batchMutex.Lock()
	sendBatch := c.batch[:]
	c.batchMutex.Unlock()

	// Do not send an empty batch
	if len(sendBatch) == 0 {
		return nil
	}

	if c.client == nil {
		var err error
		if c.client, err = c.factory(); err != nil {
			_ = c.logger.Log("err", fmt.Sprintf("during reconnect: %v", err))
			return err
		}
	}
	if rc, err := c.client.Log(sendBatch); err != nil {
		c.client = nil
		_ = c.logger.Log("err", fmt.Sprintf("during Log: %v", err))
		return err
	} else if rc != scribe.ResultCode_OK {
		// probably transient error; don't reset client
		_ = c.logger.Log("err", fmt.Sprintf("remote returned %s", rc))
	}

	// Remove sent spans from the batch
	c.batchMutex.Lock()
	c.batch = c.batch[len(sendBatch):]
	c.batchMutex.Unlock()

	return nil
}

func scribeClientFactory(addr string, timeout time.Duration) func() (scribe.Scribe, error) {
	return func() (scribe.Scribe, error) {
		a, err := net.ResolveTCPAddr("tcp", addr)
		if err != nil {
			return nil, err
		}
		socket := thrift.NewTSocketFromAddrTimeout(a, timeout)
		transport := thrift.NewTFramedTransport(socket)
		if err := transport.Open(); err != nil {
			_ = socket.Close()
			return nil, err
		}
		proto := thrift.NewTBinaryProtocolTransport(transport)
		client := scribe.NewScribeClientProtocol(transport, proto, proto)
		return client, nil
	}
}


text:
export = Reward;
/**
 * Represents a mission reward
 */
declare class Reward {
    /**
     * @param   {Object} data                 The mission data
     * @param   {Object}             deps            The dependencies object
     * @param   {Translator}         deps.translator The string translator
     * @param   {string}             deps.locale     Locale to use for translations
     */
    constructor(data: any, { translator, locale }: {
        translator: any;
        locale: string;
    });
    /**
     * The items being rewarded
     * @type {Array.<string>}
     */
    items: Array<string>;
    /**
     * The counted items being rewarded
     * @type {Array.<Object>}
     */
    countedItems: Array<any>;
    /**
     * The credits being rewarded
     * @type {number}
     */
    credits: number;
    asString: string;
    itemString: string;
    thumbnail: string;
    color: string | number;
    /**
     * The types of all items that are being rewarded
     * @returns {Array.<string>}
     */
    getTypes(): Array<string>;
    /**
     * The types of all the items that are being rewarded
     * @returns {Array.<RewardType>}
     */
    getTypesFull(): Array<RewardType>;
    /**
     * The reward's string representation
     * @returns {string}
     */
    toString(): string;
}
declare namespace Reward {
    export { RewardType };
}
/**
 * An object describing a type of reward, including name, description,
 * test function to verify type from a string, thumbnail url, and color
 */
type RewardType = {
    /**
     * - Name of the reward type
     */
    name: string;
    /**
     * - Description of the reward type
     */
    description: string;
    /**
     * - Function for testing the return type against a string
     */
    test: string;
    /**
     * - Thumbnail url for this reward type
     */
    thumbnail: string;
    /**
     * - Summary color representing this reward type
     */
    color: string;
};


text:
package org.spacebits.structures.storage.fuel;

import org.spacebits.components.SpacecraftBusComponent;
import org.spacebits.components.TypeInfo;
import org.spacebits.consumables.Fuel;

public interface FuelStorageTank extends SpacecraftBusComponent {

	TypeInfo categoryID = new TypeInfo("FuelStorageTank");

	double getCapacity();

	double getFuelLevel();

	void setFuel(Fuel fuel, double fuelVolume);

	void fillFuel(double fuelVolume);

	void removeFuel(double fuelVolume);

	Fuel getFuel();

	double getAmountOfFuelInTank();

}


text:
package com.android.rs.image;

import java.lang.Math;

import android.view.Surface;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicConvolve3x3;
import android.renderscript.ScriptIntrinsicColorMatrix;
import android.renderscript.Type;
import android.renderscript.Matrix4f;
import android.util.Log;

public class UsageIO extends TestBase {
    private ScriptIntrinsicColorMatrix mMatrix;

    private Allocation mScratchPixelsAllocation1;
    private Allocation mScratchPixelsAllocation2;

    public UsageIO() {
    }

    public void createTest(android.content.res.Resources res) {
        mMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));

        Matrix4f m = new Matrix4f();
        m.set(1, 0, 0.2f);
        m.set(1, 1, 0.9f);
        m.set(1, 2, 0.2f);
        mMatrix.setColorMatrix(m);

        Type connect = mInPixelsAllocation.getType();

        mScratchPixelsAllocation1 = Allocation.createTyped(mRS, connect, Allocation.USAGE_IO_OUTPUT | Allocation.USAGE_SCRIPT);
        mScratchPixelsAllocation2 = Allocation.createTyped(mRS, connect, Allocation.USAGE_IO_INPUT | Allocation.USAGE_SCRIPT);

        Surface s = mScratchPixelsAllocation2.getSurface();
        mScratchPixelsAllocation1.setSurface(s);
    }

    public void runTest() {
        mScratchPixelsAllocation1.copyFrom(mInPixelsAllocation);
        mScratchPixelsAllocation1.ioSend();
        mScratchPixelsAllocation2.ioReceive();
        mMatrix.forEach(mScratchPixelsAllocation2, mOutPixelsAllocation);
    }

}


text:
package feign.cdi.test;

import feign.RequestLine;
import feign.cdi.api.FeignClient;
import feign.cdi.impl.FeignExtension;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;

import javax.enterprise.inject.spi.Extension;
import javax.inject.Inject;

import static com.netflix.config.ConfigurationManager.getConfigInstance;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

@RunWith(Arquillian.class)
public class DelegatingFeignClientBeanTest {

    @FeignClient(url="http://DelegatingFeignClientBeanTest")
    interface TestInterface {
        @RequestLine("POST /")
        String invoke();
    }

    @Deployment
    public static Archive<?> createArchive() {
        return ShrinkWrap.create(JavaArchive.class).addClasses(TestInterface.class, BuilderProvider.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                .addAsServiceProvider(Extension.class, FeignExtension.class);
    }

    @Rule
    public MockWebServer server = new MockWebServer();

    @Rule
    public TestName testName = new TestName();

    @Inject
    private TestInterface api;

    @Before
    public void setUp() throws Exception {
        String serverHost = "localhost:" + server.url("").url().getPort();
        getConfigInstance().setProperty("DelegatingFeignClientBeanTest.ribbon.listOfServers", serverHost);
    }

    @Test
    public void shouldHandleFailuresAndSuccesses() {
        server.enqueue(new MockResponse().setResponseCode(500).setBody("Failure"));
        assertThatThrownBy(() -> api.invoke())
                .isInstanceOf(IllegalStateException.class)
                .hasMessage("Error 500 while invoking TestInterface#invoke()");
    }

    @Test
    public void shouldExecuteASuccessCallUsingBuilder() {
        String body = "Success";
        server.enqueue(new MockResponse().setBody(body));
        String result = api.invoke();
        assertThat(result).isEqualTo(body);
    }

}


text:
<?php

namespace Zimbra\Mail\Struct;

use Zimbra\Struct\Base;

/**
 * ByYearDayRule struct class
 *
 * @package    Zimbra
 * @subpackage Mail
 * @category   Struct
 * @author     Nguyen Van Nguyen - nguyennv1981@gmail.com
 * @copyright  Copyright © 2013 by Nguyen Van Nguyen.
 */
class ByYearDayRule extends Base
{
    /**
     * Constructor method for ByYearDayRule
     * @param  string $list BYYEARDAY yearday list. Format : [[+]|-]num[,...]" where num is between 1 and 366
     * @return self
     */
    public function __construct($list)
    {
        parent::__construct();
        $this->setList($list);
    }

    /**
     * Gets list
     *
     * @return string
     */
    public function getList()
    {
        return $this->getProperty('yrdaylist');
    }

    /**
     * Sets list
     *
     * @param  string $list
     * @return self
     */
    public function setList($list)
    {
        $yrdaylist = explode(',', $list);
        $arr = array();
        foreach ($yrdaylist as $day)
        {
            if(is_numeric($day))
            {
                $day = (int) $day;
                if($day != 0 && $day > -367 && $day < 367 && !in_array($day, $arr))
                {
                    $arr[] = $day;
                }
            }
        }
        return $this->setProperty('yrdaylist', implode(',', $arr));
    }

    /**
     * Returns the array representation of this class
     *
     * @param  string $name
     * @return array
     */
    public function toArray($name = 'byyearday')
    {
        return parent::toArray($name);
    }

    /**
     * Method returning the xml representation of this class
     *
     * @param  string $name
     * @return SimpleXML
     */
    public function toXml($name = 'byyearday')
    {
        return parent::toXml($name);
    }
}


text:
.class Lcom/android/internal/policy/impl/SimUnlockScreen$4;
.super Lcom/android/internal/policy/impl/SimUnlockScreen$CheckSimPin;
.source "SimUnlockScreen.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/internal/policy/impl/SimUnlockScreen;->checkPuk()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/SimUnlockScreen;Ljava/lang/String;Ljava/lang/String;I)V
    .locals 0
    .parameter
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"

    .prologue
    .line 1373
    iput-object p1, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    invoke-direct {p0, p1, p2, p3, p4}, Lcom/android/internal/policy/impl/SimUnlockScreen$CheckSimPin;-><init>(Lcom/android/internal/policy/impl/SimUnlockScreen;Ljava/lang/String;Ljava/lang/String;I)V

    return-void
.end method

# virtual methods
.method onSimLockChangedResponse(Z)V
    .locals 8
    .parameter "success"

    .prologue
    const/4 v3, 0x1

    const/4 v4, 0x0

    .line 1375
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$300(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/app/ProgressDialog;

    move-result-object v5

    if-eqz v5, :cond_0

    .line 1376
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$300(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/app/ProgressDialog;

    move-result-object v5

    invoke-virtual {v5}, Landroid/app/ProgressDialog;->hide()V

    .line 1378
    :cond_0
    if-eqz p1, :cond_2

    .line 1381
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
    invoke-static {v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$100(Lcom/android/internal/policy/impl/SimUnlockScreen;)Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;

    move-result-object v3

    iget-object v4, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    iget v4, v4, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimId:I

    invoke-virtual {v3, v4}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->reportSimUnlocked(I)V

    .line 1382
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
    invoke-static {v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$100(Lcom/android/internal/policy/impl/SimUnlockScreen;)Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;

    move-result-object v3

    invoke-virtual {v3}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->dmIsLocked()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 1383
    const-string v3, "keyguard"

    const-string v4, "we clicked cancel button"

    invoke-static {v3, v4}, Lcom/mediatek/xlog/Xlog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 1384
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
    invoke-static {v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$400(Lcom/android/internal/policy/impl/SimUnlockScreen;)Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    move-result-object v3

    invoke-interface {v3}, Lcom/android/internal/policy/impl/KeyguardScreenCallback;->goToLockScreen()V

    .line 1415
    :goto_0
    return-void

    .line 1386
    :cond_1
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
    invoke-static {v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$400(Lcom/android/internal/policy/impl/SimUnlockScreen;)Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    move-result-object v3

    invoke-interface {v3}, Lcom/android/internal/policy/impl/KeyguardScreenCallback;->goToUnlockScreen()V

    goto :goto_0

    .line 1389
    :cond_2
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mTimesLeft:Landroid/widget/TextView;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$1000(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/widget/TextView;

    move-result-object v5

    invoke-virtual {v5, v4}, Landroid/widget/TextView;->setVisibility(I)V

    .line 1390
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mResultPrompt:Landroid/widget/TextView;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$600(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/widget/TextView;

    move-result-object v5

    const v6, 0x205008a

    invoke-virtual {v5, v6}, Landroid/widget/TextView;->setText(I)V

    .line 1391
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mResultPrompt:Landroid/widget/TextView;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$600(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/widget/TextView;

    move-result-object v5

    invoke-virtual {v5, v3}, Landroid/widget/TextView;->setFocusable(Z)V

    .line 1392
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #calls: Lcom/android/internal/policy/impl/SimUnlockScreen;->getRetryPukCount(I)I
    invoke-static {v5, v4}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$1400(Lcom/android/internal/policy/impl/SimUnlockScreen;I)I

    move-result v1

    .line 1393
    .local v1, retryCount:I
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mPUKRetryCount:I
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2000(Lcom/android/internal/policy/impl/SimUnlockScreen;)I

    move-result v5

    if-eq v5, v1, :cond_3

    move v0, v3

    .line 1394
    .local v0, countChange:Z
    :goto_1
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #calls: Lcom/android/internal/policy/impl/SimUnlockScreen;->getRetryPuk(I)Ljava/lang/String;
    invoke-static {v5, v4}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$900(Lcom/android/internal/policy/impl/SimUnlockScreen;I)Ljava/lang/String;

    move-result-object v2

    .line 1396
    .local v2, retryInfo:Ljava/lang/String;
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mHeaderText:Landroid/widget/TextView;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$800(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/widget/TextView;

    move-result-object v5

    const v6, 0x2050011

    invoke-virtual {v5, v6}, Landroid/widget/TextView;->setText(I)V

    .line 1397
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mTimesLeft:Landroid/widget/TextView;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$1000(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/widget/TextView;

    move-result-object v5

    invoke-virtual {v5, v2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 1399
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mPinText:Landroid/widget/TextView;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$1200(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/widget/TextView;

    move-result-object v5

    const-string v6, ""

    invoke-virtual {v5, v6}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 1400
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #setter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mEnteredDigits:I
    invoke-static {v5, v4}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$1302(Lcom/android/internal/policy/impl/SimUnlockScreen;I)I

    .line 1401
    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #setter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mPukEnterState:I
    invoke-static {v5, v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$502(Lcom/android/internal/policy/impl/SimUnlockScreen;I)I

    .line 1402
    if-eqz v1, :cond_5

    .line 1403
    if-eqz v0, :cond_4

    .line 1404
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    iget-object v6, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mContext:Landroid/content/Context;
    invoke-static {v6}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2100(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/content/Context;

    move-result-object v6

    const v7, 0x2050012

    invoke-virtual {v6, v7}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    #calls: Lcom/android/internal/policy/impl/SimUnlockScreen;->setInputInvalidAlertDialog(Ljava/lang/CharSequence;Z)V
    invoke-static {v3, v5, v4}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2200(Lcom/android/internal/policy/impl/SimUnlockScreen;Ljava/lang/CharSequence;Z)V

    .line 1413
    :goto_2
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
    invoke-static {v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$400(Lcom/android/internal/policy/impl/SimUnlockScreen;)Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    move-result-object v3

    invoke-interface {v3}, Lcom/android/internal/policy/impl/KeyguardScreenCallback;->pokeWakelock()V

    goto/16 :goto_0

    .end local v0           #countChange:Z
    .end local v2           #retryInfo:Ljava/lang/String;
    :cond_3
    move v0, v4

    .line 1393
    goto :goto_1

    .line 1408
    .restart local v0       #countChange:Z
    .restart local v2       #retryInfo:Ljava/lang/String;
    :cond_4
    iget-object v3, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mContext:Landroid/content/Context;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2300(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/content/Context;

    move-result-object v5

    const v6, 0x10402fe

    invoke-virtual {v5, v6}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v5

    #calls: Lcom/android/internal/policy/impl/SimUnlockScreen;->setInputInvalidAlertDialog(Ljava/lang/CharSequence;Z)V
    invoke-static {v3, v5, v4}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2200(Lcom/android/internal/policy/impl/SimUnlockScreen;Ljava/lang/CharSequence;Z)V

    goto :goto_2

    .line 1411
    :cond_5
    iget-object v4, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    iget-object v5, p0, Lcom/android/internal/policy/impl/SimUnlockScreen$4;->this$0:Lcom/android/internal/policy/impl/SimUnlockScreen;

    #getter for: Lcom/android/internal/policy/impl/SimUnlockScreen;->mContext:Landroid/content/Context;
    invoke-static {v5}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2400(Lcom/android/internal/policy/impl/SimUnlockScreen;)Landroid/content/Context;

    move-result-object v5

    const v6, 0x2050016

    invoke-virtual {v5, v6}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v5

    #calls: Lcom/android/internal/policy/impl/SimUnlockScreen;->setInputInvalidAlertDialog(Ljava/lang/CharSequence;Z)V
    invoke-static {v4, v5, v3}, Lcom/android/internal/policy/impl/SimUnlockScreen;->access$2200(Lcom/android/internal/policy/impl/SimUnlockScreen;Ljava/lang/CharSequence;Z)V

    goto :goto_2
.end method