text:
<?php

namespace NilPortugues\SqlSchemaBuilder\Phinx\Connection\Adapter;

use NilPortugues\SqlSchemaBuilder\Connection\Adapter\AdapterInterface;
use NilPortugues\SqlSchemaBuilder\Migration\MigrationInterface;
use NilPortugues\SqlSchemaBuilder\Schema\ColumnMigrationInterface;
use NilPortugues\SqlSchemaBuilder\Schema\ForeignKeyMigrationInterface;
use NilPortugues\SqlSchemaBuilder\Schema\IndexMigrationInterface;
use NilPortugues\SqlSchemaBuilder\Schema\TableMigrationInterface;
use NilPortugues\SqlSchemaBuilder\Phinx\Connection\Adapter\AdapterParameterReader as Reader;

/**
 * Class PDOAdapter
 * @package NilPortugues\SqlSchemaBuilder\Phinx\Connection\Adapter
 */
class PDOAdapter implements AdapterInterface
{
    /**
     * @var array
     */
    protected $adapterMap = [
        'sqlite'   => '\Phinx\Db\Adapter\SQLiteAdapter',
        'mysql'    => '\Phinx\Db\Adapter\MysqlAdapter',
        'postgres' => '\Phinx\Db\Adapter\PostgresAdapter',
    ];

    /**
     * @var \Phinx\Db\Adapter\AdapterInterface
     */
    protected $adapter;

    /**
     * @var string
     */
    protected $defaultMigration = '_migrations';

    /**
     * @var string
     */
    protected $defaultCharset = '';

    /**
     * @param array $parameters
     *
     * @throws \RuntimeException
     */
    public function __construct(array $parameters)
    {
        $reader = new AdapterParameterReader($parameters);

        if (false === $reader->isValid()) {
            throw new \RuntimeException('Provided configuration is invalid');
        }

        if (true === empty($this->adapterMap[$reader->getType()])) {
            throw new \RuntimeException('Database type is not supported.');
        }

        $phinxParameters = array_merge(
            [
                'user'                    => $parameters[Reader::USER],
                'pass'                    => $parameters[Reader::PASS],
                'name'                    => $parameters[Reader::DATABASE][Reader::DB_NAME],
                'charset'                 => $this->getDefaultCharset($parameters),
                'default_migration_table' => $this->getMigrationTable($parameters),
            ],
            $parameters[Reader::DATABASE]
        );

        $this->adapter = $this->getNewAdapterInstance($phinxParameters, $reader->getType());
    }

    /**
     * @param array $parameters
     *
     * @return array|string
     */
    protected function getDefaultCharset(array &$parameters)
    {
        $charset = $this->defaultCharset;

        if (false === empty($parameters[Reader::CHARSET])) {
            $charset = $parameters[Reader::CHARSET];
        }
        return $charset;
    }

    /**
     * @param array $parameters
     *
     * @return string
     */
    protected function getMigrationTable(array &$parameters)
    {
        $migrationTable = $this->defaultMigration;
        if (false === empty($parameters[Reader::DATABASE][Reader::MIGRATION_TABLE])) {
            $migrationTable = $parameters[Reader::DATABASE][Reader::MIGRATION_TABLE];
        };

        return $migrationTable;
    }

    /**
     * @param array $parameters
     * @param       $type
     *
     * @return \Phinx\Db\Adapter\AdapterInterface
     */
    protected function getNewAdapterInstance(array &$parameters, $type)
    {
        $class = new \ReflectionClass($this->adapterMap[$type]);

        return $class->newInstanceArgs([$parameters]);
    }

    /**
     * @return \Phinx\Db\Adapter\AdapterInterface
     */
    public function getAdapter()
    {
        return $this->adapter;
    }

    /**
     * Get all migrated version numbers.
     *
     * @return array
     */
    public function getVersions()
    {
        return $this->adapter->getVersions();
    }

    /**
     * Records a migration being run.
     *
     * @param MigrationInterface $migration Migration
     * @param string             $direction Direction
     * @param int                $startTime Start Time
     * @param int                $endTime   End Time
     *
     * @return AdapterInterface
     */
    public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime)
    {
        return $this->adapter->migrated($migration, $direction, $startTime, $endTime);
    }

    /**
     * Creates the schema table.
     *
     * @return TableMigrationInterface
     */
    public function createSchemaTable()
    {
        $this->adapter->createSchemaTable();

        return $this;
    }

    /**
     * Returns the adapter dbType.
     *
     * @return string
     */
    public function getAdapterType()
    {
        return $this->adapter->getAdapterType();
    }

    /**
     * Initializes the database connection.
     *
     * @throws \RuntimeException When the requested database driver is not installed.
     * @return TableMigrationInterface
     */
    public function connect()
    {
        $this->adapter->connect();

        return $this;
    }

    /**
     * Closes the database connection.
     *
     * @return TableMigrationInterface
     */
    public function close()
    {
        $reflection    = new \ReflectionObject($this->adapter);
        $pdoConnection = $reflection->getProperty('connection');
        $pdoConnection->setAccessible(true);

        $connection = $pdoConnection->getValue($this->adapter);
        $connection->close();

        return $this;
    }

    /**
     * Does the adapter support transactions?
     *
     * @return boolean
     */
    public function hasTransactions()
    {
        return $this->adapter->hasTransactions();
    }

    /**
     * Begin a transaction.
     *
     * @return TableMigrationInterface
     */
    public function beginTransaction()
    {
        $this->adapter->beginTransaction();

        return $this;
    }

    /**
     * Commit a transaction.
     *
     * @return TableMigrationInterface
     */
    public function commit()
    {
        $this->adapter->commitTransaction();

        return $this;
    }

    /**
     * Rollback a transaction.
     *
     * @return TableMigrationInterface
     */
    public function rollBack()
    {
        $this->adapter->rollbackTransaction();

        return $this;
    }

    /**
     * Executes a SQL statement and returns the number of affected rows.
     *
     * @param string $sql SQL
     *
     * @return int
     */
    public function execute($sql)
    {
        return $this->adapter->execute($sql);
    }

    /**
     * Executes a SQL statement and returns the result as an array.
     *
     * @param string $sql SQL
     *
     * @return array
     */
    public function query($sql)
    {
        return $this->adapter->query($sql);
    }

    /**
     * Executes a query and returns only one row as an array.
     *
     * @param string $sql SQL
     *
     * @return array
     */
    public function fetchRow($sql)
    {
        return $this->adapter->fetchRow($sql);
    }

    /**
     * Executes a query and returns an array of rows.
     *
     * @param string $sql SQL
     *
     * @return array
     */
    public function fetchAll($sql)
    {
        return $this->adapter->fetchAll($sql);
    }

    /**
     * Quotes a table name for use in a query.
     *
     * @param string $tableName TableMigrationInterface Name
     *
     * @return string
     */
    public function quoteTableName($tableName)
    {
        return $this->adapter->quoteTableName($tableName);
    }

    /**
     * Quotes a column name for use in a query.
     *
     * @param string $columnName TableMigrationInterface Name
     *
     * @return string
     */
    public function quoteColumnName($columnName)
    {
        return $this->adapter->quoteColumnName($columnName);
    }

    /**
     * Checks to see if a table exists.
     *
     * @param string $tableName TableMigrationInterface Name
     *
     * @return boolean
     */
    public function hasTable($tableName)
    {
        return $this->adapter->hasTable($tableName);
    }

    /**
     * Creates the specified database table.
     *
     * @param TableMigrationInterface $table TableMigrationInterface
     *
     * @return TableMigrationInterface
     */
    public function createTable(TableMigrationInterface $table)
    {
        $this->adapter->createTable($table);

        return $this;
    }

    /**
     * Renames the specified database table.
     *
     * @param string $tableName TableMigrationInterface Name
     * @param string $newName   New Name
     *
     * @return TableMigrationInterface
     */
    public function renameTable($tableName, $newName)
    {
        $this->adapter->renameTable($tableName, $newName);

        return $this;
    }

    /**
     * Drops the specified database table.
     *
     * @param string $tableName TableMigrationInterface Name
     *
     * @return TableMigrationInterface
     */
    public function dropTable($tableName)
    {
        $this->adapter->dropTable($tableName);

        return $this;
    }

    /**
     * Returns table columns
     *
     * @param string $tableName TableMigrationInterface Name
     *
     * @return ColumnMigrationInterface[]
     */
    public function getColumns($tableName)
    {
        return $this->adapter->getColumns($tableName);
    }

    /**
     * Checks to see if a column exists.
     *
     * @param string $tableName  TableMigrationInterface Name
     * @param string $columnName ColumnMigrationInterface Name
     *
     * @return boolean
     */
    public function hasColumn($tableName, $columnName)
    {
        return $this->hasColumn($tableName, $columnName);
    }

    /**
     * Adds the specified column to a database table.
     *
     * @param TableMigrationInterface  $table  TableMigrationInterface
     * @param ColumnMigrationInterface $column ColumnMigrationInterface
     *
     * @return TableMigrationInterface
     */
    public function addColumn(TableMigrationInterface $table, ColumnMigrationInterface $column)
    {
        $this->adapter->addColumn($table, $column);

        return $this;
    }

    /**
     * Renames the specified column.
     *
     * @param string $tableName     TableMigrationInterface Name
     * @param string $columnName    ColumnMigrationInterface Name
     * @param string $newColumnName New ColumnMigrationInterface Name
     *
     * @return TableMigrationInterface
     */
    public function renameColumn($tableName, $columnName, $newColumnName)
    {
        $this->adapter->renameColumn($tableName, $columnName, $newColumnName);

        return $this;
    }

    /**
     * Change a table column dbType.
     *
     * @param string                   $tableName                   TableMigrationInterface Name
     * @param string                   $columnName                  ColumnMigrationInterface Name
     * @param ColumnMigrationInterface $newColumnMigrationInterface ColumnMigrationInterface
     *
     * @return TableMigrationInterface
     */
    public function changeColumnType(
        $tableName,
        $columnName,
        ColumnMigrationInterface $newColumnMigrationInterface
    ) {
        $this->adapter->renameColumn($tableName, $columnName, $newColumnMigrationInterface);

        return $this;
    }

    /**
     * Drops the specified column.
     *
     * @param string $tableName  TableMigrationInterface Name
     * @param string $columnName ColumnMigrationInterface Name
     *
     * @return TableMigrationInterface
     */
    public function dropColumn($tableName, $columnName)
    {
        $this->adapter->dropColumn($tableName, $columnName);

        return $this;
    }

    /**
     * Checks to see if an index exists.
     *
     * @param string $tableName TableMigrationInterface Name
     * @param array  $columns   Column(s)
     *
     * @return boolean
     */
    public function hasIndex($tableName, array $columns)
    {
        return $this->adapter->hasIndex($tableName, $columns);
    }

    /**
     * Adds the specified index to a database table.
     *
     * @param TableMigrationInterface $table TableMigrationInterface
     * @param IndexMigrationInterface $index Index
     *
     * @return TableMigrationInterface
     */
    public function addIndex(TableMigrationInterface $table, IndexMigrationInterface $index)
    {
        $this->adapter->addIndex($table, $index);

        return $this;
    }

    /**
     * Drops the specified index from a database table.
     *
     * @param string $tableName
     * @param array  $columns Column(s)
     *
     * @return TableMigrationInterface
     */
    public function dropIndex($tableName, array $columns)
    {
        $this->adapter->dropIndex($tableName, $columns);

        return $this;
    }

    /**
     * Drops the index specified by name from a database table.
     *
     * @param string $tableName
     * @param string $indexName
     *
     * @return TableMigrationInterface
     */
    public function dropIndexByName($tableName, $indexName)
    {
        $this->adapter->dropIndexByName($tableName, $indexName);

        return $this;
    }

    /**
     * Checks to see if a foreign key exists.
     *
     * @param string   $tableName
     * @param string[] $columns    Column(s)
     * @param string   $constraint Constraint name
     *
     * @return boolean
     */
    public function hasForeignKey($tableName, array $columns, $constraint = null)
    {
        return $this->adapter->hasForeignKey($tableName, $columns, $constraint);
    }

    /**
     * Adds the specified foreign key to a database table.
     *
     * @param TableMigrationInterface      $table
     * @param ForeignKeyMigrationInterface $foreignKey
     *
     * @return TableMigrationInterface
     */
    public function addForeignKey(TableMigrationInterface $table, ForeignKeyMigrationInterface $foreignKey)
    {
        $this->adapter->dropIndexByName($table, $foreignKey);

        return $this;
    }

    /**
     * Drops the specified foreign key from a database table.
     *
     * @param string   $tableName
     * @param string[] $columns    Column(s)
     * @param string   $constraint Constraint name
     *
     * @return TableMigrationInterface
     */
    public function dropForeignKey($tableName, $columns, $constraint = null)
    {
        $this->adapter->dropForeignKey($tableName, $columns, $constraint);

        return $this;
    }

    /**
     * Creates a new database.
     *
     * @param string $name    Database Name
     * @param array  $options Options
     *
     * @return TableMigrationInterface
     */
    public function createDatabase($name, array $options = [])
    {
        $this->adapter->createDatabase($name, $options);

        return $this;
    }

    /**
     * Checks to see if a database exists.
     *
     * @param string $name Database Name
     *
     * @return boolean
     */
    public function hasDatabase($name)
    {
        return $this->adapter->hasDatabase($name);
    }

    /**
     * Drops the specified database.
     *
     * @param string $name Database Name
     *
     * @return TableMigrationInterface
     */
    public function dropDatabase($name)
    {
        $this->adapter->dropDatabase($name);

        return $this;
    }
}


