text:
var fs = require('fs');

eval(fs.readFileSync('./test/testSetup.js')+'');

describe('gulp-extify', function(){
    describe("file ordering", function () {
        it("should pipe a single file", function () {
            sort([fixture("app/Application.js")], function(resultFiles) {
                resultFiles.length.should.equal(1);
                resultFiles[0].should.equal("app"+path.sep+"Application.js");
            });
        });

        describe("general parse behaviors", function () {
            it("should parse all Ext.define's and should pay attention to each of the requirements", function () {
                sort([
                    fixture("app/mixin/MyMixin.js"),
                    fixture("app/base/Root.js"),
                    fixture("app/controller/MulitpleDefinitionsInOneFileController.js")
                ], function(resultFiles) {
                    resultFiles.length.should.equal(3);
                    resultFiles[0].should.equal("app" + path.sep + "base"+path.sep+"Root.js");
                    resultFiles[1].should.equal("app" + path.sep + "mixin"+path.sep+"MyMixin.js");
                    resultFiles[2].should.equal("app" + path.sep + "controller"+path.sep+"MulitpleDefinitionsInOneFileController.js");
                });
            });

            it("should not parse inner defines", function () {
                sort([
                    fixture("app/base/ClassWithInnerDefines.js"),
                    fixture("app/base/ClassThatRequiresInnerDefine.js")
                ], function(resultFiles) {
                    resultFiles.length.should.equal(2);

                    resultFiles[0].should.equal("app" + path.sep + "base"+path.sep+"ClassThatRequiresInnerDefine.js");
                    resultFiles[1].should.equal("app" + path.sep + "base"+path.sep+"ClassWithInnerDefines.js");
                });
            });
        });

        describe("requires", function () {
            it("should put Root before application because application depends on root independent of file input ordering", function () {
                sort([fixture("app/Application.js"),fixture("app/controller/Root.js")], function(resultFiles) {
                    resultFiles.length.should.equal(2);
                    resultFiles[0].should.equal("app"+path.sep+"controller"+path.sep+"Root.js");
                    resultFiles[1].should.equal("app"+path.sep+"Application.js");

                });
                sort([fixture("app/controller/Root.js"),fixture("app/Application.js")], function(resultFiles) {
                    resultFiles.length.should.equal(2);
                    resultFiles[0].should.equal("app"+path.sep+"controller"+path.sep+"Root.js");
                    resultFiles[1].should.equal("app"+path.sep+"Application.js");
                });
            });

            it("should requires classes that are plain strings and no array like require: 'myclass' ", function () {
                sort([fixture("app/requires/Req1.js"), fixture("app/requires/Req2.js")], function(resultFiles) {
                    resultFiles.length.should.equal(2);
                    resultFiles[0].should.equal("app" + path.sep + "requires"+path.sep+"Req2.js");
                    resultFiles[1].should.equal("app" + path.sep + "requires"+path.sep+"Req1.js");
                });
            });

            it("should be able to require files with _", function () {
                sort([
                        fixture("app/requires/ReqForUnderscores.js"),
                        fixture("app/requires/_Req.js"),
                        fixture("app/requires/Req_.js")
                    ], function(resultFiles) {
                    resultFiles.length.should.equal(3);
                    resultFiles[0].should.equal("app" + path.sep + "requires"+path.sep+"_Req.js");
                    resultFiles[1].should.equal("app" + path.sep + "requires"+path.sep+"Req_.js");
                    resultFiles[2].should.equal("app" + path.sep + "requires"+path.sep+"ReqForUnderscores.js");
                });
            });
        });

        describe("extend", function () {
            it("should put base.root before controller.root because controller.root depends on base.root independent of file input ordering", function () {
                sort([fixture("app/Application.js"),fixture("app/controller/Root.js"),fixture("app/base/Root.js")], function(resultFiles) {
                    resultFiles.length.should.equal(3);
                    resultFiles[0].should.equal("app"+path.sep+"base"+path.sep+"Root.js");
                    resultFiles[1].should.equal("app"+path.sep+"controller"+path.sep+"Root.js");
                    resultFiles[2].should.equal("app"+path.sep+"Application.js");
                });
                sort([fixture("app/Application.js"),fixture("app/base/Root.js"),fixture("app/controller/Root.js")], function(resultFiles) {
                    resultFiles.length.should.equal(3);
                    resultFiles[0].should.equal("app"+path.sep+"base"+path.sep+"Root.js");
                    resultFiles[1].should.equal("app"+path.sep+"controller"+path.sep+"Root.js");
                    resultFiles[2].should.equal("app"+path.sep+"Application.js");
                });
            });
            it("should be possible to extend files with _", function () {
                sort([fixture("app/controller/MyUnderscoreController.js"), fixture("app/controller/Controller_Base.js")], function(resultFiles) {
                    resultFiles.length.should.equal(2);
                    resultFiles[0].should.equal("app" + path.sep + "controller"+path.sep+"Controller_Base.js");
                    resultFiles[1].should.equal("app" + path.sep + "controller"+path.sep+"MyUnderscoreController.js");
                });
            });
        });

        describe("mixins", function () {
            it("should parse simple mixins", function () {
                sort([
                    fixture("app/controller/BindableController.js"),
                    fixture("app/mixin/BindableMixin.js"),
                    fixture("app/mixin/BindableMixinOther.js")

                ], function(resultFiles) {
                    resultFiles.length.should.equal(3);
                    resultFiles.indexOf("app"+path.sep+"mixin"+path.sep+"BindableMixin.js").should.be.below(resultFiles.indexOf("app"+path.sep+"controller"+path.sep+"BindableController.js"));
                    resultFiles.indexOf("app"+path.sep+"mixin"+path.sep+"BindableMixinOther.js").should.be.below(resultFiles.indexOf("app"+path.sep+"controller"+path.sep+"BindableController.js"));
                });
            });

            it("should parse object mixins", function () {
                sort([
                    fixture("app/base/Root.js"),
                    fixture("app/controller/Root.js"),
                    fixture("app/mixin/MyMixin.js"),
                    fixture("app/mixin/MyOtherMixin.js"),
                    fixture("app/Application.js")

                ], function(resultFiles) {
                    resultFiles.length.should.equal(5);
                    resultFiles.indexOf("app"+path.sep+"base"+path.sep+"Root.js").should.be.below(resultFiles.indexOf("app"+path.sep+"controller"+path.sep+"Root.js"));
                    resultFiles.indexOf("app"+path.sep+"mixin"+path.sep+"MyOtherMixin.js").should.be.below(resultFiles.indexOf("app"+path.sep+"controller"+path.sep+"Root.js"));
                    resultFiles.indexOf("app"+path.sep+"mixin"+path.sep+"MyMixin.js").should.be.below(resultFiles.indexOf("app"+path.sep+"controller"+path.sep+"Root.js"));
                    resultFiles.indexOf("app"+path.sep+"controller"+path.sep+"Root.js").should.be.below(resultFiles.indexOf("app"+path.sep+"Application.js"));
                });
            });

            it("should be possible to mixin files with _", function () {
                sort([fixture("app/base/FileWithUnderscoreMixin.js"), fixture("app/mixin/_MyMixin.js")], function(resultFiles) {
                    resultFiles.length.should.equal(2);
                    resultFiles[0].should.equal("app" + path.sep + "mixin"+path.sep+"_MyMixin.js");
                    resultFiles[1].should.equal("app" + path.sep + "base"+path.sep+"FileWithUnderscoreMixin.js");
                });
            });
        });

        describe("model", function () {
            it("should handle model defitions of stores like commmon depdendencies", function () {
                sort([
                    fixture("app/Application.js"),
                    fixture("app/controller/Root.js"),
                    fixture("app/store/MyStore.js"),
                    fixture("app/model/MyModel.js"),
                    fixture("app/base/Root.js")

                ], function(resultFiles) {
                    resultFiles.length.should.equal(5);
                    resultFiles.indexOf("app"+path.sep+"model"+path.sep+"MyModel.js").should.be.below(resultFiles.indexOf("app"+path.sep+"store"+path.sep+"MyStore.js"));
                });
            });

            it("should be possible to mixin files with _", function () {
                sort([fixture("app/store/StoreWithUnderscoreModel.js"), fixture("app/model/_MyModel.js")], function(resultFiles) {
                    resultFiles.length.should.equal(2);
                    resultFiles[0].should.equal("app" + path.sep + "model"+path.sep+"_MyModel.js");
                    resultFiles[1].should.equal("app" + path.sep + "store"+path.sep+"StoreWithUnderscoreModel.js");
                });
            });
        });
    });

    describe("errors", function () {
        it("should be read with gulp.src", function () {
            sort([
                "app/controller/Empty.js"
            ], function(resultFiles) {
                resultFiles.length.should.equal(0);
            }, function(err) {
                err.message.length.should.be.above(0);
                err.plugin.should.equal("gulp-extify");
            });
        });

        it("should have no circular dependencies", function () {
            sort([
                fixture("app/mixin/MyMixin.js"),
                fixture("app/mixin/MyOtherMixin.js"),
                fixture("app/Application.js"),
                fixture("app/controller/Root.js"),
                fixture("app/base/Root.js"),
                fixture("app/controller/CircDepControllerOne.js"),
                fixture("app/controller/CircDepControllerTwo.js")
            ], function(resultFiles) {

            }, function(err) {
                err.message.should.equal("At least 1 circular dependency in nodes: " +
                "\n" +
                "\n" +
                "My.controller.CircDepControllerOne\n" +
                "My.base.Root\n" +
                "My.controller.CircDepControllerTwo\n" +
                "\n" +
                "Graph cannot be sorted!");
                err.plugin.should.equal("gulp-extify");
            });
        });
    });
});


text:
"""

"""

__author__ = "Jan Petter Maehlen", "Asbjoern Ulvestad", "Muhammad Abdelhamid"
__email__ = "jepe@ife.no", "Asbjorn.Ulvestad@ife.no", "Muhammad.Abdelhamid@ife.no"

import logging
import warnings

import cellpy._version
from cellpy.parameters import prms  # TODO: this might give circular ref
from cellpy.parameters import prmreader
from cellpy.readers import cellreader, dbreader, filefinder
from cellpy.readers.core import Q, ureg

__version__ = cellpy._version.__version__

logging.getLogger(__name__).addHandler(logging.NullHandler())

try:
    prmreader._read_prm_file(prmreader._get_prm_file())
except FileNotFoundError:
    warnings.warn("Could not find the config-file")
except UserWarning:
    warnings.warn("Could not read the config-file")

get = cellreader.get
__all__ = [
    "cellreader",
    "dbreader",
    "prmreader",
    "prms",
    "filefinder",
    "get",
    "ureg",
    "Q",
]

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <link rel="stylesheet" href="./build/style.css" />
    <title></title>


text:
<?php

namespace AccueilBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ContratType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('nature', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'CDD' => 'CDD',
                'CDI' => 'CDI',
                'Stage' => 'Stage',
            ),
        ));
        $builder->add('libellePoste', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'Technicien de déploiement' => 'Technicien de déploiement',
                'Developpeur informatique' => 'Developpeur informatique',
            ),
        ));
        $builder->add('motifCDD', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'Surcroît activité' => 'Surcroît activité',
                'Remplacement' => 'Remplacement',
            ),
        ));
        $builder->add('justificatifCDD');
        $builder->add('remplacement', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'DE CONDE Xavier' => 'DE CONDE Xavier',
                'LECOMTE Sophie' => 'LECOMTE Sophie',
            ),
        ));
        $builder->add('dateDebut', DateType::class, array(
            'widget' => 'choice',
        ));
        $builder->add('motifDebutHRM');
        $builder->add('dateFinCDD', DateType::class, array(
            'widget' => 'choice',
        ));
        $builder->add('site', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'QMP' => 'QMP',
                'RNS' => 'RNS',
                'LYN' => 'LYN',
            ),
        ));
        $builder->add('horaireHebdo');
        $builder->add('horaireMensuel');
        $builder->add('tauxTemps');
        $builder->add('repartitionHeures');
        $builder->add('codeAffaire');
        $builder->add('codeAnalytique');
        $builder->add('manager', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'CORTET Pascal' => 'CORTET Pascal',
                'ROUILLIER Jean-Christophe' => 'ROUILLIER Jean-Christophe',
            ),
        ));
        $builder->add('service', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'DSI Etudes Rennes' => 'DSI Etudes Rennes',
                'DSI Etudes Lyon' => 'DSI Etudes Lyon',
            ),
        ));
        $builder->add('convention', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'Mettalurigie du Rhône' => 'Mettalurigie du Rhône',
                'Mettalurgie Yonne' => 'Mettalurgie Yonne',
            ),
        ));
        $builder->add('profil', ChoiceType::class, array(
            'choices' => array(
                '--Selectionnez une valeur--' => '',
                'Etam' => 'Etam',
                'Cadre' => 'Cadre',
            ),
        ));
        $builder->add('classification');
        $builder->add('indice');
        $builder->add('codeEmploi');
        $builder->add('salaireMensuel');
        $builder->add('primeVariable');
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'AccueilBundle\Entity\Contrat',
        ));
    }
}


text:
exports.loodles = require('./loodles');
exports.users = require('./users');


text:
<?php

declare(strict_types=1);

