text:
<?php

namespace Phpactor\WorseReflection\Bridge\TolerantParser\Reflection;

use Phpactor\WorseReflection\Bridge\TolerantParser\Reflection\Collection\ReflectionParameterCollection as TolerantReflectionParameterCollection;
use Phpactor\WorseReflection\Core\Reflection\ReflectionFunction as CoreReflectionFunction;
use Phpactor\WorseReflection\Core\Name;
use Phpactor\WorseReflection\Core\Inference\Frame;
use Phpactor\WorseReflection\Core\DocBlock\DocBlock;
use Phpactor\WorseReflection\Core\SourceCode;
use Phpactor\WorseReflection\Core\Types;
use Phpactor\WorseReflection\Core\Type;
use Phpactor\WorseReflection\Core\Reflection\Collection\ReflectionParameterCollection;
use Phpactor\WorseReflection\Core\NodeText;
use Microsoft\PhpParser\Node\Statement\FunctionDeclaration;
use Phpactor\WorseReflection\Core\ServiceLocator;
use Microsoft\PhpParser\Node;
use Microsoft\PhpParser\Node\QualifiedName;
use Microsoft\PhpParser\Token;
use Phpactor\WorseReflection\Core\Reflection\TypeResolver\FunctionReturnTypeResolver;

class ReflectionFunction extends AbstractReflectedNode implements CoreReflectionFunction
{
    /**
     * @var ServiceLocator
     */
    private $serviceLocator;

    /**
     * @var FunctionDeclaration
     */
    private $node;

    /**
     * @var SourceCode
     */
    private $sourceCode;

    public function __construct(SourceCode $sourceCode, ServiceLocator $serviceLocator, FunctionDeclaration $node)
    {
        $this->serviceLocator = $serviceLocator;
        $this->node = $node;
        $this->sourceCode = $sourceCode;
    }

    public function name(): Name
    {
        return Name::fromParts($this->node->getNamespacedName()->getNameParts());
    }

    public function frame(): Frame
    {
        return $this->serviceLocator->frameBuilder()->build($this->node());
    }

    public function docblock(): DocBlock
    {
        return $this->serviceLocator->docblockFactory()->create($this->node()->getLeadingCommentAndWhitespaceText());
    }

    public function inferredTypes(): Types
    {
        return (new FunctionReturnTypeResolver($this))->resolve();
    }

    public function type(): Type
    {
        $type = $this->node->returnType;

        if (null === $type) {
            return Type::unknown();
        }

        if ($type instanceof Token) {
            return Type::fromString($type->getText($this->node->getFileContents()));
        }

        if (!$type instanceof QualifiedName) {
            return Type::unknown();
        }

        return Type::fromString($type->getResolvedName());
    }

    public function parameters(): ReflectionParameterCollection
    {
        return TolerantReflectionParameterCollection::fromFunctionDeclaration($this->serviceLocator, $this->node, $this);
    }

    public function body(): NodeText
    {
    }

    public function sourceCode(): SourceCode
    {
        return $this->sourceCode;
    }

    protected function node(): Node
    {
        return $this->node;
    }
}


text:
// -*- C++ -*-

//=============================================================================
/**
 * @file Notify_EventChannelFactory_i.h
 *
 * $Id: Notify_EventChannelFactory_i.h 935 2008-12-10 21:47:27Z mitza $
 *
 *  @author Pradeep Gore <pradeep@cs.wustl.edu>
 */
//=============================================================================

#ifndef NOTIFY_EVENTCHANNELFACTORY_I_H
#define NOTIFY_EVENTCHANNELFACTORY_I_H
#include /**/ "ace/pre.h"

#include "orbsvcs/CosNotifyChannelAdminS.h"
#include "orbsvcs/Notify/notify_serv_export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_Notify_EventChannelFactory_i
 *
 * @brief Class maintained for Backward compatibility.
 *
 */
class TAO_Notify_Serv_Export TAO_Notify_EventChannelFactory_i
{
public:
  /// Create a factory servant and activates it with the default POA.
  /// Also creates a resource factory and assigns it this default_POA.
  static CosNotifyChannelAdmin::EventChannelFactory_ptr
    create (PortableServer::POA_ptr default_POA,
            const char* factory_name = "EventChannelFactory");
};

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"
#endif /* NOTIFY_EVENTCHANNELFACTORY_I_H */

redpajama_set_name: RedPajamaGithub


text:
<?php namespace CodeBurrow\Services;

use CodeBurrow\Database;

class EditRoutes extends Database
{

	public function editAllRoutes($thePost)
	{
		if (isset($thePost['individual_btn'])) {

			$theID = $thePost['individual_btn'];
			$theNameENG = $thePost['editNameENG'][$theID];
			$theNameGR = $thePost['editNameGR'][$theID];
			$theSchool = $thePost['editSchool'][$theID];

			$query_routes = "SELECT * FROM Routes WHERE ID = '$theID';";

			try {
				$db = $this->getDbConnection();
				$stmt_routes = $db->prepare($query_routes);
				$result_routes = $stmt_routes->execute();
			} catch (PDOException $ex) {
				// For testing, you could use a die and message.
				//die("Failed to run query: " . $ex->getMessage());

				//or just use this use this one to product JSON data:
				$response["success"] = 0;
				$response["message"] = "Database Error. Please Try Again!";

				return $response;
			}

			//fetching the row from the query
			$dbRoute = $stmt_routes->fetch();

			if (!empty($dbRoute)) {

				$update_route = "UPDATE Routes SET nameENG='$theNameENG', nameGR='$theNameGR', school='$theSchool' WHERE ID = '$theID';";

				try {
					$stmt_route = $db->prepare($update_route);
					$result_route = $stmt_route->execute();
				} catch (PDOException $ex) {
					// For testing, you could use a die and message.
					//die("Failed to run query: " . $ex->getMessage());

					//or just use this use this one to product JSON data:
					$response["success"] = 0;
					$response["message"] = "Database Error 2. Please Try Again!";

					return $response;
				}

				if ($result_route) {
					$response["success"] = 1;
					$response["message"] = "Route(s) Successfully Edited ";
				} else {
					$response["success"] = 0;
					$response["message"] = "Route(s) Could Not Be Edited ";
				}

			} else {
				// no routes found
				$response["success"] = 0;
				$response["message"] = "Route With ID $theID Was NOT Found";

				return $response;
			}

			return $response;

		} else if( isset($thePost['selections']) ) {

			foreach ($thePost['selections'] as $routeID) {

				$query_routes = "SELECT * FROM Routes WHERE ID = $routeID;";

				try {
					$db = $this->getDbConnection();
					$stmt_routes = $db->prepare($query_routes);
					$result_routes = $stmt_routes->execute();
				} catch (PDOException $ex) {
					// For testing, you could use a die and message.
					//die("Failed to run query: " . $ex->getMessage());

					//or just use this use this one to product JSON data:
					$response["success"] = 0;
					$response["message"] = "Database Error. Please Try Again!";

					return $response;
				}

				//fetching all the rows from the query
				$dbRoute = $stmt_routes->fetch();

				if (!empty($dbRoute)) {

					$theNameENG = $thePost['editNameENG'][$routeID];
					$theNameGR = $thePost['editNameGR'][$routeID];
					$theSchool = $thePost['editSchool'][$routeID];

					$update_route = "UPDATE Routes SET nameENG='$theNameENG', nameGR='$theNameGR', school='$theSchool' WHERE ID = '$routeID';";

					try {
						$stmt_route = $db->prepare($update_route);
						$result_route = $stmt_route->execute();
					} catch (PDOException $ex) {
						// For testing, you could use a die and message.
						//die("Failed to run query: " . $ex->getMessage());

						//or just use this use this one to product JSON data:
						$response["success"] = 0;
						$response["message"] = "Database Error 2. Please Try Again!";

						return $response;
					}

					if ($result_route) {
						$response["success"] = 1;
						$response["message"] = "Route(s) Successfully Edited ";
					} else {
						$response["success"] = 0;
						$response["message"] = "Route(s) Could Not Be Edited ";
					}

				} else {
					// no routes found
					$response["success"] = 0;
					$response["message"] = "Route With ID $routeID Was NOT Found";

					return $response;
				}
			}

			return $response;
		} else {
			$response["success"] = 2;
			$response["message"] = "No Route Was Selected for Modification";

			return $response;
		}
	}

}


text:
package se1test.werkzeuge;

import java.awt.Color;
import java.io.File;

import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;

class FragenWerkzeugUI
{
    public static final String NAME = "SE1-Test";

    private JLabel _fragetextLabel;
    private JLabel _bildLabel;

	private JTextArea _quelltextLabel;

    private JButton _naechsteFrageButton;
    private JButton _vorherigeFrageButton;
    private JButton _abgabeButton;

    private JPanel _anzeige;
    private JPanel _frageBereich;
    private JPanel _bildBereich;
    private JPanel _quelltextBereich;
    private JPanel _antwortenBereich;
    private JPanel _abgabeBereich;
    private JPanel _bedienBereich;

	private JFrame _frame;