text:
namespace bp = boost::python;

struct StackedTransformElement_wrapper : osgAnimation::StackedTransformElement, bp::wrapper< osgAnimation::StackedTransformElement > {

    virtual void applyToMatrix( ::osg::Matrix & matrix ) const {
        bp::override func_applyToMatrix = this->get_override( "applyToMatrix" );
        func_applyToMatrix( boost::ref(matrix) );
    }

    virtual ::osg::Matrix getAsMatrix(  ) const {
        bp::override func_getAsMatrix = this->get_override( "getAsMatrix" );
        return func_getAsMatrix(  );
    }

    virtual ::osgAnimation::Target * getOrCreateTarget(  ) {
        if( bp::override func_getOrCreateTarget = this->get_override( "getOrCreateTarget" ) )
            return func_getOrCreateTarget(  );
        else{
            return this->osgAnimation::StackedTransformElement::getOrCreateTarget(  );
        }
    }

    ::osgAnimation::Target * default_getOrCreateTarget(  ) {
        return osgAnimation::StackedTransformElement::getOrCreateTarget( );
    }

    virtual ::osgAnimation::Target * getTarget(  ) {
        if( bp::override func_getTarget = this->get_override( "getTarget" ) )
            return func_getTarget(  );
        else{
            return this->osgAnimation::StackedTransformElement::getTarget(  );
        }
    }

    ::osgAnimation::Target * default_getTarget(  ) {
        return osgAnimation::StackedTransformElement::getTarget( );
    }

    virtual ::osgAnimation::Target const * getTarget(  ) const  {
        if( bp::override func_getTarget = this->get_override( "getTarget" ) )
            return func_getTarget(  );
        else{
            return this->osgAnimation::StackedTransformElement::getTarget(  );
        }
    }

    ::osgAnimation::Target const * default_getTarget(  ) const  {
        return osgAnimation::StackedTransformElement::getTarget( );
    }

    virtual bool isIdentity(  ) const {
        bp::override func_isIdentity = this->get_override( "isIdentity" );
        return func_isIdentity(  );
    }

    virtual void update( float t ){
        bp::override func_update = this->get_override( "update" );
        func_update( t );
    }

    virtual char const * className(  ) const {
        bp::override func_className = this->get_override( "className" );
        return func_className(  );
    }

    virtual ::osg::Object * clone( ::osg::CopyOp const & arg0 ) const {
        bp::override func_clone = this->get_override( "clone" );
        return func_clone( boost::ref(arg0) );
    }

    virtual ::osg::Object * cloneType(  ) const {
        bp::override func_cloneType = this->get_override( "cloneType" );
        return func_cloneType(  );
    }

    virtual void computeDataVariance(  ) {
        if( bp::override func_computeDataVariance = this->get_override( "computeDataVariance" ) )
            func_computeDataVariance(  );
        else{
            this->osg::Object::computeDataVariance(  );
        }
    }

    void default_computeDataVariance(  ) {
        osg::Object::computeDataVariance( );
    }

    virtual ::osg::Referenced * getUserData(  ) {
        if( bp::override func_getUserData = this->get_override( "getUserData" ) )
            return func_getUserData(  );
        else{
            return this->osg::Object::getUserData(  );
        }
    }

    ::osg::Referenced * default_getUserData(  ) {
        return osg::Object::getUserData( );
    }

    virtual ::osg::Referenced const * getUserData(  ) const  {
        if( bp::override func_getUserData = this->get_override( "getUserData" ) )
            return func_getUserData(  );
        else{
            return this->osg::Object::getUserData(  );
        }
    }

    ::osg::Referenced const * default_getUserData(  ) const  {
        return osg::Object::getUserData( );
    }

    virtual bool isSameKindAs( ::osg::Object const * arg0 ) const  {
        if( bp::override func_isSameKindAs = this->get_override( "isSameKindAs" ) )
            return func_isSameKindAs( boost::python::ptr(arg0) );
        else{
            return this->osg::Object::isSameKindAs( boost::python::ptr(arg0) );
        }
    }

    bool default_isSameKindAs( ::osg::Object const * arg0 ) const  {
        return osg::Object::isSameKindAs( boost::python::ptr(arg0) );
    }

    virtual char const * libraryName(  ) const {
        bp::override func_libraryName = this->get_override( "libraryName" );
        return func_libraryName(  );
    }