namespace Eloquent\Phony\Spy;

use ArrayObject;
use Eloquent\Phony\Spy\Exception\NonArrayAccessTraversableException;
use Eloquent\Phony\Spy\Exception\NonCountableTraversableException;
use Eloquent\Phony\Test\TestCallFactory;
use Eloquent\Phony\Test\TestIteratorAggregate;
use EmptyIterator;
use PHPUnit\Framework\TestCase;

class TraversableSpyTest extends TestCase
{
    protected function setUp(): void
    {
        $this->callFactory = new TestCallFactory();
        $this->callEventFactory = $this->callFactory->eventFactory();
        $this->array = ['a' => 'b', 'c' => 'd'];
        $this->value = new ArrayObject($this->array);
        $this->call = $this->callFactory->create(
            $this->callEventFactory->createCalled(),
            $this->callEventFactory->createReturned($this->value)
        );
        $this->subject = new TraversableSpy($this->call, $this->value, $this->callEventFactory);
    }

    public function testConstructor()
    {
        $this->assertSame($this->value, $this->subject->iterable());
    }

    public function testIterator()
    {
        $this->assertSame($this->array, iterator_to_array($this->subject));
        $this->assertSame($this->array, iterator_to_array($this->subject));
    }

    public function testArrayAccess()
    {
        $this->assertSame('b', $this->subject['a']);
        $this->assertSame('d', $this->subject['c']);
        $this->assertArrayNotHasKey('e', $this->subject);

        $this->subject['e'] = 'f';

        $this->assertArrayHasKey('e', $this->subject);
        $this->assertSame('f', $this->subject['e']);

        unset($this->subject['e']);

        $this->assertArrayNotHasKey('e', $this->subject);
    }

    public function testArrayAccessOffsetExistsWithNonArrayAccess()
    {
        $traversable = new EmptyIterator();
        $subject = new TraversableSpy($this->call, $traversable, $this->callEventFactory);

        $this->expectException(NonArrayAccessTraversableException::class);
        isset($subject[0]);
    }

    public function testArrayAccessOffsetGetWithNonArrayAccess()
    {
        $traversable = new EmptyIterator();
        $subject = new TraversableSpy($this->call, $traversable, $this->callEventFactory);

        $this->expectException(NonArrayAccessTraversableException::class);
        $subject[0];
    }

    public function testArrayAccessOffsetSetWithNonArrayAccess()
    {
        $traversable = new EmptyIterator();
        $subject = new TraversableSpy($this->call, $traversable, $this->callEventFactory);

        $this->expectException(NonArrayAccessTraversableException::class);
        $subject[0] = 0;
    }

    public function testArrayAccessOffsetUnsetWithNonArrayAccess()
    {
        $traversable = new EmptyIterator();
        $subject = new TraversableSpy($this->call, $traversable, $this->callEventFactory);

        $this->expectException(NonArrayAccessTraversableException::class);
        unset($subject[0]);
    }

    public function testCountable()
    {
        $this->assertCount(2, $this->subject);

        $this->subject['e'] = 'f';

        $this->assertCount(3, $this->subject);
    }

    public function testCountableWithNonCountable()
    {
        $traversable = new EmptyIterator();
        $subject = new TraversableSpy($this->call, $traversable, $this->callEventFactory);

        $this->expectException(NonCountableTraversableException::class);
        count($subject);
    }

    public function testNestedIteratorAggregateUnwrapping()
    {
        $traversable = new TestIteratorAggregate(new TestIteratorAggregate(new ArrayObject($this->array)));
        $subject = new TraversableSpy($this->call, $traversable, $this->callEventFactory);

        $this->assertSame($this->array, iterator_to_array($subject));
    }
}


text:
<md-button ng-click="onExportWidgetsBundle({event: $event})"
           ng-show="!isEdit"
           class="md-raised md-primary">{{ 'widgets-bundle.export' | translate }}</md-button>
<md-button ng-click="onDeleteWidgetsBundle({event: $event})"
           ng-show="!isEdit && !isReadOnly"
           class="md-raised md-primary">{{ 'widgets-bundle.delete' | translate }}</md-button>

<md-content class="md-padding" layout="column">
    <fieldset ng-disabled="loading || !isEdit">
        <md-input-container class="md-block">
            widgets-bundle.title
            <input required name="title" ng-model="widgetsBundle.title">

widgets-bundle.title-required

        </md-input-container>
    </fieldset>
</md-content>


text:
<?php
/**
 * The template for displaying image attachments.
 *
 * @package sparkling
 */

get_header();
?>

			<?php while ( have_posts() ) : the_post(); ?>

					<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php the_title(); ?>

								<?php sparkling_posted_on(); ?>

<?php previous_image_link( false, __( ' Previous', 'sparkling' ) ); ?>

<?php next_image_link( false, __( 'Next ', 'sparkling' ) ); ?>

									<?php
										/**
										 * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
										 * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
										 */
										$attachments = array_values( get_children( array(
											'post_parent'    => $post->post_parent,
											'post_status'    => 'inherit',
											'post_type'      => 'attachment',
											'post_mime_type' => 'image',
											'order'          => 'ASC',
											'orderby'        => 'menu_order ID',
										) ) );
									foreach ( $attachments as $k => $attachment ) {
										if ( $attachment->ID == $post->ID ) {
											break;
										}
									}
										$k++;
										// If there is more than 1 attachment in a gallery
									if ( count( $attachments ) > 1 ) {
										if ( isset( $attachments[ $k ] ) ) {
											// get the URL of the next image attachment
											$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
										} else {                                        // or get the URL of the first image attachment
											$next_attachment_url = get_attachment_link( $attachments[0]->ID );
										}
									} else {
										// or, if there's only 1 image, get the URL of the image
										$next_attachment_url = wp_get_attachment_url();
									}
									?>

									<a href="<?php echo $next_attachment_url; ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
										$attachment_size = apply_filters( 'sparkling_attachment_size', array( 1200, 1200 ) ); // Filterable image size.
										echo wp_get_attachment_image( $post->ID, $attachment_size );
									?>

								<?php if ( ! empty( $post->post_excerpt ) ) : ?>

									<?php the_excerpt(); ?>

								<?php endif; ?>

							<?php the_content(); ?>
							<?php
								wp_link_pages( array(
									'before' => '
' . esc_html__( 'Pages:', 'sparkling' ),
									'after'  => '
',
								) );
							?>

				<?php
					// If comments are open or we have at least one comment, load up the comment template
				if ( get_theme_mod( 'sparkling_page_comments', 1 ) == 1 ) :
					if ( comments_open() || '0' != get_comments_number() ) :
						comments_template();
						endif;
					endif;
				?>

			<?php endwhile; // end of the loop. ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>


text:
class Api::V1::DonationsController < Api::V1Controller

  # Public: Shows monthly statistics for donations
  # Returns a hash of collection statistics
  def index
    @donation_statistics = Donation.monthly_statistics
    @donation_url        = Donation.paypal_donate_url_for(current_user)
    render status: 200
  end

end


text:
stdarch - Rust's standard library SIMD components
=======