	/**
	 * Erstellt eine neue GUI für ein FragenWerkzeug und fügt dieses
	 * zu den Observern hinzu.
	 *
	 * @param fragenwerkzeug Das beobachtende FragenWerkzeug.
	 */
	public FragenWerkzeugUI(JPanel antwortenPanel)
	{
		initGUI(antwortenPanel);
	}

	/**
	 * Initilisiert die Interfaceelemente der GUI.
	 */
	private void initGUI(JPanel antwortenPanel)
	{
		_anzeige = new JPanel();
		_anzeige.setLayout(new BoxLayout(_anzeige, BoxLayout.Y_AXIS));

		erzeugeFrageBereich();
		erzeugeBildBereich();
		erzeugeQuelltextBereich();
		erzeugeAntwortenBereich(antwortenPanel);
		erzeugeBedienBereich();
		erzeugeAbgabeBereich();

		erzeugeHauptfenster();
	}

	/**
	 * Erzeugt einen Bildbereich mit einem JLabel.
	 */
	private void erzeugeBildBereich()
    {
	    _bildBereich = new JPanel();
	    _anzeige.add(_bildBereich);

	    _bildLabel = new JLabel();

	    _bildBereich.add(_bildLabel);
    }

	/**
	 * Erzeugt einen Fragenbereich mit einem JLabel
	 */
	private void erzeugeFrageBereich()
	{
		_frageBereich = new JPanel();
		_anzeige.add(_frageBereich);

		_fragetextLabel = new JLabel("Frage?");

		_frageBereich.add(_fragetextLabel);
	}

	/**
	 * Erzeugt einen Quelltextbereich mit einem JLabel.
	 */
	private void erzeugeQuelltextBereich()
	{
		_quelltextBereich = new JPanel();
		_anzeige.add(_quelltextBereich);

		_quelltextLabel = new JTextArea("Quelltext");
		_quelltextLabel.setEditable(false);
		_quelltextLabel.setForeground(Color.BLUE);

		_quelltextBereich.add(_quelltextLabel);
		_quelltextBereich.setEnabled(false);
	}

	/**
	 * Erzeugt einen Antwortenbereich.
	 */
	private void erzeugeAntwortenBereich(JPanel antwortenPanel)
	{
		_antwortenBereich = antwortenPanel;
		_anzeige.add(_antwortenBereich);
	}

	/**
	 * Erzeugt einen BedienBereich mit Vorwärts- und Zurück-Knopf.
	 */
	private void erzeugeBedienBereich()
	{
		_bedienBereich = new JPanel();
		_anzeige.add(_bedienBereich);

		_vorherigeFrageButton = new JButton("Vorherige Frage");

		_naechsteFrageButton = new JButton("Nächste Frage");

		_bedienBereich.add(_vorherigeFrageButton);
		_bedienBereich.add(_naechsteFrageButton);
	}

	/**
	 * Erzeug einen AbgabeBereich mit Abgabebutton.
	 */
	private void erzeugeAbgabeBereich()
	{
		_abgabeBereich = new JPanel();
		_anzeige.add(_abgabeBereich);

		_abgabeButton = new JButton("Test abgeben");

		_abgabeBereich.add(_abgabeButton);
	}

	/**
	 * Erzeugt das Hauptfenster der GUI.
	 */
	private void erzeugeHauptfenster()
	{
		_frame = new JFrame(NAME);
        _frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		_frame.setTitle(NAME);
        _frame.setLocationRelativeTo(null);
        _frame.setVisible(true);
        _frame.add(_anzeige);
        _frame.pack();
	}

	/**
	 * Passt das Fenster an die Bedienelemente an.
	 */
	public void passeFensterAn()
	{
		_frame.pack();
	}

	/**
	 * Aktualisiert den Text im Fragebereich.
	 *
	 * @param neuerFragetext Der neue Fragetext.
	 */
	public void aktualisiereFrage(String neuerFragetext)
	{
		_fragetextLabel.setText(neuerFragetext);
	}

	/**
	 * Beendet den Test und gibt die erreichte Punktzahl aus.
	 *
	 * @param endergebnis Erreichte Punktzahl
	 * @param maxPunktzahl Die maximal erreichbare Punktzahl
	 */
	public void beendeTest(int endergebnis, int maxPunktzahl)
    {
	    _abgabeBereich.add(new JLabel("Erreichte Punktzahl: " + endergebnis
	    													+ "/" + maxPunktzahl));
	    _abgabeBereich.remove(_abgabeButton);
    }

	/**
	 * Aktualisiert den Quelltextbereich.
	 *
	 * @param neuerQuelltext Der neue Quelltext.
	 */
	public void aktualisiereQuelltext(String neuerQuelltext)
	{
		_quelltextLabel.setText(neuerQuelltext);
	}

	/**
	 * Aktualisiert den Bildbereich mit einem Bild.
	 *
	 * @param neuesBild Das neue Bild.
	 *
	 * @require neuesBild != null
	 */
	public void aktualisiereBild(File neuesBild)
	{
		assert neuesBild != null : "Vorbedingung verletzt : neuesBilde != null";

		_bildLabel.setIcon(new ImageIcon(neuesBild.getPath()));
	}

	/**
	 * Entfernt das Bild aus dem Bildbereich.
	 */
	public void entferneBild()
	{
		_bildLabel.setIcon(null);
	}

	/**
	 * Gibt den Button der zur nächsten Frage springt zurück.
	 *
	 * @return Der JButton
	 */
	public JButton getVorwaertsButton()
	{
		return _naechsteFrageButton;
	}

	/**
	 * Gibt den Button der zur vorigen Frage springt zurück.
	 *
	 * @return Der JButton
	 */
	public JButton getRueckwaertsButton()
	{
		return _vorherigeFrageButton;
	}

	/**
	 * Gibt den Button für die Abgabe zurück.
	 *
	 * @return Der JButton
	 */
	public JButton getAbgabeButton()
	{
		return _abgabeButton;
	}
}


text:
<?php

namespace Upload;

/**
 * File
 *
 * This class provides the implementation for an uploaded file. It exposes
 * common attributes for the uploaded file (e.g. name, extension, media type)
 * and allows you to attach validations to the file that must pass for the
 * upload to succeed.
 *
 * @author  Josh Lockhart <info@joshlockhart.com>
 * @since   1.0.0
 * @package Upload
 */
class File extends \SplFileInfo
{
    /********************************************************************************
    * Static Properties
    *******************************************************************************/

    /**
     * Upload error code messages
     * @var array
     */
    protected static $errorCodeMessages = array(
        1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
        2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
        3 => 'The uploaded file was only partially uploaded',
        4 => 'Er is geen bestand geupload.',
        6 => 'Missing a temporary folder',
        7 => 'Failed to write file to disk',
        8 => 'A PHP extension stopped the file upload'
    );

    /**
     * Lookup hash to convert file units to bytes
     * @var array
     */
    protected static $units = array(
        'b' => 1,
        'k' => 1024,
        'm' => 1048576,
        'g' => 1073741824
    );

    /********************************************************************************
    * Instance Properties
    *******************************************************************************/

    /**
     * Storage delegate
     * @var \Upload\Storage\Base
     */
    protected $storage;

    /**
     * Validations
     * @var array[\Upload\Validation\Base]
     */
    protected $validations;

    /**
     * Validation errors
     * @var array
     */
    protected $errors;

    /**
     * Original file name provided by client (for internal use only)
     * @var string
     */
    protected $originalName;

    /**
     * File name (without extension)
     * @var string
     */
    protected $name;

    /**
     * File extension (without leading dot)
     * @var string
     */
    protected $extension;

    /**
     * File mimetype (e.g. "image/png")
     * @var string
     */
    protected $mimetype;

    /**
     * Upload error code (for internal use only)
     * @var  int
     * @link http://www.php.net/manual/en/features.file-upload.errors.php
     */
    protected $errorCode;

    /**
     * Constructor
     * @param  string                            $key            The file's key in $_FILES superglobal
     * @param  \Upload\Storage\Base              $storage        The method with which to store file
     * @throws \Upload\Exception\UploadException If file uploads are disabled in the php.ini file
     * @throws \InvalidArgumentException         If $_FILES key does not exist
     */
    public function __construct($key, \Upload\Storage\Base $storage)
    {
        if (!isset($_FILES[$key])) {
            throw new \InvalidArgumentException("Cannot find uploaded file identified by key: $key");
        }
        $this->storage = $storage;
        $this->validations = array();
        $this->errors = array();
        $this->originalName = $_FILES[$key]['name'];
        $this->errorCode = $_FILES[$key]['error'];
        parent::__construct($_FILES[$key]['tmp_name']);
    }

    /**
     * Get name
     * @return string
     */
    public function getName()
    {
        if (!isset($this->name)) {
            $this->name = pathinfo($this->originalName, PATHINFO_FILENAME);
        }

        return $this->name;
    }

    /**
     * Set name (without extension)
     * @param  string           $name
     * @return \Upload\File     Self
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get file name with extension
     * @return string
     */
    public function getNameWithExtension()
    {
        return sprintf('%s.%s', $this->getName(), $this->getExtension());
    }