    virtual void resizeGLObjectBuffers( unsigned int arg0 ) {
        if( bp::override func_resizeGLObjectBuffers = this->get_override( "resizeGLObjectBuffers" ) )
            func_resizeGLObjectBuffers( arg0 );
        else{
            this->osg::Object::resizeGLObjectBuffers( arg0 );
        }
    }

    void default_resizeGLObjectBuffers( unsigned int arg0 ) {
        osg::Object::resizeGLObjectBuffers( arg0 );
    }

    virtual void setName( ::std::string const & name ) {
        if( bp::override func_setName = this->get_override( "setName" ) )
            func_setName( name );
        else{
            this->osg::Object::setName( name );
        }
    }

    void default_setName( ::std::string const & name ) {
        osg::Object::setName( name );
    }

    virtual void setThreadSafeRefUnref( bool threadSafe ) {
        if( bp::override func_setThreadSafeRefUnref = this->get_override( "setThreadSafeRefUnref" ) )
            func_setThreadSafeRefUnref( threadSafe );
        else{
            this->osg::Object::setThreadSafeRefUnref( threadSafe );
        }
    }

    void default_setThreadSafeRefUnref( bool threadSafe ) {
        osg::Object::setThreadSafeRefUnref( threadSafe );
    }

    virtual void setUserData( ::osg::Referenced * obj ) {
        if( bp::override func_setUserData = this->get_override( "setUserData" ) )
            func_setUserData( boost::python::ptr(obj) );
        else{
            this->osg::Object::setUserData( boost::python::ptr(obj) );
        }
    }

    void default_setUserData( ::osg::Referenced * obj ) {
        osg::Object::setUserData( boost::python::ptr(obj) );
    }

};

void register_StackedTransformElement_class(){

    bp::class_< StackedTransformElement_wrapper, bp::bases< ::osg::Object >, osg::ref_ptr< StackedTransformElement_wrapper >, boost::noncopyable >( "StackedTransformElement", bp::no_init )
        .def(
            "applyToMatrix"
            , bp::pure_virtual( (void ( ::osgAnimation::StackedTransformElement::* )( ::osg::Matrix & )const)(&::osgAnimation::StackedTransformElement::applyToMatrix) )
            , ( bp::arg("matrix") ) )
        .def(
            "getAsMatrix"
            , bp::pure_virtual( (::osg::Matrix ( ::osgAnimation::StackedTransformElement::* )(  )const)(&::osgAnimation::StackedTransformElement::getAsMatrix) ) )
        .def(
            "getOrCreateTarget"
            , (::osgAnimation::Target * ( ::osgAnimation::StackedTransformElement::* )(  ))(&::osgAnimation::StackedTransformElement::getOrCreateTarget)
            , (::osgAnimation::Target * ( StackedTransformElement_wrapper::* )(  ))(&StackedTransformElement_wrapper::default_getOrCreateTarget)
            , bp::return_internal_reference< >() )
        .def(
            "getTarget"
            , (::osgAnimation::Target * ( ::osgAnimation::StackedTransformElement::* )(  ))(&::osgAnimation::StackedTransformElement::getTarget)
            , (::osgAnimation::Target * ( StackedTransformElement_wrapper::* )(  ))(&StackedTransformElement_wrapper::default_getTarget)
            , bp::return_internal_reference< >() )
        .def(
            "getTarget"
            , (::osgAnimation::Target const * ( ::osgAnimation::StackedTransformElement::* )(  )const)(&::osgAnimation::StackedTransformElement::getTarget)
            , (::osgAnimation::Target const * ( StackedTransformElement_wrapper::* )(  )const)(&StackedTransformElement_wrapper::default_getTarget)
            , bp::return_internal_reference< >() )
        .def(
            "isIdentity"
            , bp::pure_virtual( (bool ( ::osgAnimation::StackedTransformElement::* )(  )const)(&::osgAnimation::StackedTransformElement::isIdentity) ) )
        .def(
            "update"
            , bp::pure_virtual( (void ( ::osgAnimation::StackedTransformElement::* )( float ))(&::osgAnimation::StackedTransformElement::update) )
            , ( bp::arg("t") ) );

}

redpajama_set_name: RedPajamaGithub


text:
package net.wolfesoftware.jax.ast;

public class Equality extends ComparisonOperator
{
    public Equality(Expression expression1, Expression expression2)
    {
        super(expression1, expression2);
    }

    public static final int TYPE = 0x0e36034f;
    public int getElementType()
    {
        return TYPE;
    }

    protected String getOperator()
    {
        return "==";
    }
}


text:
.class public Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;
.super Ljava/lang/Object;
.source "CdmaInformationRecords.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/telephony/cdma/CdmaInformationRecords;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "CdmaLineControlInfoRec"
.end annotation

# instance fields
.field public lineCtrlPolarityIncluded:B

.field public lineCtrlPowerDenial:B

.field public lineCtrlReverse:B

.field public lineCtrlToggle:B

# direct methods
.method public constructor <init>(IIII)V
    .locals 1
    .parameter "lineCtrlPolarityIncluded"
    .parameter "lineCtrlToggle"
    .parameter "lineCtrlReverse"
    .parameter "lineCtrlPowerDenial"

    .prologue
    .line 213
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 214
    int-to-byte v0, p1

    iput-byte v0, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlPolarityIncluded:B

    .line 215
    int-to-byte v0, p2

    iput-byte v0, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlToggle:B

    .line 216
    int-to-byte v0, p3

    iput-byte v0, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlReverse:B

    .line 217
    int-to-byte v0, p4

    iput-byte v0, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlPowerDenial:B

    .line 218
    return-void
.end method

# virtual methods
.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 222
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "CdmaLineControlInfoRec: { lineCtrlPolarityIncluded: "

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

    move-result-object v0

    iget-byte v1, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlPolarityIncluded:B

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " lineCtrlToggle: "

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

    move-result-object v0

    iget-byte v1, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlToggle:B

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " lineCtrlReverse: "

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

    move-result-object v0

    iget-byte v1, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlReverse:B

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " lineCtrlPowerDenial: "

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

    move-result-object v0

    iget-byte v1, p0, Lcom/android/internal/telephony/cdma/CdmaInformationRecords$CdmaLineControlInfoRec;->lineCtrlPowerDenial:B

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " }"

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

    move-result-object v0

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

    move-result-object v0

    return-object v0
.end method


text:
package carbonreceiver

import (
	"context"
	"testing"

	"github.com/stretchr/testify/assert"
	"go.opentelemetry.io/collector/component/componenttest"
	"go.opentelemetry.io/collector/consumer/consumertest"
)

func TestCreateDefaultConfig(t *testing.T) {
	factory := NewFactory()
	cfg := factory.CreateDefaultConfig()
	assert.NotNil(t, cfg, "failed to create default config")
	assert.NoError(t, componenttest.CheckConfigStruct(cfg))
}

func TestCreateReceiver(t *testing.T) {
	cfg := createDefaultConfig().(*Config)
	cfg.Endpoint = "localhost:0" // Endpoint is required, not going to be used here.

	params := componenttest.NewNopReceiverCreateSettings()
	tReceiver, err := createMetricsReceiver(context.Background(), params, cfg, consumertest.NewNop())
	assert.NoError(t, err)
	assert.NotNil(t, tReceiver, "receiver creation failed")
}


text:
package com.google.code.morphia.testutil;

/**
 * @author uwe
 */
public abstract class AssertedFailure
{
    private Throwable exceptionRaised;
    private Class<? extends Throwable> expected;

    protected AssertedFailure(final Class<? extends Throwable> expectedAssertionType)
    {
        expected = expectedAssertionType;
        run();
    }

    protected AssertedFailure()
    {
        run();
    }

    private void run()
    {
        try
        {
            thisMustFail();
            throw new AssertedFailureDidNotHappenException();
        }
        catch (Throwable e)
        {
            if (e instanceof AssertedFailureDidNotHappenException)
            {
                AssertedFailureDidNotHappenException assertedOne = (AssertedFailureDidNotHappenException) e;
                throw assertedOne;
            }

            exceptionRaised = e;
            if (dumpToSystemOut())
            {
                System.out.println("AssertedFailure:" + exceptionRaised);
            }
            if (expected != null)
            {
                Throwable ex = getWrappedException(e, expected);
                if (ex == null)
                {
                    throw new AssertedFailureDidNotHappenException("unexpected exception class. got '"
                            + e.getClass().getName() + "' instead of expected '" + expected.getName() + "'", e);
                }

            }
        }
    }

    @SuppressWarnings("unchecked")
    public static <T extends Throwable> T getWrappedException(final Throwable throwable, final Class<T> targetClass)
    {
        if (throwable == null)
        {
            return null;
        }

        if (throwable.getClass() == targetClass)
        {
            return (T) throwable;
        }
        else
        {
            return getWrappedException(throwable.getCause(), targetClass);
        }
    }

    protected abstract void thisMustFail() throws Throwable;

    protected boolean dumpToSystemOut()
    {
        return false;
    }

    public Throwable getExceptionRaised()
    {
        return exceptionRaised;
    }

}