[![Actions Status](https://github.com/rust-lang/stdarch/workflows/CI/badge.svg)](https://github.com/rust-lang/stdarch/actions)

# Crates

This repository contains two main crates:

* [`core_arch`](crates/core_arch/README.md) implements `core::arch` - Rust's
  core library architecture-specific intrinsics, and

* [`std_detect`](crates/std_detect/README.md) implements `std::detect` - Rust's
  standard library run-time CPU feature detection.

The `std::simd` component now lives in the
[`packed_simd_2`](https://github.com/rust-lang/packed_simd) crate.


text:
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const mode = process.env.NODE_ENV || 'development';
const TerserPlugin = require('terser-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
  entry: path.resolve(__dirname + '/src/index.ts'),
  target: 'node',
  externals: [nodeExternals()],
  mode,
  optimization: {
    minimizer: [
      new TerserPlugin({
        terserOptions: {
          output: {
            comments: false,
          },
        },
      }),
    ],
  },
  module: {
    rules: [
      {
        test: /\.ts?$/,
        use: 'ts-loader',
        exclude: /node_modules/g,
      },
    ],
  },
  resolve: {
    extensions: ['.ts', '.js'],
    alias: {
      'cd-interfaces': path.resolve(__dirname, '../../dist/cd-interfaces'),
      'cd-utils': path.resolve(__dirname, '../../dist/cd-utils'),
      'cd-metadata': path.resolve(__dirname, '../../dist/cd-metadata'),
      'cd-common/consts': path.resolve(__dirname, '../../dist/cd-common/consts'),
      'cd-common/utils': path.resolve(__dirname, '../../dist/cd-common/utils'),
      'cd-common/pipes': path.resolve(__dirname, '../../dist/cd-common/pipes'),
      'cd-common/directives': path.resolve(__dirname, '../../dist/cd-common/directives'),
      'cd-common/services': path.resolve(__dirname, '../../dist/cd-common/services'),
      'cd-common/datasets': path.resolve(__dirname, '../../dist/cd-common/datasets'),
    },
  },
  plugins: [
    new CopyPlugin({
      patterns: [
        { from: path.resolve(__dirname + '/app.yaml') },
        { from: path.resolve(__dirname + '/package.json') },
        { from: path.resolve(__dirname + '/.gcloudignore') },
      ],
    }),
  ],
  output: {
    filename: 'screenshot-service.js',
    path: path.resolve(__dirname, '../../dist/'),
  },
};


text:
const jsBuilder = require('./JSBuilder');
const mdBuilder = require('./MDBuilder');
const Documentation = require('./Documentation');
const Message = require('../Message');

const EXCLUDE_CLASSES = new Set([
  'Connection',
  'EmulationManager',
  'FrameManager',
  'Helper',
  'Launcher',
  'Multimap',
  'NavigatorWatcher',
  'NetworkManager',
  'ProxyStream',
  'Session',
  'TaskQueue',
  'WaitTask',
]);

const EXCLUDE_METHODS = new Set([
  'Headers.fromPayload',
  'Page.create',
  'JSHandle.toString',
]);

/**
 * @param {!Page} page
 * @param {!Array<!Source>} mdSources
 * @param {!Array<!Source>} jsSources
 * @return {!Promise<!Array<!Message>>}
 */
module.exports = async function lint(page, mdSources, jsSources) {
  const mdResult = await mdBuilder(page, mdSources);
  const jsResult = await jsBuilder(jsSources);
  const jsDocumentation = filterJSDocumentation(jsResult.documentation);
  const mdDocumentation = mdResult.documentation;

  const jsErrors = jsResult.errors;
  jsErrors.push(...checkDuplicates(jsDocumentation));

  const mdErrors = mdResult.errors;
  mdErrors.push(...compareDocumentations(mdDocumentation, jsDocumentation));
  mdErrors.push(...checkDuplicates(mdDocumentation));
  mdErrors.push(...checkSorting(mdDocumentation));

  // Push all errors with proper prefixes
  const errors = jsErrors.map(error => '[JavaScript] ' + error);
  errors.push(...mdErrors.map(error => '[MarkDown] ' + error));
  return errors.map(error => Message.error(error));
};

/**
 * @param {!Documentation} doc
 * @return {!Array<string>}
 */
function checkSorting(doc) {
  const errors = [];
  for (const cls of doc.classesArray) {
    const members = cls.membersArray;

    // Events should go first.
    let eventIndex = 0;
    for (; eventIndex < members.length && members[eventIndex].type === 'event'; ++eventIndex);
    for (; eventIndex < members.length && members[eventIndex].type !== 'event'; ++eventIndex);
    if (eventIndex < members.length)
      errors.push(`Events should go first. Event '${members[eventIndex].name}' in class ${cls.name} breaks order`);

    // Constructor should be right after events and before all other members.
    const constructorIndex = members.findIndex(member => member.type === 'method' && member.name === 'constructor');
    if (constructorIndex > 0 && members[constructorIndex - 1].type !== 'event')
      errors.push(`Constructor of ${cls.name} should go before other methods`);

    // Events should be sorted alphabetically.
    for (let i = 0; i < members.length - 1; ++i) {
      const member1 = cls.membersArray[i];
      const member2 = cls.membersArray[i + 1];
      if (member1.type !== 'event' || member2.type !== 'event')
        continue;
      if (member1.name > member2.name)
        errors.push(`Event '${member1.name}' in class ${cls.name} breaks alphabetic ordering of events`);
    }

    // All other members should be sorted alphabetically.
    for (let i = 0; i < members.length - 1; ++i) {
      const member1 = cls.membersArray[i];
      const member2 = cls.membersArray[i + 1];
      if (member1.type === 'event' || member2.type === 'event')
        continue;
      if (member1.type === 'method' && member1.name === 'constructor')
        continue;
      if (member1.name > member2.name) {
        let memberName1 = `${cls.name}.${member1.name}`;
        if (member1.type === 'method')
          memberName1 += '()';
        let memberName2 = `${cls.name}.${member2.name}`;
        if (member2.type === 'method')
          memberName2 += '()';
        errors.push(`Bad alphabetic ordering of ${cls.name} members: ${memberName1} should go after ${memberName2}`);
      }
    }
  }
  return errors;
}

/**
 * @param {!Documentation} jsDocumentation
 * @return {!Documentation}
 */
function filterJSDocumentation(jsDocumentation) {
  // Filter classes and methods.
  const classes = [];
  for (const cls of jsDocumentation.classesArray) {
    if (EXCLUDE_CLASSES.has(cls.name))
      continue;
    const members = cls.membersArray.filter(member => {
      if (member.name.startsWith('_'))
        return false;
      // Exclude all constructors by default.
      if (member.name === 'constructor' && member.type === 'method')
        return false;
      return !EXCLUDE_METHODS.has(`${cls.name}.${member.name}`);
    });
    classes.push(new Documentation.Class(cls.name, members));
  }
  return new Documentation(classes);
}

/**
 * @param {!Documentation} doc
 * @return {!Array<string>}
 */
function checkDuplicates(doc) {
  const errors = [];
  const classes = new Set();
  // Report duplicates.
  for (const cls of doc.classesArray) {
    if (classes.has(cls.name))
      errors.push(`Duplicate declaration of class ${cls.name}`);
    classes.add(cls.name);
    const members = new Set();
    for (const member of cls.membersArray) {
      if (members.has(member.type + ' ' + member.name))
        errors.push(`Duplicate declaration of ${member.type} ${cls.name}.${member.name}()`);
      members.add(member.type + ' ' + member.name);
      const args = new Set();
      for (const arg of member.argsArray) {
        if (args.has(arg.name))
          errors.push(`Duplicate declaration of argument ${cls.name}.${member.name} "${arg.name}"`);
        args.add(arg.name);
      }
    }
  }
  return errors;
}

/**
 * @param {!Documentation} actual
 * @param {!Documentation} expected
 * @return {!Array<string>}
 */
function compareDocumentations(actual, expected) {
  const errors = [];

  const actualClasses = Array.from(actual.classes.keys()).sort();
  const expectedClasses = Array.from(expected.classes.keys()).sort();
  const classesDiff = diff(actualClasses, expectedClasses);
  for (const className of classesDiff.extra)
    errors.push(`Non-existing class found: ${className}`);
  for (const className of classesDiff.missing)
    errors.push(`Class not found: ${className}`);

  for (const className of classesDiff.equal) {
    const actualClass = actual.classes.get(className);
    const expectedClass = expected.classes.get(className);
    const actualMethods = Array.from(actualClass.methods.keys()).sort();
    const expectedMethods = Array.from(expectedClass.methods.keys()).sort();
    const methodDiff = diff(actualMethods, expectedMethods);
    for (const methodName of methodDiff.extra)
      errors.push(`Non-existing method found: ${className}.${methodName}()`);
    for (const methodName of methodDiff.missing)
      errors.push(`Method not found: ${className}.${methodName}()`);

    for (const methodName of methodDiff.equal) {
      const actualMethod = actualClass.methods.get(methodName);
      const expectedMethod = expectedClass.methods.get(methodName);
      if (actualMethod.hasReturn !== expectedMethod.hasReturn) {
        if (actualMethod.hasReturn)
          errors.push(`Method ${className}.${methodName} has unneeded description of return type`);
        else if (!expectedMethod.async)
          errors.push(`Method ${className}.${methodName} is missing return type description`);
        else
          errors.push(`Async method ${className}.${methodName} should describe return type Promise`);
      }
      const actualArgs = Array.from(actualMethod.args.keys());
      const expectedArgs = Array.from(expectedMethod.args.keys());
      const argDiff = diff(actualArgs, expectedArgs);
      if (argDiff.extra.length || argDiff.missing.length) {
        const text = [`Method ${className}.${methodName}() fails to describe its parameters:`];
        for (const arg of argDiff.missing)
          text.push(`- Argument not found: ${arg}`);
        for (const arg of argDiff.extra)
          text.push(`- Non-existing argument found: ${arg}`);
        errors.push(text.join('\n'));
      }
    }
    const actualProperties = Array.from(actualClass.properties.keys()).sort();
    const expectedProperties = Array.from(expectedClass.properties.keys()).sort();
    const propertyDiff = diff(actualProperties, expectedProperties);
    for (const propertyName of propertyDiff.extra)
      errors.push(`Non-existing property found: ${className}.${propertyName}`);
    for (const propertyName of propertyDiff.missing)
      errors.push(`Property not found: ${className}.${propertyName}`);

    const actualEvents = Array.from(actualClass.events.keys()).sort();
    const expectedEvents = Array.from(expectedClass.events.keys()).sort();
    const eventsDiff = diff(actualEvents, expectedEvents);
    for (const eventName of eventsDiff.extra)
      errors.push(`Non-existing event found in class ${className}: '${eventName}'`);
    for (const eventName of eventsDiff.missing)
      errors.push(`Event not found in class ${className}: '${eventName}'`);
  }
  return errors;
}

/**
 * @param {!Array<string>} actual
 * @param {!Array<string>} expected
 * @return {{extra: !Array<string>, missing: !Array<string>, equal: !Array<string>}}
 */
function diff(actual, expected) {
  const N = actual.length;
  const M = expected.length;
  if (N === 0 && M === 0)
    return { extra: [], missing: [], equal: []};
  if (N === 0)
    return {extra: [], missing: expected.slice(), equal: []};
  if (M === 0)
    return {extra: actual.slice(), missing: [], equal: []};
  const d = new Array(N);
  const bt = new Array(N);
  for (let i = 0; i < N; ++i) {
    d[i] = new Array(M);
    bt[i] = new Array(M);
    for (let j = 0; j < M; ++j) {
      const top = val(i - 1, j);
      const left = val(i, j - 1);
      if (top > left) {
        d[i][j] = top;
        bt[i][j] = 'extra';
      } else {
        d[i][j] = left;
        bt[i][j] = 'missing';
      }
      const diag = val(i - 1, j - 1);
      if (actual[i] === expected[j] && d[i][j] < diag + 1) {
        d[i][j] = diag + 1;
        bt[i][j] = 'eq';
      }
    }
  }
  // Backtrack results.
  let i = N - 1;
  let j = M - 1;
  const missing = [];
  const extra = [];
  const equal = [];
  while (i >= 0 && j >= 0) {
    switch (bt[i][j]) {
      case 'extra':
        extra.push(actual[i]);
        i -= 1;
        break;
      case 'missing':
        missing.push(expected[j]);
        j -= 1;
        break;
      case 'eq':
        equal.push(actual[i]);
        i -= 1;
        j -= 1;
        break;
    }
  }
  while (i >= 0)
    extra.push(actual[i--]);
  while (j >= 0)
    missing.push(expected[j--]);
  extra.reverse();
  missing.reverse();
  equal.reverse();
  return {extra, missing, equal};

  function val(i, j) {
    return i < 0 || j < 0 ? 0 : d[i][j];
  }
}


text:
package com.mapswithme.maps.bookmarks;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;

import com.mapswithme.maps.bookmarks.data.Error;
import com.mapswithme.maps.bookmarks.data.Result;

public class OperationStatus implements Parcelable
{
  @Nullable
  private final Result mResult;
  @Nullable
  private final Error mError;

  OperationStatus(@Nullable Result result, @Nullable Error error)
  {
    mResult = result;
    mError = error;
  }

  private OperationStatus(Parcel in)
  {
    mResult = in.readParcelable(Result.class.getClassLoader());
    mError = in.readParcelable(Error.class.getClassLoader());
  }

  public static final Creator<OperationStatus> CREATOR = new Creator<OperationStatus>()
  {
    @Override
    public OperationStatus createFromParcel(Parcel in)
    {
      return new OperationStatus(in);
    }

    @Override
    public OperationStatus[] newArray(int size)
    {
      return new OperationStatus[size];
    }
  };

  public boolean isOk()
  {
    return mError == null;
  }

  @Nullable
  public Result getResult()
  {
    return mResult;
  }

  @Nullable
  public Error getError()
  {
    return mError;
  }

  @Override
  public int describeContents()
  {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags)
  {
    dest.writeParcelable(mResult, flags);
    dest.writeParcelable(mError, flags);
  }
}


text:
use strict;
use warnings;

package OpenXPKI::Crypto::CRL;

use OpenXPKI::Debug;
use DateTime::Format::DateParse;

use base qw(OpenXPKI::Crypto::Object);

sub new
{
    my $self = shift;
    my $class = ref($self) || $self;
    $self = {};
    bless $self, $class;

    my $keys = { @_ };
    $self->{DATA}  = $keys->{DATA};
    $self->{TOKEN} = $keys->{TOKEN};
    $self->{REVOKED} = $keys->{REVOKED};
    $self->{EXTENSIONS} = $keys->{EXTENSIONS};

    if (not $self->{DATA})
    {
        OpenXPKI::Exception->throw (
            message => "I18N_OPENXPKI_CRYPTO_CRL_NEW_MISSING_DATA");
    }
    if (not $self->{TOKEN})
    {
        OpenXPKI::Exception->throw (
            message => "I18N_OPENXPKI_CRYPTO_CRL_NEW_MISSING_TOKEN");
    }

    $self->__init();

    return $self;
}

sub __init
{
    my $self = shift;
    ##! 1: "start"

    ##########################
    ##     init objects     ##
    ##########################

    $self->{header} = OpenXPKI::Crypto::Header->new (DATA  => $self->{DATA});
    $self->{crl} = $self->{TOKEN}->get_object({DATA  => $self->{header}->get_body(),
                                               TYPE  => "CRL"});

    ##########################
    ##     core parsing     ##
    ##########################

    $self->{PARSED}->{HEADER} = $self->{header}->get_parsed();

    my @attr = ("version", "issuer", "next_update", "last_update","signature_algorithm", "itemcnt", "serial");

    push @attr, "revoked" if ($self->{REVOKED});
    push @attr, "extensions" if ($self->{EXTENSIONS});

    foreach my $attr (@attr)
    {
        $self->{PARSED}->{BODY}->{uc($attr)} = $self->{TOKEN}->get_object_function ({
                                                   OBJECT   => $self->{crl},
                                                   FUNCTION => $attr});
    }

    $self->{PARSED}->{BODY}->{NEXT_UPDATE}
        = DateTime::Format::DateParse->parse_datetime($self->{PARSED}->{BODY}->{NEXT_UPDATE})->epoch();
    $self->{PARSED}->{BODY}->{LAST_UPDATE}
        = DateTime::Format::DateParse->parse_datetime($self->{PARSED}->{BODY}->{LAST_UPDATE})->epoch();
    $self->{TOKEN}->free_object ($self->{crl});
    delete $self->{crl};
    ##! 2: "loaded crl attributes"
    my $ret = $self->{PARSED}->{BODY};

    # parse AKI
    my $ext = {};
    if ($ret->{EXTENSIONS}) {
        my @lines = split(/\n/, $ret->{EXTENSIONS});
        while (my $line = shift @lines) {
            if ($line =~ /X509v3 Authority Key Identifier/) {
                my $item = shift @lines;
                my ($value) = ($item =~ /^[^:]+:(.*)$/);
                if ($value) {
                    $ext->{AUTHORITY_KEY_IDENTIFIER} = $value;
                }
                last;
            }
        }
        $ret->{EXTENSIONS} = $ext;
    }

    #################################
    ##     parse revoked certs     ##
    #################################

    if ($ret->{REVOKED})
    {
        ## parse revoked certificates
        my @list = ();
        my @certs = split ( /\n/i, $ret->{REVOKED} );
        for (my $i=0; $i<scalar @certs; $i++)
        {
            my $serial = $certs[$i++];
            my $date   = $certs[$i];
            my $ext    = "";
            while ($i+1<scalar @certs && $certs[$i+1] =~ /^  /) {
                $ext .= $certs[++$i]."\n";
            }
            my $entry = {SERIAL     => $serial,
                         DATE       => $date,
                         EXTENSIONS => $ext};
            @list = ( @list, $entry );
        }
        $self->{PARSED}->{LIST} = \@list;
    }

    return 1;
}

sub get_serial {
    my $self = shift;

    # return the serial (undef if not present)
    return $self->get_parsed("BODY", "SERIAL");
}

sub get_converted
{
    my $self   = shift;
    my $format = shift;

    if (not $format)
    {
        OpenXPKI::Exception->throw (
            message => "I18N_OPENXPKI_CRYPTO_CRL_GET_CONVERTED_MISSING_FORMAT");
    }
    if ($format ne "PEM" and $format ne "DER" and $format ne "TXT")
    {
        OpenXPKI::Exception->throw (
            message => "I18N_OPENXPKI_CRYPTO_CRL_GET_CONVERTED_WRONG_FORMAT",
            params  => {"FORMAT" => $format});
    }

    if ($format eq 'PEM' ) {
        return $self->get_body();
    }
    else
    {
        return $self->{TOKEN}->command ({COMMAND => "convert_crl",
                                         DATA    => $self->get_body(),
                                         OUT     => $format});
    }
}

sub to_db_hash {
    my $self = shift;

    my %insert_hash;
    $insert_hash{'DATA'} = $self->get_body();
    $insert_hash{'LAST_UPDATE'} = $self->get_parsed("BODY", "LAST_UPDATE");
    $insert_hash{'NEXT_UPDATE'} = $self->get_parsed("BODY", "NEXT_UPDATE");
    return %insert_hash;
}

1;
__END__

=head1 Name

OpenXPKI::Crypto::CRL

=head1 Description

This is the module for managing CRLs. You can use this module to parse
and convert CRLs. If you are missing some functions here please check
OpenXPKI::Crypto::Object. OpenXPKI::Crypto::Object inherits from
OpenXPKI::Crypto::Object several functions.

=head1 Functions

=head2 new

The constructor requires two parameters - DATA and TOKEN.
DATA is a PEM encoded CRL. TOKEN is a token from the token manager
(OpenXPKI::TokenManager). The token is needed to parse the CRL.

You can optionally pass EXTENSIONS and REVOKED as boolean flags.
EXTENSIONS parses the extension section and looks for the Authority Key
Identifier. REVOKED reads the list of revoked certificates from the
CRL and adds it to the return structure.

=head2 get_serial

returns the serial of the CRL. If there is no serial in the CRL,
undef will be returned.

=head2 get_converted

The functions supports three formats - PEM, DER and TXT. All other
formats create errors (or better exceptions). The CRL will be
returned in the specified format on success.

=head2 to_db_hash

Converts the CRL into a hash that can (with a few additions) be
inserted in to a database using $dbi->insert()


text:
DevOps as a Service, or DOaaS, it could be sub-set of offerings of IaaS . Like all members of the "as a Service" (aaS) family, DOaaS is based on the concept that the product, Service + Operation in this case, can be provided on demand to the user regardless of geographic or organizational separation of provider and consumer.

Benefits
==============================================
 - Overcome the challenge of creating a DevOps environment in your organization with expertise, experience and leadership
 - Improve current processes and adopt best practices
 - Rely on experts responsible for performance and uptime
 - Increase release frequency and reliability
 - Increase visibility into your operations improving collaboration and efficiency
 - Free up resources to focus on new strategic initiatives that would not otherwise be possible.
 - Benefit from 24/7 availability without any additional overhead
 - Increase in scalability across Infrastructure, Platform, DB.
 - Ease in on-demand customizations of system.
 - Significant decrease in cost. PAY-AS-YOU-USE.

What could be the offering of Cloud Services-:
==============================================

**Server Monitoring and Management with plug and play**

 - Performance Management
 - Load and Stress Testing
 - Root cause Analysis
 - Troubleshooting
 - Network monitoring
 - Scale up/down
 - Auto Scalable infrastructure
 - Load balancers

**Database Management**

 - Database Monitoring and Management
 - Performance tuning
 - Updating Patches
 - Availability Status
 - Upgrades and migrations
 - Cluster Mangement
 - master/slave
 - Master and Master high availability

**Backup Management**

 - Backup Automation
 - Backup Frequency
 - Restore Requests
 - Backup Retention

**Security Management**

 - Infrastructure Hardening
 - Firewall Setup
 - Security Patches

**Configuration Management**
 - Setup and install packages and libraries required.
 - Allow user to setup chef or puppet to manage their configurations.

This Document is still in very early phase. Anyone is wants to add, comment, delete or suggestions most welcome. Lots of research needs to be done on this. ANy suggestions are welcome.


text:
<?php
/**
 * Created by PhpStorm.
 * User: Topchiy
 * Date: 05.01.2015
 * Time: 23:26
 */

namespace BL\BookBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 *
 * @ORM\Entity
 * @ORM\HasLifecycleCallbacks
 */
class Blog extends HeaderBook
{
    /**
     * @ORM\OneToOne(targetEntity="BL\BookBundle\Entity\BlogBody", mappedBy="book")
     * @var
     */
    protected $text;

    /**
     * @return mixed
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * @param mixed $text
     */
    public function setText($text)
    {
        $this->text = $text;
    }
}


text:
package ro.isdc.wro.manager.runnable;

import static org.junit.Assert.assertEquals;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import ro.isdc.wro.cache.CacheStrategy;
import ro.isdc.wro.config.Context;

/**
 * @author Alex Objelean
 */
public class TestReloadCacheRunnable {
  @Mock
  private CacheStrategy<?, ?> mockCacheStrategy;
  private ReloadCacheRunnable victim;

  @BeforeClass
  public static void onBeforeClass() {
    assertEquals(0, Context.countActive());
  }

  @AfterClass
  public static void onAfterClass() {
    assertEquals(0, Context.countActive());
  }

  @Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);
    victim = new ReloadCacheRunnable(mockCacheStrategy);
  }

  @Test(expected = NullPointerException.class)
  public void cannotAcceptNullArgument() {
    new ReloadCacheRunnable(null);
  }

  @Test
  public void shouldDestroyModelWhenInvokingRun() {
    victim.run();
    Mockito.verify(mockCacheStrategy).clear();
  }
}


text:
function test_suite = test_thatFails

% Copyright 2013 The MathWorks, Inc.

initTestSuite;

function test_case
assertTrue(false);


text:
class AccountController < ApplicationController

  get '/' do
    #login registration page
    erb :login, layout: :layout
  end

  post '/register' do
    #accept params from a post to create a user (bcrypt)
    #these are all the fields in the database table coming from
    #params as a post from the page
    # @username = params[:username]
    # @password = params[:password]
    # @email = params[:email]
    # @first_name = params[:first_name]
    # @last_name = params[:last_name]
    # @liberal = params[:liberal]
    # @moderate = params[:moderate]
    # @conservative = params[:conservative]

    if does_user_exist?(@username) == false
      @account_message = "User already exists"
      return erb :login_notice
    end

    # password_salt = BCrypt::Engine.generate_salt
    # password_hash = BCrypt::Engine.hash_secret(@password, password_salt)
    password_hash = BCrypt::Password.create(params[:password])

    #new model(new person) created (from params
    #to variables to here to the db)
    @model = Account.new(username: params[:username], email: params[:email], first_name: params[:first_name], last_name: params[:last_name], liberal: params[:liberal], moderate: params[:moderate], conservative: params[:conservative], password_hash: password_hash)
    # @model.username = @username
    # @model.email = @email
    # @model.first_name = @first_name
    # @model.last_name = @last_name
    # @model.liberal = @liberal
    # @model.moderate = @moderate
    # @model.conservative = @conservative
    # @model.password_hash = password_hash
    # @model.password_salt = password_salt
    @model.save

    @account_message = "you have successfully registered and are logged in!"

    #this means that when they have registered, they are also logged in:
    session[:user] = @model

    erb :login_notice

  end

  post '/login' do
    #check params if user exists and if so, log them in
    @username = params[:username]
    @password = params[:password]
    @email = params[:email] #optional

    if does_user_exist?(@username) == true
      @account_message = "User Already Exists"
      return erb :login_notice
    end

    #could also use Account.find...
    @user = Acccount.find_by(username: params[:username])

    #if password provided matches the password provided along with the salt that's in the db:
    if @model.password_hash == BCrypt::Engine.hash_secret(@password, @model.password_salt)
      @account_message = "Welcome Back!"
      #make the session user(the person who is signed in) equal to the person (the @model)
      session[:user] = @model
      return erb :login_notice
    else
      @account_message = "Sorry, your password did not match.  Try again?"
      return erb :login_notice
  end

  get '/logout' do
    #user peaces out
    #will need to login again
    session[:user] = nil
    redirect '/'
  end

  get '/supersecret' do
    #test of user authentication. Show only to registered,
    #logged-in users

  end
end
end


text:
revision = '33121d26c93'
down_revision = '2b059ec04b'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
    op.create_table('asset_statement',
        sa.Column('id', postgresql.UUID(), nullable=False),
        sa.Column('date', sa.Date(), nullable=True),
        sa.Column('raw_data', sa.Text(), nullable=True),
        sa.Column('land_agri_area', sa.Integer(), nullable=True),
        sa.Column('land_city_area', sa.Integer(), nullable=True),
        sa.Column('net_worth_eur', sa.Integer(), nullable=True),
        sa.Column('realty_count', sa.Integer(), nullable=True),
        sa.Column('vehicle_count', sa.Integer(), nullable=True),
        sa.Column('year_income_eur', sa.Integer(), nullable=True),
        sa.Column('person_id', postgresql.UUID(), nullable=False),
        sa.ForeignKeyConstraint(['person_id'], ['person.id']),
        sa.PrimaryKeyConstraint('id'),
    )

def downgrade():
    op.drop_table('asset_statement')


text:
/* this ALWAYS GENERATED file contains the definitions for the interfaces */

 /* File created by MIDL compiler version 6.00.0363 */
/* Compiler settings for cmdtree.idl:
    Oicf, W1, ..., env=Win32 (32b run)
    protocol : dce , ms_ext, c_ext
    error checks: allocation ref bounds_check enum stub_data
    VC __declspec() decoration level:
         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
         DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING(  )

#pragma warning( disable: 4049 )  /* more than 64k source lines */

/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__

#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/

#ifndef __cmdtree_h__
#define __cmdtree_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */

#ifndef __ICommandTree_FWD_DEFINED__
#define __ICommandTree_FWD_DEFINED__
typedef interface ICommandTree ICommandTree;
#endif 	/* __ICommandTree_FWD_DEFINED__ */

#ifndef __IQuery_FWD_DEFINED__
#define __IQuery_FWD_DEFINED__
typedef interface IQuery IQuery;
#endif 	/* __IQuery_FWD_DEFINED__ */

/* header files for imported files */
#include "oledb.h"

#ifdef __cplusplus
extern "C"{
#endif

void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * );

/* interface __MIDL_itf_cmdtree_0000 */
/* [local] */

//+---------------------------------------------------------------------------
//
//  Microsoft OLE DB
//  Copyright (C) Microsoft Corporation, 1994 - 1999.
//
//----------------------------------------------------------------------------

#ifdef _WIN64
#include <pshpack8.h>	// 8-byte structure packing
#else
#include <pshpack2.h>	// 2-byte structure packing
#endif

extern RPC_IF_HANDLE __MIDL_itf_cmdtree_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_cmdtree_0000_v0_0_s_ifspec;

#ifndef __CommandTreeStructureDefinitions_INTERFACE_DEFINED__
#define __CommandTreeStructureDefinitions_INTERFACE_DEFINED__

/* interface CommandTreeStructureDefinitions */
/* [auto_handle][unique][uuid] */

typedef WORD DBCOMMANDOP;

enum DBCOMMANDOPENUM
    {	DBOP_scalar_constant	= 0,
	DBOP_DEFAULT	= DBOP_scalar_constant + 1,
	DBOP_NULL	= DBOP_DEFAULT + 1,
	DBOP_bookmark_name	= DBOP_NULL + 1,
	DBOP_catalog_name	= DBOP_bookmark_name + 1,
	DBOP_column_name	= DBOP_catalog_name + 1,
	DBOP_schema_name	= DBOP_column_name + 1,
	DBOP_outall_name	= DBOP_schema_name + 1,
	DBOP_qualifier_name	= DBOP_outall_name + 1,
	DBOP_qualified_column_name	= DBOP_qualifier_name + 1,
	DBOP_table_name	= DBOP_qualified_column_name + 1,
	DBOP_nested_table_name	= DBOP_table_name + 1,
	DBOP_nested_column_name	= DBOP_nested_table_name + 1,
	DBOP_row	= DBOP_nested_column_name + 1,
	DBOP_table	= DBOP_row + 1,
	DBOP_sort	= DBOP_table + 1,
	DBOP_distinct	= DBOP_sort + 1,
	DBOP_distinct_order_preserving	= DBOP_distinct + 1,
	DBOP_alias	= DBOP_distinct_order_preserving + 1,
	DBOP_cross_join	= DBOP_alias + 1,
	DBOP_union_join	= DBOP_cross_join + 1,
	DBOP_inner_join	= DBOP_union_join + 1,
	DBOP_left_semi_join	= DBOP_inner_join + 1,
	DBOP_right_semi_join	= DBOP_left_semi_join + 1,
	DBOP_left_anti_semi_join	= DBOP_right_semi_join + 1,
	DBOP_right_anti_semi_join	= DBOP_left_anti_semi_join + 1,
	DBOP_left_outer_join	= DBOP_right_anti_semi_join + 1,
	DBOP_right_outer_join	= DBOP_left_outer_join + 1,
	DBOP_full_outer_join	= DBOP_right_outer_join + 1,
	DBOP_natural_join	= DBOP_full_outer_join + 1,
	DBOP_natural_left_outer_join	= DBOP_natural_join + 1,
	DBOP_natural_right_outer_join	= DBOP_natural_left_outer_join + 1,
	DBOP_natural_full_outer_join	= DBOP_natural_right_outer_join + 1,
	DBOP_set_intersection	= DBOP_natural_full_outer_join + 1,
	DBOP_set_union	= DBOP_set_intersection + 1,
	DBOP_set_left_difference	= DBOP_set_union + 1,
	DBOP_set_right_difference	= DBOP_set_left_difference + 1,
	DBOP_set_anti_difference	= DBOP_set_right_difference + 1,
	DBOP_bag_intersection	= DBOP_set_anti_difference + 1,
	DBOP_bag_union	= DBOP_bag_intersection + 1,
	DBOP_bag_left_difference	= DBOP_bag_union + 1,
	DBOP_bag_right_difference	= DBOP_bag_left_difference + 1,
	DBOP_bag_anti_difference	= DBOP_bag_right_difference + 1,
	DBOP_division	= DBOP_bag_anti_difference + 1,
	DBOP_relative_sampling	= DBOP_division + 1,
	DBOP_absolute_sampling	= DBOP_relative_sampling + 1,
	DBOP_transitive_closure	= DBOP_absolute_sampling + 1,
	DBOP_recursive_union	= DBOP_transitive_closure + 1,
	DBOP_aggregate	= DBOP_recursive_union + 1,
	DBOP_remote_table	= DBOP_aggregate + 1,
	DBOP_select	= DBOP_remote_table + 1,
	DBOP_order_preserving_select	= DBOP_select + 1,
	DBOP_project	= DBOP_order_preserving_select + 1,
	DBOP_project_order_preserving	= DBOP_project + 1,
	DBOP_top	= DBOP_project_order_preserving + 1,
	DBOP_top_percent	= DBOP_top + 1,
	DBOP_top_plus_ties	= DBOP_top_percent + 1,
	DBOP_top_percent_plus_ties	= DBOP_top_plus_ties + 1,
	DBOP_rank	= DBOP_top_percent_plus_ties + 1,
	DBOP_rank_ties_equally	= DBOP_rank + 1,
	DBOP_rank_ties_equally_and_skip	= DBOP_rank_ties_equally + 1,
	DBOP_navigate	= DBOP_rank_ties_equally_and_skip + 1,
	DBOP_nesting	= DBOP_navigate + 1,
	DBOP_unnesting	= DBOP_nesting + 1,
	DBOP_nested_apply	= DBOP_unnesting + 1,
	DBOP_cross_tab	= DBOP_nested_apply + 1,
	DBOP_is_NULL	= DBOP_cross_tab + 1,
	DBOP_is_NOT_NULL	= DBOP_is_NULL + 1,
	DBOP_equal	= DBOP_is_NOT_NULL + 1,
	DBOP_not_equal	= DBOP_equal + 1,
	DBOP_less	= DBOP_not_equal + 1,
	DBOP_less_equal	= DBOP_less + 1,
	DBOP_greater	= DBOP_less_equal + 1,
	DBOP_greater_equal	= DBOP_greater + 1,
	DBOP_equal_all	= DBOP_greater_equal + 1,
	DBOP_not_equal_all	= DBOP_equal_all + 1,
	DBOP_less_all	= DBOP_not_equal_all + 1,
	DBOP_less_equal_all	= DBOP_less_all + 1,
	DBOP_greater_all	= DBOP_less_equal_all + 1,
	DBOP_greater_equal_all	= DBOP_greater_all + 1,
	DBOP_equal_any	= DBOP_greater_equal_all + 1,
	DBOP_not_equal_any	= DBOP_equal_any + 1,
	DBOP_less_any	= DBOP_not_equal_any + 1,
	DBOP_less_equal_any	= DBOP_less_any + 1,
	DBOP_greater_any	= DBOP_less_equal_any + 1,
	DBOP_greater_equal_any	= DBOP_greater_any + 1,
	DBOP_anybits	= DBOP_greater_equal_any + 1,
	DBOP_allbits	= DBOP_anybits + 1,
	DBOP_anybits_any	= DBOP_allbits + 1,
	DBOP_allbits_any	= DBOP_anybits_any + 1,
	DBOP_anybits_all	= DBOP_allbits_any + 1,
	DBOP_allbits_all	= DBOP_anybits_all + 1,
	DBOP_between	= DBOP_allbits_all + 1,
	DBOP_between_unordered	= DBOP_between + 1,
	DBOP_match	= DBOP_between_unordered + 1,
	DBOP_match_unique	= DBOP_match + 1,
	DBOP_match_partial	= DBOP_match_unique + 1,
	DBOP_match_partial_unique	= DBOP_match_partial + 1,
	DBOP_match_full	= DBOP_match_partial_unique + 1,
	DBOP_match_full_unique	= DBOP_match_full + 1,
	DBOP_scalar_parameter	= DBOP_match_full_unique + 1,
	DBOP_scalar_function	= DBOP_scalar_parameter + 1,
	DBOP_plus	= DBOP_scalar_function + 1,
	DBOP_minus	= DBOP_plus + 1,
	DBOP_times	= DBOP_minus + 1,
	DBOP_over	= DBOP_times + 1,
	DBOP_div	= DBOP_over + 1,
	DBOP_modulo	= DBOP_div + 1,
	DBOP_power	= DBOP_modulo + 1,
	DBOP_like	= DBOP_power + 1,
	DBOP_sounds_like	= DBOP_like + 1,
	DBOP_like_any	= DBOP_sounds_like + 1,
	DBOP_like_all	= DBOP_like_any + 1,
	DBOP_is_INVALID	= DBOP_like_all + 1,
	DBOP_is_TRUE	= DBOP_is_INVALID + 1,
	DBOP_is_FALSE	= DBOP_is_TRUE + 1,
	DBOP_and	= DBOP_is_FALSE + 1,
	DBOP_or	= DBOP_and + 1,
	DBOP_xor	= DBOP_or + 1,
	DBOP_equivalent	= DBOP_xor + 1,
	DBOP_not	= DBOP_equivalent + 1,
	DBOP_implies	= DBOP_not + 1,
	DBOP_overlaps	= DBOP_implies + 1,
	DBOP_case_condition	= DBOP_overlaps + 1,
	DBOP_case_value	= DBOP_case_condition + 1,
	DBOP_nullif	= DBOP_case_value + 1,
	DBOP_cast	= DBOP_nullif + 1,
	DBOP_coalesce	= DBOP_cast + 1,
	DBOP_position	= DBOP_coalesce + 1,
	DBOP_extract	= DBOP_position + 1,
	DBOP_char_length	= DBOP_extract + 1,
	DBOP_octet_length	= DBOP_char_length + 1,
	DBOP_bit_length	= DBOP_octet_length + 1,
	DBOP_substring	= DBOP_bit_length + 1,
	DBOP_upper	= DBOP_substring + 1,
	DBOP_lower	= DBOP_upper + 1,
	DBOP_trim	= DBOP_lower + 1,
	DBOP_translate	= DBOP_trim + 1,
	DBOP_convert	= DBOP_translate + 1,
	DBOP_string_concat	= DBOP_convert + 1,
	DBOP_current_date	= DBOP_string_concat + 1,
	DBOP_current_time	= DBOP_current_date + 1,
	DBOP_current_timestamp	= DBOP_current_time + 1,
	DBOP_content_select	= DBOP_current_timestamp + 1,
	DBOP_content	= DBOP_content_select + 1,
	DBOP_content_freetext	= DBOP_content + 1,
	DBOP_content_proximity	= DBOP_content_freetext + 1,
	DBOP_content_vector_or	= DBOP_content_proximity + 1,
	DBOP_delete	= DBOP_content_vector_or + 1,
	DBOP_update	= DBOP_delete + 1,
	DBOP_insert	= DBOP_update + 1,
	DBOP_min	= DBOP_insert + 1,
	DBOP_max	= DBOP_min + 1,
	DBOP_count	= DBOP_max + 1,
	DBOP_sum	= DBOP_count + 1,
	DBOP_avg	= DBOP_sum + 1,
	DBOP_any_sample	= DBOP_avg + 1,
	DBOP_stddev	= DBOP_any_sample + 1,
	DBOP_stddev_pop	= DBOP_stddev + 1,
	DBOP_var	= DBOP_stddev_pop + 1,
	DBOP_var_pop	= DBOP_var + 1,
	DBOP_first	= DBOP_var_pop + 1,
	DBOP_last	= DBOP_first + 1,
	DBOP_in	= DBOP_last + 1,
	DBOP_exists	= DBOP_in + 1,
	DBOP_unique	= DBOP_exists + 1,
	DBOP_subset	= DBOP_unique + 1,
	DBOP_proper_subset	= DBOP_subset + 1,
	DBOP_superset	= DBOP_proper_subset + 1,
	DBOP_proper_superset	= DBOP_superset + 1,
	DBOP_disjoint	= DBOP_proper_superset + 1,
	DBOP_pass_through	= DBOP_disjoint + 1,
	DBOP_defined_by_GUID	= DBOP_pass_through + 1,
	DBOP_text_command	= DBOP_defined_by_GUID + 1,
	DBOP_SQL_select	= DBOP_text_command + 1,
	DBOP_prior_command_tree	= DBOP_SQL_select + 1,
	DBOP_add_columns	= DBOP_prior_command_tree + 1,
	DBOP_column_list_anchor	= DBOP_add_columns + 1,
	DBOP_column_list_element	= DBOP_column_list_anchor + 1,
	DBOP_command_list_anchor	= DBOP_column_list_element + 1,
	DBOP_command_list_element	= DBOP_command_list_anchor + 1,
	DBOP_from_list_anchor	= DBOP_command_list_element + 1,
	DBOP_from_list_element	= DBOP_from_list_anchor + 1,
	DBOP_project_list_anchor	= DBOP_from_list_element + 1,
	DBOP_project_list_element	= DBOP_project_list_anchor + 1,
	DBOP_row_list_anchor	= DBOP_project_list_element + 1,
	DBOP_row_list_element	= DBOP_row_list_anchor + 1,
	DBOP_scalar_list_anchor	= DBOP_row_list_element + 1,
	DBOP_scalar_list_element	= DBOP_scalar_list_anchor + 1,
	DBOP_set_list_anchor	= DBOP_scalar_list_element + 1,
	DBOP_set_list_element	= DBOP_set_list_anchor + 1,
	DBOP_sort_list_anchor	= DBOP_set_list_element + 1,
	DBOP_sort_list_element	= DBOP_sort_list_anchor + 1,
	DBOP_alter_character_set	= DBOP_sort_list_element + 1,
	DBOP_alter_collation	= DBOP_alter_character_set + 1,
	DBOP_alter_domain	= DBOP_alter_collation + 1,
	DBOP_alter_index	= DBOP_alter_domain + 1,
	DBOP_alter_procedure	= DBOP_alter_index + 1,
	DBOP_alter_schema	= DBOP_alter_procedure + 1,
	DBOP_alter_table	= DBOP_alter_schema + 1,
	DBOP_alter_trigger	= DBOP_alter_table + 1,
	DBOP_alter_view	= DBOP_alter_trigger + 1,
	DBOP_coldef_list_anchor	= DBOP_alter_view + 1,
	DBOP_coldef_list_element	= DBOP_coldef_list_anchor + 1,
	DBOP_create_assertion	= DBOP_coldef_list_element + 1,
	DBOP_create_character_set	= DBOP_create_assertion + 1,
	DBOP_create_collation	= DBOP_create_character_set + 1,
	DBOP_create_domain	= DBOP_create_collation + 1,
	DBOP_create_index	= DBOP_create_domain + 1,
	DBOP_create_procedure	= DBOP_create_index + 1,
	DBOP_create_schema	= DBOP_create_procedure + 1,
	DBOP_create_synonym	= DBOP_create_schema + 1,
	DBOP_create_table	= DBOP_create_synonym + 1,
	DBOP_create_temporary_table	= DBOP_create_table + 1,
	DBOP_create_translation	= DBOP_create_temporary_table + 1,
	DBOP_create_trigger	= DBOP_create_translation + 1,
	DBOP_create_view	= DBOP_create_trigger + 1,
	DBOP_drop_assertion	= DBOP_create_view + 1,
	DBOP_drop_character_set	= DBOP_drop_assertion + 1,
	DBOP_drop_collation	= DBOP_drop_character_set + 1,
	DBOP_drop_domain	= DBOP_drop_collation + 1,
	DBOP_drop_index	= DBOP_drop_domain + 1,
	DBOP_drop_procedure	= DBOP_drop_index + 1,
	DBOP_drop_schema	= DBOP_drop_procedure + 1,
	DBOP_drop_synonym	= DBOP_drop_schema + 1,
	DBOP_drop_table	= DBOP_drop_synonym + 1,
	DBOP_drop_translation	= DBOP_drop_table + 1,
	DBOP_drop_trigger	= DBOP_drop_translation + 1,
	DBOP_drop_view	= DBOP_drop_trigger + 1,
	DBOP_foreign_key	= DBOP_drop_view + 1,
	DBOP_grant_privileges	= DBOP_foreign_key + 1,
	DBOP_index_list_anchor	= DBOP_grant_privileges + 1,
	DBOP_index_list_element	= DBOP_index_list_anchor + 1,
	DBOP_primary_key	= DBOP_index_list_element + 1,
	DBOP_property_list_anchor	= DBOP_primary_key + 1,
	DBOP_property_list_element	= DBOP_property_list_anchor + 1,
	DBOP_referenced_table	= DBOP_property_list_element + 1,
	DBOP_rename_object	= DBOP_referenced_table + 1,
	DBOP_revoke_privileges	= DBOP_rename_object + 1,
	DBOP_schema_authorization	= DBOP_revoke_privileges + 1,
	DBOP_unique_key	= DBOP_schema_authorization + 1,
	DBOP_scope_list_anchor	= DBOP_unique_key + 1,
	DBOP_scope_list_element	= DBOP_scope_list_anchor + 1,
	DBOP_content_table	= DBOP_scope_list_element + 1
    } ;
#ifdef DBINITCONSTANTS
extern const OLEDBDECLSPEC GUID DBGUID_LIKE_SQL                        = {0xc8b521f6,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}};
extern const OLEDBDECLSPEC GUID DBGUID_LIKE_DOS                        = {0xc8b521f7,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}};
extern const OLEDBDECLSPEC GUID DBGUID_LIKE_OFS                        = {0xc8b521f8,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}};
extern const OLEDBDECLSPEC GUID DBGUID_LIKE_MAPI                       = {0xc8b521f9,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}};
#else // !DBINITCONSTANTS
extern const GUID DBGUID_LIKE_SQL;
extern const GUID DBGUID_LIKE_DOS;
extern const GUID DBGUID_LIKE_OFS;
extern const GUID DBGUID_LIKE_MAPI;
#endif // DBINITCONSTANTS