    /**
     * Get file extension (without leading dot)
     * @return string
     */
    public function getExtension()
    {
        if (!isset($this->extension)) {
            $this->extension = pathinfo($this->originalName, PATHINFO_EXTENSION);
        }

        return $this->extension;
    }

    /**
     * Get mimetype
     * @return string
     */
    public function getMimetype()
    {
        if (!isset($this->mimeType)) {
            $finfo = new \finfo(FILEINFO_MIME);
            $mimetype = $finfo->file($this->getPathname());
            $mimetypeParts = preg_split('/\s*[;,]\s*/', $mimetype);
            $this->mimetype = strtolower($mimetypeParts[0]);
            unset($finfo);
        }

        return $this->mimetype;
    }

    /********************************************************************************
    * Validate
    *******************************************************************************/

    /**
     * Add file validations
     * @param \Upload\Validation\Base|array[\Upload\Validation\Base] $validations
     */
    public function addValidations($validations)
    {
        if (!is_array($validations)) {
            $validations = array($validations);
        }
        foreach ($validations as $validation) {
            if ($validation instanceof \Upload\Validation\Base) {
                $this->validations[] = $validation;
            }
        }
    }

    /**
     * Get file validations
     * @return array[\Upload\Validation\Base]
     */
    public function getValidations()
    {
        return $this->validations;
    }

    /**
     * Validate file
     * @return bool True if valid, false if invalid
     */
    public function validate()
    {
        // Validate is uploaded OK
        if ($this->isOk() === false) {
            $this->errors[] = self::$errorCodeMessages[$this->errorCode];
        }

        // Validate is uploaded file
        if ($this->isUploadedFile() === false) {
            //$this->errors[] = 'Er is geen bestand geupload.';
        }

        // User validations
        foreach ($this->validations as $validation) {
            if ($validation->validate($this) === false) {
                $this->errors[] = $validation->getMessage();
            }
        }

        return empty($this->errors);
    }

    /**
     * Get file validation errors
     * @return array[String]
     */
    public function getErrors()
    {
        return $this->errors;
    }

    /**
     * Add file validation error
     * @param  string
     * @return \Upload\File Self
     */
    public function addError($error)
    {
        $this->errors[] = $error;

        return $this;
    }

    /********************************************************************************
    * Upload
    *******************************************************************************/

    /**
     * Upload file (delegated to storage object)
     * @param  string $newName Give the file it a new name
     * @return bool
     * @throws \Upload\Exception\UploadException If file does not validate
     */
    public function upload($newName = null)
    {
        if ($this->validate() === false) {
            throw new \Upload\Exception\UploadException('File validation failed');
        }

        // Update the name, leaving out the extension
        $this->name = pathinfo($newName, PATHINFO_FILENAME);

        return $this->storage->upload($this, $newName);
    }

    /********************************************************************************
    * Helpers
    *******************************************************************************/

    /**
     * Is this file uploaded with a POST request?
     *
     * This is a separate method so that it can be stubbed in unit tests to avoid
     * the hard dependency on the `is_uploaded_file` function.
     *
     * @return  bool
     */
    public function isUploadedFile()
    {
        return is_uploaded_file($this->getPathname());
    }

    /**
     * Is this file OK?
     *
     * This method inspects the upload error code to see if the upload was
     * successful or if it failed for a variety of reasons.
     *
     * @link    http://www.php.net/manual/en/features.file-upload.errors.php
     * @return  bool
     */
    public function isOk()
    {
        return ($this->errorCode === UPLOAD_ERR_OK);
    }

    /**
     * Convert human readable file size (e.g. "10K" or "3M") into bytes
     * @param  string $input
     * @return int
     */
    public static function humanReadableToBytes($input)
    {
        $number = (int)$input;
        $unit = strtolower(substr($input, -1));
        if (isset(self::$units[$unit])) {
            $number = $number * self::$units[$unit];
        }

        return $number;
    }
}


text:
/*
 * This file is part of the swblocks-baselib library.
 *
 * 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.
 */

#ifndef __BL_MESSAGING_ASYNCEXECUTORWRAPPERBLOCKS_H_
#define __BL_MESSAGING_ASYNCEXECUTORWRAPPERBLOCKS_H_

#include <baselib/messaging/DataChunkStorage.h>
#include <baselib/messaging/BackendProcessingBase.h>
#include <baselib/messaging/BackendProcessing.h>

#include <baselib/async/AsyncExecutorWrapperBase.h>

namespace bl
{
    namespace detail
    {
        /**
         * @brief class AsyncSharedStateBlocks - state object that will be used to maintain the shared
         * state between the AsyncExecutorWrapperBlocks object and the operation states it manages
         */

        template
        <
            typename E = void
        >
        class AsyncSharedStateBlocksT : public AsyncSharedStateBase
        {
        public:

            typedef messaging::BackendProcessing::CommandId                                 CommandId;
            typedef messaging::BackendProcessing::OperationId                               OperationId;

            typedef cpp::function
                <
                    void (
                        SAA_in const om::ObjPtr< data::DataBlock >& dataBlock
                        )
                >
                datablock_callback_t;

        protected:

            typedef AsyncSharedStateBase                                                    base_type;

            const om::ObjPtr< data::datablocks_pool_type >                                  m_dataBlocksPool;
            datablock_callback_t                                                            m_authenticationCallback;
            datablock_callback_t                                                            m_serverStateCallback;
            std::size_t                                                                     m_blockCapacity;

            AsyncSharedStateBlocksT(
                SAA_in              om::ObjPtr< data::datablocks_pool_type >&&              dataBlocksPool,
                SAA_in_opt          om::ObjPtr< tasks::TaskControlToken >&&                 controlToken = nullptr,
                SAA_in_opt          datablock_callback_t&&                                  authenticationCallback =
                    datablock_callback_t(),
                SAA_in_opt          datablock_callback_t&&                                  serverStateCallback =
                    datablock_callback_t()
                )
                :
                base_type( BL_PARAM_FWD( controlToken ) ),
                m_dataBlocksPool( BL_PARAM_FWD( dataBlocksPool ) ),
                m_blockCapacity( data::DataBlock::defaultCapacity() )
            {
                authenticationCallback.swap( m_authenticationCallback );
                serverStateCallback.swap( m_serverStateCallback );
            }

        public:

            auto dataBlocksPool() const NOEXCEPT -> const om::ObjPtr< data::datablocks_pool_type >&
            {
                return m_dataBlocksPool;
            }

            auto authenticationCallback() const NOEXCEPT -> const datablock_callback_t&
            {
                return m_authenticationCallback;
            }

            void authenticationCallback( SAA_in_opt datablock_callback_t&& authenticationCallback ) NOEXCEPT
            {
                authenticationCallback.swap( m_authenticationCallback );
            }

            auto serverStateCallback() const NOEXCEPT -> const datablock_callback_t&
            {
                return m_serverStateCallback;
            }

            void serverStateCallback( SAA_in_opt datablock_callback_t&& serverStateCallback ) NOEXCEPT
            {
                serverStateCallback.swap( m_serverStateCallback );
            }

            auto blockCapacity() const NOEXCEPT -> std::size_t
            {
                return m_blockCapacity;
            }

            void blockCapacity( SAA_in const std::size_t blockCapacity ) NOEXCEPT
            {
                m_blockCapacity = blockCapacity;
            }

            auto allocateBlock() const -> om::ObjPtr< data::DataBlock >
            {
                auto newBlock = m_dataBlocksPool -> tryGet();

                if( ! newBlock )
                {
                    newBlock = data::DataBlock::createInstance( m_blockCapacity );
                }

                BL_ASSERT( newBlock -> capacity() == m_blockCapacity );

                newBlock -> reset();

                return newBlock;
            }

            void deallocateBlock( SAA_in om::ObjPtr< data::DataBlock >&& block ) const NOEXCEPT
            {
                BL_NOEXCEPT_BEGIN()

                BL_ASSERT( block );
                BL_ASSERT( block -> capacity() == m_blockCapacity );

                block -> reset();

                m_dataBlocksPool -> put( BL_PARAM_FWD( block ) );

                BL_NOEXCEPT_END()
            }
        };

        typedef AsyncSharedStateBlocksT<> AsyncSharedStateBlocks;

    } // detail

    /**
     * @brief class AsyncExecutorWrapperBlocks - an implementation of async executor
     * which manages, possibly authenticated, data blocks
     *
     * For more information see the description of AsyncExecutorWrapperBase class
     */

    template
    <
        typename IMPL = detail::AsyncSharedStateBlocks
    >
    class AsyncExecutorWrapperBlocks : public AsyncExecutorWrapperBase< IMPL >
    {
    public:

        enum : char
        {
            SECURE_BLOCKS_FILL_BYTE = 'x',
        };

        typedef typename IMPL::OperationId                                                  OperationId;
        typedef typename IMPL::CommandId                                                    CommandId;
        typedef typename IMPL::datablock_callback_t                                         datablock_callback_t;
        typedef AsyncExecutorWrapperBase< IMPL >                                            base_type;
        typedef typename base_type::AsyncOperationStateBase                                 AsyncOperationStateBase;

        using base_type::impl;