class AssertedFailureDidNotHappenException extends RuntimeException
{

    public AssertedFailureDidNotHappenException(final String string, final Throwable e)
    {
        super(string, e);
    }

    public AssertedFailureDidNotHappenException()
    {
        super();
    }

    private static final long serialVersionUID = 1L;
}


text:
package se.softhouse.garden.oak;

import java.util.HashMap;
import java.util.Map;

import se.softhouse.garden.oak.model.ARegister;
import se.softhouse.garden.oak.table.DecisionTable;

import com.google.gson.Gson;

/**
 * @author Mikael Svahn
 *
 */
public class DecisionEngine {

	protected Map<String, DecisionTable> sets = new HashMap<String, DecisionTable>();

	public void addDecisionTable(String name, DecisionTable set) {
		this.sets.put(name, set);
	}

	public boolean execute(String tableSetName, ARegister register) {
		DecisionTable tableSet = this.sets.get(tableSetName);
		if (tableSet != null) {
			tableSet.execute(register, this);
			return true;
		}
		return false;
	}

	@Override
	public String toString() {
		return new Gson().toJson(this);
	}

}


text:
- **Technique Mitre**
- **Technique Name**


text:
package com.ibasco.agql.protocols.valve.steam.webapi;

import com.ibasco.agql.core.AbstractWebApiRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Represents a Steam API Request
 *
 * @author Rafael Luis Ibasco
 */
abstract public class SteamWebApiRequest extends AbstractWebApiRequest {

    private static final Logger log = LoggerFactory.getLogger(SteamWebApiRequest.class);

    private String steamApiInterface;

    private String steamApiMethod;

    /**
     *
Constructor for SteamWebApiRequest.

     *
     * @param apiInterface
     *         a {@link java.lang.String} object
     * @param apiMethod
     *         a {@link java.lang.String} object
     * @param apiVersion
     *         a int
     */
    public SteamWebApiRequest(String apiInterface, String apiMethod, int apiVersion) {
        super(apiVersion);

        this.steamApiInterface = resolveProperties(apiInterface);
        this.steamApiMethod = apiMethod;
        baseUrlFormat(SteamApiConstants.STEAM_BASE_URL_FORMAT);
        property(SteamApiConstants.STEAM_PROP_INTERFACE, this.steamApiInterface);
        property(SteamApiConstants.STEAM_PROP_METHOD, this.steamApiMethod);
        property(SteamApiConstants.STEAM_PROP_VERSION, apiVersion);
    }

    /**
     *
Getter for the field steamApiInterface.

     *
     * @return a {@link java.lang.String} object
     */
    public String getSteamApiInterface() {
        return steamApiInterface;
    }

    /**
     *
Setter for the field steamApiInterface.

     *
     * @param steamApiInterface
     *         a {@link java.lang.String} object
     */
    public void setSteamApiInterface(String steamApiInterface) {
        this.steamApiInterface = steamApiInterface;
    }

    /**
     *
Getter for the field steamApiMethod.

     *
     * @return a {@link java.lang.String} object
     */
    public String getSteamApiMethod() {
        return steamApiMethod;
    }

    /**
     *
Setter for the field steamApiMethod.

     *
     * @param steamApiMethod
     *         a {@link java.lang.String} object
     */
    public void setSteamApiMethod(String steamApiMethod) {
        this.steamApiMethod = steamApiMethod;
    }
}


text:
package ch.qos.logback.core.joran.implicitAction;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.util.HashMap;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import ch.qos.logback.core.joran.SimpleConfigurator;
import ch.qos.logback.core.joran.action.Action;
import ch.qos.logback.core.joran.spi.ElementSelector;
import ch.qos.logback.core.util.CoreTestConstants;
import ch.qos.logback.core.util.StatusPrinter;

public class ImplicitActionTest {

  static final String IMPLCIT_DIR = CoreTestConstants.TEST_SRC_PREFIX
      + "input/joran/implicitAction/";

  FruitContext fruitContext = new FruitContext();
  SimpleConfigurator simpleConfigurator;

  @Before
  public void setUp() throws Exception {
    fruitContext.setName("fruits");
    HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>();
    rulesMap.put(new ElementSelector("/context/"), new FruitContextAction());
    simpleConfigurator = new SimpleConfigurator(rulesMap);
    simpleConfigurator.setContext(fruitContext);
  }

  void verifyFruit() {
    List<Fruit> fList = fruitContext.getFruitList();
    assertNotNull(fList);
    assertEquals(1, fList.size());

    Fruit f0 = fList.get(0);
    assertEquals("blue", f0.getName());
    assertEquals(2, f0.textList.size());
    assertEquals("hello", f0.textList.get(0));
    assertEquals("world", f0.textList.get(1));
  }

  @Test
  public void nestedComplex() throws Exception {
    try {
      simpleConfigurator.doConfigure(IMPLCIT_DIR + "nestedComplex.xml");
      verifyFruit();

    } catch (Exception je) {
      StatusPrinter.print(fruitContext);
      throw je;
    }
  }

  @Test
  public void nestedComplexWithoutClassAtrribute() throws Exception {
    try {
      simpleConfigurator.doConfigure(IMPLCIT_DIR
          + "nestedComplexWithoutClassAtrribute.xml");

      verifyFruit();

    } catch (Exception je) {
      StatusPrinter.print(fruitContext);
      throw je;
    }
  }

  void verifyFruitList() {
    List<Fruit> fList = fruitContext.getFruitList();
    assertNotNull(fList);
    assertEquals(1, fList.size());

    Fruit f0 = fList.get(0);
    assertEquals(2, f0.cakeList.size());

    Cake cakeA = f0.cakeList.get(0);
    assertEquals("A", cakeA.getType());

    Cake cakeB = f0.cakeList.get(1);
    assertEquals("B", cakeB.getType());
  }
  @Test
  public void nestedComplexCollection() throws Exception {
    try {
      simpleConfigurator.doConfigure(IMPLCIT_DIR
          + "nestedComplexCollection.xml");
      verifyFruitList();
    } catch (Exception je) {
      StatusPrinter.print(fruitContext);
      throw je;
    }
  }

  @Test
  public void nestedComplexCollectionWithoutClassAtrribute() throws Exception {
    try {
      simpleConfigurator.doConfigure(IMPLCIT_DIR
          + "nestedComplexCollectionWithoutClassAtrribute.xml");
      verifyFruitList();
    } catch (Exception je) {
      StatusPrinter.print(fruitContext);
      throw je;
    }
  }

}


text:
#include "platform/i_platform.h"
#include "recreate_borders_map_element_system.h"
#include "core/map/recreate_borders_map_element.h"
#include "core/i_border_component.h"
#include "core/i_position_component.h"
#include "core/i_collision_component.h"

namespace map {

RecreateBordersMapElementSystem::RecreateBordersMapElementSystem()
    : MapElementSystem()
    , mScene( Scene::Get() )
    , mBorderType( BorderType::Get() )
{
}

Neighbors RecreateBordersMapElementSystem::GetNeighbors( Actor& actor )
{
    Neighbors r;
    auto positionC = actor.Get<IPositionComponent>();
    BOOST_ASSERT( positionC.IsValid() );
    auto collisionC = actor.Get<ICollisionComponent>();
    BOOST_ASSERT( collisionC.IsValid() );
    glm::vec2 posOnMatrix = glm::vec2( positionC->GetX(), positionC->GetY() );
    double radius = collisionC->GetRadius();
    for (BorderType::NeighborDirs_t::const_iterator i = mBorderType.GetNeighborDirs().begin(), e = mBorderType.GetNeighborDirs().end(); i != e; ++i)
    {
        glm::vec2 pos = *i;
        pos = glm::vec2( pos.x * radius * 2, pos.y * radius * 2 ) + posOnMatrix;

        bool foundNeighbor = false;
        int32_t x = pos.x;
        int32_t y = pos.y;
        auto actors = GetActors( x, y );
        if (actors.IsValid())
        {
            for (auto other : *actors)
            {
                if (actor.GetId() == other->GetId()) //TODO there need to be a way to ensure that the neighbor is the same type
                {
                    r.mNeighbors.push_back( Neighbor( other->GetGUID() ) );
                    foundNeighbor = true;
                    break;
                }
            } //search actor for the neighbor pos ended
        }
        if (!foundNeighbor)
        {
            r.mNeighbors.push_back( Neighbor( -1 ) );
        }
    }
    return r;
}

void RecreateBordersMapElementSystem::Init()
{
    MapElementSystem::Init();
}

void RecreateBordersMapElementSystem::Update(double DeltaTime)
{
    MapElementSystem::Update( DeltaTime );
    if (!mActors.empty())
    {
        for (auto actor : mScene.GetActors())
        {
            auto borderC = actor->Get<IBorderComponent>();
            if (borderC.IsValid())
            {
                borderC->SetChanged( false );
            }
        }
        mActors.clear();
        mGrid.clear();
    }
    for( Opt<RecreateBordersMapElement> recreateBordersMapElement : MapElementListFilter<MapSystem::All>( mMapSystem->GetMapElementList(), RecreateBordersMapElement::GetType_static() ) )
    {
        if (recreateBordersMapElement->GetValueId( RecreateBordersMapElement::RecreateNodeId() ) > 0)
        {
            CreateGrid();
            for (auto actor : mActors)
            {
                auto borderC = actor->Get<IBorderComponent>();
                auto neighbors = GetNeighbors( *actor );
                auto borders = neighbors.GetBorders( Neighbors::GetNeighborDirs() );
                auto outerBorders = neighbors.GetBorders( Neighbors::GetNeighborOuterDirs() );
                borderC->SetBorders( borders );
                borderC->SetOuterBorders( outerBorders );
                borderC->SetChanged( true );
            }
        }
        recreateBordersMapElement->ResetValues();
    }
}

void RecreateBordersMapElementSystem::CreateGrid()
{
    mGrid.clear();
    mActors.clear();
    for (auto actor : mScene.GetActors())
    {
        auto borderC = actor->Get<IBorderComponent>();
        auto positionC = actor->Get<IPositionComponent>();
        if (borderC.IsValid()&&positionC.IsValid())
        {
            int32_t x = positionC->GetX();
            int32_t y = positionC->GetY();
            mActors.push_back( actor );
            auto actors = GetActors( x, y, true );
            actors->push_back( actor );
        }
    }

}

Opt<RecreateBordersMapElementSystem::Actors_t> RecreateBordersMapElementSystem::GetActors( int32_t x, int32_t y, bool forceEmplace /*= false*/ )
{
    auto xi = mGrid.find( x );
    if (xi != mGrid.end())
    {
        auto acti = xi->second.find( y );
        if (acti != xi->second.end())
        {
            return &acti->second;
        }
        else if (forceEmplace)
        {
            xi->second.emplace( y, Actors_t() );
            return GetActors( x, y );
        }
    }
    else if (forceEmplace)
    {
        std::map<int32_t, Actors_t> m;
        m.emplace( y, Actors_t() );
        mGrid.emplace( x, m );
        return GetActors( x, y );
    }
    return nullptr;
}

} // namespace map