extern RPC_IF_HANDLE CommandTreeStructureDefinitions_v0_0_c_ifspec;
extern RPC_IF_HANDLE CommandTreeStructureDefinitions_v0_0_s_ifspec;
#endif /* __CommandTreeStructureDefinitions_INTERFACE_DEFINED__ */

#ifndef __ICommandTree_INTERFACE_DEFINED__
#define __ICommandTree_INTERFACE_DEFINED__

/* interface ICommandTree */
/* [unique][uuid][object][local] */

typedef DWORD DBCOMMANDREUSE;

enum DBCOMMANDREUSEENUM
    {	DBCOMMANDREUSE_NONE	= 0,
	DBCOMMANDREUSE_PROPERTIES	= 0x1,
	DBCOMMANDREUSE_PARAMETERS	= 0x2
    } ;
typedef DWORD DBVALUEKIND;

enum DBVALUEKINDENUM
    {	DBVALUEKIND_BYGUID	= 256,
	DBVALUEKIND_COLDESC	= DBVALUEKIND_BYGUID + 1,
	DBVALUEKIND_ID	= DBVALUEKIND_COLDESC + 1,
	DBVALUEKIND_CONTENT	= DBVALUEKIND_ID + 1,
	DBVALUEKIND_CONTENTVECTOR	= DBVALUEKIND_CONTENT + 1,
	DBVALUEKIND_GROUPINFO	= DBVALUEKIND_CONTENTVECTOR + 1,
	DBVALUEKIND_PARAMETER	= DBVALUEKIND_GROUPINFO + 1,
	DBVALUEKIND_PROPERTY	= DBVALUEKIND_PARAMETER + 1,
	DBVALUEKIND_SETFUNC	= DBVALUEKIND_PROPERTY + 1,
	DBVALUEKIND_SORTINFO	= DBVALUEKIND_SETFUNC + 1,
	DBVALUEKIND_TEXT	= DBVALUEKIND_SORTINFO + 1,
	DBVALUEKIND_COMMAND	= DBVALUEKIND_TEXT + 1,
	DBVALUEKIND_MONIKER	= DBVALUEKIND_COMMAND + 1,
	DBVALUEKIND_ROWSET	= DBVALUEKIND_MONIKER + 1,
	DBVALUEKIND_LIKE	= DBVALUEKIND_ROWSET + 1,
	DBVALUEKIND_CONTENTPROXIMITY	= DBVALUEKIND_LIKE + 1,
	DBVALUEKIND_CONTENTSCOPE	= DBVALUEKIND_CONTENTPROXIMITY + 1,
	DBVALUEKIND_CONTENTTABLE	= DBVALUEKIND_CONTENTSCOPE + 1,
	DBVALUEKIND_IDISPATCH	= 9,
	DBVALUEKIND_IUNKNOWN	= 13,
	DBVALUEKIND_EMPTY	= 0,
	DBVALUEKIND_NULL	= 1,
	DBVALUEKIND_I2	= 2,
	DBVALUEKIND_I4	= 3,
	DBVALUEKIND_R4	= 4,
	DBVALUEKIND_R8	= 5,
	DBVALUEKIND_CY	= 6,
	DBVALUEKIND_DATE	= 7,
	DBVALUEKIND_BSTR	= 8,
	DBVALUEKIND_ERROR	= 10,
	DBVALUEKIND_BOOL	= 11,
	DBVALUEKIND_VARIANT	= 12,
	DBVALUEKIND_VECTOR	= 0x1000,
	DBVALUEKIND_ARRAY	= 0x2000,
	DBVALUEKIND_BYREF	= 0x4000,
	DBVALUEKIND_I1	= 16,
	DBVALUEKIND_UI1	= 17,
	DBVALUEKIND_UI2	= 18,
	DBVALUEKIND_UI4	= DBVALUEKIND_UI2 + 1,
	DBVALUEKIND_I8	= DBVALUEKIND_UI4 + 1,
	DBVALUEKIND_UI8	= DBVALUEKIND_I8 + 1,
	DBVALUEKIND_GUID	= 72,
	DBVALUEKIND_BYTES	= 128,
	DBVALUEKIND_STR	= 129,
	DBVALUEKIND_WSTR	= 130,
	DBVALUEKIND_NUMERIC	= 131,
	DBVALUEKIND_DBDATE	= 133,
	DBVALUEKIND_DBTIME	= 134,
	DBVALUEKIND_DBTIMESTAMP	= 135,
	DBVALUEKIND_PROBABILISTIC	= 136,
	DBVALUEKIND_RELEVANTDOCUMENT	= 137
    } ;