        /**
         * @brief class AsyncOperationState - this object holds the state for an async operation that
         * is already in progress
         */

        template
        <
            typename E2 = void
        >
        class AsyncOperationStateBlockBaseT : public AsyncOperationStateBase
        {
            BL_DECLARE_OBJECT_IMPL( AsyncOperationStateBlockBaseT )

        protected:

            typedef AsyncOperationStateBase                                                 base_type;

        public:

            using base_type::impl;

        protected:

            cpp::ScalarTypeIniter< OperationId >                                            m_operationId;
            om::ObjPtr< data::DataBlock >                                                   m_data;
            uuid_t                                                                          m_sessionId;
            uuid_t                                                                          m_chunkId;
            uuid_t                                                                          m_sourcePeerId;
            uuid_t                                                                          m_targetPeerId;
            cpp::ScalarTypeIniter< CommandId >                                              m_commandId;

            AsyncOperationStateBlockBaseT()
                :
                m_operationId( OperationId::None ),
                m_sessionId( uuids::nil() ),
                m_chunkId( uuids::nil() ),
                m_sourcePeerId( uuids::nil() ),
                m_targetPeerId( uuids::nil() ),
                m_commandId( CommandId::None )
            {
            }

            om::ObjPtr< data::DataBlock > detachData() NOEXCEPT
            {
                om::ObjPtr< data::DataBlock > result( std::move( m_data ) );
                return result;
            }

            virtual void reset() NOEXCEPT
            {
                BL_ASSERT( ! m_data );

                m_operationId = OperationId::None;
                m_sessionId = uuids::nil();
                m_chunkId = uuids::nil();
                m_sourcePeerId = uuids::nil();
                m_targetPeerId = uuids::nil();
                m_commandId = CommandId::None;
            }

            void data( SAA_in om::ObjPtr< data::DataBlock >&& data ) NOEXCEPT
            {
                m_data = BL_PARAM_FWD( data );
            }

            void handleAlloc( SAA_in const bool isSecure )
            {
                if( ! m_data )
                {
                    m_data = impl() -> allocateBlock();
                }

                if( isSecure )
                {
                    ::memset( m_data -> pv(), SECURE_BLOCKS_FILL_BYTE, m_data -> capacity() );
                }
            }

            void handleDataBlockCallback(
                SAA_in          const bool                          allowAllocate,
                SAA_in_opt      const datablock_callback_t&         callback,
                SAA_in          const std::string&                  messagePrefix,
                SAA_in_opt      const eh::errc::errc_t              defaultError = eh::errc::success
                )
            {
                messaging::BackendProcessingBase::chkToWrapInServerErrorAndThrow(
                    [ & ]() -> void
                    {
                        if( ! callback )
                        {
                            BL_THROW_EC(
                                eh::errc::make_error_code( eh::errc::function_not_supported ),
                                BL_MSG()
                                    << messagePrefix
                                    << " is not supported by the backend"
                                    );
                        }

                        if( ! m_data && allowAllocate )
                        {
                            m_data = impl() -> allocateBlock();
                        }

                        if( ! m_data )
                        {
                            BL_THROW_EC(
                                eh::errc::make_error_code( eh::errc::invalid_argument ),
                                BL_MSG()
                                    << "Data block data is required to be sent from the client"
                                    );
                        }

                        callback( m_data );
                    },
                    messagePrefix,
                    defaultError
                    );
            }

        public:

            OperationId operationId() const NOEXCEPT
            {
                return m_operationId;
            }

            void operationId( SAA_in const OperationId operationId ) NOEXCEPT
            {
                m_operationId = operationId;
            }

            const om::ObjPtr< data::DataBlock >& data() const NOEXCEPT
            {
                return m_data;
            }

            const uuid_t& sessionId() const NOEXCEPT
            {
                return m_sessionId;
            }

            void sessionId( SAA_in const uuid_t& sessionId ) NOEXCEPT
            {
                m_sessionId = sessionId;
            }

            const uuid_t& chunkId() const NOEXCEPT
            {
                return m_chunkId;
            }

            void chunkId( SAA_in const uuid_t& chunkId ) NOEXCEPT
            {
                m_chunkId = chunkId;
            }

            const uuid_t& sourcePeerId() const NOEXCEPT
            {
                return m_sourcePeerId;
            }

            void sourcePeerId( SAA_in const uuid_t& sourcePeerId ) NOEXCEPT
            {
                m_sourcePeerId = sourcePeerId;
            }

            const uuid_t& targetPeerId() const NOEXCEPT
            {
                return m_targetPeerId;
            }

            void targetPeerId( SAA_in const uuid_t& targetPeerId ) NOEXCEPT
            {
                m_targetPeerId = targetPeerId;
            }

            CommandId commandId() const NOEXCEPT
            {
                return m_commandId;
            }

            void commandId( SAA_in const CommandId commandId ) NOEXCEPT
            {
                m_commandId = commandId;
            }

            /**************************************************************************************
             * AsyncOperationState implementation
             */

            virtual void execute() OVERRIDE
            {
                switch( m_operationId.value() )
                {
                    default:
                        BL_RT_ASSERT( false, "Invalid operation id" );
                        break;

                    case OperationId::Alloc:
                    case OperationId::SecureAlloc:
                        {
                            handleAlloc( OperationId::SecureAlloc == m_operationId /* isSecure */ );
                        }
                        break;

                    case OperationId::SecureDiscard:
                        {
                            BL_CHK(
                                nullptr,
                                m_data,
                                BL_MSG()
                                    << "Secure discard operation was scheduled without data"
                                );

                            ::memset( m_data -> pv(), SECURE_BLOCKS_FILL_BYTE, m_data -> capacity() );
                        }
                        break;

                    case OperationId::AuthenticateClient:
                        {
                            handleDataBlockCallback(
                                false                                               /* allowAllocate */,
                                impl() -> authenticationCallback(),
                                "Operation authenticate client"                     /* messagePrefix */,
                                eh::errc::permission_denied                         /* defaultError */
                                );
                        }
                        break;

                    case OperationId::GetServerState:
                        {
                            handleDataBlockCallback(
                                true                                                /* allowAllocate */,
                                impl() -> serverStateCallback(),
                                "Operation getting server state"                    /* messagePrefix */
                                );
                        }
                        break;

                    case OperationId::Command:
                        {
                            /*
                             * 'FlushPeerSessions' and 'Remove' can be ignored, but everything else
                             *  should cause RIP if not implemented in the derived classes
                             */

                            switch( m_commandId.value() )
                            {
                                default:
                                    BL_RT_ASSERT( false, "Invalid command id" );
                                    break;

                                case CommandId::FlushPeerSessions:
                                case CommandId::Remove:
                                    break;
                            }
                        }
                        break;
                }
            }

            virtual void releaseResources() NOEXCEPT OVERRIDE
            {
                if( m_data )
                {
                    impl() -> deallocateBlock( detachData() );
                }

                reset();

                base_type::releaseResources();
            }
        };

        typedef AsyncOperationStateBlockBaseT<> AsyncOperationStateBlockBase;

    protected:

        AsyncExecutorWrapperBlocks(
            SAA_in                  om::ObjPtr< IMPL >&&                                impl,
            SAA_in_opt              const std::size_t                                   threadsCount = 0U,
            SAA_in_opt              const std::size_t                                   maxConcurrentTasks = 0U
            )
            :
            base_type( BL_PARAM_FWD( impl ), threadsCount, maxConcurrentTasks )
        {
        }

        template
        <
            typename T
        >
        om::ObjPtr< T > createOperationStateInternal(
            SAA_in                  const OperationId                                   operationId,
            SAA_in_opt              const uuid_t&                                       sessionId,
            SAA_in_opt              const uuid_t&                                       chunkId,
            SAA_in_opt              const uuid_t&                                       sourcePeerId,
            SAA_in_opt              const uuid_t&                                       targetPeerId,
            SAA_in_opt              const CommandId                                     commandId
            )
        {
            auto operationState = impl() -> template tryGetOperationState< T >();

            if( ! operationState )
            {
                operationState = T::template createInstance();
            }

            operationState -> impl( om::copy( impl() ) );

            operationState -> operationId( operationId );
            operationState -> sessionId( sessionId );
            operationState -> chunkId( chunkId );
            operationState -> sourcePeerId( sourcePeerId );
            operationState -> targetPeerId( targetPeerId );
            operationState -> commandId( commandId );

            BL_ASSERT( ! operationState -> data() );

            return operationState;
        }

    public:

        auto authenticationCallback() const NOEXCEPT -> const datablock_callback_t&
        {
            return impl() -> authenticationCallback();
        }

        void authenticationCallback( SAA_in_opt datablock_callback_t&& authenticationCallback ) NOEXCEPT
        {
            impl() -> authenticationCallback( BL_PARAM_FWD( authenticationCallback ) );
        }

        auto serverStateCallback() const NOEXCEPT -> const datablock_callback_t&
        {
            return impl() -> serverStateCallback();
        }

        void serverStateCallback( SAA_in_opt datablock_callback_t&& serverStateCallback ) NOEXCEPT
        {
            impl() -> serverStateCallback( BL_PARAM_FWD( serverStateCallback ) );
        }
    };

} // bl