text:
<?php

namespace System;

use Closure;
use Response;
use View;

class route {
	/**
	 * Array of collection actions.
	 *
	 * @var array
	 */
	public static $collection = [];
	/**
	 * Array of callable functions.
	 *
	 * @var array
	 */
	public $callbacks;
	/**
	 * The collected arguments from the uri match.
	 *
	 * @var array
	 */
	public $args = [];

	/**
	 * Define a route using the method name as
	 * the request method to listen for.
	 *
	 * @param string
	 * @param array
	 */
	public static function __callStatic($method, $arguments) {
		static ::register($method, array_shift($arguments), array_shift($arguments));
	}

	/**
	 * Register a route on the router.
	 *
	 * @param string
	 * @param array|string
	 * @param array|closure
	 */
	public static function register($method, $patterns, $arguments) {
		$method = strtoupper($method);
		if ($arguments instanceof \Closure) {
			$arguments = ['main' => $arguments];
		}
		// add collection actions
		$arguments = array_merge($arguments, static ::$collection);
		foreach ((array) $patterns as $pattern) {
			Router::$routes[$method][$pattern] = $arguments;
		}
	}

	/**
	 * Register a action on the router.
	 *
	 * @param string
	 * @param string|closure
	 */
	public static function action($name, $callback) {
		Router::$actions[$name] = $callback;
	}

	/**
	 * Start a collection of routes with common actions.
	 *
	 * @param string
	 * @param string|closure
	 */
	public static function collection($actions, $definitions) {
		// start collection
		static ::$collection = $actions;
		// run definitions
		call_user_func($definitions);
		// end of collection
		static ::$collection = [];
	}

	/**
	 * Create a new instance of the Route class.
	 *
	 * @param array
	 * @param array
	 */
	public function __construct($callbacks, $args = []) {
		$this->callbacks = $callbacks;
		$this->args = $args;
	}

	/**
	 * Calls before actions.
	 *
	 * @return object
	 */
	public function before() {
		if (!isset($this->callbacks['before'])) {
			return;
		}
		foreach (explode(',', $this->callbacks['before']) as $action) {
			// return the first response object
			if ($response = call_user_func_array(Router::$actions[$action], $this->args)) {
				return $response;
			}
		}
	}

	/**
	 * Calls after actions.
	 *
	 * @param string
	 */
	public function after($response) {
		if (!isset($this->callbacks['after'])) {
			return;
		}
		foreach (explode(',', $this->callbacks['after']) as $action) {
			call_user_func(Router::$actions[$action], $response);
		}
	}

	/**
	 * Calls the route actions and returns a response object.
	 *
	 * @return object
	 */
	public function run() {
		// Call before actions
		$response = $this->before();
		// If we didn't get a response run the main callback
		if (is_null($response)) {
			$response = call_user_func_array($this->callbacks['main'], $this->args);
		}
		// Call any after actions
		$this->after($response);
		// If the response was a view get the output and create response
		if ($response instanceof \System\View) {
			return Response::create($response->render());
		}
		// If we have a response object return it
		if ($response instanceof \System\Response) {
			return $response;
		}

		return Response::create((string) $response);
	}
}


text:
"""

Module: voice.py
Desc: Text to speech
Author: on_three
Email: on.three.email@gmail.com
DATE: Sat March 4th 2015

Text to Speech hook

"""
import os
import string
import re
from twisted.python import log
from twisted.internet.task import LoopingCall

import psutil
from irc import splitnick
from config import Config
from util import kill_proc_tree
from whitelist import is_mod
from whitelist import is_whitelisted
from volume import adjust_volume

from irc import foreground
from irc import background
from irc import style

TRIGGER = u'.'
SWIFT = Config.SWIFT
CHANNEL = Config.CHANNEL

def get_voice_status():
  if Voice._on:
    return foreground(u'white') + background(u'green') + u' ON ' + style(u'normal')
  else:
    return foreground(u'black') + background(u'red') + u' OFF ' + style(u'normal')

#Remove procs that have completed.
def service():
  initial_voice_count = len(Voice.PROCS)
  Voice.PROCS = [x for x in Voice.PROCS if x and x.poll() is None]
  #if not len(Voice.PROCS) and initial_voice_count:
  #  adjust_volume('VOICE_OFF')

class Voice(object):
  '''
  just say selected strings via text to speech.
  '''
  VOICE_REGEX = ur'^(?P<command>\.v )(?P<text>.+)'.format(trigger=TRIGGER)
  ON_REGEX = ur'^(?P<command>\.v on)$'.format(trigger=TRIGGER)
  OFF_REGEX = ur'^(?P<command>\.v off)$'.format(trigger=TRIGGER)
  WIPE_REGEX = ur'^(?P<command>\.v wipe)$'.format(trigger=TRIGGER)

  PROCS = []
  STARTER = None
  _on = True

  def __init__(self, parent):
    '''
    constructor
    '''
    self._parent = parent
    Voice._on = True
    Voice.STARTER = LoopingCall(service)
    Voice.STARTER.start(0.5);

  def do_help(self, channel):
    '''
    PLUGIN API REQUIRED
    '''
    #self._parent.say(channel, TextOverlay.USAGE)
    pass

  def is_msg_of_interest(self, user, channel, msg):
    '''
    PLUGIN API REQUIRED
    Is the rx'd irc message of interest to this plugin?
    '''
    #this plugin can "handle" messages without swallowing them
    #(i.e. still let other plugins get a crack at them)
    #so we "process" them here and just return False.
    self.process_messages(user, channel, msg)
    return False

  def handle_msg(self, user, channel, msg):
    '''
    PLUGIN API REQUIRED
    Handle message and return nothing
    '''
    pass

  def process_messages(self, user, channel, msg):
    #allow us to limit use at odd times
    if not is_whitelisted(splitnick(user)):
      return

    m = re.match(Voice.WIPE_REGEX, msg, re.UNICODE)
    if m:
      return self.wipe()

    #turn voice on
    m = re.match(Voice.ON_REGEX, msg, re.UNICODE)
    if m:
      return self.turn_on(channel, user)

    #turn constant voice off
    m = re.match(Voice.OFF_REGEX, msg, re.UNICODE)
    if m:
      return self.turn_off(channel, user)

    m = re.match(Voice.VOICE_REGEX, msg, re.UNICODE)
    if m and Voice._on and is_whitelisted(splitnick(user)):
      text = m.groupdict()['text']
      return self.say_text(text, channel, user)

  def wipe(self):
    for s in self.PROCS:
      if s.poll() is None:
        kill_proc_tree(s.pid)
    self.PROCS = []

  def turn_on(self, channel, user):
    if channel != CHANNEL:
      return
    if is_mod(splitnick(user)):
      Voice._on = True

  def turn_off(self, channel, user):
    if channel != CHANNEL:
      return
    if is_mod(splitnick(user)):
      Voice._on = False
      self.wipe()

  def say_text(self, text, channel, user):
    '''
    say the given text as text-to-speech.
    '''
    if not text:
      return

    #adjust_volume('VOICE_ON')

    #first clean up and filter our messages
    msg = Voice.filter_messages(text)
    log.msg('Voice: {channel} {user}: {msg}'.format(channel=channel, user=user, msg=msg.encode('utf-8')))
    call = u'{exe} "{text}"'.format(exe=SWIFT, text=text)
    proc = psutil.Popen(call.encode('utf-8'), shell=True)
    self.PROCS.append(proc)

  @staticmethod
  def filter_messages(text):
    '''
    Turn an incoming (unicode) message into a screen display message
    (if possible).
    Return a unicode string or None if failed.
    '''
    #first strip any IRC color codes
    msg = text
    #trip leading and trailing spaces
    msg = msg.lstrip().rstrip()
    #eliminate unwanted text like URLs etc?
    return msg