typedef struct tagDBBYGUID
    {
    /* [size_is] */ BYTE *pbInfo;
    DBLENGTH cbInfo;
    GUID guid;
    } 	DBBYGUID;

#define GENERATE_METHOD_EXACT    ( 0 )
#define GENERATE_METHOD_PREFIX   ( 1 )
#define GENERATE_METHOD_INFLECT  ( 2 )
typedef struct tagDBCONTENT
    {
    LPOLESTR pwszPhrase;
    DWORD dwGenerateMethod;
    LONG lWeight;
    LCID lcid;
    } 	DBCONTENT;

#define SCOPE_FLAG_MASK      ( 0x000000ff )
#define SCOPE_FLAG_INCLUDE   ( 0x00000001 )
#define SCOPE_FLAG_DEEP      ( 0x00000002 )
#define SCOPE_TYPE_MASK      ( 0xffffff00 )
#define SCOPE_TYPE_WINPATH   ( 0x00000100 )
#define SCOPE_TYPE_VPATH     ( 0x00000200 )
typedef struct tagDBCONTENTSCOPE
    {
    DWORD dwFlags;
    LPOLESTR *rgpwszTagName;
    LPOLESTR pwszElementValue;
    } 	DBCONTENTSCOPE;

typedef struct tagDBCONTENTTABLE
    {
    LPOLESTR pwszMachine;
    LPOLESTR pwszCatalog;
    } 	DBCONTENTTABLE;