#endif /* __BL_MESSAGING_ASYNCEXECUTORWRAPPERBLOCKS_H_ */


text:
package com.alibaba.otter.shared.common.model.user;

import java.io.Serializable;
import java.util.Date;

public class User implements Serializable {

    private static final long serialVersionUID = -1724299315008190533L;
    private Long              id;
    private String            name;
    private String            password;
    private String            department;
    private String            realName;
    private AuthorizeType     authorizeType;
    private Date              gmtCreate;
    private Date              gmtModified;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

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

    public String getPassword() {
        return password;
    }

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

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public AuthorizeType getAuthorizeType() {
        return authorizeType;
    }

    public void setAuthorizeType(AuthorizeType authorizeType) {
        this.authorizeType = authorizeType;
    }

}


text:
import time

class SignalError(Exception):
    pass

class ArduinoInterface:
  def __init__(self, serialInterface):
    self.serialInterface = serialInterface

    self.signalMap = {}
    self.outputMap = {}
    self.voltageMap = {}
    self.data = {}

  def mapOutput(self, signalName, outputPin):
    self.signalMap[signalName] = outputPin

  def mapInput(self, signalName, inputPin):
    self.voltageMap[inputPin] = signalName

  def setSignal(self, signal):
    if signal.name not in self.signalMap.keys():
      raise SignalError('Signal ' + str(signal.name) + ' is not assigned to any output')
    self.outputMap[signal.name] = signal.value

  def inspectVoltage(self, voltageName):
    if voltageName not in self.voltageMap.values():
      raise SignalError('Signal ' + str(voltageName) + ' is not assigned to any output')
    self.data[voltageName] = []

  def getVoltage(self, voltageName):
    value = float(self.data[voltageName][-1])
    value = 5.0 * (value / 1023.0)
    return value

  def run(self, duration = 500):
    self._setOutputs()
    self.flushInput()
    self._command('a1;')

    inputCounter = 0
    now = time.time()
    endTime = now + (duration / 1000.0)
    while time.time() < endTime:
      line = self.serialInterface.readline().strip()
      if len(line) > 0:
        if self._proccessInput(line):
          inputCounter += 1
    self.serialInterface.write("a0;")
    self._setAllOutputs('z')

  def flushInput(self):
    self._command('a0;')
    endTime = time.time() + 0.1
    while time.time() < endTime:
     self.serialInterface.read()

  def _command(self, command):
    self.serialInterface.flushInput()
    self.serialInterface.flushOutput()
    self.serialInterface.write(command)
    self.serialInterface.flush()
    pass

  def _setOutputs(self):
    for signalName in self.outputMap.keys():
      if signalName not in self.signalMap.keys():
        raise SignalError('Signal ' + str(signalName) + ' is not assigned to any output')

      pin = self.signalMap[signalName]
      value = 'l'
      if self.outputMap[signalName] > 2.5:
        value = 'h'

      command = "s{pin}={value};".format(pin = pin, value = value)
      self._command(command)

  def _setAllOutputs(self, value):
    for pin in self.signalMap.values():
      command = "s{pin}={value};".format(pin = pin, value = value)
      self._command(command)

  def _proccessInput(self, inputLine):
    values = inputLine.split(';')
    if len(values) < 2:
      return False

    for i in range(0, len(values)):
      if i < len(self.voltageMap):
        voltageName = self.voltageMap[i]
        self.data[voltageName].append(values[i])
    return True


text:
<component name="libraryTable">
  <library name="play-services-instantapps-9.6.1">
    <CLASSES>
      <root url="jar://$PROJECT_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-instantapps/9.6.1/jars/classes.jar!/" />
      <root url="file://$PROJECT_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-instantapps/9.6.1/res" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
'use strict';

module.exports = function($provide) {

	/*
	 * Fix form autofill using a decorator
	 */
	var FormDirectiveAutofillDecorator =
		require('../decorators/formDirectiveAutofillDecorator');

	$provide.decorator('formDirective', ['$delegate', '$timeout',
		FormDirectiveAutofillDecorator]);

	/*
	 * Fix ngTouch issues with modal forms by using our own ngClick
	 * directive in directives/click.js
	 *
	 * https://github.com/angular/angular.js/issues/6432
	 * TODO: Fix this by not using either Angular UI or angular-touch
	 */
	$provide.decorator('ngClickDirective', ['$delegate',
		function($delegate) {
			$delegate.shift();

			return $delegate;
	}]);

	// Set default tools in text editors
	$provide.decorator('taOptions', ['$delegate', function(taOptions){
		taOptions.toolbar = [
			// ['h5', 'p'],
			['bold', 'italics', 'underline'],
			['ul', 'ol']
		];

		taOptions.classes = {
			focussed: 'focussed',
			toolbar: 'btn-toolbar',
			toolbarGroup: 'btn-group',
			toolbarButton: 'btn btn-default',
			toolbarButtonActive: 'active',
			disabled: 'disabled',
			textEditor: 'form-control',
			htmlEditor: 'form-control'
		};

		return taOptions;
	}]);

	$provide.decorator('taTools', ['$delegate', function(taTools) {
		taTools.h5.buttontext = 'Header';
		taTools.p.buttontext = 'Paragraph';

		return taTools;
	}]);
}


text:
CREATE TABLE v3_0_precinct_splits(id INTEGER PRIMARY KEY,
                                  name TEXT,
                                  precinct_id INTEGER,
                                  ballot_style_image_url TEXT);


text:
from wormhole import wsgi
from wormhole import container
from wormhole import host
from wormhole import volumes
from wormhole import tasks

class Router(wsgi.ComposableRouter):
    def add_routes(self, mapper):
        for r in [container, host, volumes, tasks]:
            r.create_router(mapper)


text:
using System;
using System.Collections.Generic;
using Android.Database;
using Android.Graphics;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
using Android.Content;

// TODO: Syncronize this view. This is not anywhere near thread safe...
// If you wiggle a list back and forth on the detail page then simultaniouslly
// hit the exit icon on the toolbar this view attempts to use disposed resources
// and crashes hard. P.S: This is 3rd party code.

namespace Cheesebaron.HorizontalListView
{
    [Preserve]
    public delegate void ScreenChangedEventHandler(object sender, ScreenChangedEventArgs e);

    [Preserve(AllMembers = true)]
    public class ScreenChangedEventArgs : EventArgs
    {
        public int CurrentScreen { get; set; }
        public int CurrentX { get; set; }
    }

    [Preserve(AllMembers = true)]
    public class HorizontalListView : AdapterView<BaseAdapter>
    {
        #region Fields
        private int _currentScreen;

        private int _leftViewIndex;
        private int _rightViewIndex;
        private int _displayOffset;
        private int _currentX;
        private int _nextX;
        private int _maxX;
        private GestureDetector _gestureDetector;
        private readonly Queue<View> _removedViewQueue = new Queue<View>();
        private bool _dataChanged;
        private DataSetObserver _dataSetObserver;
        private BaseAdapter _adapter;

        #endregion

        #region Ctor + Init

        public HorizontalListView(IntPtr handle, JniHandleOwnership transfer) : base(handle, transfer)
        {
            InitView();
            _dataSetObserver = new DataObserver(this);
        }

        public HorizontalListView(Context context) : this(context, null) { }

        public HorizontalListView(Context context, IAttributeSet attrs) : this(context, attrs, 0) { }

        public HorizontalListView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
            InitView();
            _dataSetObserver = new DataObserver(this);
        }

        private void InitView()
        {
            _leftViewIndex = -1;
            _rightViewIndex = 0;
            _displayOffset = 0;
            _currentX = 0;
            _nextX = 0;
            _maxX = int.MaxValue;
            Scroller = new Scroller(Context);
            var listener = new GestureListener(this);
            _gestureDetector = new GestureDetector(Context, listener);
        }

        #endregion

        #region Properties

        #region EventHandlers

        public event ScreenChangedEventHandler ScreenChanged;

        protected virtual void OnScreenChanged(ScreenChangedEventArgs e)
        {
            if (ScreenChanged != null)
                ScreenChanged(this, e);
        }

        #endregion

        public override View SelectedView
        {
            get { return GetChildAt(CurrentScreen); }
        }

        public override BaseAdapter Adapter
        {
            get { return _adapter; }
            set
            {
                if (null != Adapter)
                    Adapter.UnregisterDataSetObserver(_dataSetObserver);

                _adapter = value;
                _adapter.RegisterDataSetObserver(_dataSetObserver);
                Reset();
            }
        }

        public Scroller Scroller { get; private set; }

        /// <summary>
        /// Returns the CurrentScreen (Snap mode only).
        /// </summary>
        public int CurrentScreen
        {
            get { return _currentScreen; }
            private set
            {
                _currentScreen = value;
                OnScreenChanged(new ScreenChangedEventArgs
                {
                    CurrentScreen = _currentScreen,
                    CurrentX = _currentX
                });
            }
        }

        /// <summary>
        /// Returns the current leftmost X coordinate.
        /// </summary>
        public int CurrentX
        {
            get { return _currentX; }
            private set { _currentX = value; }
        }