text:
""" This module loads all the classes from the VTK Rendering library into
its namespace.  This is an optional module."""

from vtkRenderingPython import *


text:
using VndbSharp.Attributes;

namespace VndbSharp.Models.Dumps
{
	/// <summary>
	///		Indicates what type the tag is
	/// </summary>
	public enum TagCategory
	{
		/// <summary>
		///		The tag describes the contents of the game
		/// </summary>
		[RealValue("cont")]
		Content,
		/// <summary>
		///		The tag describes the sexual contents of the game
		/// </summary>
		[RealValue("ero")]
		Sexual,
		/// <summary>
		///		The tag describes the features of the game
		/// </summary>
		[RealValue("tech")]
		Technical,
	}
}


text:
package clipboard

import (
	"syscall"
	"unsafe"
)

const (
	cfUnicodetext = 13
	gmemFixed     = 0x0000
)

var (
	user32           = syscall.MustLoadDLL("user32")
	openClipboard    = user32.MustFindProc("OpenClipboard")
	closeClipboard   = user32.MustFindProc("CloseClipboard")
	emptyClipboard   = user32.MustFindProc("EmptyClipboard")
	getClipboardData = user32.MustFindProc("GetClipboardData")
	setClipboardData = user32.MustFindProc("SetClipboardData")

	kernel32     = syscall.NewLazyDLL("kernel32")
	globalAlloc  = kernel32.NewProc("GlobalAlloc")
	globalFree   = kernel32.NewProc("GlobalFree")
	globalLock   = kernel32.NewProc("GlobalLock")
	globalUnlock = kernel32.NewProc("GlobalUnlock")
	lstrcpy      = kernel32.NewProc("lstrcpyW")
)

func readAll() (string, error) {
	r, _, err := openClipboard.Call(0)
	if r == 0 {
		return "", err
	}
	defer closeClipboard.Call()

	h, _, err := getClipboardData.Call(cfUnicodetext)
	if r == 0 {
		return "", err
	}

	l, _, err := globalLock.Call(h)
	if l == 0 {
		return "", err
	}

	text := syscall.UTF16ToString((*[1 << 20]uint16)(unsafe.Pointer(l))[:])

	r, _, err = globalUnlock.Call(h)
	if r == 0 {
		return "", err
	}

	return text, nil
}

func writeAll(text string) error {
	r, _, err := openClipboard.Call(0)
	if r == 0 {
		return err
	}
	defer closeClipboard.Call()

	r, _, err = emptyClipboard.Call(0)
	if r == 0 {
		return err
	}

	data := syscall.StringToUTF16(text)

	h, _, err := globalAlloc.Call(gmemFixed, uintptr(len(data)*int(unsafe.Sizeof(data))/8))
	if h == 0 {
		return err
	}

	l, _, err := globalLock.Call(h)
	if l == 0 {
		return err
	}

	r, _, err = lstrcpy.Call(l, uintptr(unsafe.Pointer(&data[0])))
	if r == 0 {
		return err
	}

	r, _, err = globalUnlock.Call(h)
	if r == 0 {
		return err
	}

	r, _, err = setClipboardData.Call(cfUnicodetext, h)
	if r == 0 {
		return err
	}
	return nil
}


text:
module ActiveRecord
  module Associations
    class Preloader
      module ThroughAssociation #:nodoc:
        def through_reflection
          reflection.through_reflection
        end

        def source_reflection
          reflection.source_reflection
        end

        def associated_records_by_owner(preloader)
          through_scope = through_scope()

          preloader.preload(owners,
                            through_reflection.name,
                            through_scope)

          through_records = owners.map do |owner|
            center = owner.association(through_reflection.name).target
            [owner, Array(center)]
          end

          reset_association(owners, through_reflection.name, through_scope)

          middle_records = through_records.flat_map(&:last)

          preloaders = preloader.preload(middle_records,
                                         source_reflection.name,
                                         reflection_scope)

          @preloaded_records = preloaders.flat_map(&:preloaded_records)

          middle_to_pl = preloaders.each_with_object({}) do |pl, h|
            pl.owners.each { |middle|
              h[middle] = pl
            }
          end

          through_records.each_with_object({}) do |(lhs, center), records_by_owner|
            pl_to_middle = center.group_by { |record| middle_to_pl[record] }

            records_by_owner[lhs] = pl_to_middle.flat_map do |pl, middles|
              rhs_records = middles.flat_map { |r|
                r.association(source_reflection.name).target
              }.compact

              # Respect the order on `reflection_scope` if it exists, else use the natural order.
              if reflection_scope.values[:order].present?
                @id_map ||= id_to_index_map @preloaded_records
                rhs_records.sort_by { |rhs| @id_map[rhs] }
              else
                rhs_records
              end
            end
          end
        end

        private

          def id_to_index_map(ids)
            id_map = {}
            ids.each_with_index { |id, index| id_map[id] = index }
            id_map
          end

          def reset_association(owners, association_name, through_scope)
            should_reset = (through_scope != through_reflection.klass.unscoped) ||
               (options[:source_type] && through_reflection.collection?)

            # Don't cache the association - we would only be caching a subset
            if should_reset
              owners.each { |owner|
                owner.association(association_name).reset
              }
            end
          end

          def through_scope
            scope = through_reflection.klass.unscoped
            values = reflection_scope.values

            if options[:source_type]
              scope.where! reflection.foreign_type => options[:source_type]
            else
              unless reflection_scope.where_clause.empty?
                scope.includes_values = Array(values[:includes] || options[:source])
                scope.where_clause = reflection_scope.where_clause
                if joins = values[:joins]
                  scope.joins!(source_reflection.name => joins)
                end
                if left_outer_joins = values[:left_outer_joins]
                  scope.left_outer_joins!(source_reflection.name => left_outer_joins)
                end
              end

              scope.references! values[:references]
              if scope.eager_loading? && order_values = values[:order]
                scope = scope.order(order_values)
              end
            end

            scope
          end
      end
    end
  end
end


text:
<component name="libraryTable">
  <library name="uast-145.597.3">
    <CLASSES>
      <root url="jar://$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/external/com-intellij/uast/145.597.3/uast-145.597.3.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
namespace PhoneManagementSystem.WebApi.BindingModels
{
    using System.ComponentModel.DataAnnotations;

    public class DepartmentBindingModel
    {
        public int Id { get; set; }

        [Required]
        [MinLength(1)]
        [MaxLength(50)]
        public string Name { get; set; }
    }
}


text:
namespace cpp_client
{

namespace anarchy
{

bool Weather_station_::intensify(bool negative)
{
    std::string order = R"({"event": "run", "data": {"functionName": "intensify", "caller": {"id": ")";
    order += this->id + R"("}, "args": {)";

    order += std::string("\"negative\":") + std::to_string(negative);

    order += "}}}";
    Anarchy::instance()->send(order);
    //Go until not a delta
    std::unique_ptr<Any> info;
    //until a not bool is seen (i.e., the delta has been processed)
    do
    {
        info = Anarchy::instance()->handle_response();
    } while(info->type() == typeid(bool));
    auto doc = info->as<rapidjson::Document*>();
    auto loc = doc->FindMember("data");
    if(loc == doc->MemberEnd())
    {
       return {};
    }
    auto& val = loc->value;
    Any to_return;
    morph_any(to_return, val);
    return to_return.as<bool>();
}

bool Weather_station_::rotate(bool counterclockwise)
{
    std::string order = R"({"event": "run", "data": {"functionName": "rotate", "caller": {"id": ")";
    order += this->id + R"("}, "args": {)";

    order += std::string("\"counterclockwise\":") + std::to_string(counterclockwise);

    order += "}}}";
    Anarchy::instance()->send(order);
    //Go until not a delta
    std::unique_ptr<Any> info;
    //until a not bool is seen (i.e., the delta has been processed)
    do
    {
        info = Anarchy::instance()->handle_response();
    } while(info->type() == typeid(bool));
    auto doc = info->as<rapidjson::Document*>();
    auto loc = doc->FindMember("data");
    if(loc == doc->MemberEnd())
    {
       return {};
    }
    auto& val = loc->value;
    Any to_return;
    morph_any(to_return, val);
    return to_return.as<bool>();
}