#define PROPID_QUERY_RANKVECTOR  ( 0x2 )
#define PROPID_QUERY_RANK        ( 0x3 )
#define PROPID_QUERY_HITCOUNT    ( 0x4 )
#define PROPID_QUERY_ALL         ( 0x6 )
#define PROPID_STG_CONTENTS      ( 0x13 )
#define VECTOR_RANK_MIN          ( 0 )
#define VECTOR_RANK_MAX          ( 1 )
#define VECTOR_RANK_INNER        ( 2 )
#define VECTOR_RANK_DICE         ( 3 )
#define VECTOR_RANK_JACCARD      ( 4 )
typedef struct tagDBCONTENTVECTOR
    {
    LONG lWeight;
    DWORD dwRankingMethod;
    } 	DBCONTENTVECTOR;

typedef struct tagDBGROUPINFO
    {
    LCID lcid;
    } 	DBGROUPINFO;

typedef struct tagDBPARAMETER
    {
    LPOLESTR pwszName;
    ITypeInfo *pTypeInfo;
    DB_NUMERIC *pNum;
    DBLENGTH cbMaxLength;
    DBPARAMFLAGS dwFlags;
    DBTYPE wType;
    } 	DBPARAMETER;

#define DBSETFUNC_NONE       0x0
#define DBSETFUNC_ALL        0x1
#define DBSETFUNC_DISTINCT   0x2
typedef struct tagDBSETFUNC
    {
    DWORD dwSetQuantifier;
    } 	DBSETFUNC;

typedef struct tagDBSORTINFO
    {
    BOOL fDesc;
    LCID lcid;
    } 	DBSORTINFO;

typedef struct tagDBTEXT
    {
    LPOLESTR pwszText;
    ULONG ulErrorLocator;
    ULONG ulTokenLength;
    GUID guidDialect;
    } 	DBTEXT;

typedef struct tagDBLIKE
    {
    LONG lWeight;
    GUID guidDialect;
    } 	DBLIKE;

#define PROXIMITY_UNIT_WORD           ( 0 )
#define PROXIMITY_UNIT_SENTENCE       ( 1 )
#define PROXIMITY_UNIT_PARAGRAPH      ( 2 )
#define PROXIMITY_UNIT_CHAPTER        ( 3 )
typedef struct tagDBCONTENTPROXIMITY
    {
    DWORD dwProximityUnit;
    ULONG ulProximityDistance;
    LONG lWeight;
    } 	DBCONTENTPROXIMITY;

typedef struct tagDBPROBABILISTIC
    {
    LONG lWeight;
    float flK1;
    float flK2;
    float flK3;
    float flB;
    } 	DBPROBABILISTIC;

typedef struct tagDBRELEVANTDOCUMENT
    {
    LONG lWeight;
    VARIANT vDocument;
    } 	DBRELEVANTDOCUMENT;

typedef struct tagDBCOMMANDTREE
    {
    DBCOMMANDOP op;
    WORD wKind;
    struct tagDBCOMMANDTREE *pctFirstChild;
    struct tagDBCOMMANDTREE *pctNextSibling;
    /* [switch_is][switch_type] */ union
        {
        /* [case()] */ __int64 llValue;
        /* [case()] */ unsigned __int64 ullValue;
        /* [case()] */ BOOL fValue;
        /* [case()] */ unsigned char uchValue;
        /* [case()] */ signed char schValue;
        /* [case()] */ unsigned short usValue;
        /* [case()] */ short sValue;
        /* [case()] */ LPOLESTR pwszValue;
        /* [case()] */ LONG lValue;
        /* [case()] */ ULONG ulValue;
        /* [case()] */ float flValue;
        /* [case()] */ double dblValue;
        /* [case()] */ CY cyValue;
        /* [case()] */ DATE dateValue;
        /* [case()] */ DBDATE dbdateValue;
        /* [case()] */ DBTIME dbtimeValue;
        /* [case()] */ SCODE scodeValue;
        /* [case()] */ BSTR *pbstrValue;
        /* [case()] */ ICommand *pCommand;
        /* [case()] */ IDispatch *pDispatch;
        /* [case()] */ IMoniker *pMoniker;
        /* [case()] */ IRowset *pRowset;
        /* [case()] */ IUnknown *pUnknown;
        /* [case()] */ DBBYGUID *pdbbygdValue;
        /* [case()] */ DBCOLUMNDESC *pcoldescValue;
        /* [case()] */ DBID *pdbidValue;
        /* [case()] */ DBLIKE *pdblikeValue;
        /* [case()] */ DBCONTENT *pdbcntntValue;
        /* [case()] */ DBCONTENTSCOPE *pdbcntntscpValue;
        /* [case()] */ DBCONTENTTABLE *pdbcntnttblValue;
        /* [case()] */ DBCONTENTVECTOR *pdbcntntvcValue;
        /* [case()] */ DBCONTENTPROXIMITY *pdbcntntproxValue;
        /* [case()] */ DBGROUPINFO *pdbgrpinfValue;
        /* [case()] */ DBPARAMETER *pdbparamValue;
        /* [case()] */ DBPROPSET *pdbpropValue;
        /* [case()] */ DBSETFUNC *pdbstfncValue;
        /* [case()] */ DBSORTINFO *pdbsrtinfValue;
        /* [case()] */ DBTEXT *pdbtxtValue;
        /* [case()] */ DBVECTOR *pdbvectorValue;
        /* [case()] */ SAFEARRAY *parrayValue;
        /* [case()] */ VARIANT *pvarValue;
        /* [case()] */ GUID *pGuid;
        /* [case()] */ BYTE *pbValue;
        /* [case()] */ char *pzValue;
        /* [case()] */ DB_NUMERIC *pdbnValue;
        /* [case()] */ DBTIMESTAMP *pdbtsValue;
        /* [case()] */ void *pvValue;
        /* [case()] */ DBPROBABILISTIC *pdbprobValue;
        /* [case()] */ DBRELEVANTDOCUMENT *pdbreldocValue;
        } 	value;
    HRESULT hrError;
    } 	DBCOMMANDTREE;

EXTERN_C const IID IID_ICommandTree;

#if defined(__cplusplus) && !defined(CINTERFACE)

    MIDL_INTERFACE("0c733a87-2a1c-11ce-ade5-00aa0044773d")
    ICommandTree : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE FindErrorNodes(
            /* [in] */ const DBCOMMANDTREE *pRoot,
            /* [out] */ ULONG *pcErrorNodes,
            /* [out] */ DBCOMMANDTREE ***prgErrorNodes) = 0;

        virtual HRESULT STDMETHODCALLTYPE FreeCommandTree(
            /* [in] */ DBCOMMANDTREE **ppRoot) = 0;

        virtual HRESULT STDMETHODCALLTYPE GetCommandTree(
            /* [out] */ DBCOMMANDTREE **ppRoot) = 0;

        virtual HRESULT STDMETHODCALLTYPE SetCommandTree(
            /* [in] */ DBCOMMANDTREE **ppRoot,
            /* [in] */ DBCOMMANDREUSE dwCommandReuse,
            /* [in] */ BOOL fCopy) = 0;

    };