        #endregion

        private void Reset()
        {
            lock (this)
            {
                InitView();
                RemoveAllViewsInLayout();
                RequestLayout();
            }
        }

        private void AddAndMeasureChild(View child, int viewPos)
        {
            var childParams = child.LayoutParameters ??
                              new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            AddViewInLayout(child, viewPos, childParams, true);
            child.Measure(MeasureSpec.MakeMeasureSpec(Width, MeasureSpecMode.AtMost),
                MeasureSpec.MakeMeasureSpec(Height, MeasureSpecMode.AtMost));
        }

        protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
        {
            base.OnLayout(changed, left, top, right, bottom);

            if (null == Adapter)
                return;

            if (_dataChanged)
            {
                var oldCurrentX = CurrentX;
                InitView();
                RemoveAllViewsInLayout();
                _nextX = oldCurrentX;
                _dataChanged = false;
            }

            if (Scroller.ComputeScrollOffset())
                _nextX = Scroller.CurrX;

            if (_nextX <= 0)
            {
                _nextX = 0;
                Scroller.ForceFinished(true);
            }

            if (_nextX >= _maxX)
            {
                _nextX = _maxX;
                Scroller.ForceFinished(true);
            }

            var dx = CurrentX - _nextX;
            RemoveNonVisibleItems(dx);
            FillList(dx);
            PositionItems(dx);

            CurrentX = _nextX;

            if (!Scroller.IsFinished)
                Post(RequestLayout);
        }

        public override void SetSelection(int position)
        {
            CurrentScreen = position;
        }

        private void FillList(int dx)
        {
            var edge = _displayOffset; //TODO: https://github.com/dinocore1/DevsmartLib-Android/issues/24
            var child = GetChildAt(ChildCount - 1);
            if (null != child)
                edge = child.Right;
            FillListRight(edge, dx);

            edge = 0;
            child = GetChildAt(0);
            if (null != child)
                edge = child.Left;
            FillListLeft(edge, dx);
        }

        private void FillListRight(int rightEdge, int dx)
        {
            while (rightEdge + dx < Width && _rightViewIndex < Adapter.Count)
            {
                View view = null;
                if (_removedViewQueue.Count > 0)
                {
                    view = _removedViewQueue.Dequeue();
                }

                var child = Adapter.GetView(_rightViewIndex, view, this);
                AddAndMeasureChild(child, -1);
                rightEdge += child.MeasuredWidth;

                if (_rightViewIndex == Adapter.Count - 1)
                {
                    _maxX = CurrentX + rightEdge - Width;
                }

                if (_maxX < 0)
                    _maxX = 0;

                _rightViewIndex++;
            }
        }

        private void FillListLeft(int leftEdge, int dx)
        {
            while (leftEdge + dx > 0 && _leftViewIndex >= 0)
            {
                View view = null;
                if (_removedViewQueue.Count > 0)
                {
                    view = _removedViewQueue.Dequeue();
                }

                var child = Adapter.GetView(_leftViewIndex, view, this);
                AddAndMeasureChild(child, 0);
                leftEdge -= child.MeasuredWidth;
                _leftViewIndex--;
                _displayOffset -= child.MeasuredWidth;
            }
        }

        private void RemoveNonVisibleItems(int dx)
        {
            var child = GetChildAt(0);
            while (null != child && child.Right + dx <= 0)
            {
                _displayOffset += child.MeasuredWidth;
                _removedViewQueue.Enqueue(child);
                RemoveViewInLayout(child);
                _leftViewIndex++;
                child = GetChildAt(0);
            }

            child = GetChildAt(ChildCount - 1);
            while (null != child && child.Left + dx >= Width)
            {
                _removedViewQueue.Enqueue(child);
                RemoveViewInLayout(child);
                _rightViewIndex--;
                child = GetChildAt(ChildCount - 1);
            }
        }

        private void PositionItems(int dx)
        {
            if (ChildCount < 1) return;

            _displayOffset += dx;
            var left = _displayOffset;
            for (var i = 0; i < ChildCount; i++)
            {
                var child = GetChildAt(i);
                var childWidth = child.MeasuredWidth;
                child.Layout(left, 0, left + childWidth, child.MeasuredHeight);
                left += childWidth + child.PaddingRight;
            }
        }

        public override bool DispatchTouchEvent(MotionEvent e)
        {
            var handled = base.DispatchTouchEvent(e) | _gestureDetector.OnTouchEvent(e);
            return handled;
        }

        public void ScrollTo(int x)
        {
            Scroller.StartScroll(_nextX, 0, x - _nextX, 0);
            RequestLayout();
        }

        protected bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
        {
            lock (this)
            {
                Scroller.Fling(_nextX, 0, (int)-velocityX, 0, 0, _maxX, 0, 0);
            }
            RequestLayout();

            return true;
        }

        protected bool OnDown(MotionEvent e)
        {
            Scroller.ForceFinished(true);
            return true;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (null != _gestureDetector)
                {
                    _gestureDetector.Dispose();
                    _gestureDetector = null;
                }
                if (null != Scroller)
                {
                    Scroller.Dispose();
                    Scroller = null;
                }
                if (null != _dataSetObserver)
                {
                    _dataSetObserver.Dispose();
                    _dataSetObserver = null;
                }
            }

