text:
<?php

namespace zikmont\GestionCarteraBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * carterazk\GCarteraBundle\Entity\RegistroGestion
 */
class RegistroGestion
{
    /**
     * @var integer $id
     */
    private $id;

    /**
     * @var integer $codigo_registro_pk
     */
    private $codigo_registro_pk;

    /**
     * @var datetime $fecha_registro
     */
    private $fecha_registro;

    /**
     * @var string $telefono
     */
    private $telefono;

    /**
     * @var string $contacto
     */
    private $contacto;

    /**
     * @var integer $codigo_concepto_fk
     */
    private $codigo_concepto_fk;

    /**
     * @var string $codigo_usuario
     */
    private $codigo_usuario;

    /**
     * @var string $comentarios
     */
    private $comentarios;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set codigo_registro_pk
     *
     * @param integer $codigoRegistroPk
     */
    public function setCodigoRegistroPk($codigoRegistroPk)
    {
        $this->codigo_registro_pk = $codigoRegistroPk;
    }

    /**
     * Get codigo_registro_pk
     *
     * @return integer
     */
    public function getCodigoRegistroPk()
    {
        return $this->codigo_registro_pk;
    }

    /**
     * Set fecha_registro
     *
     * @param datetime $fechaRegistro
     */
    public function setFechaRegistro($fechaRegistro)
    {
        $this->fecha_registro = $fechaRegistro;
    }

    /**
     * Get fecha_registro
     *
     * @return datetime
     */
    public function getFechaRegistro()
    {
        return $this->fecha_registro;
    }

    /**
     * Set telefono
     *
     * @param string $telefono
     */
    public function setTelefono($telefono)
    {
        $this->telefono = $telefono;
    }

    /**
     * Get telefono
     *
     * @return string
     */
    public function getTelefono()
    {
        return $this->telefono;
    }

    /**
     * Set contacto
     *
     * @param string $contacto
     */
    public function setContacto($contacto)
    {
        $this->contacto = $contacto;
    }

    /**
     * Get contacto
     *
     * @return string
     */
    public function getContacto()
    {
        return $this->contacto;
    }

    /**
     * Set codigo_concepto_fk
     *
     * @param integer $codigoConceptoFk
     */
    public function setCodigoConceptoFk($codigoConceptoFk)
    {
        $this->codigo_concepto_fk = $codigoConceptoFk;
    }

    /**
     * Get codigo_concepto_fk
     *
     * @return integer
     */
    public function getCodigoConceptoFk()
    {
        return $this->codigo_concepto_fk;
    }

    /**
     * Set codigo_usuario
     *
     * @param string $codigoUsuario
     */
    public function setCodigoUsuario($codigoUsuario)
    {
        $this->codigo_usuario = $codigoUsuario;
    }

    /**
     * Get codigo_usuario
     *
     * @return string
     */
    public function getCodigoUsuario()
    {
        return $this->codigo_usuario;
    }

    /**
     * Set comentarios
     *
     * @param string $comentarios
     */
    public function setComentarios($comentarios)
    {
        $this->comentarios = $comentarios;
    }

    /**
     * Get comentarios
     *
     * @return string
     */
    public function getComentarios()
    {
        return $this->comentarios;
    }
}


text:
import { Generation } from '../data/interface';
import { Pokemon } from '../pokemon';
import { Move } from '../move';
import { Field } from '../field';
import { Result } from '../result';
export declare function calculateADV(gen: Generation, attacker: Pokemon, defender: Pokemon, move: Move, field: Field): Result;