Weather_station_::Weather_station_(std::initializer_list<std::pair<std::string, Any&&>> init) :
    Building_{
    }
{
    for(auto&& obj : init)
    {
      variables_.emplace(std::make_pair(std::move(obj.first), std::move(obj.second)));
    }
}

Weather_station_::~Weather_station_() = default;

void Weather_station_::resize(const std::string& name, std::size_t size)
{
    try
    {
        Building_::resize(name, size);
        return;
    }
    catch(...){}
    throw Bad_manipulation(name + " in Weather_station treated as a vector, but it is not a vector.");
}

void Weather_station_::change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values)
{
    try
    {
        Building_::change_vec_values(name, values);
        return;
    }
    catch(...){}
    throw Bad_manipulation(name + " in Weather_station treated as a vector, but it is not a vector.");
}

void Weather_station_::remove_key(const std::string& name, Any& key)
{
    try
    {
        Building_::remove_key(name, key);
        return;
    }
    catch(...){}
    throw Bad_manipulation(name + " in Weather_station treated as a map, but it is not a map.");
}

std::unique_ptr<Any> Weather_station_::add_key_value(const std::string& name, Any& key, Any& value)
{
    try
    {
        return Building_::add_key_value(name, key, value);
    }
    catch(...){}
    throw Bad_manipulation(name + " in Weather_station treated as a map, but it is not a map.");
}

bool Weather_station_::is_map(const std::string& name)
{
    try
    {
        return Building_::is_map(name);
    }
    catch(...){}
    return false;
}

void Weather_station_::rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref)
{
   try
   {
      Building_::rebind_by_name(to_change, member, ref);
      return;
   }
   catch(...){}
   throw Bad_manipulation(member + " in Weather_station treated as a reference, but it is not a reference.");
}

} // anarchy

} // cpp_client


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace WordHunt.Models.Games.Creation
{
    public class GameTeamCreate
    {
        public string Name { get; set; }
        public string Color { get; set; }
        public string Icon { get; set; }
        public int FieldCount { get; set; }
        public int? UserId { get; set; }
        public int Order { get; set; }
        public int GameId { get; set; }
    }
}


text:
<link
    rel="import"
    href="/bower_components/polymer/polymer.html">
<link
	  rel="import"
	  href="/bower_components/paper-card/paper-card.html">
<link
    rel="import"
    href="/bower_components/paper-ripple/paper-ripple.html">
<link
    rel="import"
    href="/behaviors/splendor-base-behavior.html">
<link
    rel="import"
    href="/behaviors/splendor-selectable-behavior.html">
<link
    rel="import"
    href="/components/shared-styles/shared-styles.html">

<dom-module id="splendor-deck">

  <template>

    <paper-card
        class$="[[classes(selected, 'selected')]]"
        elevation="[[elevation(selected)]]"
        on-tap="_toggleSelected">

        <paper-ripple></paper-ripple>
		    [[deck.length]]

    </paper-card>

  </template>

</dom-module>