            base.Dispose(disposing);
        }

        #region Internal classes
        [Preserve(AllMembers = true)]
        private class DataObserver : DataSetObserver
        {
            private readonly HorizontalListView _horizontalListView;

            public DataObserver(HorizontalListView horizontalListView)
            {
                _horizontalListView = horizontalListView;
            }

            public override void OnChanged()
            {
                _horizontalListView._dataChanged = true;
                _horizontalListView.Invalidate();
                _horizontalListView.RequestLayout();
            }

            public override void OnInvalidated()
            {
                _horizontalListView.Reset();
                _horizontalListView.Invalidate();
                _horizontalListView.RequestLayout();
            }
        }

        [Preserve(AllMembers = true)]
        private class GestureListener : GestureDetector.SimpleOnGestureListener
        {
            private readonly HorizontalListView _horizontalListView;

            public GestureListener(HorizontalListView horizontalListView)
            {
                _horizontalListView = horizontalListView;
            }

            public override bool OnDown(MotionEvent e)
            {
                return _horizontalListView.OnDown(e);
            }

            public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
            {
                return _horizontalListView.OnFling(e1, e2, velocityX, velocityY);
            }

            public override bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
            {
                _horizontalListView.RequestDisallowInterceptTouchEvent(true);
                _horizontalListView._nextX += (int)distanceX;
                _horizontalListView.RequestLayout();

                return true;
            }

            public override bool OnSingleTapConfirmed(MotionEvent e)
            {
                for (var i = 0; i < _horizontalListView.ChildCount; i++)
                {
                    var child = _horizontalListView.GetChildAt(i);

                    if (!IsEventWithinView(e, child)) continue;
                    if (null != _horizontalListView.OnItemClickListener)
                        _horizontalListView.OnItemClickListener.OnItemClick(_horizontalListView, child, _horizontalListView._leftViewIndex + 1 + i,
                                                                            _horizontalListView.Adapter.GetItemId(_horizontalListView._leftViewIndex + 1 + i));
                    if (null != _horizontalListView.OnItemSelectedListener)
                        _horizontalListView.OnItemSelectedListener.OnItemSelected(_horizontalListView, child, _horizontalListView._leftViewIndex + 1 + i,
                                                                                _horizontalListView.Adapter.GetItemId(_horizontalListView._leftViewIndex + 1 + i));
                    break;
                }

                return true;
            }

            public override void OnLongPress(MotionEvent e)
            {
                for (var i = 0; i < _horizontalListView.ChildCount; i++)
                {
                    var child = _horizontalListView.GetChildAt(i);

                    if (!IsEventWithinView(e, child)) continue;
                    if (null != _horizontalListView.OnItemLongClickListener)
                        _horizontalListView.OnItemLongClickListener.OnItemLongClick(_horizontalListView, child, _horizontalListView._leftViewIndex + 1 + i,
                                                                                _horizontalListView.Adapter.GetItemId(_horizontalListView._leftViewIndex + 1 + i));
                    break;
                }
            }

            private static bool IsEventWithinView(MotionEvent e, View child)
            {
                var viewRect = new Rect();
                var childPosition = new int[2];
                child.GetLocationOnScreen(childPosition);
                var left = childPosition[0];
                var right = left + child.Width;
                var top = childPosition[1];
                var bottom = top + child.Height;
                viewRect.Set(left, top, right, bottom);
                return viewRect.Contains((int)e.RawX, (int)e.RawY);
            }
        }
        #endregion
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>13</version>
  </parent>

  <groupId>org.apache.sentry</groupId>
  <artifactId>sentry</artifactId>
  <version>1.5.1-incubating</version>
  <description>Sentry component</description>
  <name>Sentry</name>
  <packaging>pom</packaging>

  <issueManagement>
    <system>JIRA</system>
    <url>https://issues.apache.org/jira/browse/SENTRY</url>
  </issueManagement>

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

  <scm>
    <connection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-sentry.git</connection>
    <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-sentry.git</developerConnection>
    <url>https://git-wip-us.apache.org/repos/asf/incubator-sentry</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compile.source>1.6</maven.compile.source>
    <maven.compile.target>1.6</maven.compile.target>
    <!-- versions are in alphabetical order -->
    <ant.contrib.version>1.0b3</ant.contrib.version>
    <maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
    <maven.eclipse.plugin.version>2.9</maven.eclipse.plugin.version>
    <maven.enforcer.plugin.version>1.3.1</maven.enforcer.plugin.version>
    <build.helper.maven.plugin.version>1.8</build.helper.maven.plugin.version>
    <commons.lang.version>2.6</commons.lang.version>
    <commons.logging.version>1.2</commons.logging.version>
    <bonecp.version>0.7.1.RELEASE</bonecp.version>
    <datanucleus.maven.plugin.version>3.3.0-release</datanucleus.maven.plugin.version>
    <datanucleus-api-jdo.version>3.2.6</datanucleus-api-jdo.version>
    <datanucleus-core.version>3.2.12</datanucleus-core.version>
    <datanucleus-rdbms.version>3.2.12</datanucleus-rdbms.version>
    <jdo-api.version>3.0.1</jdo-api.version>
    <derby.version>10.14.2.0</derby.version>
    <commons-cli.version>1.2</commons-cli.version>
    <hive.version>1.1.0</hive.version>
    <hadoop.version>2.6.0</hadoop.version>
    <fest.reflect.version>1.4.1</fest.reflect.version>
    <guava.version>11.0.2</guava.version>
    <junit.version>4.9</junit.version>
    <libthrift.version>0.9.2</libthrift.version>
    <libfb303.version>0.9.2</libfb303.version>
    <curator.version>2.6.0</curator.version>
    <junit.version>4.10</junit.version>
    <log4j.version>1.2.16</log4j.version>
    <mockito.version>1.8.5</mockito.version>
    <shiro.version>1.2.1</shiro.version>
    <slf4j.version>1.6.1</slf4j.version>
    <solr.version>4.10.2</solr.version>
    <zookeeper.version>3.4.5</zookeeper.version>
    <pig.version>0.12.0</pig.version>
    <jackson.version>1.8.8</jackson.version>
    <metrics.version>3.1.0</metrics.version>
    <jettyVersion>7.6.16.v20140903</jettyVersion>
    <curator.version>2.6.0</curator.version>
    <joda-time.version>2.5</joda-time.version>
    <test.sentry.hadoop.classpath>${maven.test.classpath}</test.sentry.hadoop.classpath>
    <easymock.version>3.0</easymock.version>
    <objenesis.version>1.2</objenesis.version>
    <cglib.version>2.2</cglib.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>ant-contrib</groupId>
        <artifactId>ant-contrib</artifactId>
        <version>1.0b3</version>
      </dependency>
      <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>${commons-cli.version}</version>
      </dependency>
      <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>${commons.lang.version}</version>
      </dependency>
      <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>${commons.logging.version}</version>
      </dependency>
      <dependency>
        <groupId>com.jolbox</groupId>
        <artifactId>bonecp</artifactId>
        <version>${bonecp.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derby</artifactId>
        <version>${derby.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.thrift</groupId>
        <artifactId>libthrift</artifactId>
        <version>${libthrift.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.thrift</groupId>
        <artifactId>libfb303</artifactId>
        <version>${libfb303.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-common</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive.hcatalog</groupId>
        <artifactId>hive-hcatalog-core</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive.hcatalog</groupId>
        <artifactId>hive-hcatalog-pig-adapter</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-hdfs</artifactId>
        <version>${hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-hdfs</artifactId>
        <version>${hadoop.version}</version>
        <type>test-jar</type>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-minicluster</artifactId>
        <version>${hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-minikdc</artifactId>
        <version>${hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
        <version>${hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
        <version>${hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-metastore</artifactId>
        <version>${hive.version}</version>
      </dependency>

      <dependency>
         <groupId>org.codehaus.jackson</groupId>
         <artifactId>jackson-core-asl</artifactId>
         <version>${jackson.version}</version>
       </dependency>
       <dependency>
         <groupId>org.codehaus.jackson</groupId>
         <artifactId>jackson-mapper-asl</artifactId>
         <version>${jackson.version}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-beeline</artifactId>
        <version>${hive.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-metastore</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-serde</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-common</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-serde</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-shims</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>solr-sentry-handlers</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-solrj</artifactId>
        <version>${solr.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-core</artifactId>
        <version>${solr.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-test-framework</artifactId>
        <version>${solr.version}</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-reflect</artifactId>
        <version>${fest.reflect.version}</version>
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.shiro</groupId>
        <artifactId>shiro-core</artifactId>
        <version>${shiro.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${guava.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-core-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-core-model-db</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-core-model-indexer</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-core-model-search</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-jdbc</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-shims</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-serde</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-exec</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-service</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-hbase-handler</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-contrib</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-cli</artifactId>
        <version>${hive.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-binding-hive</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-binding-solr</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-binding-solr</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-provider-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-provider-file</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-hdfs-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-hdfs-service</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-hdfs-namenode-plugin</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-hdfs-dist</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-provider-cache</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-provider-db</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-provider-db</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-policy-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-policy-db</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-policy-indexer</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-policy-search</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sentry</groupId>
        <artifactId>sentry-dist</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>javax.jdo</groupId>
        <artifactId>jdo-api</artifactId>
        <version>${jdo-api.version}</version>
      </dependency>
      <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>${datanucleus-core.version}</version>
      </dependency>
      <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-api-jdo</artifactId>
        <version>${datanucleus-api-jdo.version}</version>
      </dependency>
      <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-rdbms</artifactId>
        <version>${datanucleus-rdbms.version}</version>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>${mockito.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.pig</groupId>
        <artifactId>pig</artifactId>
        <version>${pig.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-recipes</artifactId>
        <version>${curator.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-x-discovery</artifactId>
        <version>${curator.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-test</artifactId>
        <version>${curator.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-framework</artifactId>
        <version>${curator.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>${zookeeper.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.jboss.netty</groupId>
            <artifactId>netty</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
      </dependency>
      <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>${easymock.version}</version>
      </dependency>
      <dependency>
        <groupId>org.objenesis</groupId>
        <artifactId>objenesis</artifactId>
        <version>${objenesis.version}</version>
      </dependency>
      <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>${cglib.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <modules>
    <module>sentry-core</module>
    <module>sentry-binding</module>
    <module>sentry-provider</module>
    <module>sentry-policy</module>
    <module>sentry-tests</module>
    <module>sentry-hdfs</module>
    <module>sentry-solr</module>
    <module>sentry-dist</module>
  </modules>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <inherited>true</inherited>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>${maven.eclipse.plugin.version}</version>
        <configuration>
          <workspaceActiveCodeStyleProfileName>GoogleStyle</workspaceActiveCodeStyleProfileName>
          <workspaceCodeStylesURL>https://google-styleguide.googlecode.com/svn/trunk/eclipse-java-google-style.xml</workspaceCodeStylesURL>
          <sourceIncludes><include>src/gen/thrift/gen-javabean/**</include></sourceIncludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>define-classpath</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <exportAntProperties>true</exportAntProperties>
              <target>
                <property name="maven.test.classpath" refid="maven.test.classpath"/>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

<!---
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes>
                  <include>org.apache.thrift:libthrift</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>org.apache.thrift</pattern>
                  <shadedPattern>sentry.org.apache.thrift</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
-->
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>2.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${maven.antrun.plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>ant-contrib</groupId>
              <artifactId>ant-contrib</artifactId>
              <version>${ant.contrib.version}</version>
              <exclusions>
                <exclusion>
                  <groupId>ant</groupId>
                  <artifactId>ant</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <source>${maven.compile.source}</source>
            <target>${maven.compile.target}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven.enforcer.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.16</version>
          <configuration>
            <forkMode>always</forkMode>
            <environmentVariables>
              <HADOOP_CLIENT_OPTS>-Xmx1500m -Dhive.log.dir=./target/</HADOOP_CLIENT_OPTS>
            </environmentVariables>
            <forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
            <argLine>-Xms512m -Xmx2g</argLine>
            <systemPropertyVariables>
              <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>0.10</version>
          <executions>
            <execution>
              <id>header-check</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <excludes>
                  <!-- Git specific files -->
                  <exclude>.git/</exclude>
                  <exclude>.gitignore</exclude>
                  <!--IDE specific files-->
                  <exclude>.idea/</exclude>
                  <exclude>**/*.iml</exclude>
                  <exclude>**/nb-configuration.xml</exclude>
                  <exclude>**/.classpath</exclude>
                  <exclude>**/.settings/**</exclude>
                  <exclude>**/.project</exclude>
                  <exclude>**/.metadata/</exclude>
                  <!-- Maven working directory -->
                  <exclude>**/target/</exclude>
                  <exclude>**/assembly/</exclude>
                  <!-- Pre commit testing generated files -->
                  <exclude>maven-repo/</exclude>
                  <exclude>test-output/</exclude>
                  <!-- Derby files which are created after test run -->
                  <exclude>**/dependency-reduced-pom.xml</exclude>
                  <exclude>**/derby.log</exclude>
                  <exclude>**/service.properties</exclude>
                  <exclude>**/*.lck</exclude>
                  <!-- Patch files which can be lying around -->
                  <exclude>**.patch</exclude>
                  <!-- Exclude generated solr config files -->
                  <exclude>**/solr/collection1/conf/**</exclude>
                  <exclude>**/empty-file-main-lib.txt</exclude>
                  <!-- Exclude generated thrift files -->
                  <exclude>**/gen/**</exclude>
                  <!-- README and test data with exact format -->
                  <exclude>README*</exclude>
                  <exclude>**/kv1.dat</exclude>
                  <exclude>**/*.sql</exclude>
                  <exclude>**/upgrade.*</exclude>
                  <exclude>**/datanucleus.log</exclude>
                  <exclude>**/metastore_db/</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${build.helper.maven.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.datanucleus</groupId>
          <artifactId>datanucleus-maven-plugin</artifactId>
          <version>${datanucleus.maven.plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.datanucleus</groupId>
              <artifactId>datanucleus-core</artifactId>
              <version>${datanucleus-core.version}</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <repositories>
    <repository>
      <id>apache</id>
      <url>https://repository.apache.org/content/repositories/</url>
    </repository>
  </repositories>

</project>


text:
package com.android.cts.verifier.p2p.testcase;

import java.util.ArrayList;
import java.util.List;

import com.android.cts.verifier.R;

import android.content.Context;
import android.net.wifi.p2p.nsd.WifiP2pServiceInfo;
import android.net.wifi.p2p.nsd.WifiP2pServiceRequest;

/**
 * Service discovery requester test case to search all UPnP and Bonjour services with
 * WifiP2pServiceRequest.newInstance(WifiP2pServiceInfo.SERVICE_TYPE_BONJOUR) and
 * WifiP2pServiceRequest.newInstance(WifiP2pServiceInfo.SERVICE_TYPE_UPNP).
 */
public class ServReqAllTestCase02 extends ServReqTestCase {

    public ServReqAllTestCase02(Context context) {
        super(context);
    }

    @Override
    protected boolean executeTest() throws InterruptedException {

        notifyTestMsg(R.string.p2p_checking_serv_capab);

        /*
         * create request to search all services.
         */
        List<WifiP2pServiceRequest> reqList = new ArrayList<WifiP2pServiceRequest>();
        reqList.add(WifiP2pServiceRequest.newInstance(
                WifiP2pServiceInfo.SERVICE_TYPE_BONJOUR));
        reqList.add(WifiP2pServiceRequest.newInstance(
                WifiP2pServiceInfo.SERVICE_TYPE_UPNP));

        /*
         * search and check the callback function.
         *
         * The expected the argument of the callback function is as follows.
         * DNS PTR: ALL services.
         * DNS TXT: ALL services.
         * UPnP: ALL services.
         */
        return searchTest(mTargetAddress, reqList,
                DnsSdResponseListenerTest.ALL_DNS_PTR,
                DnsSdTxtRecordListenerTest.ALL_DNS_TXT,
                UPnPServiceResponseListenerTest.ALL_UPNP_SERVICES);
    }

    @Override
    public String getTestName() {
        return "Request all services test 02";
    }
}


text:
/*
 * @lc app=leetcode id=487 lang=java
 *
 * [487] Max Consecutive Ones II
 *
 * https://leetcode.com/problems/max-consecutive-ones-ii/description/
 *
 * algorithms
 * Medium (47.87%)
 * Total Accepted:    46.7K
 * Total Submissions: 97.6K
 * Testcase Example:  '[1,0,1,1,0,1]'
 *
 *
 * Given a binary array, find the maximum number of consecutive 1s in this
 * array if you can flip at most one 0.
 *
 *
 * Example 1:
 *
 * Input: [1,0,1,1,0]
 * Output: 4
 * Explanation: Flip the first zero will get the the maximum number of
 * consecutive 1s.
 *    After flipping, the maximum number of consecutive 1s is 4.
 *
 *
 *
 * Note:
 *
 * The input array will only contain 0 and 1.
 * The length of input array is a positive integer and will not exceed
 * 10,000
 *
 *
 *
 * Follow up:
 * What if the input numbers come in one by one as an infinite stream? In other
 * words, you can't store all numbers coming from the stream as it's too large
 * to hold in memory. Could you solve it efficiently?
 *
 */
class Solution {
    public int findMaxConsecutiveOnes(int[] nums) {
        int ans = 0;
        int pre = 0;
        int cur = 0;
        for (int x : nums) {
            if (x == 1)
                cur++;
            else {
                ans = Math.max(ans, pre+cur);
                pre = cur;
                cur = 0;
            }
        }
        ans = Math.max(ans, pre+cur);

        return nums.length == ans ? ans : ans+1;
    }
}


text:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Stundenplan.Data;

namespace Stundenplan.ViewModels
{
    /// <summary>
    /// ViewModel für die Verlaufsanzeige
    /// </summary>
    public class ProgressViewModel : NotifyPropertyChangedObject
    {
        private Timetable timetable;

        public LessonViewModel CurrentLesson { get; private set; }
        public LessonViewModel NextLesson { get; private set; }

        public double CurrentLessonProgress
        {
            get
            {
                if (CurrentLesson != null && CurrentLesson.LessonTime != null)
                    return (DateTime.Now.TimeOfDay - this.CurrentLesson.LessonTime.Start.TimeOfDay).TotalSeconds /
                        (this.CurrentLesson.LessonTime.End - this.CurrentLesson.LessonTime.Start).TotalSeconds;
                else
                    return 0;
            }
        }

        public string ProgressString
        {
            get
            {
                if (CurrentLesson != null && CurrentLesson.LessonTime != null)
                {
                    TimeSpan difference = CurrentLesson.LessonTime.End - DateTime.Now;

                    return String.Format(progressStringFormat,
                        (int)difference.TotalHours, difference.Minutes, difference.Seconds);
                }
                else return "";
            }
        }

        private LessonViewModel notEnoughData;
        private LessonViewModel empty;
        private string freeTimeString;
        private string progressStringFormat;

        public ProgressViewModel(Timetable timetable, string notEnoughDataString, string freeTimeString, string progressStringFormat)
        {
            this.timetable = timetable;

            this.notEnoughData = new LessonViewModel(new Lesson(null, new SubjectRoom(new Subject(notEnoughDataString), "")));
            this.empty = new LessonViewModel(new Lesson(null, new SubjectRoom(new Subject(""), "")));
            this.freeTimeString = freeTimeString;
            this.progressStringFormat = progressStringFormat;
            this.UpdateData();
        }

        private void UpdateData()
        {
            DateTime now = DateTime.Now;

            var listedLessons = timetable.GetListedLessons(now, DateTime.Now.AddDays(7), LessonViewModel.GetIsOddWeek());

            var currentLesson = GetNextLesson(listedLessons, now);

            if (currentLesson == null) //In diesem Falle ists einfach: Nicht genügend Daten vorhanden
            {
                this.CurrentLesson = notEnoughData;
                this.NextLesson = empty;
            }
            else if (currentLesson.LessonTime.Start > now) //Aktuell: Freizeit. Nächstes: Untericht.
            {
                this.NextLesson = new LessonViewModel(currentLesson);
                this.CurrentLesson = new LessonViewModel(new Lesson(new LessonTime(0, now, this.NextLesson.LessonTime.Start), new SubjectRoom(new Subject(freeTimeString), "")));
            }
            else //Aktuell: Unterricht. Nächstes: Untericht.
            {
                this.CurrentLesson = new LessonViewModel(currentLesson);
                var nextLesson = GetNextLesson(listedLessons, currentLesson.LessonTime.End);

                if (nextLesson != null && (this.CurrentLesson.LessonTime.Start.Date == nextLesson.LessonTime.Start.Date))
                {
                    this.NextLesson = new LessonViewModel(nextLesson);
                }
                else //Aktuell Unterricht nächstes Freizeit
                    this.NextLesson = new LessonViewModel(new Lesson(null, new SubjectRoom(new Subject(freeTimeString), "")));
            }

            //Eigentlich haben sich alle Eigenschaften verändert.
            NotifyPropertyChanged(null);
        }

        private Lesson GetNextLesson(Dictionary<DateTime, Dictionary<LessonTime, SubjectRoom>> lessons, DateTime startTime)
        {
            foreach (var day in lessons)
            {
                if (day.Key.Date >= startTime.Date)
                {
                    foreach (var lesson in day.Value)
                    {
                        DateTime lessonStart = day.Key.Date + lesson.Key.Start.TimeOfDay;
                        DateTime lessonEnd = day.Key.Date + lesson.Key.End.TimeOfDay;

                        if ((lessonEnd > startTime) && (lesson.Value.Subject != Subject.None))
                        {
                            return new Lesson(new LessonTime(lesson.Key.Number, lessonStart, lessonEnd), lesson.Value);
                        }
                    }
                }
            }
            return null;
        }
    }
}