#else 	/* C style interface */

    typedef struct ICommandTreeVtbl
    {
        BEGIN_INTERFACE

        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
            ICommandTree * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void **ppvObject);

        ULONG ( STDMETHODCALLTYPE *AddRef )(
            ICommandTree * This);

        ULONG ( STDMETHODCALLTYPE *Release )(
            ICommandTree * This);

        HRESULT ( STDMETHODCALLTYPE *FindErrorNodes )(
            ICommandTree * This,
            /* [in] */ const DBCOMMANDTREE *pRoot,
            /* [out] */ ULONG *pcErrorNodes,
            /* [out] */ DBCOMMANDTREE ***prgErrorNodes);

        HRESULT ( STDMETHODCALLTYPE *FreeCommandTree )(
            ICommandTree * This,
            /* [in] */ DBCOMMANDTREE **ppRoot);

        HRESULT ( STDMETHODCALLTYPE *GetCommandTree )(
            ICommandTree * This,
            /* [out] */ DBCOMMANDTREE **ppRoot);

        HRESULT ( STDMETHODCALLTYPE *SetCommandTree )(
            ICommandTree * This,
            /* [in] */ DBCOMMANDTREE **ppRoot,
            /* [in] */ DBCOMMANDREUSE dwCommandReuse,
            /* [in] */ BOOL fCopy);

        END_INTERFACE
    } ICommandTreeVtbl;

    interface ICommandTree
    {
        CONST_VTBL struct ICommandTreeVtbl *lpVtbl;
    };

#ifdef COBJMACROS

#define ICommandTree_QueryInterface(This,riid,ppvObject)	\
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define ICommandTree_AddRef(This)	\
    (This)->lpVtbl -> AddRef(This)

#define ICommandTree_Release(This)	\
    (This)->lpVtbl -> Release(This)

#define ICommandTree_FindErrorNodes(This,pRoot,pcErrorNodes,prgErrorNodes)	\
    (This)->lpVtbl -> FindErrorNodes(This,pRoot,pcErrorNodes,prgErrorNodes)

#define ICommandTree_FreeCommandTree(This,ppRoot)	\
    (This)->lpVtbl -> FreeCommandTree(This,ppRoot)

#define ICommandTree_GetCommandTree(This,ppRoot)	\
    (This)->lpVtbl -> GetCommandTree(This,ppRoot)

#define ICommandTree_SetCommandTree(This,ppRoot,dwCommandReuse,fCopy)	\
    (This)->lpVtbl -> SetCommandTree(This,ppRoot,dwCommandReuse,fCopy)

#endif /* COBJMACROS */

#endif 	/* C style interface */

HRESULT STDMETHODCALLTYPE ICommandTree_FindErrorNodes_Proxy(
    ICommandTree * This,
    /* [in] */ const DBCOMMANDTREE *pRoot,
    /* [out] */ ULONG *pcErrorNodes,
    /* [out] */ DBCOMMANDTREE ***prgErrorNodes);

void __RPC_STUB ICommandTree_FindErrorNodes_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);

HRESULT STDMETHODCALLTYPE ICommandTree_FreeCommandTree_Proxy(
    ICommandTree * This,
    /* [in] */ DBCOMMANDTREE **ppRoot);

void __RPC_STUB ICommandTree_FreeCommandTree_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);

HRESULT STDMETHODCALLTYPE ICommandTree_GetCommandTree_Proxy(
    ICommandTree * This,
    /* [out] */ DBCOMMANDTREE **ppRoot);

void __RPC_STUB ICommandTree_GetCommandTree_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);

HRESULT STDMETHODCALLTYPE ICommandTree_SetCommandTree_Proxy(
    ICommandTree * This,
    /* [in] */ DBCOMMANDTREE **ppRoot,
    /* [in] */ DBCOMMANDREUSE dwCommandReuse,
    /* [in] */ BOOL fCopy);

void __RPC_STUB ICommandTree_SetCommandTree_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);

#endif 	/* __ICommandTree_INTERFACE_DEFINED__ */

#ifndef __IQuery_INTERFACE_DEFINED__
#define __IQuery_INTERFACE_DEFINED__

/* interface IQuery */
/* [unique][uuid][object][local] */

EXTERN_C const IID IID_IQuery;

#if defined(__cplusplus) && !defined(CINTERFACE)

    MIDL_INTERFACE("0c733a51-2a1c-11ce-ade5-00aa0044773d")
    IQuery : public ICommandTree
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE AddPostProcessing(
            /* [in] */ DBCOMMANDTREE **ppRoot,
            /* [in] */ BOOL fCopy) = 0;

        virtual HRESULT STDMETHODCALLTYPE GetCardinalityEstimate(
            /* [out] */ DBORDINAL *pulCardinality) = 0;

    };

#else 	/* C style interface */

    typedef struct IQueryVtbl
    {
        BEGIN_INTERFACE

        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
            IQuery * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void **ppvObject);

        ULONG ( STDMETHODCALLTYPE *AddRef )(
            IQuery * This);

        ULONG ( STDMETHODCALLTYPE *Release )(
            IQuery * This);

        HRESULT ( STDMETHODCALLTYPE *FindErrorNodes )(
            IQuery * This,
            /* [in] */ const DBCOMMANDTREE *pRoot,
            /* [out] */ ULONG *pcErrorNodes,
            /* [out] */ DBCOMMANDTREE ***prgErrorNodes);

        HRESULT ( STDMETHODCALLTYPE *FreeCommandTree )(
            IQuery * This,
            /* [in] */ DBCOMMANDTREE **ppRoot);

        HRESULT ( STDMETHODCALLTYPE *GetCommandTree )(
            IQuery * This,
            /* [out] */ DBCOMMANDTREE **ppRoot);

        HRESULT ( STDMETHODCALLTYPE *SetCommandTree )(
            IQuery * This,
            /* [in] */ DBCOMMANDTREE **ppRoot,
            /* [in] */ DBCOMMANDREUSE dwCommandReuse,
            /* [in] */ BOOL fCopy);

        HRESULT ( STDMETHODCALLTYPE *AddPostProcessing )(
            IQuery * This,
            /* [in] */ DBCOMMANDTREE **ppRoot,
            /* [in] */ BOOL fCopy);

        HRESULT ( STDMETHODCALLTYPE *GetCardinalityEstimate )(
            IQuery * This,
            /* [out] */ DBORDINAL *pulCardinality);

        END_INTERFACE
    } IQueryVtbl;

    interface IQuery
    {
        CONST_VTBL struct IQueryVtbl *lpVtbl;
    };

#ifdef COBJMACROS

#define IQuery_QueryInterface(This,riid,ppvObject)	\
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define IQuery_AddRef(This)	\
    (This)->lpVtbl -> AddRef(This)

#define IQuery_Release(This)	\
    (This)->lpVtbl -> Release(This)

#define IQuery_FindErrorNodes(This,pRoot,pcErrorNodes,prgErrorNodes)	\
    (This)->lpVtbl -> FindErrorNodes(This,pRoot,pcErrorNodes,prgErrorNodes)

#define IQuery_FreeCommandTree(This,ppRoot)	\
    (This)->lpVtbl -> FreeCommandTree(This,ppRoot)

#define IQuery_GetCommandTree(This,ppRoot)	\
    (This)->lpVtbl -> GetCommandTree(This,ppRoot)

#define IQuery_SetCommandTree(This,ppRoot,dwCommandReuse,fCopy)	\
    (This)->lpVtbl -> SetCommandTree(This,ppRoot,dwCommandReuse,fCopy)

#define IQuery_AddPostProcessing(This,ppRoot,fCopy)	\
    (This)->lpVtbl -> AddPostProcessing(This,ppRoot,fCopy)

#define IQuery_GetCardinalityEstimate(This,pulCardinality)	\
    (This)->lpVtbl -> GetCardinalityEstimate(This,pulCardinality)

#endif /* COBJMACROS */

#endif 	/* C style interface */

HRESULT STDMETHODCALLTYPE IQuery_AddPostProcessing_Proxy(
    IQuery * This,
    /* [in] */ DBCOMMANDTREE **ppRoot,
    /* [in] */ BOOL fCopy);

void __RPC_STUB IQuery_AddPostProcessing_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);

HRESULT STDMETHODCALLTYPE IQuery_GetCardinalityEstimate_Proxy(
    IQuery * This,
    /* [out] */ DBORDINAL *pulCardinality);

void __RPC_STUB IQuery_GetCardinalityEstimate_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);

#endif 	/* __IQuery_INTERFACE_DEFINED__ */

/* interface __MIDL_itf_cmdtree_0359 */
/* [local] */

#include <poppack.h>     // restore original structure packing

extern RPC_IF_HANDLE __MIDL_itf_cmdtree_0359_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_cmdtree_0359_v0_0_s_ifspec;

/* Additional Prototypes for ALL interfaces */

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif


text:
namespace {
const int64_t kActivationDelayMS = 200;
}

// static
TabScrubber* TabScrubber::GetInstance() {
  static TabScrubber* instance = NULL;
  if (!instance)
    instance = new TabScrubber();
  return instance;
}

// static
gfx::Point TabScrubber::GetStartPoint(
    TabStrip* tab_strip,
    int index,
    TabScrubber::Direction direction) {
  int initial_tab_offset = Tab::GetPinnedWidth() / 2;
  // In RTL layouts the tabs are mirrored. We hence use GetMirroredBounds()
  // which will give us the correct bounds of tabs in RTL layouts as well as
  // non-RTL layouts (in non-RTL layouts GetMirroredBounds() is the same as
  // bounds()).
  gfx::Rect tab_bounds = tab_strip->tab_at(index)->GetMirroredBounds();
  float x = direction == LEFT ?
      tab_bounds.x() + initial_tab_offset :
          tab_bounds.right() - initial_tab_offset;
  return gfx::Point(x, tab_bounds.CenterPoint().y());
}

bool TabScrubber::IsActivationPending() {
  return activate_timer_.IsRunning();
}

TabScrubber::TabScrubber()
    : scrubbing_(false),
      browser_(nullptr),
      tab_strip_(nullptr),
      swipe_x_(-1),
      swipe_y_(-1),
      swipe_direction_(LEFT),
      highlighted_tab_(-1),
      activate_timer_(true, false),
      activation_delay_(kActivationDelayMS),
      use_default_activation_delay_(true),
      weak_ptr_factory_(this) {
  ash::Shell::GetInstance()->AddPreTargetHandler(this);
  registrar_.Add(
      this,
      chrome::NOTIFICATION_BROWSER_CLOSED,
      content::NotificationService::AllSources());
}

TabScrubber::~TabScrubber() {
  // Note: The weak_ptr_factory_ should invalidate  its weak pointers before
  // any other members are destroyed.
  weak_ptr_factory_.InvalidateWeakPtrs();
}

void TabScrubber::OnScrollEvent(ui::ScrollEvent* event) {
  if (event->type() == ui::ET_SCROLL_FLING_CANCEL ||
      event->type() == ui::ET_SCROLL_FLING_START) {
    FinishScrub(true);
    immersive_reveal_lock_.reset();
    return;
  }

  if (event->finger_count() != 3)
    return;

  Browser* browser = GetActiveBrowser();
  if (!browser || (scrubbing_ && browser_ && browser != browser_) ||
      (highlighted_tab_ != -1 &&
          highlighted_tab_ >= browser->tab_strip_model()->count())) {
    FinishScrub(false);
    return;
  }

  BrowserView* browser_view =
      BrowserView::GetBrowserViewForNativeWindow(
          browser->window()->GetNativeWindow());
  TabStrip* tab_strip = browser_view->tabstrip();

  if (tab_strip->IsAnimating()) {
    FinishScrub(false);
    return;
  }

  // We are handling the event.
  event->StopPropagation();

  // The event's x_offset doesn't change in an RTL layout. Negative value means
  // left, positive means right.
  float x_offset = event->x_offset();
  int initial_tab_index = highlighted_tab_ == -1
                              ? browser->tab_strip_model()->active_index()
                              : highlighted_tab_;
  if (!scrubbing_) {
    BeginScrub(browser, browser_view, x_offset);
  } else if (highlighted_tab_ == -1) {
    // Has the direction of the swipe changed while scrubbing?
    Direction direction = (x_offset < 0) ? LEFT : RIGHT;
    if (direction != swipe_direction_)
      ScrubDirectionChanged(direction);
  }

  UpdateSwipeX(x_offset);

  Tab* initial_tab = tab_strip_->tab_at(initial_tab_index);
  gfx::Point tab_point(swipe_x_, swipe_y_);
  views::View::ConvertPointToTarget(tab_strip_, initial_tab, &tab_point);
  Tab* new_tab = tab_strip_->GetTabAt(initial_tab, tab_point);
  if (!new_tab)
    return;

  int new_index = tab_strip_->GetModelIndexOfTab(new_tab);
  if (highlighted_tab_ == -1 &&
      new_index == browser_->tab_strip_model()->active_index()) {
    return;
  }

  if (new_index != highlighted_tab_) {
    if (activate_timer_.IsRunning())
      activate_timer_.Reset();
    else
      ScheduleFinishScrubIfNeeded();
  }

  UpdateHighlightedTab(new_tab, new_index);

  if (highlighted_tab_ != -1) {
    gfx::Point hover_point(swipe_x_, swipe_y_);
    views::View::ConvertPointToTarget(tab_strip_, new_tab, &hover_point);
    new_tab->hover_controller()->SetLocation(hover_point);
  }
}