text:
[![npm version](https://img.shields.io/npm/v/redux-replicate-fs.svg?style=flat-square)](https://www.npmjs.com/package/redux-replicate-fs)
[![npm downloads](https://img.shields.io/npm/dm/redux-replicate-fs.svg?style=flat-square)](https://www.npmjs.com/package/redux-replicate-fs)

Replicator for [`redux-replicate`](https://github.com/loggur/redux-replicate) designed to locally persist the state of [`redux`](https://github.com/rackt/redux) stores using [`fs`](https://github.com/mozilla/fs).

## Table of contents

1.  [Installation](#installation)
2.  [Usage](#usage)
3.  [Example using `react-redux-provide`](#example-using-react-redux-provide)
4.  [Example using `compose`](#example-using-compose)
5.  [Debouncing](#debouncing)

## Installation

```
npm install redux-replicate-fs --save
```

## Usage

> **Note:** This is currently intended only for demonstration purposes!  Don't use this in production.  At some point we may turn this into a proper flatfile storage system though!  :)

Use with [`redux-replicate`](https://github.com/loggur/redux-replicate).

## Example using [`react-redux-provide`](https://github.com/loggur/react-redux-provide)

```js
// src/replication.js

import fs from 'redux-replicate-fs';
import { theme } from './providers/index';

theme.replication = {
  reducerKeys: ['themeName'],
  replicator: fs
};
```

## Example using `compose`

```js
import { createStore, combineReducers, compose } from 'redux';
import replicate from 'redux-replicate';
import fs from 'redux-replicate-fs';
import reducers from './reducers';

const initialState = {
  wow: 'such storage',
  very: 'cool'
};

const key = 'superCoolStorageUnit';
const reducerKeys = true;
const replicator = fs;
const replication = replicate({ key, reducerKeys, replicator });
const create = compose(replication)(createStore);
const store = create(combineReducers(reducers), initialState);
```

## Debouncing

By default, a debounce occurs when writing the next state to the file system (during `onStateChange`).  The default timeout is 1 millisecond.  You can change it by doing this:

```js
import fs from 'redux-replicate-fs';

fs.debounce = 20;
```


text:
using System;
using System.Collections.Generic;

namespace ZKill.Discord.ZKill
{
    public class KillMail
    {
        public int KillId { get; set; }
        public DateTime KillTime { get; set; }
        public float FittedValue { get; set; }
        public float TotalValue { get; set; }
        public string KbUrl { get; set; }
        public string VictimName { get; set; }
        public int? CharacterId { get; set; }
        public string ShipTypeName { get; set; }
        public string SystemName { get; set; }
        public int DamageTaken { get; set; }

        public List<Item> Items { get; set; }
        public List<Attacker> Attackers { get; set; }
    }
}


text:
package org.apache.tika.sax;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.AttributesImpl;

public class SerializerTest {

    @Test
    public void testToTextContentHandler() throws Exception {
        assertStartDocument("", new ToTextContentHandler());
        assertCharacters("content", new ToTextContentHandler());
        assertCharacterEscaping("<&\">", new ToTextContentHandler());
        assertIgnorableWhitespace(" \t\r\n", new ToTextContentHandler());
        assertEmptyElement("", new ToTextContentHandler());
        assertEmptyElementWithAttributes("", new ToTextContentHandler());
        assertEmptyElementWithAttributeEscaping("", new ToTextContentHandler());
        assertElement("content", new ToTextContentHandler());
        assertElementWithAttributes("content", new ToTextContentHandler());
    }

    @Test
    public void testToXMLContentHandler() throws Exception {
        assertStartDocument("", new ToXMLContentHandler());
        assertStartDocument(
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
                new ToXMLContentHandler("UTF-8"));
        assertCharacters("content", new ToXMLContentHandler());
        assertCharacterEscaping("<&\">", new ToXMLContentHandler());
        assertIgnorableWhitespace(" \t\r\n", new ToXMLContentHandler());
        assertEmptyElement("
", new ToXMLContentHandler());
        assertEmptyElementWithAttributes(
                "<meta name=\"foo\" value=\"bar\" />",
                new ToXMLContentHandler());
        assertEmptyElementWithAttributeEscaping(
                "
",
                new ToXMLContentHandler());
        assertElement("
content
", new ToXMLContentHandler());
        assertElementWithAttributes(
                "
content
",
                new ToXMLContentHandler());
    }

    @Test
    public void testToHTMLContentHandler() throws Exception {
        assertStartDocument("", new ToHTMLContentHandler());
        assertCharacters("content", new ToHTMLContentHandler());
        assertCharacterEscaping("<&\">", new ToHTMLContentHandler());
        assertIgnorableWhitespace(" \t\r\n", new ToHTMLContentHandler());
        assertEmptyElement("
", new ToHTMLContentHandler());
        assertEmptyElementWithAttributes(
                "<meta name=\"foo\" value=\"bar\">",
                new ToHTMLContentHandler());
        assertEmptyElementWithAttributeEscaping(
                "

",
                new ToHTMLContentHandler());
        assertElement("
content
", new ToHTMLContentHandler());
        assertElementWithAttributes(
                "
content
",
                new ToHTMLContentHandler());
    }

    private void assertStartDocument(String expected, ContentHandler handler)
            throws Exception {
        handler.startDocument();
        assertEquals(expected, handler.toString());
    }

    private void assertCharacters(String expected, ContentHandler handler)
            throws Exception {
        handler.characters("content".toCharArray(), 0, 7);
        assertEquals(expected, handler.toString());
    }

    private void assertCharacterEscaping(
            String expected, ContentHandler handler) throws Exception {
        handler.characters("<&\">".toCharArray(), 0, 4);
        assertEquals(expected, handler.toString());
    }

    private void assertIgnorableWhitespace(
            String expected, ContentHandler handler) throws Exception {
        handler.ignorableWhitespace(" \t\r\n".toCharArray(), 0, 4);
        assertEquals(expected, handler.toString());
    }

    private void assertEmptyElement(String expected, ContentHandler handler)
            throws Exception {
        AttributesImpl attributes = new AttributesImpl();
        handler.startElement("", "br", "br", attributes);
        handler.endElement("", "br", "br");
        assertEquals(expected, handler.toString());
    }

    private void assertEmptyElementWithAttributes(
            String expected, ContentHandler handler) throws Exception {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("", "name", "name", "CDATA", "foo");
        attributes.addAttribute("", "value", "value", "CDATA", "bar");
        handler.startElement("", "meta", "meta", attributes);
        handler.endElement("", "meta", "meta");
        assertEquals(expected, handler.toString());
    }

    private void assertEmptyElementWithAttributeEscaping(
            String expected, ContentHandler handler) throws Exception {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("", "class", "class", "CDATA", "<&\">");
        handler.startElement("", "p", "p", attributes);
        handler.endElement("", "p", "p");
        assertEquals(expected, handler.toString());
    }

    private void assertElement(
            String expected, ContentHandler handler) throws Exception {
        AttributesImpl attributes = new AttributesImpl();
        handler.startElement("", "p", "p", attributes);
        handler.characters("content".toCharArray(), 0, 7);
        handler.endElement("", "p", "p");
        assertEquals(expected, handler.toString());
    }

    private void assertElementWithAttributes(
            String expected, ContentHandler handler) throws Exception {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("", "class", "class", "CDATA", "test");
        handler.startElement("", "p", "p", attributes);
        handler.characters("content".toCharArray(), 0, 7);
        handler.endElement("", "p", "p");
        assertEquals(expected, handler.toString());
    }

}


text:
namespace ChilliSource
{
    //-------------------------------------------------------
    /// Custom options for loading a cubempap
    ///
    /// @author S Downie
    //-------------------------------------------------------
    class CubemapResourceOptions final : public IResourceOptions<Cubemap>
    {
    public:
        //-------------------------------------------------------
        /// Constructor
        ///
        /// @author S Downie
        //-------------------------------------------------------
        CubemapResourceOptions() = default;
        //-------------------------------------------------------
        /// Constructor
        ///
        /// @author S Downie
        ///
        /// @param MipMaps enabled
        /// @param Filter mode
        /// @param Wrap mode S
        /// @param Wrap mode T
        /// @param Whether or not the texture data should be
        /// restored after a context loss. This involves maintaining
        /// a copy of the texture data in memory which is costly
        /// so this should be disabled for any textures that can
        /// easily be recreated, i.e any texture that is rendered
        /// into every frame. This has no effect on textures that
        /// are loaded from file as they are always restored from
        /// disk. This will only work for RGBA8888, RGB888, RGBA4444
        /// and RGB565 textures.
        //-------------------------------------------------------
        CubemapResourceOptions(bool in_mipmaps, TextureFilterMode in_filter, TextureWrapMode in_wrapS, TextureWrapMode in_wrapT);
        //-------------------------------------------------------
        /// Generate a unique hash based on the
        /// currently set options
        ///
        /// @author S Downie
        ///
        /// @return Hash of the options contents
        //-------------------------------------------------------
        u32 GenerateHash() const override;
        //-------------------------------------------------------
        /// @author S Downie
        ///
        /// @return Whether the texture should be created with
        /// mip-maps
        //-------------------------------------------------------
        bool IsMipMapsEnabled() const;
        //-------------------------------------------------------
        /// @author S Downie
        ///
        /// @return Wrap S direction mode to create texture with
        //-------------------------------------------------------
        TextureWrapMode GetWrapModeS() const;
        //-------------------------------------------------------
        /// @author S Downie
        ///
        /// @return Wrap T direction mode to create texture with
        //-------------------------------------------------------
        TextureWrapMode GetWrapModeT() const;
        //-------------------------------------------------------
        /// @author S Downie
        ///
        /// @return Filter mode to create texture with
        //-------------------------------------------------------
        TextureFilterMode GetFilterMode() const;

    private:

        //-------------------------------------------------------
        /// The options for loading textures. These are held
        /// in a struct to more easily allow hashing of the data
        ///
        /// @author S Downie
        //-------------------------------------------------------
        struct Options
        {
            TextureWrapMode m_wrapModeS = TextureWrapMode::k_clamp;
            TextureWrapMode m_wrapModeT = TextureWrapMode::k_clamp;
            TextureFilterMode m_filterMode = TextureFilterMode::k_bilinear;
            bool m_hasMipMaps = false;
        };

        Options m_options;
    };
}

#endif


text:
package com.gentics.mesh.util;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
import java.util.stream.Collector;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

/**
 * Utility for stream related operations and conversions.
 */
public final class StreamUtil {

	private StreamUtil() {

	}

	/**
	 * Convert the iterable to a stream.
	 *
	 * @param <T>
	 * @param iterable
	 * @return
	 */
	public static <T> Stream<T> toStream(Iterable<? extends T> iterable) {
		return (Stream<T>) StreamSupport.stream(iterable.spliterator(), false);
	}

	/**
	 * Convert the iterator to a stream.
	 *
	 * @param <T>
	 * @param iterator
	 * @return
	 */
	public static <T> Stream<T> toStream(Iterator<? extends T> iterator) {
		return toStream(() -> (Iterator<T>) iterator);
	}

	/**
	 * Turns an optional into a stream.
	 *
	 * @deprecated Use {@link Optional#stream()} instead
	 * @param opt
	 * @param <T>
	 * @return
	 */
	@Deprecated
	public static <T> Stream<T> toStream(Optional<T> opt) {
		return opt.map(Stream::of).orElseGet(Stream::empty);
	}

	/**
	 * Applies the {@code nextValue} operator repeatedly to its previous result until null is returned.
	 *
	 * @param initialValue
	 * @param nextValue
	 * @param <T>
	 * @return
	 */
	public static <T> Stream<T> untilNull(Supplier<T> initialValue, UnaryOperator<T> nextValue) {
		return toStream(new Iterator<T>() {
			Supplier<T> next = lazy(initialValue);

			@Override
			public boolean hasNext() {
				return next.get() != null;
			}

			@Override
			public T next() {
				T returnedValue = next.get();
				next = lazy(() -> nextValue.apply(returnedValue));
				return returnedValue;
			}
		});
	}

	/**
	 * Return a lazy supplier which will load the value from the given supplier once {@link Supplier#get()} gets invoked.
	 *
	 * @param <T>
	 * @param supplier
	 * @return
	 */
	public static <T> Supplier<T> lazy(Supplier<T> supplier) {
		return new Supplier<T>() {
			T value;
			boolean hasBeenCalled;

			@Override
			public T get() {
				if (!hasBeenCalled) {
					hasBeenCalled = true;
					value = supplier.get();
				}
				return value;
			}
		};
	}

	/**
	 * Return a custom collector which is able to merge two maps.
	 *
	 * @param <K>
	 *            Type of the key
	 * @param <V>
	 *            Type of the value
	 * @return
	 */
	public static <K, V> Collector<Map<K, V>, Map<K, V>, Map<K, V>> mergeMaps() {
		return Collector.of(
			HashMap::new,
			Map::putAll,
			(m1, m2) -> {
				m1.putAll(m2);
				return m1;
			});
	}

	/**
	 * Create a stream of nullable elements in which null items will be excluded via a filter.
	 *
	 * @param <T>
	 * @param elements
	 * @return
	 */
	public static <T> Stream<T> ofNullable(T... elements) {
		return Arrays.stream(elements)
			.filter(Objects::nonNull);
	}

	/**
	 * Return the negated predicate.
	 *
	 * @param <T>
	 * @param predicate
	 * @return
	 */
	public static <T> Predicate<T> not(Predicate<T> predicate) {
		return predicate.negate();
	}

	/**
	 * Filters out duplicate items in the stream. Use this with {@link Stream#filter(Predicate)}.
	 *
	 * @return
	 */
	public static <T> Predicate<T> unique() {
		return uniqueBy(Function.identity());
	}

	/**
	 * Filters out duplicate items in the stream. Use this with {@link Stream#filter(Predicate)}. Two items are considered equal when the results of the
	 * keyMapper function are equal by {@link #equals(Object)}.
	 *
	 * @param keyMapper
	 * @param <T>
	 * @param <K>
	 * @return
	 */
	public static <T, K> Predicate<T> uniqueBy(Function<T, K> keyMapper) {
		Set<K> keys = new HashSet<>();
		return item -> {
			K key = keyMapper.apply(item);
			if (keys.contains(key)) {
				return false;
			} else {
				keys.add(key);
				return true;
			}
		};
	}

	/**
	 * Creates a stream that provides the elements of an array in reverse order.
	 *
	 * @param arr
	 * @param <T>
	 * @return
	 */
	public static <T> Stream<T> reverseOf(T[] arr) {
		return IntStream.iterate(arr.length - 1, i -> i - 1)
			.limit(arr.length)
			.mapToObj(i -> arr[i]);
	}

	/**
	 * Creates an iterable that uses {@link Stream#iterator()}.
	 *
	 * @param stream
	 * @param <T>
	 * @return
	 */
	public static <T> Iterable<T> toIterable(Stream<? extends T> stream) {
		return () -> ((Iterator<T>) stream.iterator());
	}
}