redpajama_set_name: RedPajamaGithub


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('academics', '0025_parent'),
    ]

    operations = [
        migrations.CreateModel(
            name='StudentParentRelation',
            fields=[
                ('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
                ('relationship', models.CharField(blank=True, max_length=20)),
            ],
        ),
        migrations.AlterField(
            model_name='parent',
            name='phone_cell',
            field=models.CharField(blank=True, max_length=50),
        ),
        migrations.AlterField(
            model_name='parent',
            name='phone_home',
            field=models.CharField(blank=True, max_length=50),
        ),
        migrations.AlterField(
            model_name='parent',
            name='phone_work',
            field=models.CharField(blank=True, max_length=50),
        ),
        migrations.AddField(
            model_name='studentparentrelation',
            name='parent',
            field=models.ForeignKey(to='academics.Parent'),
        ),
        migrations.AddField(
            model_name='studentparentrelation',
            name='student',
            field=models.ForeignKey(to='academics.Student'),
        ),
        migrations.AlterUniqueTogether(
            name='studentparentrelation',
            unique_together=set([('student', 'parent')]),
        ),
    ]


text:
require 'rails/generators/migration'

class RefinerycmsCradleRollGenerator < Rails::Generators::NamedBase
  include Rails::Generators::Migration

  source_root File.expand_path('../refinerycms_cradle_roll/templates/', __FILE__)
  argument :name, :type => :string, :default => 'birth', :banner => ''
  argument :attributes, :type => :array, :default => ["name:string", "birth_date:datetime", "image_id:integer", "weight:string", "length:string"]

  def generate
    # seed file
    template 'db/seeds/seed.rb', Rails.root.join('db/seeds/refinerycms_cradle_roll.rb')

    next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
    template('db/migrate/migration_number_create_singular_name.rb',
             Rails.root.join("db/migrate/#{next_migration_number}_create_#{plural_name}.rb"))

     unless self.behavior == :revoke
       puts "------------------------"
       puts "Now run:"
       puts "rake db:migrate"
       puts "------------------------"
     end
  end
end

# Below is a hack until this issue:
# https://rails.lighthouseapp.com/projects/8994/tickets/3820-make-railsgeneratorsmigrationnext_migration_number-method-a-class-method-so-it-possible-to-use-it-in-custom-generators
# is fixed on the Rails project.

require 'rails/generators/named_base'
require 'rails/generators/migration'
require 'rails/generators/active_model'
require 'active_record'

module ActiveRecord
  module Generators
    class Base < Rails::Generators::NamedBase #:nodoc:
      include Rails::Generators::Migration

      # Implement the required interface for Rails::Generators::Migration.
      def self.next_migration_number(dirname) #:nodoc:
        next_migration_number = current_migration_number(dirname) + 1
        if ActiveRecord::Base.timestamped_migrations
          [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
        else
          "%.3d" % next_migration_number
        end
      end
    end
  end
end


text:
package co.cask.cdap.test.base;

import co.cask.cdap.batch.stream.BatchStreamIntegrationTestRun;
import co.cask.cdap.flow.stream.FlowStreamIntegrationTestRun;
import co.cask.cdap.mapreduce.MapReduceStreamInputTestRun;
import co.cask.cdap.mapreduce.service.MapReduceServiceIntegrationTestRun;
import co.cask.cdap.partitioned.MapReducePartitionConsumingTestRun;
import co.cask.cdap.spark.metrics.SparkMetricsIntegrationTestRun;
import co.cask.cdap.spark.service.SparkServiceIntegrationTestRun;
import co.cask.cdap.spark.stream.SparkStreamIntegrationTestRun;
import co.cask.cdap.test.XSlowTests;
import co.cask.cdap.test.app.DummyBaseCloneTestRun;
import co.cask.cdap.test.app.DummyBaseTestRun;
import co.cask.cdap.test.app.TestFrameworkTestRun;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
 * This is a test suite that runs all tests in the cdap-unit-test. This avoid starting/stopping app-fabric per test.
 */
@Category(XSlowTests.class)
@RunWith(Suite.class)
@Suite.SuiteClasses({
  BatchStreamIntegrationTestRun.class,
  DummyBaseTestRun.class,
  DummyBaseCloneTestRun.class,
  FlowStreamIntegrationTestRun.class,
  MapReduceStreamInputTestRun.class,
  MapReduceServiceIntegrationTestRun.class,
  MapReducePartitionConsumingTestRun.class,
  SparkMetricsIntegrationTestRun.class,
  SparkServiceIntegrationTestRun.class,
  SparkStreamIntegrationTestRun.class,
  TestFrameworkTestRun.class
})
public class TestFrameworkTestSuite extends TestFrameworkTestBase {
}


text:
from edjango.settings.common import *

# Apps setttings auto discovery

from edjango.common.utils import discover_apps

for app in discover_apps('edjango', only_names=True):

    # Check if we have the populate:
    settings_file = 'edjango/{}/settings.py'.format(app)
    if os.path.isfile(settings_file):

        app_settings_module = 'edjango.{}.settings'.format(app)

        # A bit triky but should be fine...
        exec('from {} import *'.format(app_settings_module))


text:
Declarative transactions

The container manages transactions (begin()/commmit()).

    @Transactional(propagation = Propagation.REQUIRED)
    public void myMethod() {
    // business code
    }

 Developer instructs the container how to manage the transaction.


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

<configuration scan="true" scanPeriod="30 seconds">
    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
        <resetJUL>true</resetJUL>
    </contextListener>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%date %-5.5level [%-40.40thread] %-36.36logger{36} - %message%n</pattern>
        </encoder>
    </appender>

    <logger name="com.mesosphere.mesos.rx.java" level="debug"/>
    <!--<logger name="com.mesosphere.mesos.rx.java.example.framework.sleepy.State" level="debug"/>-->
    <logger name="io.netty.handler.logging.LoggingHandler" level="info"/>

    <root level="info">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>


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.
*/
/*
    Created on : 21/05/2017, 08:19:23 AM
    Author     : David Zuluaga
*/

#containerproduct{
    padding: 55px 15px 15px 755px;
}
.searchproduct{
    width: 25px;
}


text:
An example client app to demonstrate how to access Signafire APIs via OAuth 2.0.

## Usage

1. Edit `src/oauth-client-example-clojure/core.clj` file to set the `<CLIENT-ID>`, `<CLIENT-SECRET>`, `<API-NAME>`, and `<API-VERSION>` values.

2. Run on the command line with `lein run`.

## License

Copyright © 2015 Signafire

Distributed under the MIT License.  See `LICENSE` file for details.


text:
This application makes use of the following third party libraries:

## AFNetworking

Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

## ASIHTTPRequest

* Copyright (c) 2007-2011, All-Seeing Interactive
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above copyright
*       notice, this list of conditions and the following disclaimer in the
*       documentation and/or other materials provided with the distribution.
*     * Neither the name of the All-Seeing Interactive 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 All-Seeing Interactive ''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 All-Seeing Interactive 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.

A different license may apply to other software included in this package,
including GHUnit and Andrew Donoho's Reachability class. Please consult their
respective headers for the terms of their individual licenses.

## MBProgressHUD

Copyright (c) 2009-2015 Matej Bukovinski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

## OpenUDID

initiated by Yann Lechelle (cofounder @Appsfire) on 8/28/11.
Copyright 2011, 2012 OpenUDID.org

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.

## Reachability

Copyright (c) 2011, Tony Million.
All rights reserved.

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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## YYWebImage

The MIT License (MIT)

Copyright (c) 2015 ibireme <ibireme@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Generated by CocoaPods - http://cocoapods.org


text:
package com.carrotsearch.hppcrt.generator.parser;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Locale;
import java.util.logging.Level;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.carrotsearch.hppcrt.generator.TemplateOptions;
import com.carrotsearch.hppcrt.generator.Type;
import com.carrotsearch.randomizedtesting.RandomizedRunner;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;

@RunWith(RandomizedRunner.class)
//To be able to display GUI
@ThreadLeakLingering(linger = Integer.MAX_VALUE)
public class SignatureProcessorTest
{
    private static final String TEST_CASE_RESOURCE_PATH = "test_cases/";

    private boolean displayParseTree = false;

    @Before
    public void setUp() {

        // set to true to launch the GUI for the tests.
        this.displayParseTree = false;
    }

    @Test
    public void testClassKV() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor("public class KTypeVTypeClass<KType, VType> {}");
        check(Type.INT, Type.LONG, sp, "public class IntLongClass {}");
        check(Type.INT, Type.GENERIC, sp, "public class IntObjectClass<VType> {}");
        check(Type.GENERIC, Type.LONG, sp, "public class ObjectLongClass<KType> {}");
        check(Type.GENERIC, Type.GENERIC, sp, "public class ObjectObjectClass<KType, VType> {}");
    }

    @Test
    public void testClassVK_SignatureReversed() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor("public class KTypeVTypeClass<VType, KType> {}");
        check(Type.INT, Type.LONG, sp, "public class LongIntClass {}");
        check(Type.INT, Type.GENERIC, sp, "public class ObjectIntClass<VType> {}");
        check(Type.GENERIC, Type.LONG, sp, "public class LongObjectClass<KType> {}");
        check(Type.GENERIC, Type.GENERIC, sp, "public class ObjectObjectClass<VType, KType> {}");
    }

    @Test
    public void testClassK() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor("public class KTypeClass<KType> {}");
        check(Type.INT, sp, "public class IntClass {}");
        check(Type.GENERIC, sp, "public class ObjectClass<KType> {}");
    }

    @Test
    public void testClassExtendsNonTemplate() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor("public class KTypeVTypeClass<KType, VType> extends SuperClass {}");
        check(Type.INT, Type.LONG, sp, "public class IntLongClass extends SuperClass {}");
        check(Type.INT, Type.GENERIC, sp, "public class IntObjectClass<VType> extends SuperClass {}");
        check(Type.GENERIC, Type.LONG, sp, "public class ObjectLongClass<KType> extends SuperClass {}");
        check(Type.GENERIC, Type.GENERIC, sp, "public class ObjectObjectClass<KType, VType> extends SuperClass {}");
    }

    @Test
    public void testClassExtendsTemplate() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "public class KTypeVTypeClass<KType, VType> extends KTypeVTypeSuperClass<KType, VType> {}");
        check(Type.INT, Type.LONG, sp, "public class IntLongClass extends IntLongSuperClass {}");
        check(Type.INT, Type.GENERIC, sp, "public class IntObjectClass<VType> extends IntObjectSuperClass<VType> {}");
        check(Type.GENERIC, Type.LONG, sp, "public class ObjectLongClass<KType> extends ObjectLongSuperClass<KType> {}");
        check(Type.GENERIC, Type.GENERIC, sp, "public class ObjectObjectClass<KType, VType> extends ObjectObjectSuperClass<KType, VType> {}");
    }

    @Test
    public void testClassImplementsTemplate() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "public class KTypeVTypeClass<KType, VType> " +
                        " extends     KTypeVTypeSuperClass<KType, VType>" +
                " implements  KTypeVTypeInterface<KType, VType> {}");

        check(Type.INT, Type.LONG, sp, "public class IntLongClass extends IntLongSuperClass implements IntLongInterface {}");
        check(Type.INT, Type.GENERIC, sp, "public class IntObjectClass<VType> extends IntObjectSuperClass<VType> implements IntObjectInterface<VType> {}");
        check(Type.GENERIC, Type.LONG, sp, "public class ObjectLongClass<KType> extends ObjectLongSuperClass<KType> implements ObjectLongInterface<KType> {}");
        check(Type.GENERIC, Type.GENERIC, sp, "public class ObjectObjectClass<KType, VType> extends ObjectObjectSuperClass<KType, VType> implements ObjectObjectInterface<KType, VType> {}");
    }

    @Test
    public void testInterfaceKV() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "public interface KTypeVTypeInterface<KType, VType> " +
                "         extends KTypeVTypeSuper<KType, VType> {}");

        check(Type.INT, Type.LONG, sp, "public interface IntLongInterface extends IntLongSuper {}");
        check(Type.INT, Type.GENERIC, sp, "public interface IntObjectInterface<VType> extends IntObjectSuper<VType> {}");
        check(Type.GENERIC, Type.LONG, sp, "public interface ObjectLongInterface<KType> extends ObjectLongSuper<KType> {}");
        check(Type.GENERIC, Type.GENERIC, sp, "public interface ObjectObjectInterface<KType, VType> extends ObjectObjectSuper<KType, VType> {}");
    }

    @Test
    public void testImportDeclarations() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "import foo.KTypeVTypeClass; class Foo {}");

        check(Type.INT, Type.LONG, sp, "import foo.IntLongClass; class Foo {}");
        check(Type.INT, Type.GENERIC, sp, "import foo.IntObjectClass; class Foo {}");
        check(Type.GENERIC, Type.LONG, sp, "import foo.ObjectLongClass; class Foo {}");
        check(Type.GENERIC, Type.GENERIC, sp, "import foo.ObjectObjectClass; class Foo {}");
    }

    @Test
    public void testFieldDeclaration() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { KType foo; KType [] foo2; }");

        check(Type.FLOAT, sp, "class FloatFoo { float foo; float [] foo2; }");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { KType foo; KType [] foo2; }");
    }

    @Test
    public void testClassConstructor() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeVTypeFoo<KType, VType> { public KTypeVTypeFoo(KType k, VType v) {} }");

        check(Type.FLOAT, Type.DOUBLE, sp, "class FloatDoubleFoo { public FloatDoubleFoo(float k, double v) {} }");
        check(Type.FLOAT, Type.GENERIC, sp, "class FloatObjectFoo<VType> { public FloatObjectFoo(float k, VType v) {} }");
        check(Type.GENERIC, Type.FLOAT, sp, "class ObjectFloatFoo<KType> { public ObjectFloatFoo(KType k, float v) {} }");
        check(Type.GENERIC, Type.GENERIC, sp, "class ObjectObjectFoo<KType, VType> { public ObjectObjectFoo(KType k, VType v) {} }");
    }

    @Test
    public void testThisReference() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeVTypeFoo<KType, VType> { public void foo() { KTypeVTypeFoo.this.foo(); } }");

        check(Type.FLOAT, Type.DOUBLE, sp, "class FloatDoubleFoo { public void foo() { FloatDoubleFoo.this.foo(); } }");
    }

    @Test
    public void testNewClassDiamond() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeVTypeFoo<KType, VType> { public void foo() { new KTypeVTypeFoo<>(); } }");

        check(Type.FLOAT, Type.DOUBLE, sp, "class FloatDoubleFoo { public void foo() { new FloatDoubleFoo(); } }");
        check(Type.GENERIC, Type.DOUBLE, sp, "class ObjectDoubleFoo<KType> { public void foo() { new ObjectDoubleFoo<>(); } }");
    }

    @Test
    public void testNewClass() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeVTypeFoo<KType, VType> { public void foo() { new KTypeVTypeFoo<KType, VType>(); } }");

        check(Type.FLOAT, Type.DOUBLE, sp, "class FloatDoubleFoo { public void foo() { new FloatDoubleFoo(); } }");
        check(Type.GENERIC, Type.DOUBLE, sp, "class ObjectDoubleFoo<KType> { public void foo() { new ObjectDoubleFoo<KType>(); } }");
    }

    @Test
    public void testStaticGenericMethod() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeVTypeFoo<KType, VType> { static <KType, VType> KTypeVTypeFoo foo(KType[] k, VType[] v) {} }");

        check(Type.FLOAT, Type.DOUBLE, sp, "class FloatDoubleFoo { static FloatDoubleFoo foo(float[] k, double[] v) {} }");
        check(Type.GENERIC, Type.DOUBLE, sp, "class ObjectDoubleFoo<KType> { static <KType> ObjectDoubleFoo foo(KType[] k, double[] v) {} }");
    }

    @Test
    public void testWildcardBound() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { void bar(KTypeFoo<?> other) {} }");

        check(Type.FLOAT, sp, "class FloatFoo { void bar(FloatFoo other) {} }");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { void bar(ObjectFoo<?> other) {} }");
    }

    @Test
    public void testGenericNamedTypeBound() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { public <T extends KTypeBar<? super KType>> T forEach(T v) { throw new R(); } }");

        check(Type.FLOAT, sp, "class FloatFoo         { public <T extends FloatBar> T forEach(T v) { throw new R(); } }");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { public <T extends ObjectBar<? super KType>> T forEach(T v) { throw new R(); } }");
    }

    @Test
    public void testNotGenericNamedTypeBound() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { public <T extends IntProcedure> T forEach(T v) { } }");

        check(Type.FLOAT, sp, "class FloatFoo { public <T extends IntProcedure> T forEach(T v) { } }");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { public <T extends IntProcedure> T forEach(T v) { } }");
    }

    @Test
    public void testBug_ErasesObjectConstructor() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeVTypeFoo<KType, VType> { static { HashSet<Object> values = new HashSet<Object>(); }}");

        check(Type.FLOAT, Type.INT, sp, "class FloatIntFoo { static { HashSet<Object> values = new HashSet<Object>(); }}");
        check(Type.GENERIC, Type.GENERIC, sp, "class ObjectObjectFoo<KType, VType> { static { HashSet<Object> values = new HashSet<Object>(); }}");
    }

    @Test
    public void testBug_ErasesUntemplated() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { void foo() { KTypeBar<B> x = new KTypeBar<B>(); } }");

        check(Type.FLOAT, sp, "class FloatFoo { void foo() { ObjectBar<B> x = new ObjectBar<B>(); } }");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { void foo() { ObjectBar<B> x = new ObjectBar<B>(); } }");
    }

    @Test
    public void testUnboundedUnknownWildcard() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { void foo() { boolean bTEST = Bar instanceof TestUnbounded<?>; }}");

        check(Type.FLOAT, sp, "class FloatFoo { void foo() { boolean bTEST = Bar instanceof TestUnbounded<?>; }}");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { void foo() { boolean bTEST = Bar instanceof TestUnbounded<?>; }}");
    }

    @Test
    public void testBug_EraseNestedPrimitive() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "class KTypeFoo<KType> { static class Nested<KType> extends KTypeBar<KType> {} }");

        check(Type.FLOAT, sp, "class FloatFoo { static class Nested extends FloatBar {} }");
        check(Type.GENERIC, sp, "class ObjectFoo<KType> { static class Nested<KType> extends ObjectBar<KType> {} }");
    }

    @Test
    public void testJavaDoc_k() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "/** KTypeFoo KTypes */");

        check(Type.FLOAT, sp, "/** FloatFoo floats */");
        check(Type.GENERIC, sp, "/** ObjectFoo Objects */");
    }

    @Test
    public void testJavaDoc_with_bounds_k() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor("/** KTypeFoo KTypes */");

        check(Type.FLOAT, sp, "/** FloatFoo floats */");
        check(Type.GENERIC, sp, "/** ObjectFoo Objects */");
    }

    @Test
    public void testJavaDoc_kv() throws IOException {
        final SignatureProcessor sp = new SignatureProcessor(
                "/** KTypeFoo KTypes KTypeVTypeFoo VTypes */");

        check(Type.FLOAT, Type.DOUBLE, sp, "/** FloatFoo floats FloatDoubleFoo doubles */");
        check(Type.GENERIC, Type.GENERIC, sp, "/** ObjectFoo Objects ObjectObjectFoo Objects */");
    }

    /**
     * Just like java.util.Arrays
     * @throws IOException
     */
    @Test
    public void testUtilityClassStaticGenericMethods() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "public final class KTypeArraysClass {  "
                        + "public static <KType> void utilityMethod(final KType[] objectArray, final int startIndex, final int endIndex) {"
                        + "} "
                        + "}");

        check(Type.GENERIC, sp, "public final class ObjectArraysClass {  "
                + "public static <KType> void utilityMethod(final KType[] objectArray, final int startIndex, final int endIndex) {"
                + "} "
                + "}");

        check(Type.INT, sp, "public final class IntArraysClass {  "
                + "public static void utilityMethod(final int[] objectArray, final int startIndex, final int endIndex) {"
                + "} "
                + "}");
    }

    @Test
    public void testMethodCall() throws IOException {

        final SignatureProcessor sp = new SignatureProcessor(
                "public final class Foo {  "
                        + "public static bar() {\n"
                        + "// Static method call alone\n"
                        + "AloneVoidClass.<KType>voidMethod(a,b); "
                        + "AloneVoidClass.<KType>voidMethodOneArgument(a);"
                        + "AloneVoidClass.<KType>voidMethodNoArgument();"
                        + "//This\n"
                        + "this.methodCalledWithThis(c,d);"
                        + "this.methodCalledWithThisOneArgument(one);"
                        + "this.methodCalledWithThisNoArgument();"
                        + "// Not this\n"
                        + "methodCallWithoutThis(c,d);"
                        + "methodCallWithoutThisOneArgument(one);"
                        + "methodCallWithoutThisNoArgument();"
                        + "} "
                        + "}");

        //blocking
        //sp.displayParseTreeGui();

    }

    @Test
    public void testFullClass() throws IOException {

        final String testedPath = "KTypeVTypeClass.test";

        final String expectedLongObjectTest = "LongObjectClass.ok";
        final String expectedLongIntTest = "LongIntClass.ok";
        final String expectedObjectlongTest = "ObjectlongClass.ok";

        compareWithReferenceFile(new TemplateOptions(Type.LONG, Type.GENERIC), testedPath, expectedLongObjectTest);
        compareWithReferenceFile(new TemplateOptions(Type.LONG, Type.INT), testedPath, expectedLongIntTest);
        compareWithReferenceFile(new TemplateOptions(Type.GENERIC, Type.LONG), testedPath, expectedObjectlongTest);
    }

    @Test
    public void testFullClassArrays() throws IOException {

        final String testedPath = "KTypeArraysClass.test";

        final String expectedPathLong = "LongArraysClass.ok";
        final String expectedPathObject = "ObjectArraysClass.ok";

        System.out.println(">>>> Converted to Object: \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.GENERIC, null), testedPath, expectedPathObject);

        System.out.println("\n\n>>>> Converted to long : \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.LONG, null), testedPath, expectedPathLong);
    }

    @Test
    public void testFullClassPartialTemplateSpecialization() throws IOException {

        final String testedPath = "KTypePartialSpecializationClass.test";

        final String expectedPathLong = "LongPartialSpecializationClass.ok";
        final String expectedPathObject = "ObjectPartialSpecializationClass.ok";

        System.out.println(">>>> Converted to Object: \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.GENERIC, null), testedPath, expectedPathObject);

        System.out.println("\n\n>>>> Converted to long : \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.LONG, null), testedPath, expectedPathLong);
    }

    @Test
    public void testIteratorPoolAllocFull() throws IOException {

        final String testedPath = "IteratorPoolAlloc.test";

        final String expectedPathLong = "IteratorPoolAllocLong.ok";
        final String expectedPathObject = "IteratorPoolAllocGeneric.ok";

        System.out.println(">>>> Converted to Object: \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.GENERIC, null), testedPath, expectedPathObject);

        System.out.println("\n\n>>>> Converted to long : \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.LONG, null), testedPath, expectedPathLong);

    }

    @Test
    public void testIteratorPool() throws IOException {

        final String testedPath = "IteratorPool.test";

        final String expectedPathLong = "IteratorPoolLong.ok";
        final String expectedPathObject = "IteratorPoolGeneric.ok";

        System.out.println(">>>> Converted to Object: \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.GENERIC, null), testedPath, expectedPathObject);

        System.out.println("\n\n>>>> Converted to long : \n\n");
        compareWithReferenceFile(new TemplateOptions(Type.LONG, null), testedPath, expectedPathLong);
    }

    /**
     * Not really a test, used for debugging crashs of the parser itself.
     * @throws IOException
     */
    @Test
    public void testCrashParsing() throws IOException {

        final String testedPath = "CrashParser.txt";

        final SignatureProcessor processor = new SignatureProcessor(loadFile(testedPath));

        if (this.displayParseTree) {

            processor.displayParseTreeGui();
        }

        //Compute :
        final String output = processor.process(new TemplateOptions(Type.LONG, Type.GENERIC));

        System.out.println(output);
    }

    @Test
    public void testGenericWithinGenericWithinGeneric() throws IOException {

        //generic within generic within generic
        final SignatureProcessor sp = new SignatureProcessor(
                "class Foo { public void foo() { new KTypeFoo<KTypeInner<KTypeProcecedure<KType>>, A>(); } }");

        check(Type.FLOAT, null, sp, "class Foo { public void foo() { new FloatFoo<FloatInner<FloatProcecedure>, A>(); } }");
        check(Type.GENERIC, null, sp, "class Foo { public void foo() { new ObjectFoo<ObjectInner<ObjectProcecedure<KType>>, A>(); } }");
    }

    @Test
    public void testDoubleGenericWithinGenericWithinGeneric() throws IOException {

        //generic within generic within generic
        final SignatureProcessor sp = new SignatureProcessor(
                "class Foo { public void foo() { new KTypeVTypeFoo<KTypeVTypeInner<KTypeVTypeProcecedure<KType, VType>>, A>(); } }");

        check(Type.FLOAT, Type.GENERIC, sp, "class Foo { public void foo() { new FloatObjectFoo<FloatObjectInner<FloatObjectProcecedure<VType>>, A>(); } }");
        check(Type.GENERIC, Type.INT, sp, "class Foo { public void foo() { new ObjectIntFoo<ObjectIntInner<ObjectIntProcecedure<KType>>, A>(); } }");
        check(Type.GENERIC, Type.GENERIC, sp, "class Foo { public void foo() { new ObjectObjectFoo<ObjectObjectInner<ObjectObjectProcecedure<KType, VType>>, A>(); } }");
        check(Type.FLOAT, Type.INT, sp, "class Foo { public void foo() { new FloatIntFoo<FloatIntInner<FloatIntProcecedure>, A>(); } }");

    }

    @Test
    public void testAbstractClassMethods() throws IOException {

        //generic within generic within generic
        final SignatureProcessor sp = new SignatureProcessor(
                "public abstract class AbstractKTypeVTypeHashMapTest<KType, VType> extends AbstractKTypeVTypeTest<KType, VType> { "
                        + " protected abstract KTypeVTypeMap<KType, VType> createNewMapInstance(final int initialCapacity,"
                        + " final double loadFactor, KTypeHashingStrategy<KType> strategy); } }");

        check(Type.FLOAT, Type.GENERIC, sp,
                "public abstract class AbstractFloatObjectHashMapTest<VType> extends AbstractFloatObjectTest<VType> { "
                        + " protected abstract FloatObjectMap<VType> createNewMapInstance(final int initialCapacity,"
                        + " final double loadFactor, FloatHashingStrategy strategy); } }");

        check(Type.GENERIC, Type.INT, sp,
                "public abstract class AbstractObjectIntHashMapTest<KType> extends AbstractObjectIntTest<KType> { "
                        + " protected abstract ObjectIntMap<KType> createNewMapInstance(final int initialCapacity,"
                        + " final double loadFactor, ObjectHashingStrategy<KType> strategy); } }");

        check(Type.GENERIC, Type.GENERIC, sp,
                "public abstract class AbstractObjectObjectHashMapTest<KType, VType> extends AbstractObjectObjectTest<KType, VType> { "
                        + " protected abstract ObjectObjectMap<KType, VType> createNewMapInstance(final int initialCapacity,"
                        + " final double loadFactor, ObjectHashingStrategy<KType> strategy); } }");

        check(Type.FLOAT, Type.INT, sp,
                "public abstract class AbstractFloatIntHashMapTest extends AbstractFloatIntTest { "
                        + " protected abstract FloatIntMap createNewMapInstance(final int initialCapacity,"
                        + " final double loadFactor, FloatHashingStrategy strategy); } }");

    }

    ///////////////////////
    // Utility methods
    ///////////////////////

    private void check(final Type ktype, final SignatureProcessor processor, final String expected) throws IOException {
        check(new TemplateOptions(ktype, null), processor, expected);
    }

    private void check(final Type ktype, final Type vtype, final SignatureProcessor processor, final String expected) throws IOException {
        check(new TemplateOptions(ktype, vtype), processor, expected);
    }

    private void check(final TemplateOptions templateOptions, final SignatureProcessor processor, final String expected) throws IOException {

        //we want all traces
        templateOptions.verbose = Level.ALL;

        if (this.displayParseTree) {

            processor.displayParseTreeGui();
        }

        final String output = processor.process(templateOptions);

        final String expectedNormalized = expected.trim().replaceAll("\\s+", " ");
        final String outputNormalized = output.trim().replaceAll("\\s+", " ");

        if (!outputNormalized.equals(expectedNormalized)) {

            System.out.println(String.format(Locale.ROOT,
                    "Output:\n'%s'\n" +
                            "Expected:\n'%s'\n", output, expected));

            //this is always false, so trigger the comparison with the original outputs
            //so that is easier to diff them because formatting is kept.
            Assert.assertEquals(expected, output);
        }

        Assert.assertTrue(true);
    }

    private void compareWithReferenceFile(final TemplateOptions templateOptions,
            final String testFileName,
            final String expectedFileName) throws IOException {

        final SignatureProcessor processor = new SignatureProcessor(loadFile(testFileName));

        if (this.displayParseTree) {

            processor.displayParseTreeGui();
        }

        //Compute :
        final String output = processor.process(templateOptions);

        //whitespace is not significant, normalize it
        final String outputNormalized = output.trim().replaceAll("\\s+", " ");

        final String expected = loadFile(expectedFileName);

        //whitespace is not significant, normalize it
        final String expectedNormalized = expected.trim().replaceAll("\\s+", " ");

        //Dump on sysout if not identical
        if (!outputNormalized.equals(expectedNormalized)) {
            System.out.println(String.format(Locale.ROOT,
                    "Wrong output:\n'%s'\n\n", output));

            //this is always false, so trigger the comparison with the original outputs
            //so that is easier to diff them because formatting is kept.
            Assert.assertEquals(expected, output);
        }

        Assert.assertTrue(true);
    }

    /**
     * Load a file fileName as UTF-8 and return its String contents
     * @param fileName
     * @return
     * @throws IOException
     */
    private String loadFile(final String fileName) throws IOException {

        final URL resURL = ClassLoader.getSystemResource(SignatureProcessorTest.TEST_CASE_RESOURCE_PATH + fileName);

        URI resURI = null;
        try {
            resURI = resURL.toURI();
        } catch (final URISyntaxException e) {
            //
            e.printStackTrace();
        }

        final Path resPath = Paths.get(resURI);

        Assert.assertTrue("Not a regular file, or file do not exist : " + resPath.toString(), Files.isRegularFile(resPath));

        return new String(Files.readAllBytes(resPath), StandardCharsets.UTF_8);
    }
}


text:
package kubecli

import (
	"runtime/debug"
	"time"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/fields"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/apimachinery/pkg/watch"
	"k8s.io/client-go/tools/cache"
	"k8s.io/client-go/util/workqueue"

	"kubevirt.io/kubevirt/pkg/logging"
)

// NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector.
func NewListWatchFromClient(c cache.Getter, resource string, namespace string, fieldSelector fields.Selector, labelSelector labels.Selector) *cache.ListWatch {
	listFunc := func(options metav1.ListOptions) (runtime.Object, error) {
		return c.Get().
			Namespace(namespace).
			Resource(resource).
			VersionedParams(&options, metav1.ParameterCodec).
			FieldsSelectorParam(fieldSelector).
			LabelsSelectorParam(labelSelector).
			Do().
			Get()
	}
	watchFunc := func(options metav1.ListOptions) (watch.Interface, error) {
		return c.Get().
			Prefix("watch").
			Namespace(namespace).
			Resource(resource).
			VersionedParams(&options, metav1.ParameterCodec).
			FieldsSelectorParam(fieldSelector).
			LabelsSelectorParam(labelSelector).
			Watch()
	}
	return &cache.ListWatch{ListFunc: listFunc, WatchFunc: watchFunc}
}

func HandlePanic() {
	if r := recover(); r != nil {
		logging.DefaultLogger().Critical().Log("stacktrace", debug.Stack(), "msg", r)
	}
}

func NewResourceEventHandlerFuncsForWorkqueue(queue workqueue.RateLimitingInterface) cache.ResourceEventHandlerFuncs {
	return cache.ResourceEventHandlerFuncs{
		AddFunc: func(obj interface{}) {
			key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
			if err == nil {
				queue.Add(key)
			}
		},
		UpdateFunc: func(old interface{}, new interface{}) {
			key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(new)
			if err == nil {
				queue.Add(key)
			}
		},
		DeleteFunc: func(obj interface{}) {
			key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
			if err == nil {
				queue.Add(key)
			}
		},
	}
}

func NewResourceEventHandlerFuncsForFunc(f func(interface{})) cache.ResourceEventHandlerFuncs {
	return cache.ResourceEventHandlerFuncs{
		AddFunc: func(obj interface{}) {
			f(obj)
		},
		UpdateFunc: func(old interface{}, new interface{}) {
			f(new)

		},
		DeleteFunc: func(obj interface{}) {
			f(obj)
		},
	}
}

type Controller struct {
	indexer  cache.Store
	queue    workqueue.RateLimitingInterface
	informer cache.Controller
	dispatch ControllerDispatch
}

func NewController(lw cache.ListerWatcher, queue workqueue.RateLimitingInterface, objType runtime.Object, dispatch ControllerDispatch) (cache.Store, *Controller) {

	indexer, informer := cache.NewIndexerInformer(lw, objType, 0, NewResourceEventHandlerFuncsForWorkqueue(queue), cache.Indexers{})
	return NewControllerFromInformer(indexer, informer, queue, dispatch)
}

type ControllerDispatch interface {
	Execute( /*cache*/ cache.Store /*queue*/, workqueue.RateLimitingInterface /*key*/, interface{})
}

func NewControllerFromInformer(indexer cache.Store, informer cache.Controller, queue workqueue.RateLimitingInterface, dispatch ControllerDispatch) (cache.Store, *Controller) {
	c := &Controller{
		informer: informer,
		indexer:  indexer,
		queue:    queue,
		dispatch: dispatch,
	}
	return indexer, c
}

type ControllerFunc func(cache.Store, workqueue.RateLimitingInterface, interface{})

func (c *Controller) callControllerFn(s cache.Store, w workqueue.RateLimitingInterface) bool {
	quit := !Dequeue(s, w, c.dispatch)
	return quit
}

func Dequeue(s cache.Store, w workqueue.RateLimitingInterface, dispatch ControllerDispatch) bool {
	key, quit := w.Get()
	if quit {
		return false
	} else {
		defer w.Done(key)
		dispatch.Execute(s, w, key)
		return true
	}
}

func (c *Controller) Run(threadiness int, stopCh chan struct{}) {
	defer HandlePanic()
	defer c.queue.ShutDown()
	logging.DefaultLogger().Info().Msg("Starting controller.")

	for i := 0; i < threadiness; i++ {
		go wait.Until(c.runWorker, time.Second, stopCh)
	}

	<-stopCh
	logging.DefaultLogger().Info().Msg("Stopping controller.")
}

func (c *Controller) StartInformer(stopCh chan struct{}) {
	go c.informer.Run(stopCh)
}

func (c *Controller) WaitForSync(stopCh chan struct{}) {
	cache.WaitForCacheSync(stopCh, c.informer.HasSynced)
}

func (c *Controller) runWorker() {
	for c.callControllerFn(c.indexer, c.queue) {
	}
}

// Shut down the embedded queue. After the shutdown was issued, all items already in the queue will be processed but no
// new items will be accepted. It is possible to wait via #WaitUntilDone() until the last item was processed.
func (c *Controller) ShutDownQueue() {
	c.queue.ShutDown()
}


text:
'use strict';

var bower = require('bower');

module.exports = function(grunt) {

  // Please see the Grunt documentation for more information regarding task
  // creation: http://gruntjs.com/creating-tasks

  grunt.registerMultiTask('bower_install', 'Install bower packages', function() {
    var done = this.async();

    var options = this.options({
      endpoints: [],
      opts: {},
      config: {},
      done: null
    });

    bower.commands.install(optios.endpoints, options.opts, options.config).on('end', function() {
      if (typeof options.done === 'function') {
        options.done.apply(this, arguments);
      }

      done();
    });
  });

};


text:
================
Writing ATK Docs
================

New users of Agile Toolkit rely on documentation. To make it easier for the
maintainers to update documentation - each component of ATK framework comes
with a nice documentation builder.

Writing ATK Documentation
=========================

Open file "docs/index.rst" in your editor. Most editors will support
"reSTructured Text" through add-on. The support is not perfect, but it works.

If you are updating a feature - find a corresponding ".rst" file. Your editor
may be able to show you a preview. Modify or extend documentation as needed.

See also: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html

Building and Testing Documentation
==================================

Make sure you have "Docker" installed, follow simple instructions in
"docs/README.md".

Integrating PhpStorm
--------------------

You can integrate PhpStorm build process like this:

.. figure:: images/doc-build-phpstorm1.png
   :scale: 50 %
   :alt: Create build configuration for the Dockerfile

.. figure:: images/doc-build-phpstorm2.png
   :scale: 50 %
   :alt: Adjust Port settings to expose 80 as 8080

.. figure:: images/doc-build-phpstorm3.png
   :scale: 50 %
   :alt: Use "Ctrl+R" anytime to build docs


text:
<?php

namespace JanDolata\CrudeCRUD\Http\Requests\Abstracts;

use JanDolata\CrudeCRUD\Http\Requests\Abstracts\BaseRequest;
use JanDolata\CrudeCRUD\Engine\CrudeInstance;

abstract class RequestWithAttributes extends BaseRequest
{

    public function attributes()
    {
        $crude = CrudeInstance::get($this->crudeName);

        if ($crude == null)
            return [];

        if (! $crude instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithValidationInterface)
            return [];

        return $crude->getCrudeSetup()->getTrans();
    }
}


text:
=begin
Copyright (c) 2007 RubyMSN team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=end
require 'msn/msnutil'

class MSNChatSession
  include MSNProtocol

  attr_writer :extracode
  attr_reader :is_inviting
  attr_reader :initial_contact
  attr_reader :participants
  attr_reader :commandhandlers
  attr_writer :message_received
  attr_writer :session_started
  attr_writer :session_ended
  attr_writer :participants_updated

  attr_accessor :tag
  attr_accessor :connection

  def initialize(self_email, initial_contact, server, port, code, is_inviting, contactlist)
    #events
    @message_received = nil
    @session_started = nil
    @session_ended = nil
    @participants_updated = nil

    # properties
    @contactlist = contactlist
    @participants = MSNContactList.new
    @extracode = nil
    @code = code
    @initial_contact = initial_contact
    @self_email = self_email
    @commandhandlers = Hash.new
    connect_commandhandlers

    init_protocol
    @is_inviting = is_inviting
    @socket = ThreadTCPSocket.new(port, server, @receiveproc, nil)
  end

  def email
    @self_email
  end

  def start
    if @is_inviting
      send_command "USR #{@trid} #{@self_email} #{@code}"
    else
      send_command "ANS #{@trid} #{@self_email} #{@code} #{@extracode}"
    end
  end

  def close
    @session_ended.call if @session_ended
    send_command "OUT"
    connection.remove_session(@tag)
    @socket.close
  end

  def connect_commandhandlers
    @commandhandlers["USR"] = lambda { |cp| handle_usr cp }
    @commandhandlers["CAL"] = lambda { |cp| handle_cal cp }
    @commandhandlers["JOI"] = lambda { |cp| handle_joi cp }
    @commandhandlers["ANS"] = lambda { |cp| handle_ans cp }
    @commandhandlers["IRO"] = lambda { |cp| handle_iro cp }
    @commandhandlers["BYE"] = lambda { |cp| handle_bye cp }
  end

  def handle_usr(cp)
    if cp[2] == "OK"
      send_command "CAL #{@trid} #{@initial_contact}"
    end
  end

  def handle_cal(cp)
    if cp[2] == "RINGING"
    end
  end

  def handle_joi(cp)
    peer_email = cp[1]
    peer_nick = cp[2]
    puts "#{peer_email} joined the chat session!"
    contact = @contactlist[peer_email]
    @participants.add_contact contact if contact
    @participants.add_contact MSNContact.new(peer_email, peer_nick, MSNStatus.new("FLN")) unless contact
    @participants_updated.call if @participants_updated
    @session_started.call if @session_started && @participants.list.length == 1
  end

  def handle_ans(cp)
    @session_started.call if @session_started
  end

  def handle_iro(cp)
    contact = @contactlist[cp[4]]
    @participants.add_contact contact if contact
    @participants.add_contact MSNContact.new(cp[4], cp[5], MSNStatus.new("FLN")) unless contact
    @participants_updated.call if @participants_updated
  end

  def handle_bye(cp)
    @participants.remove_contact @participants[cp[1]]

    @participants_updated.call if @participants_updated && @participants.list.length > 0
    close if @particpants.list.length == 0
  end

  def handle_command(command)
    @lastcommand = command
    newcmd = command[0..command.length-3] # strip crlf
    cp = newcmd.split(" ")
    return if cp.length == 0
    handler = @commandhandlers[cp[0]]
    handler.call cp if handler
    case cp[0]
    when "NOT"
      @nextpayload = cp[1].to_i
    when "MSG"
      @nextpayload = cp[3].to_i
    end
  end

  def say(message)
    mimestring = "MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\nX-MMS-IM-Format: FN=Arial; EF=; CO=0; CS=0; PF=22\r\n\r\n#{message}"
    send_command "MSG #{@trid} A #{mimestring.length.to_s}"
    @socket.write mimestring
  end

  def handle_payload(command, payload)
    newcmd = command[0..command.length-3] # strip crlf
    cp = newcmd.split(" ")
    if cp.length == 0
      return
    end
    case cp[0]
    when "MSG"
      peer_email = cp[1]
      if payload.index("Content-Type: text/plain")
        message = payload[payload.index("\r\n\r\n") + 4..payload.length-1]
        @message_received.call(peer_email, message) if @message_received
      end
    when "NOT"

    end
  end
end


text:
namespace engine
{
	class ProbeObject;

	class ProbeObjectManager
	{
	public:
		void Initialize();
		void Deinitalize();
		ProbeObject *GetPlaneProbe() const { return plane_probe; }
		ProbeObject *GetTunnelProbe() const { return tunnel_probe; }
	private:
		ProbeObject *plane_probe;
		ProbeObject *tunnel_probe;
	};

	extern ProbeObjectManager probe_object_manager;
}


text:
package net.acomputerdog.map.stage.convert.in;

import net.acomputerdog.map.image.SourcedImage;
import net.acomputerdog.map.tile.Tile;
import net.acomputerdog.map.tile.TileProvider;
import net.acomputerdog.map.tile.TileSource;

import java.awt.*;
import java.io.File;

public class ImportTileProvider extends TileProvider {

    private final ImportCache cache;

    public ImportTileProvider(TileSource tileSource, ImportCache cache) {
        super(tileSource);
        this.cache = cache;
    }

    @Override
    public boolean hasRegion(int x, int y) {
        return cache.getImageForRegion(x, y) != null;
    }

    @Override
    public Tile getRegion(int x, int y) {
        try {
            SourcedImage image = cache.getImageForRegion(x, y);
            Graphics2D g = image.createGraphics();
            //Debugging
            g.setColor(Color.BLACK);
            g.drawRect(0, 0, 511, 511);
            return new ImportedTile(getTileSource(), image, x, y);
        } catch (Exception e) {
            throw new RuntimeException("Unable to load region " + x + "," + y + " from converter cache!", e);
        }
    }

    private File getFile(int x, int y) {
        return new File(getTileSource().getFile(), getFileName(x, y));
    }

    private String getFileName(int x, int y) {
        return "/" + x + "," + y + ".tmp";
    }
}


text:
use crate::avcodec::AvError;
use crate::avcodec::AvPixelFormat;
use crate::ffi;

pub const AV_NOPTS_VALUE: u64 = 0x8000000000000000;
const MAX_FFMPEG_PLANES: usize = 4;

/// Get the maximum data alignment that may be required by FFmpeg.
/// This could change depending on FFmpeg's build configuration (AVX etc.).
pub fn max_buffer_alignment() -> usize {
    // Safe because this function has no side effects and just returns an integer.
    unsafe { ffi::av_cpu_max_align() as usize }
}

// See AvPixelFormat::line_size.
pub(crate) fn av_image_line_size(
    format: AvPixelFormat,
    width: u32,
    plane: usize,
) -> Result<usize, AvError> {
    // Safe because format is a valid format and this function is pure computation.
    match unsafe { ffi::av_image_get_linesize(format.pix_fmt(), width as _, plane as _) } {
        i if i >= 0 => Ok(i as _),
        err => Err(AvError(err)),
    }
}

// See AvPixelFormat::plane_sizes.
pub(crate) fn av_image_plane_sizes<I: IntoIterator<Item = u32>>(
    format: AvPixelFormat,
    linesizes: I,
    height: u32,
) -> Result<Vec<usize>, AvError> {
    let mut linesizes_buf = [0; MAX_FFMPEG_PLANES];
    let mut planes = 0;
    for (i, linesize) in linesizes.into_iter().take(MAX_FFMPEG_PLANES).enumerate() {
        linesizes_buf[i] = linesize as _;
        planes += 1;
    }
    let mut plane_sizes_buf = [0; MAX_FFMPEG_PLANES];
    // Safe because plane_sizes_buf and linesizes_buf have the size specified by the API, format is
    // valid, and this function doesn't have any side effects other than writing to plane_sizes_buf.
    AvError::result(unsafe {
        ffi::av_image_fill_plane_sizes(
            plane_sizes_buf.as_mut_ptr(),
            format.pix_fmt(),
            height as _,
            linesizes_buf.as_ptr(),
        )
    })?;
    Ok(plane_sizes_buf
        .into_iter()
        .map(|x| x as _)
        .take(planes)
        .collect())
}


text:
@class LXZoomingScrollView;

@protocol LXZoomingScrollViewDelegate <NSObject>

- (void)zoomingScrollViewSingleTap:(LXZoomingScrollView *)photoView;

@end

@interface LXZoomingScrollView : UIScrollView <UIScrollViewDelegate>

//获取当前显示的图片
@property (strong, nonatomic,readonly) UIImage * currentImage;

//图片显示模式
@property (nonatomic) UIViewContentMode imageContentMode;// default is UIViewContentModeScaleAspectFit

@property (nonatomic, assign) BOOL zoomEnabled;// 能否双击方大缩小

//代理
@property (nonatomic, weak) id<LXZoomingScrollViewDelegate> tapDelegate;

//加载网络图片的方法
- (void) lx_setImageWithURL:(NSURL *)url;
- (void) lx_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder;
- (void) lx_setImageWithURL:(NSURL *)url placeholderImage:(UIImage * )placeholderImage errorImage:(UIImage *) errorImage;

@end


text:
  //define a worker

  var crew = new WorkCrew(quintWork, 8);

  crew.beforestart = function(work) {
    if (typeof work             === "undefined" ||
        typeof work.work        === "undefined" ||
        typeof work.work.index  === "undefined" ) {
      return;
    }
    $('tbody tr#' + work.work.index + ' td.latest').addClass("the-progress-bar stripes");
  };

  crew.oncomplete = function(result) {
    if (typeof result           === "undefined" ||
        typeof result.result    === "undefined" ) {
      return;
    }

    var e = result.result;
    if (typeof e.data       === "undefined" ||
        typeof e.data.index === "undefined" ) {
      return;
    }

    var $row     = $('tbody tr#' + e.data.index );
    var $version = $row.children('td.version');
    var $latest  = $row.children('td.latest');

    $latest.removeClass("the-progress-bar stripes");

    if (typeof e.data.responseText === "undefined") {
      $latest.empty();
      return;
    }

    var r = e.data.responseText;
    if (typeof r === "string") {
      r = $.parseJSON(r)
    }

    if (r.version && null == semver.valid(r.version)) {
      $latest.addClass('badsemver');
    } else {
      $latest.removeClass('badsemver');
    }
    if (r.baseVersion && null == semver.valid(r.baseVersion)) {
      $version.addClass('badsemver');
    } else {
      $version.removeClass('badsemver');
    }

    if (r.version) {
      if (r.groupId && r.artifactId) {
        var $a = $('<a/>').attr({
          href : "http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22" + r.groupId + "%22%20AND%20a%3A%22" + r.artifactId + "%22",
          target : "maven_central"
        }).text(r.version);
        $latest.html($a);
      } else {
        $latest.text(r.version);
      }
    } else {
      $latest.empty();
    }

    if (typeof r.baseVersion !== "undefined" && r.baseVersion.indexOf('SNAPSHOT')==-1 && typeof r.version !== "undefined" && r.version !== '∅' && r.version != $version.text()) {
      $row.addClass("needsupdate");
    } else {
      $row.removeClass("needsupdate");
    }

  };


text:
.class Lcom/android/settings/UserDictionarySettings$MyAdapter;
.super Landroid/widget/SimpleCursorAdapter;
.source "UserDictionarySettings.java"

# interfaces
.implements Landroid/widget/SectionIndexer;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/settings/UserDictionarySettings;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "MyAdapter"
.end annotation

.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/settings/UserDictionarySettings$MyAdapter$1;
    }
.end annotation

# instance fields
.field private mIndexer:Landroid/widget/AlphabetIndexer;

.field private final mViewBinder:Landroid/widget/SimpleCursorAdapter$ViewBinder;

# direct methods
.method public constructor <init>(Landroid/content/Context;ILandroid/database/Cursor;[Ljava/lang/String;[ILcom/android/settings/UserDictionarySettings;)V
    .locals 3

    invoke-direct/range {p0 .. p5}, Landroid/widget/SimpleCursorAdapter;-><init>(Landroid/content/Context;ILandroid/database/Cursor;[Ljava/lang/String;[I)V

    new-instance v2, Lcom/android/settings/UserDictionarySettings$MyAdapter$1;

    invoke-direct {v2, p0}, Lcom/android/settings/UserDictionarySettings$MyAdapter$1;-><init>(Lcom/android/settings/UserDictionarySettings$MyAdapter;)V

    iput-object v2, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mViewBinder:Landroid/widget/SimpleCursorAdapter$ViewBinder;

    if-eqz p3, :cond_0

    const v2, 0x1040352

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

    move-result-object v0

    const-string/jumbo v2, "word"

    invoke-interface {p3, v2}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v1

    new-instance v2, Landroid/widget/AlphabetIndexer;

    invoke-direct {v2, p3, v1, v0}, Landroid/widget/AlphabetIndexer;-><init>(Landroid/database/Cursor;ILjava/lang/CharSequence;)V

    iput-object v2, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    :cond_0
    iget-object v2, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mViewBinder:Landroid/widget/SimpleCursorAdapter$ViewBinder;

    invoke-virtual {p0, v2}, Lcom/android/settings/UserDictionarySettings$MyAdapter;->setViewBinder(Landroid/widget/SimpleCursorAdapter$ViewBinder;)V

    return-void
.end method

# virtual methods
.method public getPositionForSection(I)I
    .locals 1

    iget-object v0, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :cond_0
    iget-object v0, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    invoke-virtual {v0, p1}, Landroid/widget/AlphabetIndexer;->getPositionForSection(I)I

    move-result v0

    goto :goto_0
.end method

.method public getSectionForPosition(I)I
    .locals 1

    iget-object v0, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :cond_0
    iget-object v0, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    invoke-virtual {v0, p1}, Landroid/widget/AlphabetIndexer;->getSectionForPosition(I)I

    move-result v0

    goto :goto_0
.end method

.method public getSections()[Ljava/lang/Object;
    .locals 2

    const/4 v0, 0x0

    iget-object v1, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    if-nez v1, :cond_0

    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lcom/android/settings/UserDictionarySettings$MyAdapter;->mIndexer:Landroid/widget/AlphabetIndexer;

    invoke-virtual {v0}, Landroid/widget/AlphabetIndexer;->getSections()[Ljava/lang/Object;

    move-result-object v0

    goto :goto_0
.end method


text:
package io.jooby.i1786;

import static org.junit.jupiter.api.Assertions.assertEquals;

import io.jooby.StatusCode;
import io.jooby.junit.ServerTest;
import io.jooby.junit.ServerTestRunner;

public class Issue1786 {
  @ServerTest
  public void shouldFollowNonNullAnnotation(ServerTestRunner runner) {
    runner
        .define(
            app -> {
              app.mvc(new Controller1786());
            })
        .ready(
            client -> {
              client.get(
                  "/1786/nonnull",
                  rsp -> {
                    assertEquals(StatusCode.BAD_REQUEST_CODE, rsp.code());
                  });
            });
  }
}


text:
<?php

/**
 * @namespace
 */
namespace Dasbit\Plugin;

/**
 * Abstract plugin.
 *
 * @category   DASBiT
 * @package    Dasbit_Plugin
 * @copyright  Copyright (c) 2010 Ben Scholzen (http://www.dasprids.de)
 * @license    New BSD License
 */
abstract class AbstractPlugin
{
    /**
     * Mananger the plugin is attached to.
     *
     * @var Manager
     */
    protected $manager;

    /**
     * Database adapter.
     *
     * @var \Dasbit\Database
     */
    protected $db;

    /**
     * Database schema.
     *
     * If null, no database will be available.
     *
     * @var array
     */
    protected $dbSchema;

    /**
     * Instantiate the plugin.
     *
     * @param  Manager $manager
     * @param  string  $databasePath
     * @return void
     */
    public function __construct(Manager $manager, $databasePath)
    {
        $this->manager = $manager;

        if ($this->dbSchema !== null) {
            $this->db = new \Dasbit\Database($databasePath . '/' . $this->getName() . '.db', $this->dbSchema);
        }
    }

    /**
     * Get the name of the plugin.
     *
     * @return string
     */
    public function getName()
    {
        return strtolower(array_pop(explode('\\', get_class($this))));
    }

    /**
     * Enable the plugin.
     *
     * In this method you should register commands, hooks, triggers and
     * timeouts. If you need to do initial stuff, overwrite the __construct(),
     * as this method may be called several times.
     *
     * @return void
     */
    abstract public function enable();

    /**
     * Disable the plugin.
     *
     * You don't have to overwrite this method to remove commands and such, as
     * they are automatically removed by plugin manager. This method is
     * intended to remove running sockets and so forth.
     *
     * @return void
     */
    public function disable()
    {
    }

    /**
     * Register a command.
     *
     * @param  mixed  $command
     * @param  string $method
     * @param  string $restrict
     * @return Plugin
     */
    protected function registerCommand($command, $method, $restrict = null)
    {
        $this->manager->registerCommand($this->getName(), $command, array($this, $method), $restrict);
        return $this;
    }

    /**
     * Register a timeout.
     *
     * @param  integer $seconds
     * @param  string  $method
     * @return Plugin
     */
    protected function registerTimeout($seconds, $method)
    {
        $this->manager->registerTimeout($seconds, array($this, $method));
        return $this;
    }

    /**
     * Register a hook.
     *
     * @param  string $hook
     * @param  string $method
     * @return Plugin
     */
    protected function registerHook($hook, $method)
    {
        $this->manager->registerHook($this->getName(), $hook, array($this, $method));
        return $this;
    }

    /**
     * Register a trigger.
     *
     * @param  string $trigger
     * @param  string $method
     * @return Plugin
     */
    protected function registerTrigger($pattern, $method)
    {
        $this->manager->registerTrigger($this->getName(), $pattern, array($this, $method));
        return $this;
    }
}


text:
<?php

namespace Oro\Bundle\SoapBundle\Controller\Api\Rest;

use Doctrine\ORM\EntityNotFoundException;

use FOS\Rest\Util\Codes;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Util\ClassUtils;

use Oro\Bundle\SoapBundle\Controller\Api\FormAwareInterface;
use Oro\Bundle\SoapBundle\Controller\Api\FormHandlerAwareInterface;
use Oro\Bundle\SoapBundle\Handler\DeleteHandler;
use Oro\Bundle\SecurityBundle\Exception\ForbiddenException;

abstract class RestController extends RestGetController implements
    FormAwareInterface,
    FormHandlerAwareInterface,
    RestApiCrudInterface
{
    /**
     * Edit entity
     *
     * @param  mixed    $id
     * @return Response
     */
    public function handleUpdateRequest($id)
    {
        $entity = $this->getManager()->find($id);
        if (!$entity) {
            return $this->handleView($this->view(null, Codes::HTTP_NOT_FOUND));
        }

        if ($this->processForm($entity)) {
            $view = $this->view(null, Codes::HTTP_NO_CONTENT);
        } else {
            $view = $this->view($this->getForm(), Codes::HTTP_BAD_REQUEST);
        }

        return $this->handleView($view);
    }

    /**
     * Create new
     *
     * @return Response
     */
    public function handleCreateRequest()
    {
        $entity = $this->getManager()->createEntity();
        $isProcessed = $this->processForm($entity);

        if ($isProcessed) {
            $entityClass = ClassUtils::getRealClass($entity);
            $classMetadata = $this->getManager()->getObjectManager()->getClassMetadata($entityClass);
            $view = $this->view($classMetadata->getIdentifierValues($entity), Codes::HTTP_CREATED);
        } else {
            $view = $this->view($this->getForm(), Codes::HTTP_BAD_REQUEST);
        }

        return $this->handleView($view);
    }

    /**
     * Delete entity
     *
     * @param  mixed    $id
     * @return Response
     */
    public function handleDeleteRequest($id)
    {
        try {
            $this->getDeleteHandler()->handleDelete($id, $this->getManager());
        } catch (EntityNotFoundException $notFoundEx) {
            return $this->handleView($this->view(null, Codes::HTTP_NOT_FOUND));
        } catch (ForbiddenException $forbiddenEx) {
            return $this->handleView(
                $this->view(['reason' => $forbiddenEx->getReason()], Codes::HTTP_FORBIDDEN)
            );
        }

        return $this->handleView($this->view(null, Codes::HTTP_NO_CONTENT));
    }

    /**
     * Process form.
     *
     * @param  mixed $entity
     * @return bool
     */
    protected function processForm($entity)
    {
        $this->fixRequestAttributes($entity);
        return $this->getFormHandler()->process($entity);
    }

    /**
     * Convert REST request to format applicable for form.
     *
     * @param object $entity
     */
    protected function fixRequestAttributes($entity)
    {
        $request = $this->container->get('request');
        $formName = $this->getForm()->getName();
        $data = empty($formName)
            ? $request->request->all()
            : $request->request->get($formName);

        if (is_array($data) && $this->fixFormData($data, $entity)) {
            if (empty($formName)) {
                // save fixed values for unnamed form
                foreach ($request->request->keys() as $key) {
                    if (array_key_exists($key, $data)) {
                        $request->request->set($key, $data[$key]);
                    } else {
                        $request->request->remove($key);
                    }
                }
                foreach ($data as $key => $val) {
                    if (!$request->request->has($key)) {
                        $request->request->set($key, $data[$key]);
                    }
                }
            } else {
                // save fixed values for named form
                $request->request->set($this->getForm()->getName(), $data);
            }
        }
    }

    /**
     * Fixes form data
     *
     * @param array $data
     * @param mixed $entity
     * @return bool true if any changes in $data array was made; otherwise, false.
     */
    protected function fixFormData(array &$data, $entity)
    {
        return false;
    }

    /**
     * Gets an object responsible to delete an entity.
     *
     * @return DeleteHandler
     */
    protected function getDeleteHandler()
    {
        return $this->get('oro_soap.handler.delete');
    }
}


text:
package cmd

import (
	"context"
	"fmt"
	"os"

	homedir "github.com/mitchellh/go-homedir"
	"github.com/mosuka/blast/client"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
)

var (
	snapshotCmd = &cobra.Command{
		Use:   "snapshot",
		Short: "Create a snapshot",
		Long:  "Create a snapshot which is full-volume copy of data stored on the node",
		RunE: func(cmd *cobra.Command, args []string) error {
			grpcAddress = viper.GetString("grpc_address")

			certificateFile = viper.GetString("certificate_file")
			commonName = viper.GetString("common_name")

			c, err := client.NewGRPCClientWithContextTLS(grpcAddress, context.Background(), certificateFile, commonName)
			if err != nil {
				return err
			}
			defer func() {
				_ = c.Close()
			}()

			if err := c.Snapshot(); err != nil {
				return err
			}

			return nil
		},
	}
)

func init() {
	rootCmd.AddCommand(snapshotCmd)

	cobra.OnInitialize(func() {
		if configFile != "" {
			viper.SetConfigFile(configFile)
		} else {
			home, err := homedir.Dir()
			if err != nil {
				_, _ = fmt.Fprintln(os.Stderr, err)
				os.Exit(1)
			}
			viper.AddConfigPath("/etc")
			viper.AddConfigPath(home)
			viper.SetConfigName("blast")
		}

		viper.SetEnvPrefix("BLAST")
		viper.AutomaticEnv()

		if err := viper.ReadInConfig(); err != nil {
			switch err.(type) {
			case viper.ConfigFileNotFoundError:
				// config file does not found in search path
			default:
				_, _ = fmt.Fprintln(os.Stderr, err)
				os.Exit(1)
			}
		}
	})

	snapshotCmd.PersistentFlags().StringVar(&configFile, "config-file", "", "config file. if omitted, blast.yaml in /etc and home directory will be searched")
	snapshotCmd.PersistentFlags().StringVar(&grpcAddress, "grpc-address", ":9000", "gRPC server listen address")
	snapshotCmd.PersistentFlags().StringVar(&certificateFile, "certificate-file", "", "path to the client server TLS certificate file")
	snapshotCmd.PersistentFlags().StringVar(&commonName, "common-name", "", "certificate common name")

	_ = viper.BindPFlag("grpc_address", snapshotCmd.PersistentFlags().Lookup("grpc-address"))
	_ = viper.BindPFlag("certificate_file", snapshotCmd.PersistentFlags().Lookup("certificate-file"))
	_ = viper.BindPFlag("common_name", snapshotCmd.PersistentFlags().Lookup("common-name"))
}


text:
CGFloat const itemWH = 80;

@interface XYBlurEffectView () {
    NSMutableArray<XYBlurButton *> *_items;
    UIButton *_closeBtn;
}

@end

@implementation XYBlurEffectView

#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];

    }
    return self;
}

- (void)setup {
    self.backgroundColor = [UIColor clearColor];
    _items = [NSMutableArray arrayWithCapacity:2];
    [self initBlurEffect];
    [self initCloseBtn];

}

- (void)initBlurEffect {
    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    UIVisualEffectView *visualEffectView =[[UIVisualEffectView alloc] initWithEffect:blurEffect];
    [self addSubview:visualEffectView];
    [self insertSubview:visualEffectView atIndex:0];
    [visualEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
}

/// 关闭按钮
- (void)initCloseBtn {
    _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_closeBtn setImage:[UIImage imageNamed:@"tabbar_sendMsgTabbarItem"] forState:UIControlStateNormal];
    [self addSubview:_closeBtn];
    CGFloat wh = 40;
    CGFloat x = self.xy_width * 0.5 - wh * 0.5;
    CGFloat y = self.xy_height - wh;
    _closeBtn.alpha = 0;
    _closeBtn.frame = CGRectMake(x, y, wh, wh);
    [_closeBtn addTarget:self action:@selector(closeBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)setMenuItemList:(NSArray *)menuItemList {

    _menuItemList = menuItemList;
    if (_items.count > 0) {
        [_items removeAllObjects];
    }

    __block CGFloat y = self.xy_height;
    CGFloat x = self.xy_width * 0.5 - itemWH * 0.5;
    for (NSInteger i = 0; i < menuItemList.count; ++i) {
        XYBlurButton *btn = [XYBlurButton buttonWithType:UIButtonTypeCustom];
        [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [btn.titleLabel setFont:[UIFont systemFontOfSize:14]];
        [btn setTag:i];
        [self addSubview:btn];
        /// 手指按下按钮时,放大按钮
        [btn addTarget:self action:@selector(scaleBtn:) forControlEvents:UIControlEventTouchDown];
        [btn addTarget:self action:@selector(resumeBtn:) forControlEvents:UIControlEventTouchUpInside];
        [btn addTarget:self action:@selector(drawExitBtn:) forControlEvents:UIControlEventTouchDragExit];
        XYBlurItem *item = menuItemList[i];
        [btn setImage:item.image forState:UIControlStateNormal];
        [btn setTitle:item.title forState:UIControlStateNormal];
        [_items addObject:btn];

        if (i == 1) {
            y = CGRectGetMaxY(_items.firstObject.frame) - itemWH * 0.5;
        }

        btn.frame = CGRectMake(x, y, itemWH, itemWH);

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            y = self.xy_height * 0.5 - itemWH * 0.5;
            if (i == 1) {
                y = self.xy_height * 0.5 + self.xy_height * 0.5 * 0.5 - itemWH * 0.5;
            }
            [UIView animateWithDuration:0.5 delay:i*0.02 usingSpringWithDamping:0.6 initialSpringVelocity:1.5 options:UIViewAnimationOptionAllowAnimatedContent animations:^{
                // 让item出现
                btn.xy_y = y;
                _closeBtn.alpha = 1.0 * i+0.3;
            } completion:^(BOOL finished) {

            }];
        });
    }

}

#pragma mark - 对外开发的方法
- (void)showToView:(UIView *)view menuItemList:(NSArray<XYBlurItem *> *)list {

    if ([self isKindOfClass:[UIView class]]) {
        if (self.superview) {
            [self removeFromSuperview];
        }
        [view addSubview:self];
        [self setMenuItemList:list];
    }

}

+ (instancetype)showWithMenuItemList:(NSArray *)list {

    XYBlurEffectView *blurEffectView = [[XYBlurEffectView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [blurEffectView showToView:[UIApplication sharedApplication].keyWindow menuItemList:list];
    return blurEffectView;
}

+ (void)dismissWithAnimated:(BOOL)flag completion:(void (^)(BOOL))completion {
    __block XYBlurEffectView *blurEffectView = nil;
    for (UIView *view in [UIApplication sharedApplication].keyWindow.subviews) {
        if ([view isKindOfClass:[XYBlurEffectView class]]) {
            blurEffectView = (XYBlurEffectView *)view;
            break;
        }
    }
    [blurEffectView dismissWithAnimated:flag completion:completion];

}

- (void)dismissWithAnimated:(BOOL)flag completion:(void (^)(BOOL finished))completion {

    // 遍历items, 将item移动至底部看不见的范围, 即还原item的位置
    for (XYBlurButton *btn in self->_items) {
        NSLog(@"%@", btn);
        if (flag) {

            [UIView animateWithDuration:0.5 delay:btn.tag*0.02 usingSpringWithDamping:0.6 initialSpringVelocity:1.5 options:UIViewAnimationOptionAllowAnimatedContent animations:^{
                btn.xy_y = self.xy_height;
                if (btn.tag == 1) {
                    btn.xy_y = self.xy_height + self.xy_height*0.5*0.5 - itemWH*0.5;
                }

                // 让colseBtn慢慢消失
                self->_closeBtn.alpha = 0;
            } completion:^(BOOL finished) {
                [btn removeFromSuperview];
                // 移除背景蒙版
                if (self != nil) {
                    [self removeFromSuperview];

                }
                if (completion) {
                    completion(finished);
                }
            }];
        } else {
            btn.xy_y = self.xy_height;
            if (btn.tag == 1) {
                btn.xy_y = self.xy_height + self.xy_height*0.5*0.5 - itemWH*0.5;
            }

            // 让colseBtn慢慢消失
            self->_closeBtn.alpha = 0;
            // 移除背景蒙版
            if (self != nil) {
                [self removeFromSuperview];

            }

        }
    }
}

+ (void)dismiss {
    [self dismissWithAnimated:NO completion:nil];
}

#pragma mark - Events
- (void)scaleBtn:(UIButton *)btn {
    /// 放大按钮

    [UIView animateWithDuration:0.1 animations:^{
        btn.transform = CGAffineTransformMakeScale(1.0 + self.itemScale, 1.0 + self.itemScale);
    } completion:nil];
}

- (void)resumeBtn:(UIButton *)btn {

    [UIView animateWithDuration:0.1 animations:^{
        btn.transform = CGAffineTransformMakeScale(1.0, 1.0);
    } completion:nil];
    if (self.delegate && [self.delegate respondsToSelector:@selector(blurEffectView:didSelectItemWithType:)]) {
        [self.delegate blurEffectView:self didSelectItemWithType:btn.tag];
    }
}

/// 按钮退出托转时调用
- (void)drawExitBtn:(UIButton *)btn {
    [UIView animateWithDuration:0.1 animations:^{
        btn.transform = CGAffineTransformMakeScale(1.0, 1.0);
    }completion:nil];
}

- (void)closeBtnClick:(UIButton *)btn {

    /// 关闭
    [self dismissWithAnimated:YES completion:^(BOOL finished) {
        if (self.delegate && [self.delegate respondsToSelector:@selector(blurEffectView:didSelectItemWithType:)]) {
            [self.delegate blurEffectView:self didSelectItemWithType:XYBlurEffectItemTypeClose];
        }
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

    [XYBlurEffectView dismissWithAnimated:YES completion:nil];
}

#pragma mark - set\get
- (CGFloat)itemScale {
    return _itemScale ?: 0.2;
}

- (void)dealloc {
    NSLog(@"%s", __func__);
}

@end

@interface XYBlurItem ()

@end

@implementation XYBlurItem

+ (instancetype)blurItemWithImageNamed:(NSString *)imageNamed title:(NSString *)title {
    return [[self alloc] initWithImageNamed:imageNamed title:title];
}

- (instancetype)initWithImageNamed:(NSString *)imageNamed title:(NSString *)title {
    if (self = [super init]) {
        self.image = [UIImage imageNamed:imageNamed];
        self.title = title;
    }
    return self;
}

@end

@implementation XYBlurButton

- (void)layoutSubviews {

    [super layoutSubviews];

    CGFloat margin = 5;

    self.imageView.xy_y = 0;
    self.imageView.xy_height = self.xy_height - self.titleLabel.xy_height - margin;
    self.imageView.xy_width = self.imageView.xy_height;
    self.imageView.xy_centerX = self.xy_width * 0.5;

    self.titleLabel.xy_y = CGRectGetMaxY(self.imageView.frame) + margin;
    /// 当设置为imageView的中心点x值为button的中心点x值时,点击按钮后,imageView会向左偏移
    self.titleLabel.xy_centerX = self.imageView.xy_centerX;

}

- (void)setHighlighted:(BOOL)highlighted {}

@end


text:
package beer.data.judgments

class Judgment (
  val dataset:String,
  val src_lang_short:String,
  val tgt_lang_short:String,
  val sentId:Int,
  val sys_names:List[String],
  val rankings:List[Int],
  val sents:List[String],
  val ref:String
){
  def lp = src_lang_short+"-"+tgt_lang_short
}


text: Contains Object Oriented Programming Concepts with PHP example


text:
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF 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.
'''

from ambari_agent import Controller
import pprint, json, os, time, sys
import tempfile
from urllib2 import Request, urlopen, URLError
from mock.mock import patch, MagicMock, call
from ambari_agent.AmbariConfig  import AmbariConfig
import Queue
import logging
from ambari_agent import PuppetExecutor, PythonExecutor

logger=logging.getLogger()

queue = Queue.Queue()

# Set to True to replace python and puppet calls with mockups
disable_python_and_puppet = True

agent_version = "1.3.0"

# Values from the list below are returned in responce to agent requests (one per
# request). When every value has been returned, the last element of list is
# returned on every subsequent request.
responces = [
  """{"responseId":"n",
  "response":"OK"}""",

  """
  {
    "responseId":"n",
    "restartAgent": "False",
    "executionCommands":
      [{
        "commandId": "31-1",
        "role" : "DATANODE",
        "taskId" : 2,
        "clusterName" : "clusterName",
        "serviceName" : "HDFS",
        "roleCommand" : "UPGRADE",
        "hostname" : "localhost.localdomain",
        "hostLevelParams": {},
        "clusterHostInfo": "clusterHostInfo",
        "configurations": {},
        "commandType": "EXECUTION_COMMAND",
        "configurations": {"global" : {}},
        "roleParams": {},
        "commandParams" :	{
          "source_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.2.2\\"}",
          "target_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.3.0\\"}"
        },
        "clusterHostInfo": {
          "ambari_db_server_host": [
              "dev.hortonworks.com"
          ],
          "ganglia_server_host": [
              "dev.hortonworks.com"
          ],
          "nagios_server_host": [
              "dev.hortonworks.com"
          ],
          "namenode_host": [
              "dev.hortonworks.com"
          ],
          "slave_hosts": [
              "dev.hortonworks.com"
          ]
        }
      }],
    "statusCommands":[]
  }
  """,

  """
  {
    "responseId":"n",
    "restartAgent": "False",
    "executionCommands": [],
    "statusCommands":[]
  }
  """
]

class Int(object):
  def __init__(self, value):
    self.value = value

  def inc(self):
    self.value += 1

  def val(self):
    return self.value

responseId = Int(0)

def main():

  if disable_python_and_puppet:
    with patch.object(PuppetExecutor.PuppetExecutor, 'run_manifest') \
                                          as run_manifest_method:
      run_manifest_method.side_effect = \
              lambda command, file, tmpout, tmperr: {
          'exitcode' : 0,
          'stdout'   : "Simulated run of pp %s" % file,
          'stderr'   : 'None'
        }
      with patch.object(PythonExecutor.PythonExecutor, 'run_file') \
                                          as run_file_py_method:
        run_file_py_method.side_effect = \
              lambda command, file, tmpoutfile, tmperrfile: {
          'exitcode' : 0,
          'stdout'   : "Simulated run of py %s" % file,
          'stderr'   : 'None'
        }
        run_simulation()
  else:
    run_simulation()

def run_simulation():
  Controller.logger = MagicMock()
  sendRequest_method = MagicMock()

  tmpfile = tempfile.gettempdir()

  config = AmbariConfig().getConfig()
  config.set('agent', 'prefix', tmpfile)

  scriptsDir = os.path.join(os.getcwd(), os.pardir,os.pardir,
    os.pardir, 'main', 'upgrade_stack')
  config.set('stack', 'upgradeScriptsDir', scriptsDir)

  ver_file = os.path.join(tmpfile, "version")

  with open(ver_file, "w") as text_file:
      text_file.write(agent_version)

  controller = Controller.Controller(config)
  controller.sendRequest = sendRequest_method
  controller.netutil.HEARTBEAT_IDDLE_INTERVAL_SEC = 0.1
  controller.netutil.HEARTBEAT_NOT_IDDLE_INTERVAL_SEC = 0.1
  controller.range = 1

  for responce in responces:
    queue.put(responce)

  def send_stub(url, data):
    logger.info("Controller sends data to %s :" % url)
    logger.info(pprint.pformat(data))
    if not queue.empty():
      responce = queue.get()
    else:
      responce = responces[-1]
      logger.info("There is no predefined responce available, sleeping for 30 sec")
      time.sleep(30)
    responce = json.loads(responce)
    responseId.inc()
    responce["responseId"] = responseId.val()
    responce = json.dumps(responce)
    logger.info("Returning data to Controller:" + responce)
    return responce

  sendRequest_method.side_effect = send_stub

  logger.setLevel(logging.DEBUG)
  formatter = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d - \
        %(message)s")
  stream_handler = logging.StreamHandler()
  stream_handler.setFormatter(formatter)
  logger.addHandler(stream_handler)
  logger.info("Starting")

  controller.start()
  controller.actionQueue.IDLE_SLEEP_TIME = 0.1
  controller.run()

if __name__ == '__main__':
#  s =   """
#  {
#    "responseId":"n",
#    "restartAgent": "False",
#    "executionCommands":
#      [{
#        "commandId": "31-1",
#        "role" : "DATANODE",
#        "taskId" : 2,
#        "clusterName" : "clusterName",
#        "serviceName" : "HDFS",
#        "roleCommand" : "UPGRADE",
#        "hostname" : "localhost.localdomain",
#        "hostLevelParams": {},
#        "clusterHostInfo": "clusterHostInfo",
#        "configurations": {},
#        "commandType": "EXECUTION_COMMAND",
#        "configurations": {"global" : {}},
#        "roleParams": {},
#        "commandParams" :	{
#          "commandParams": {"source_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.2.0\\"}", "target_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.2.2\\"}"}
#        },
#        "clusterHostInfo": {
#          "ambari_db_server_host": [
#              "dev.hortonworks.com"
#          ],
#          "ganglia_server_host": [
#              "dev.hortonworks.com"
#          ],
#          "nagios_server_host": [
#              "dev.hortonworks.com"
#          ],
#          "namenode_host": [
#              "dev.hortonworks.com"
#          ],
#          "slave_hosts": [
#              "dev.hortonworks.com"
#          ]
#        }
#      }],
#    "statusCommands":[]
#  }
#  """
#  t = json.loads(s)
#  pprint.pprint(t)

  main()


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="8dp" >

    <TextView
        android:id="@+id/txt_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/toast_actionsheet_top_normal"
        android:gravity="center"
        android:minHeight="55dp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:paddingLeft="15dp"
        android:paddingRight="15dp"
        android:textColor="@color/actionsheet_gray"
        android:textSize="15sp"
        android:visibility="gone"
        tools:visibility="visible"
        tools:text="你确定要取消了? "
    />

    <ScrollView
        android:id="@+id/sLayout_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fadingEdge="none"
         >

        <LinearLayout
            android:id="@+id/lLayout_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

    <TextView
        android:id="@+id/txt_cancel"
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/actionsheet_single_selector"
        android:gravity="center"
        android:text="@string/text_actionsheet_negative"
        android:textColor="@color/actionsheet_red"
        android:textSize="18sp"
        android:textStyle="bold" />

</LinearLayout>


text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.util;

import com.intellij.util.ThrowableRunnable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class ClassLoaderUtil {
  private ClassLoaderUtil() {
  }

  public static <E extends Throwable> void runWithClassLoader(@Nullable ClassLoader classLoader,
                                                              @NotNull ThrowableRunnable<E> runnable)
    throws E {
    ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
    try {
      Thread.currentThread().setContextClassLoader(classLoader);
      runnable.run();
    }
    finally {
      Thread.currentThread().setContextClassLoader(oldClassLoader);
    }
  }

  public static <T, E extends Throwable> T computeWithClassLoader(@Nullable ClassLoader classLoader,
                                                                  @NotNull ThrowableComputable<T, E> computable) throws E {
    ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
    try {
      Thread.currentThread().setContextClassLoader(classLoader);
      return computable.compute();
    }
    finally {
      Thread.currentThread().setContextClassLoader(oldClassLoader);
    }
  }

  /** @deprecated Use {@link ClassLoaderUtil#computeWithClassLoader(ClassLoader, ThrowableComputable)} instead. */
  @Deprecated
  @ApiStatus.ScheduledForRemoval
  public static <T> T runWithClassLoader(ClassLoader classLoader, Computable<T> computable) {
    return computeWithClassLoader(classLoader, () -> computable.compute());
  }
}