void TabScrubber::Observe(int type,
                          const content::NotificationSource& source,
                          const content::NotificationDetails& details) {
  if (content::Source<Browser>(source).ptr() == browser_) {
    activate_timer_.Stop();
    swipe_x_ = -1;
    swipe_y_ = -1;
    scrubbing_ = false;
    highlighted_tab_ = -1;
    browser_ = nullptr;
    tab_strip_ = nullptr;
  }
}

void TabScrubber::TabStripAddedTabAt(TabStrip* tab_strip, int index) {
  if (highlighted_tab_ == -1)
    return;

  if (index < highlighted_tab_)
    ++highlighted_tab_;
}

void TabScrubber::TabStripMovedTab(TabStrip* tab_strip,
                                   int from_index,
                                   int to_index) {
  if (highlighted_tab_ == -1)
    return;

  if (from_index == highlighted_tab_)
    highlighted_tab_ = to_index;
  else if (from_index < highlighted_tab_&& highlighted_tab_<= to_index)
    --highlighted_tab_;
  else if (from_index > highlighted_tab_ && highlighted_tab_ >= to_index)
    ++highlighted_tab_;
}

void TabScrubber::TabStripRemovedTabAt(TabStrip* tab_strip, int index) {
  if (highlighted_tab_ == -1)
    return;
  if (index == highlighted_tab_) {
    FinishScrub(false);
    return;
  }
  if (index < highlighted_tab_)
    --highlighted_tab_;
}

void TabScrubber::TabStripDeleted(TabStrip* tab_strip) {
  if (highlighted_tab_ == -1)
    return;
}

Browser* TabScrubber::GetActiveBrowser() {
  aura::Window* active_window = ash::wm::GetActiveWindow();
  if (!active_window)
    return NULL;

  Browser* browser = chrome::FindBrowserWithWindow(active_window);
  if (!browser || browser->type() != Browser::TYPE_TABBED)
    return NULL;

  return browser;
}

void TabScrubber::BeginScrub(Browser* browser,
                             BrowserView* browser_view,
                             float x_offset) {
  DCHECK(browser);
  DCHECK(browser_view);

  scrubbing_ = true;
  browser_ = browser;
  tab_strip_ = browser_view->tabstrip();

  Direction direction = (x_offset < 0) ? LEFT : RIGHT;
  ScrubDirectionChanged(direction);

  ImmersiveModeController* immersive_controller =
      browser_view->immersive_mode_controller();
  if (immersive_controller->IsEnabled()) {
    immersive_reveal_lock_.reset(immersive_controller->GetRevealedLock(
        ImmersiveModeController::ANIMATE_REVEAL_YES));
  }

  tab_strip_->AddObserver(this);
}

void TabScrubber::FinishScrub(bool activate) {
  activate_timer_.Stop();

  if (browser_ && browser_->window()) {
    BrowserView* browser_view =
        BrowserView::GetBrowserViewForNativeWindow(
            browser_->window()->GetNativeWindow());
    TabStrip* tab_strip = browser_view->tabstrip();
    if (activate && highlighted_tab_ != -1) {
      Tab* tab = tab_strip->tab_at(highlighted_tab_);
      tab->hover_controller()->HideImmediately();
      int distance =
          std::abs(
              highlighted_tab_ - browser_->tab_strip_model()->active_index());
      UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 1, 20, 21);
      browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true);
    }
    tab_strip->RemoveObserver(this);
  }

  browser_ = nullptr;
  tab_strip_ = nullptr;
  swipe_x_ = -1;
  swipe_y_ = -1;
  scrubbing_ = false;
  highlighted_tab_ = -1;
}

void TabScrubber::ScheduleFinishScrubIfNeeded() {
  int delay = use_default_activation_delay_
                  ? ui::GestureConfiguration::GetInstance()
                        ->tab_scrub_activation_delay_in_ms()
                  : activation_delay_;

  if (delay >= 0) {
    activate_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(delay),
                          base::Bind(&TabScrubber::FinishScrub,
                                     weak_ptr_factory_.GetWeakPtr(), true));
  }
}

void TabScrubber::ScrubDirectionChanged(Direction direction) {
  DCHECK(browser_);
  DCHECK(tab_strip_);
  DCHECK(scrubbing_);

  swipe_direction_ = direction;
  const gfx::Point start_point =
      GetStartPoint(tab_strip_, browser_->tab_strip_model()->active_index(),
                    swipe_direction_);
  swipe_x_ = start_point.x();
  swipe_y_ = start_point.y();
}

void TabScrubber::UpdateSwipeX(float x_offset) {
  DCHECK(browser_);
  DCHECK(tab_strip_);
  DCHECK(scrubbing_);

  swipe_x_ += x_offset;

  // In an RTL layout, everything is mirrored, i.e. the index of the first tab
  // (with the smallest X mirrored co-ordinates) is actually the index of the
  // last tab. Same for the index of the last tab.
  int first_tab_index = base::i18n::IsRTL() ? tab_strip_->tab_count() - 1 : 0;
  int last_tab_index = base::i18n::IsRTL() ? 0 : tab_strip_->tab_count() - 1;

  Tab* first_tab = tab_strip_->tab_at(first_tab_index);
  int first_tab_center = first_tab->GetMirroredBounds().CenterPoint().x();
  Tab* last_tab = tab_strip_->tab_at(last_tab_index);
  int last_tab_center = last_tab->GetMirroredBounds().CenterPoint().x();

  if (swipe_x_ < first_tab_center)
    swipe_x_ = first_tab_center;
  if (swipe_x_ > last_tab_center)
    swipe_x_ = last_tab_center;
}

void TabScrubber::UpdateHighlightedTab(Tab* new_tab, int new_index) {
  DCHECK(scrubbing_);
  DCHECK(new_tab);

  if (new_index == highlighted_tab_)
    return;

  if (highlighted_tab_ != -1) {
    Tab* tab = tab_strip_->tab_at(highlighted_tab_);
    tab->hover_controller()->HideImmediately();
  }

  if (new_index != browser_->tab_strip_model()->active_index()) {
    highlighted_tab_ = new_index;
    new_tab->hover_controller()->Show(views::GlowHoverController::PRONOUNCED);
  } else {
    highlighted_tab_ = -1;
  }
}


text:
package com.indignado.games.smariano.model.managers;

import com.badlogic.gdx.math.Vector2;
import com.indignado.games.smariano.model.entities.Hero;
import com.indignado.games.smariano.model.entities.Hero.StateHero;
import com.indignado.games.smariano.model.entities.MovingPlatform;
import com.indignado.games.smariano.model.entities.base.Box2DPhysicsObject;
import com.indignado.games.smariano.model.entities.base.Box2DPhysicsObject.GRUPO;

public class PlatformManager extends AbstractWorldManager {

    @Override
    public void update(float delta, Box2DPhysicsObject entity) {
        MovingPlatform platform = (MovingPlatform) entity;
        updateMovingPlatform(platform, delta);
    }

    public void updateMovingPlatform(MovingPlatform platform, float delta) {

        if ((platform.waitForPassenger && platform.getPassengers().size() == 0) || !platform.enabled) {
            platform.getBodyA().setLinearVelocity(new Vector2(0f, 0f));
        } else {

            boolean check = platform.getPath().update(platform.getBodyA().getPosition(), delta);
            Vector2 velPlatform = platform.getPath().getVelocity().cpy();

            if (check && velPlatform.y < 0) {
                for (Box2DPhysicsObject passenger : platform.getPassengers()) {
                    float force = passenger.getBodyA().getMass() * velPlatform.y * 2;
                    passenger.getBodyA().applyLinearImpulse(0, force, passenger.getBodyA().getPosition().x,
                            passenger.getBodyA().getPosition().y, true);
                }
            }
            platform.getBodyA().setLinearVelocity(velPlatform);
        }
    }

    public MovingPlatform getMovingPlatform(Contact contact) {
        Box2DPhysicsObject box2dPhysicsA = (Box2DPhysicsObject) contact.getFixtureA().getUserData();
        Box2DPhysicsObject box2dPhysicsB = (Box2DPhysicsObject) contact.getFixtureB().getUserData();

        if (box2dPhysicsA.getGrupo().equals(GRUPO.MOVING_PLATFORM)) {
            return (MovingPlatform) box2dPhysicsA;
        } else {
            return (MovingPlatform) box2dPhysicsB;
        }
    }

    public Box2DPhysicsObject getPassenger(Contact contact) {
        Box2DPhysicsObject box2dPhysicsA = (Box2DPhysicsObject) contact.getFixtureA().getUserData();
        Box2DPhysicsObject box2dPhysicsB = (Box2DPhysicsObject) contact.getFixtureB().getUserData();

        if (!box2dPhysicsA.getGrupo().equals(GRUPO.MOVING_PLATFORM)) {
            return box2dPhysicsA;
        } else {
            return box2dPhysicsB;
        }
    }

    public Vector2 getRelativeVelocity(MovingPlatform movingPlatform, Box2DPhysicsObject passenger, Vector2 point) {
        Vector2 velMovingPlatform = movingPlatform.getBodyA().getLinearVelocityFromWorldPoint(point);
        Vector2 velPassenger = passenger.getBodyA().getLinearVelocityFromWorldPoint(point);
        return movingPlatform.getBodyA().getLocalVector(velPassenger.cpy().sub(velMovingPlatform));
    }

    @Override
    public void handleBeginContact(Contact contact) {
        MovingPlatform movingPlatform = getMovingPlatform(contact);
        contact.setEnabled(movingPlatform.enabled);
    }

    @Override
    public void handleEndContact(Contact contact) {
        MovingPlatform movingPlatform = getMovingPlatform(contact);
        Box2DPhysicsObject passenger = getPassenger(contact);
        movingPlatform.getPassengers().remove(passenger);
        movingPlatform.enabled = true;
        contact.setEnabled(movingPlatform.enabled);
    }

    @Override
    public void handlePostSolve(Contact contact, ContactImpulse impulse) {

    }

    @Override
    public void handlePreSolve(Contact contact, Manifold oldManifold) {
        Box2DPhysicsObject passenger = getPassenger(contact);
        MovingPlatform movingPlatform = getMovingPlatform(contact);

        if (contact.isEnabled()) {
            if (passenger.getGrupo().equals(GRUPO.HERO) &&
                    !((Hero) passenger).getState().equals(StateHero.WALKING)) {
                contact.setFriction(100f);
            } else if (passenger.getGrupo().equals(GRUPO.HERO) &&
                    !((Hero) passenger).getState().equals(StateHero.WALKING)) {
                contact.setFriction(0);
            }

        }
        WorldManifold manifold = contact.getWorldManifold();
        for (Vector2 point : manifold.getPoints()) {
            Vector2 pointVelPlatform = movingPlatform.getBodyA().getLinearVelocityFromWorldPoint(point);
            Vector2 pointVelOther = passenger.getBodyA().getLinearVelocityFromWorldPoint(point);
            Vector2 relativeVel = movingPlatform.getBodyA().getLocalVector(pointVelOther.sub(pointVelPlatform));

            if (relativeVel.y < -1) {
                movingPlatform.getPassengers().add(passenger);
                movingPlatform.enabled = true;
                return;
            } else if (relativeVel.y < 1) {
                Vector2 relativePoint = movingPlatform.getBodyA().getLocalPoint(point);
                float platformFaceY = 0.5f;
                if (relativePoint.y > platformFaceY - 0.05) {
                    if (contact.getFixtureA().equals(((Hero) passenger).getHeroPhysicsFixture()))
                        System.out.println(" relativeVel < 1 " + relativeVel);
                    movingPlatform.getPassengers().add(passenger);
                    movingPlatform.enabled = true;
                    Vector2 force = contact.getWorldManifold().getNormal();
                    if (Math.abs(force.x) == 1f && force.y == 0f) {

                        if (contact.getFixtureA().equals(((Hero) passenger).getHeroPhysicsFixture())) {
                            force.scl(-6);
                        } else if (contact.getFixtureB().equals(((Hero) passenger).getHeroPhysicsFixture())) {
                            force.scl(6);
                        }
                        passenger.getBodyA().applyLinearImpulse(force, passenger.getBodyA().getWorldCenter(), true);
                        System.out.println("Fuerza colision Platform: " + force);
                    }
                    return;
                }
            }

        }

        movingPlatform.enabled = false;
        contact.setEnabled(movingPlatform.enabled);

    }

    @Override
    public boolean handleShouldCollide(Fixture fixtureA, Fixture fixtureB) {
        return false;
    }

    @Override
    public void dispose() {

    }
}