text:
<?php

/**
 * @file
 * Contains \Drupal\Tests\Core\Database\ConnectionTest.
 */

namespace Drupal\Tests\Core\Database;

use Drupal\Tests\Core\Database\Stub\StubConnection;
use Drupal\Tests\Core\Database\Stub\StubPDO;
use Drupal\Tests\UnitTestCase;

/**
 * Tests the Connection class.
 *
 * @group Database
 */
class ConnectionTest extends UnitTestCase {

  /**
   * Dataprovider for testPrefixRoundTrip().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Arguments to pass to Connection::setPrefix().
   *   - Expected result from Connection::tablePrefix().
   */
  public function providerPrefixRoundTrip() {
    return array(
      array(
        array('' => 'test_'),
        'test_',
      ),
      array(
        array(
          'fooTable' => 'foo_',
          'barTable' => 'bar_',
        ),
        array(
          'fooTable' => 'foo_',
          'barTable' => 'bar_',
        ),
      ),
    );
  }

  /**
   * Exercise setPrefix() and tablePrefix().
   *
   * @dataProvider providerPrefixRoundTrip
   */
  public function testPrefixRoundTrip($expected, $prefix_info) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array());

    // setPrefix() is protected, so we make it accessible with reflection.
    $reflection = new \ReflectionClass('Drupal\Tests\Core\Database\Stub\StubConnection');
    $set_prefix = $reflection->getMethod('setPrefix');
    $set_prefix->setAccessible(TRUE);

    // Set the prefix data.
    $set_prefix->invokeArgs($connection, array($prefix_info));
    // Check the round-trip.
    foreach ($expected as $table => $prefix) {
      $this->assertEquals($prefix, $connection->tablePrefix($table));
    }
  }

  /**
   * Dataprovider for testPrefixTables().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Expected result.
   *   - Table prefix.
   *   - Query to be prefixed.
   */
  public function providerTestPrefixTables() {
    return array(
      array(
        'SELECT * FROM test_table',
        'test_',
        'SELECT * FROM {table}',
      ),
      array(
        'SELECT * FROM first_table JOIN second_thingie',
        array(
          'table' => 'first_',
          'thingie' => 'second_',
        ),
        'SELECT * FROM {table} JOIN {thingie}',
      ),
    );
  }

  /**
   * Exercise the prefixTables() method.
   *
   * @dataProvider providerTestPrefixTables
   */
  public function testPrefixTables($expected, $prefix_info, $query) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array('prefix' => $prefix_info));
    $this->assertEquals($expected, $connection->prefixTables($query));
  }

  /**
   * Dataprovider for testEscapeMethods().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Expected escaped string.
   *   - String to escape.
   */
  public function providerEscapeMethods() {
    return array(
      array('thing', 'thing'),
      array('_item', '_item'),
      array('item_', 'item_'),
      array('_item_', '_item_'),
      array('', '!@#$%^&*()-=+'),
      array('123', '!1@2#3'),
    );
  }

  /**
   * Test the various escaping methods.
   *
   * All tested together since they're basically the same method
   * with different names.
   *
   * @dataProvider providerEscapeMethods
   * @todo Separate test method for each escape method?
   */
  public function testEscapeMethods($expected, $name) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array());
    $this->assertEquals($expected, $connection->escapeDatabase($name));
    $this->assertEquals($expected, $connection->escapeTable($name));
    $this->assertEquals($expected, $connection->escapeField($name));
    $this->assertEquals($expected, $connection->escapeAlias($name));
  }

  /**
   * Dataprovider for testGetDriverClass().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Expected namespaced class name.
   *   - Driver.
   *   - Namespace.
   *   - Class name without namespace.
   */
  public function providerGetDriverClass() {
    return array(
      array(
        'nonexistent_class',
        'stub',
        '\\',
        'nonexistent_class',
      ),
      array(
        'Drupal\\Core\\Database\\Driver\\mysql\\Select',
        'mysql',
        NULL,
        'Select',
      ),
      array(
        'Drupal\\Tests\\Core\\Database\\Stub\\Driver\\Schema',
        'stub',
        'Drupal\\Tests\\Core\\Database\\Stub\\Driver',
        'Schema',
      ),
    );
  }

  /**
   * Test getDriverClass().
   *
   * @dataProvider providerGetDriverClass
   */
  public function testGetDriverClass($expected, $driver, $namespace, $class) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array('namespace' => $namespace));
    // Set the driver using our stub class' public property.
    $connection->driver = $driver;
    $this->assertEquals($expected, $connection->getDriverClass($class));
  }

  /**
   * Dataprovider for testSchema().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Expected namespaced class of schema object.
   *   - Driver for PDO connection.
   *   - Namespace for connection.
   */
  public function providerSchema() {
    return array(
      array(
        'Drupal\\Tests\\Core\\Database\\Stub\\Driver\\Schema',
        'stub',
        'Drupal\\Tests\\Core\\Database\\Stub\\Driver',
      ),
    );
  }

  /**
   * Test Connection::schema().
   *
   * @dataProvider providerSchema
   */
  public function testSchema($expected, $driver, $namespace) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array('namespace' => $namespace));
    $connection->driver = $driver;
    $this->assertInstanceOf($expected, $connection->schema());
  }

  /**
   * Test Connection::destroy().
   */
  public function testDestroy() {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    // Mocking StubConnection gives us access to the $schema attribute.
    $connection = $this->getMock(
      'Drupal\Tests\Core\Database\Stub\StubConnection',
      NULL,
      array($mock_pdo, array('namespace' => 'Drupal\\Tests\\Core\\Database\\Stub\\Driver'))
    );
    // Generate a schema object in order to verify that we've NULLed it later.
    $this->assertInstanceOf(
      'Drupal\\Tests\\Core\\Database\\Stub\\Driver\\Schema',
      $connection->schema()
    );
    $connection->destroy();
    $this->assertAttributeEquals(NULL, 'schema', $connection);
  }

  /**
   * Dataprovider for testMakeComments().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Expected filtered comment.
   *   - Arguments for Connection::makeComment().
   */
  public function providerMakeComments() {
    return array(
      array(
        '/*  */ ',
        array(''),
      ),
      array(
        '/* Exploit * / DROP TABLE node; -- */ ',
        array('Exploit * / DROP TABLE node; --'),
      ),
      array(
        '/* Exploit DROP TABLE node; --; another comment */ ',
        array('Exploit */ DROP TABLE node; --', 'another comment'),
      ),
    );
  }

  /**
   * Test Connection::makeComments().
   *
   * @dataProvider providerMakeComments
   */
  public function testMakeComments($expected, $comment_array) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array());
    $this->assertEquals($expected, $connection->makeComment($comment_array));
  }

  /**
   * Dataprovider for testFilterComments().
   *
   * @return array
   *   Array of arrays with the following elements:
   *   - Expected filtered comment.
   *   - Comment to filter.
   */
  public function providerFilterComments() {
    return array(
      array('', ''),
      array('Exploit * / DROP TABLE node; --', 'Exploit * / DROP TABLE node; --'),
      array('Exploit DROP TABLE node; --', 'Exploit */ DROP TABLE node; --'),
    );
  }

  /**
   * Test Connection::filterComments().
   *
   * @dataProvider providerFilterComments
   */
  public function testFilterComments($expected, $comment) {
    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
    $connection = new StubConnection($mock_pdo, array());

    // filterComment() is protected, so we make it accessible with reflection.
    $reflection = new \ReflectionClass('Drupal\Tests\Core\Database\Stub\StubConnection');
    $filter_comment = $reflection->getMethod('filterComment');
    $filter_comment->setAccessible(TRUE);

    $this->assertEquals(
      $expected,
      $filter_comment->invokeArgs($connection, array($comment))
    );
  }

}


text:
dooaki\amazon-wishlist
===============

[![Build Status](https://travis-ci.org/do-aki/amazon-wishlist.svg?branch=master)](https://travis-ci.org/do-aki/amazon-wishlist)

parse wishlist on amazon.co.jp

Requirements
-------------
* PHP 5.4 or later

Installation
-------------

you can install the script with [Composer](http://getcomposer.org/).

in your `composer.json` file:
```
{
    "require": {
        "dooaki/amazon-wishlist": "dev-master"
    }
}
```

```
composer.phar install
```

Usage
-------------
```php
<?php

use dooaki\AmazonWishlist\AmazonWishlist;

// http://www.amazon.co.jp/gp/wishlist/[wishlist_token]/
$wishlist = new AmazonWishlist('wishlist_token');

var_dump($wishlist->export());

```

redpajama_set_name: RedPajamaGithub


text:
using System;

using Xamarin.Forms;
using DLToolkit.PageFactory;
using FFImageLoading.Forms.Sample.ViewModels;
using FFImageLoading.Forms.Sample.Models;
using System.Collections.Generic;
using FFImageLoading.Transformations;
using FFImageLoading.Work;

namespace FFImageLoading.Forms.Sample.Pages
{
	public class ListTransformationExamplePage :  PFContentPage<ListTransformationExampleViewModel>
	{
		public ListTransformationExamplePage()
		{
			Title = "List Transformations Demo";

			var listView = new ListView() {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				ItemTemplate = new DataTemplate(typeof(TransformationExampleCell)),
				HasUnevenRows = false,
				RowHeight = 210,
			};

			listView.SetBinding<ListTransformationExampleViewModel>(ListView.ItemsSourceProperty, v => v.Items);

            if (Device.OS == TargetPlatform.Android || Device.OS == TargetPlatform.iOS)
                listView.ItemSelected += (sender, e) => { listView.SelectedItem = null; };

			var button = new Button() {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Text = "Duplicate list items",
				Command = ViewModel.DuplicateListItemsCommand
			};

			Content = new StackLayout() {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {
					listView,
					button,
				}
			};
		}

		class TransformationExampleCell : ViewCell
		{
			public TransformationExampleCell()
			{
				var image = new CachedImage() {
					WidthRequest = 200,
					HeightRequest = 200,
					DownsampleHeight = 200,
					DownsampleUseDipUnits = true,
					TransparencyEnabled = false,
					Aspect = Aspect.AspectFill,
					CacheDuration = TimeSpan.FromDays(30),
					RetryCount = 3,
					RetryDelay = 500,
					LoadingPlaceholder = "loading.png",
					Transformations = new List<ITransformation>() {
						// new SepiaTransformation(),
						// new ColorSpaceTransformation(FFColorMatrix.InvertColorMatrix),
						// new BlurredTransformation(10),
						new GrayscaleTransformation(),
						new RoundedTransformation(60),
						// new CornersTransformation(50, 50, 50, 50, CornerTransformType.AllRounded),
					}
				};
				image.SetBinding<ListExampleItem>(CachedImage.SourceProperty, v => v.ImageUrl);

				var fileName = new Label() {
					LineBreakMode = LineBreakMode.CharacterWrap,
					YAlign = TextAlignment.Center,
					XAlign = TextAlignment.Center,
				};
				fileName.SetBinding<ListExampleItem>(Label.TextProperty, v => v.FileName);

				var root = new AbsoluteLayout() {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					VerticalOptions = LayoutOptions.FillAndExpand,
					Padding = 5,
				};

				root.Children.Add(image, new Rectangle(0f, 0f, 200f, 200f));
				root.Children.Add(fileName, new Rectangle(200f, 0f, 150f, 200f));

				View = root;
			}
		}
	}
}


text:
<tool id="EMBOSS: antigenic1" name="antigenic">
  <description>Predicts potentially antigenic regions of a protein sequence, using the method of Kolaskar and Tongaonkar.</description>
  <command>antigenic -sequence $input1 -outfile $out_file1 -minlen $minlen -rformat2 $out_format1 -auto</command>
  <inputs>
    <param format="data" name="input1" type="data">
      On query
    </param>
    <param name="minlen" size="4" type="text" value="6">
      Minimum Length of region
    </param>
    <param name="out_format1" type="select">
      Output format
      <option value="gff">GFF</option>
      <option value="pir">PIR</option>
      <option value="swiss">SwissProt</option>
      <option value="dbmotif">DbMotif</option>
      <option value="diffseq">diffseq</option>
      <option value="excel">Excel (TAB Delimited)</option>
      <option value="feattable">FeatTable</option>
      <option value="motif">Motif</option>
      <option value="nametable">NameTable</option>
      <option value="regions">Regions</option>
      <option value="seqtable">SeqTable</option>
      <option value="simple">SRS simple</option>
      <option value="srs">SRS</option>
      <option value="table">Table</option>
      <option value="tagseq">Tagseq</option>
    </param>
  </inputs>
  <outputs>
    <data format="txt" name="out_file1" />
  </outputs>

  <help>
    You can view the original documentation here_.

    .. _here: http://emboss.sourceforge.net/apps/antigenic.html
  </help>
</tool>


text:
package com.intellij.codeInsight.generation;

public interface ClassMember extends MemberChooserObject {
  ClassMember[] EMPTY_ARRAY = new ClassMember[0];

  /**
   * @return should override equals() and hashCode()
   */
  MemberChooserObject getParentNodeDelegate();

}


text:
.class public interface abstract Landroid/widget/SimpleCursorAdapter$CursorToStringConverter;
.super Ljava/lang/Object;
.source "SimpleCursorAdapter.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/widget/SimpleCursorAdapter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x609
    name = "CursorToStringConverter"
.end annotation

# virtual methods
.method public abstract convertToString(Landroid/database/Cursor;)Ljava/lang/CharSequence;
.end method


text:
;(function( win, doc ) {
    "use strict";

    var TEST_STRING = 'AxmTYklsjo190QW',
        SANS_SERIF_FONTS = 'sans-serif',
        SERIF_FONTS = 'serif',

        // lighter and bolder not supported
        weightLookup = {
            normal: '400',
            bold: '700'
        },

        defaultOptions = {
            tolerance: 2, // px
            delay: 100,
            glyphs: '',
            success: function() {},
            error: function() {},
            timeout: 5000,
            weight: '400', // normal
            style: 'normal'
        },

        // See https://github.com/typekit/webfontloader/blob/master/src/core/fontruler.js#L41
        style = [
            'display:block',
            'position:absolute',
            'top:-999px',
            'left:-999px',
            'font-size:48px',
            'width:auto',
            'height:auto',
            'line-height:normal',
            'margin:0',
            'padding:0',
            'font-variant:normal',
            'white-space:nowrap'
        ],
        html = '
' + TEST_STRING + '
';

    var FontFaceOnloadInstance = function() {
        this.fontFamily = '';
        this.appended = false;
        this.serif = undefined;
        this.sansSerif = undefined;
        this.parent = undefined;
        this.options = {};
    };

    FontFaceOnloadInstance.prototype.getMeasurements = function () {
        return {
            sansSerif: {
                width: this.sansSerif.offsetWidth,
                height: this.sansSerif.offsetHeight
            },
            serif: {
                width: this.serif.offsetWidth,
                height: this.serif.offsetHeight
            }
        };
    };

    FontFaceOnloadInstance.prototype.load = function () {
        var startTime = new Date(),
            that = this,
            serif = that.serif,
            sansSerif = that.sansSerif,
            parent = that.parent,
            appended = that.appended,
            dimensions,
            options = this.options,
            ref = options.reference;

        function getStyle( family ) {
            return style
                .concat( [ 'font-weight:' + options.weight, 'font-style:' + options.style ] )
                .concat( "font-family:" + family )
                .join( ";" );
        }

        var sansSerifHtml = html.replace( /\%s/, getStyle( SANS_SERIF_FONTS ) ),
            serifHtml = html.replace( /\%s/, getStyle(  SERIF_FONTS ) );

        if( !parent ) {
            parent = that.parent = doc.createElement( "div" );
        }

        parent.innerHTML = sansSerifHtml + serifHtml;
        sansSerif = that.sansSerif = parent.firstChild;
        serif = that.serif = sansSerif.nextSibling;

        if( options.glyphs ) {
            sansSerif.innerHTML += options.glyphs;
            serif.innerHTML += options.glyphs;
        }

        function hasNewDimensions( dims, el, tolerance ) {
            return Math.abs( dims.width - el.offsetWidth ) > tolerance ||
                    Math.abs( dims.height - el.offsetHeight ) > tolerance;
        }

        function isTimeout() {
            return ( new Date() ).getTime() - startTime.getTime() > options.timeout;
        }

        (function checkDimensions() {
            if( !ref ) {
                ref = doc.body;
            }
            if( !appended && ref ) {
                ref.appendChild( parent );
                appended = that.appended = true;

                dimensions = that.getMeasurements();

                // Make sure we set the new font-family after we take our initial dimensions:
                // handles the case where FontFaceOnload is called after the font has already
                // loaded.
                sansSerif.style.fontFamily = that.fontFamily + ', ' + SANS_SERIF_FONTS;
                serif.style.fontFamily = that.fontFamily + ', ' + SERIF_FONTS;
            }

            if( appended && dimensions &&
                ( hasNewDimensions( dimensions.sansSerif, sansSerif, options.tolerance ) ||
                    hasNewDimensions( dimensions.serif, serif, options.tolerance ) ) ) {

                options.success();
            } else if( isTimeout() ) {
                options.error();
            } else {
                if( !appended && "requestAnimationFrame" in window ) {
                    win.requestAnimationFrame( checkDimensions );
                } else {
                    win.setTimeout( checkDimensions, options.delay );
                }
            }
        })();
    }; // end load()

    FontFaceOnloadInstance.prototype.checkFontFaces = function( timeout ) {
        var _t = this;
        doc.fonts.forEach(function( font ) {
            if( font.family.toLowerCase() === _t.fontFamily.toLowerCase() &&
                ( weightLookup[ font.weight ] || font.weight ) === ''+_t.options.weight &&
                font.style === _t.options.style ) {
                font.load().then(function() {
                    _t.options.success();
                    win.clearTimeout( timeout );
                });
            }
        });
    };

    FontFaceOnloadInstance.prototype.init = function( fontFamily, options ) {
        var timeout;

        for( var j in defaultOptions ) {
            if( !options.hasOwnProperty( j ) ) {
                options[ j ] = defaultOptions[ j ];
            }
        }

        this.options = options;
        this.fontFamily = fontFamily;

        // For some reason this was failing on afontgarde + icon fonts.
        if( !options.glyphs && "fonts" in doc ) {
            if( options.timeout ) {
                timeout = win.setTimeout(function() {
                    options.error();
                }, options.timeout );
            }

            this.checkFontFaces( timeout );
        } else {
            this.load();
        }
    };

    var FontFaceOnload = function( fontFamily, options ) {
        var instance = new FontFaceOnloadInstance();
        instance.init(fontFamily, options);

        return instance;
    };

    // intentional global
    win.FontFaceOnload = FontFaceOnload;
})( this, this.document );


text:
package net.sourceforge.plantuml.descdiagram;

import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;

public class EntityImageDomain extends AbstractEntityImage {
	final private TextBlock name;
	final private TextBlock tag;
	final private TextBlock stereo;
	final private Url url;

	public EntityImageDomain(ILeaf entity, ISkinParam skinParam, char typeLetter) {
		super(entity, skinParam);
		final Stereotype stereotype = entity.getStereotype();
		FontConfiguration fc = FontConfiguration.create(getSkinParam(), FontParam.DESIGNED_DOMAIN, stereotype);
		this.name = TextBlockUtils.withMargin(entity.getDisplay().create(fc, HorizontalAlignment.CENTER, skinParam), 2,
				2);
		if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) {
			this.stereo = null;
		} else {
			this.stereo = Display.create(stereotype.getLabels(skinParam.guillemet())).create(
					FontConfiguration.create(getSkinParam(), FontParam.DESIGNED_DOMAIN_STEREOTYPE, stereotype),
					HorizontalAlignment.CENTER, skinParam);
		}
		this.tag = new BoxedCharacter(typeLetter, 8, UFont.byDefault(8), stereotype.getHtmlColor(), null, fc.getColor());

		this.url = entity.getUrl99();
	}

	private UStroke getStroke() {
		UStroke stroke = getSkinParam().getThickness(LineParam.domainBorder, getStereo());

		if (stroke == null) {
			stroke = new UStroke(1.5);
		}
		return stroke;
	}

	private XDimension2D getTitleDimension(StringBounder stringBounder) {
		return getNameAndSteretypeDimension(stringBounder);
	}

	private XDimension2D getNameAndSteretypeDimension(StringBounder stringBounder) {
		final XDimension2D nameDim = name.calculateDimension(stringBounder);
		final XDimension2D stereoDim = stereo == null ? new XDimension2D(0, 0) : stereo
				.calculateDimension(stringBounder);
		final XDimension2D nameAndStereo = new XDimension2D(Math.max(nameDim.getWidth(), stereoDim.getWidth()),
				nameDim.getHeight() + stereoDim.getHeight());
		return nameAndStereo;
	}

	public double getStartingX(StringBounder stringBounder, double y) {
		return 0;
	}

	public double getEndingX(StringBounder stringBounder, double y) {
		return calculateDimension(stringBounder).getWidth();
	}

	final public void drawU(UGraphic ug) {
		final StringBounder stringBounder = ug.getStringBounder();
		final XDimension2D dimTotal = calculateDimension(stringBounder);
		final XDimension2D dimTitle = getTitleDimension(stringBounder);
		final XDimension2D dimTag = getTagDimension(stringBounder);
		final double widthTotal = dimTotal.getWidth();
		final double heightTotal = dimTotal.getHeight();
		final URectangle rect = new URectangle(widthTotal, heightTotal);

		ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBorder));
		HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
		if (backcolor == null) {
			backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBackground);
		}
		ug = ug.apply(backcolor.bg());
		if (url != null) {
			ug.startUrl(url);
		}

		final UStroke stroke = getStroke();
		ug.apply(stroke).draw(rect);

		final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder()));
		header.add(name);
		header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight());
		final ULayoutGroup footer = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder()));
		footer.add(tag);
		footer.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTag.getWidth(), dimTitle.getHeight())),
				dimTag.getWidth(), dimTag.getHeight());
		if (url != null) {
			ug.closeUrl();
		}
	}

	private XDimension2D getTagDimension(StringBounder stringBounder) {
		final XDimension2D tagDim = tag == null ? new XDimension2D(0, 0) : tag.calculateDimension(stringBounder);
		return tagDim;
	}

	public ShapeType getShapeType() {
		return ShapeType.RECTANGLE;
	}

	public XDimension2D calculateDimension(StringBounder stringBounder) {
		final XDimension2D dimTitle = getTitleDimension(stringBounder);
		final double width = dimTitle.getWidth();
		final double height = dimTitle.getHeight();
		final XDimension2D dimTag = getTagDimension(stringBounder);
		return new XDimension2D(width, height + dimTag.getHeight());
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.lucene" slot="4.6">
  <resources>
    <resource-root path="lucene-analyzers-common-4.10.2.jar" />
    <resource-root path="lucene-core-4.10.2.jar" />
    <resource-root path="lucene-queries-4.10.2.jar" />
    <resource-root path="lucene-queryparser-4.10.2.jar" />
    <resource-root path="lucene-sandbox-4.10.2.jar" />
  </resources>
  <dependencies />
</module>


text:
const {extend, parse} = require('cjson');
const {readFileSync, writeFileSync} = require('fs');
const {join, resolve} = require('path');

// Constants
const ROOT_DIR = resolve(__dirname, '..');
const TS_CONFIG_PATH = join(ROOT_DIR, 'tsconfig.json');
const NG_COMPILER_OPTS = {
  angularCompilerOptions: {
    enableIvy: false,
  },
};

// Run
_main(process.argv.slice(2));

// Functions - Definitions
function _main() {
  // Enable ViewIngine/Disable Ivy in TS config.
  console.log(`\nModifying \`${TS_CONFIG_PATH}\`...`);
  const oldTsConfigStr = readFileSync(TS_CONFIG_PATH, 'utf8');
  const oldTsConfigObj = parse(oldTsConfigStr);
  const newTsConfigObj = extend(true, oldTsConfigObj, NG_COMPILER_OPTS);
  const newTsConfigStr = `${JSON.stringify(newTsConfigObj, null, 2)}\n`;
  console.log(`\nNew config: ${newTsConfigStr}`);
  writeFileSync(TS_CONFIG_PATH, newTsConfigStr);

  // Done.
  console.log('\nReady to build with ViewEngine!');
  console.log('(To switch back to Ivy (with packages from npm), undo the changes in ' +
              `\`${TS_CONFIG_PATH}\` and run \`yarn aio-use-npm && yarn example-use-npm\`.)`);
}


text:
require "rails/generators/test_unit"

module TestUnit # :nodoc:
  module Generators # :nodoc:
    class GeneratorGenerator < Base # :nodoc:
      check_class_collision suffix: "GeneratorTest"

      class_option :namespace, type: :boolean, default: true,
                               desc: "Namespace generator under lib/generators/name"

      def create_generator_files
        template "generator_test.rb", File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
      end

    private

      def generator_path
        if options[:namespace]
          File.join("generators", regular_class_path, file_name, "#{file_name}_generator")
        else
          File.join("generators", regular_class_path, "#{file_name}_generator")
        end
      end
    end
  end
end


text:
"""
Quotes
======

The ``quotes`` plugin can be used to capture quotes in a database. It will also
print a quote containg the name of the joining person on every join.

It provides the following commands:

- ``qadd <quote>``

  Adds a new quote to the database

- ``qdelete <quote id>``

  Admin only.

  Deletes the quote with the specified ID.

- ``qget <quote id>``

  Get the quote with the specified ID.

- ``qlast``

  Get the last inserted quote.

- ``qrandom``

  Retrieve a random quote.

- ``qdislike <quote id>``

  Dislikes the quote.

- ``qlike <quote id>``

  Likes the quote.

- ``qtop <limit>``

  Shows the ``limit`` (default: ``max_quotes``) quotes with the best rating.

- ``qflop <limit>``

  Shows the ``limit`` (default: ``max_quotes``) quotes with the worst rating.

- ``quotestats``

  Display some stats about the quote database.
  This is currently limited to the total number of quotes and the percentage
  of quotes per author.

- ``searchquote <text>``

  Search for a quote containing ``text``.

Options
-------

- ``database_path``

  The path to the SQLite database file. Defaults to ``~/.lala/quotes.sqlite3``.

- ``max_quotes``

  The maximum number of quotes to print when using ``searchquote`` or
  ``qtop``/``qflop``. Defaults to 5.
"""
from __future__ import division
import logging
import os

from collections import defaultdict
from functools import partial
from lala.util import command, msg, on_join
from lala.config import get, get_int
from twisted.enterprise import adbapi
from twisted.internet.defer import inlineCallbacks

__all__ = ()

DEFAULT_OPTIONS = {"DATABASE_PATH": os.path.join(os.path.expanduser("~/.lala"),
                                                 "quotes.sqlite3"),
                   "MAX_QUOTES": "5"}

MESSAGE_TEMPLATE = "[%s] %s"
MESSAGE_TEMPLATE_WITH_RATING = "[%s] %s (rating: %s, votes: %s)"

def _openfun(c):
    c.execute("PRAGMA foreign_keys = ON;")

db_connection = None
database_path = None
db_connection = None

def run_query(query, values=[], callback=None):
    res = db_connection.runQuery(query, values)
    if callback is not None:
        res.addCallback(callback)
    return res

def run_interaction(func, callback=None, **kwargs):
    res = db_connection.runInteraction(func, kwargs)
    if callback is not None:
        res.addCallback(callback)
    return res

def init():
    global database_path
    global db_connection
    database_path = get("database_path")
    db_connection = adbapi.ConnectionPool("sqlite3", database_path,
                                          check_same_thread=False,
                                          cp_openfun=_openfun,
                                          cp_min=1)

    def f(txn, *args):
        txn.execute("""CREATE TABLE IF NOT EXISTS author(
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            name TEXT NOT NULL UNIQUE);""")
        txn.execute("""CREATE TABLE IF NOT EXISTS quote(
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            quote TEXT,
            author INTEGER NOT NULL REFERENCES author(id));""")
        txn.execute("""CREATE TABLE IF NOT EXISTS voter (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            name TEXT NOT NULL UNIQUE);""")
        txn.execute("""CREATE TABLE IF NOT EXISTS vote (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            vote INT NOT NULL,
            quote INTEGER NOT NULL REFERENCES quote(id),
            voter INTEGER NOT NULL REFERENCES voter(id),
            CONSTRAINT valid_vote CHECK (vote IN (-1, 1)),
            CONSTRAINT unique_quote_voter UNIQUE (quote, voter));""")
    return run_interaction(f)

@command(aliases=["qget"])
def getquote(user, channel, text):
    """Show the quote with a specified number"""
    def callback(quotes):
        if len(quotes) > 0 and quotes[0][0] is not None:
            msg(channel, MESSAGE_TEMPLATE_WITH_RATING % quotes[0])
        else:
            msg(channel, "%s: There's no quote #%s" % (user,
                                                       text))

    if text:
        logging.info("Trying to get quote number %s" % text)
        run_query("""SELECT q.id, q.quote, sum(v.vote) as rating, count(v.vote)
                            as votes
                    FROM quote q
                    LEFT JOIN vote v
                    ON v.quote = q.id
                    WHERE q.id = ?;""",
                  [text],
                  callback)

@command(aliases=["qadd"])
def addquote(user, channel, text):
    """Add a quote"""
    if text:

        def add(txn, *args):
            logging.info("Adding author %s" % user)
            txn.execute("INSERT OR IGNORE INTO author (name) values (?)",
                        [user])
            logging.info("Adding quote: %s" % text)
            txn.execute("INSERT INTO quote (quote, author)\
                            SELECT (?), rowid\
                            FROM author WHERE name = (?);",
                        [text, user])
            txn.execute("SELECT max(rowid) FROM quote;", [])
            num = txn.fetchone()
            msg(channel, "New quote: %s" % num)

        return run_interaction(add)

    else:
        msg(channel, "%s: You didn't give me any text to quote " % user)

@command(admin_only=True, aliases=["qdelete"])
def delquote(user, channel, text):
    """Delete a quote with a specified number"""
    if text:
        logging.debug("delquote: %s" % text)

        def interaction(txn, *args):
            logging.debug("Deleting quote %s" % text)
            txn.execute("DELETE FROM quote WHERE rowid = (?)", [text])
            txn.execute("SELECT changes()")
            res = txn.fetchone()
            logging.debug("%s changes" % res)
            return int(res[0])

        def callback(changes):
            if changes > 0:
                msg(channel, "Quote #%s has been deleted." % text)
                return
            else:
                msg(channel, "It doesn't look like quote #%s exists." %
                    text)

        return run_interaction(interaction, callback)

@command(aliases=["qlast"])
def lastquote(user, channel, text):
    """Show the last quote"""
    callback = partial(_single_quote_callback, channel)
    run_query("SELECT rowid, quote FROM quote ORDER BY rowid DESC\
    LIMIT 1;", [], callback)

@command(aliases=["qrandom"])
def randomquote(user, channel, text):
    """Show a random quote"""
    callback = partial(_single_quote_callback, channel)
    run_query("SELECT rowid, quote FROM quote ORDER BY random() DESC\
    LIMIT 1;", [], callback)

@command(aliases=["qsearch"])
def searchquote(user, channel, text):
    """Search for a quote"""
    def callback(quotes):
        max_quotes = get_int("max_quotes")
        if len(quotes) > max_quotes:
            msg(channel, "Too many results, please refine your search")
        elif len(quotes) == 0:
            msg(channel, "No matching quotes found")
        else:
            for quote in quotes:
                _send_quote_to_channel(channel, quote)

    run_query(
        "SELECT rowid, quote FROM quote WHERE quote LIKE (?)",
        ["".join(("%", text, "%"))],
        callback
    )

@command(aliases=["qstats"])
@inlineCallbacks
def quotestats(user, channel, text):
    """Display statistics about all quotes."""
    result = yield run_query("SELECT count(quote) from quote;")
    quote_count = result[0][0]
    msg(channel, "There are a total of %i quotes." % quote_count)
    rows = yield run_query(
        """
        SELECT count(q.quote) AS c, a.name
        FROM quote q
        JOIN author a
        ON q.author = a.rowid
        GROUP BY a.rowid;
        """
    )
    count_author_dict = defaultdict(list)
    for count, author in rows:
        count_author_dict[count].append(author)
    for count, authors in sorted(count_author_dict.items(), reverse=True):
        percentage = (count * 100) / quote_count
        if len(authors) > 1:
            msg(channel, "%s each added %i quote(s) (%.2f%%)" %
                (", ".join(authors), count, percentage))
        else:
            msg(channel, "%s added %i quote(s) (%.2f%%)" %
                (authors[0], count, percentage))

def _like_impl(user, channel, text, votevalue):
    if not len(text):
        msg(channel,
            "%s: You need to specify the number of the quote you like!" % user)
        return

    quotenumber = int(text)

    def interaction(txn, *args):
        logging.debug("Adding 1 vote for %i by %s" % (quotenumber, user))
        txn.execute("""INSERT OR IGNORE INTO voter (name) VALUES (?);""",
                    [user])
        txn.execute("""INSERT OR REPLACE INTO vote (vote, quote, voter)
                        SELECT ?, ?, voter.rowid
                        FROM voter
                        WHERE voter.name = ?;""",
                    [votevalue, quotenumber, user])
        logging.debug("Added 1 vote for %i by %s" % (quotenumber, user))
        msg(channel, "%s: Your vote for quote #%i has been accepted!"
            % (user, quotenumber))

    return run_interaction(interaction)

@command
def qlike(user, channel, text):
    """`Likes` a quote.
    """
    return _like_impl(user, channel, text, 1)

@command
def qdislike(user, channel, text):
    """`Dislikes` a quote.
    """
    return _like_impl(user, channel, text, -1)

@inlineCallbacks
def _topflopimpl(channel, text, top=True):
    """Shows quotes with the best or worst rating.
    If ``top`` is True, the quotes with the best ratings will be shown,
    otherwise the ones with the worst.
    """
    if text:
        limit = int(text)
    else:
        limit = get("max_quotes")

    results = yield run_query(
        """
        SELECT quote.id, quote.quote, sum(vote) as rating, count(vote) as votes
        FROM vote
        JOIN quote
        ON vote.quote = quote.id
        GROUP BY vote.quote
        ORDER BY rating %s
        LIMIT (?);""" % ("DESC" if top else "ASC"),
        [limit])
    for row in results:
        msg(channel, MESSAGE_TEMPLATE_WITH_RATING % row)

@command
def qtop(user, channel, text):
    """Shows the quotes with the best rating.
    """
    return _topflopimpl(channel, text, True)

@command
def qflop(user, channel, text):
    """Shows the quotes with the worst rating.
    """
    return _topflopimpl(channel, text, False)

@on_join
def join(user, channel):
    def callback(quotes):
        try:
            _send_quote_to_channel(channel, quotes[0])
        except IndexError:
            return

    run_query("SELECT rowid, quote FROM quote where quote LIKE (?)\
    ORDER BY random() LIMIT 1;", ["".join(["%", user, "%"])], callback)

def _single_quote_callback(channel, quotes):
    try:
        _send_quote_to_channel(channel, quotes[0])
    except IndexError:
        return

def _send_quote_to_channel(channel, quote):
    (id, quote) = quote
    msg(channel, MESSAGE_TEMPLATE % (id, quote))


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycologist 17(1): 28 (2003)

#### Original name
Licea margaritacea Ing, 2003

### Remarks
null


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

namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
{
    public interface IRevokeKeyIndexerFactory
    {
        IRevokeKeyIndexer Create();
    }
}


text:
define(function(require) { 'use strict';
	/* jshint esnext: true */

    var Animation = require('./../rendering/animation'),
		Texture = require('engine/rendering/texture'),
		DrawCallback = require('engine/rendering/drawcallback'),
		SmartTexture = require('engine/rendering/texture/smarttexture'),
		Trait = require('behaviour/trait'),
		Jello = require('physics/jello'),
		Body = Jello.Body,
		Component = require('./component');

	// TODO: extract into own file
	// TODO: add corresponding system
	// TODO: make it serializable (save only the path to the callback implementation file and act accordingly)
	class DrawCallbackComponent extends Component {}

	var Entity = mini.Class.subclass({
		initialize: function(name) {
			this.name = name;
			this.zIndex = 0;
			this.stateAnimations = {};

			this.setState('idle');
			this.tags = [];

			this.components = new Map();
		},

		addToLayer: function(layer) {
			layer.addEntity(this);

			return this;
		},

		/*
		 *  zIndex
		 */
		setZIndex: function(zIndex) {
			this.zIndex = zIndex;
		},

		getZIndex: function() {
			return this.zIndex;
		},

		/*
		 *  components
		 */
		addComponent: function(component) {
			var componentClass = component.__proto__.constructor;

			if(this.components.has(componentClass)) {
				this.components.get(componentClass).push(component);
			} else {
				this.components.set(componentClass, [component]);
			}
		},

		removeComponent: function(component) {
			var componentClass = component.__proto__.constructor;

			if(this.components.has(componentClass)) {
				var components = this.components.get(componentClass);
				var index = components.indexOf(component);
				if(index !== -1) {
					components.splice(index, 1);
					return true;
				}
			}
			throw new Error('component not found', component, 'of', componentClass);
			return false;
		},

		hasComponent: function(componentClass) {
			return !!this.getComponent(componentClass);
		},

		getComponent: function(componentClass) {
			return this.getComponents(componentClass)[0];
		},

		getComponents: function(componentClass) {
			return this.components.get(componentClass) || [];
		},

		clearComponents: function(componentClass) {
			if(this.components.has(componentClass)) {
				this.components.delete(componentClass);
			}
		},

		/*
		 *  State
		 */
		setState: function(name) {
			if(typeof name === 'string') {
				this.__state__ = name;
			} else if(typeof name === 'function') {
				this.__state__ = name(this);
			} else {
				throw 'incompatible state data type';
			}

			if(this.hasAnimationForState(name)) {
				this.setAnimationForState(name);
			}
		},

		getState: function() {
			return this.__state__;
		},

		/*
		 * Tags
		 */
        // TODO: use a Set for tags
		addTag: function(tag) {
			// check for already existing.
			var exists = false;
			for(var i = 0; i < this.tags.length; i++) {
				if(this.tags[i] == tag) {
					exists = true;
					break;
				}
			}

			// do not add an already existing tag
			if (!exists) {
				this.tags.push(tag);
			}
		},

		removeTag: function(tag) {
			var index = this.tags.indexOf(tag);
			if (index !== - 1) {
				this.tags.splice( index, 1 );
			}
		},

		hasTag: function(tag) {
			return this.tags.indexOf(tag) !== -1;
		},

		getTags: function() {
			return this.tags;
		},

		/*
		 * Rendering/Animation
		 */

		// body.aabb AnimationSheet for StateAnimation
		addStateAnimation: function(name, sheetOrAnimation, frameTime, order) {
			if(sheetOrAnimation instanceof Animation) {
				this.stateAnimations[name] = sheetOrAnimation;
			} else {
				this.stateAnimations[name] = new Animation(sheetOrAnimation, frameTime, order);
			}

			// Use newly created Animation if set for current state.
			if(name == this.getState()) {
				this.setAnimationForState(name);
			}
		},

		hasAnimationForState: function(name) {
			return typeof this.stateAnimations[name] !== 'undefined';
		},

		getAnimationForState: function(name) {
			if(!this.hasAnimationForState(name)) {
				throw 'Entity has no StateAnimation for state "' + name + '".';
			}
			return this.stateAnimations[name];
		},

		setAnimationForState: function(name) {
			this.setAnimation(this.getAnimationForState(name));
		},

		setAnimation: function(animation) {
			this.animation = animation;
		},

		// Texturing
		setTexture: function(texture) {
			this.texture = texture;
		},

		getTexture: function() {
			return this.texture;
		},

		drawTexture: function(renderer) {
			this.getTexture().drawOn(this.getBody(), renderer);
		},

		// DrawCallbacks
		addDrawCallback: function(callback) {
			var componentToAdd = new DrawCallbackComponent();
			componentToAdd.drawCallback = callback;

			this.addComponent(componentToAdd);
		},

		clearDrawCallbacks: function() {
			this.clearComponents(DrawCallbackComponent);
		},

		applyDrawCallbacks: function(renderer) {
			this.getComponents(DrawCallbackComponent).forEach(function(component) {
				component.drawCallback.draw(this, renderer);
			}, this);
		},

		/*
		 * Physics
		 */
		setBody: function(body) {
			this.body = body;
		},

		getBody: function() {
			return this.body;
		},

		// Checks, whether a point given in world coordinates is contained in the Body.
		contains: function(point) {
			// does not contains any point without a body
			var body = this.getBody();
			if(typeof body === 'undefined') {
				return false;
			}
			// check first for aabb
			if(!(body.getAABB().contains(point))) {
				return false;
			}
			return body.contains(point);
		},

		/*
		 * Behavior
		 */
		setTrait: function(trait) {
			this.trait = trait;
		},

		getTrait: function() {
			return this.trait;
		},

		isHovered: function() {
			var worldMouse = env.camera.screenToWorldCoordinates(env.input.mouse);
			return this.contains(worldMouse);
		},

		isClicked: function() {
			if(!env.input.state(env.game.LeftButton)) {
				return false;
			}
			return this.isHovered();
		},

		/*
		 *  Updating
		 */
		update: function() {
			var trait = this.getTrait();
			if(typeof trait !== 'undefined') {
				trait.update(this);
			}

			if(typeof this.animation !== 'undefined') {
				this.animation.update();
			}
		},

		// draw in order:
		// 1. AnimationSheet on bodies bounding box
		// 2. Texture
		// 3. drawCallbacks
		// 4. smart texture
		draw: function(renderer, layer) {
			if(typeof this.animation !== 'undefined') {
				this.animation.draw(this.getBody().getAABB());
			}
			if(typeof this.getTexture() !== 'undefined') {
				this.drawTexture(renderer);
			}
			this.applyDrawCallbacks(renderer);
			if(this.smartTexture) {
				this.smartTexture.draw(this, renderer, layer);
			}
		},

		debugDraw: function(debugDraw) {
			this.debugDrawName(debugDraw);
		},

		debugDrawName: function(debugDraw) {
			var body = this.getBody();
			if(body && body.isVisible(debugDraw)) {
				debugDraw.drawTextWorld(
					this.name,
					body.getAABB().getBottomLeft(),
					'lightgreen',
					0.8,
					'bottom'
				);
			}
		}

	});

	Entity.prototype.toJson = function() {
		var json = {
			name: this.name,
			zIndex: this.getZIndex(),
			state: this.getState(),
			tags: this.getTags()
		};

		// Rendering
		json.stateAnimations = {};
		for(var state in this.stateAnimations) {
			// TODO: refactor this line
			json.stateAnimations[state] = this.stateAnimations[state].toJson();
		}

		if(typeof this.getTexture() !== 'undefined') {
			json.texture = this.getTexture().toJson();
		}

		json.drawCallbacks = [];
		this.getComponents(DrawCallback).forEach(function(drawCallback) {
			json.drawCallbacks.push(drawCallback.toJson());
		});

		// Physics
		if(typeof this.getBody() !== 'undefined') {
			json.body = this.getBody().toJson();
		}

		// Behavior
		if(typeof this.getTrait() !== 'undefined') {
			json.trait = this.getTrait().toJson();
		}

		return json;
	};

	Entity.fromJson = function(json, world) {
	    var index;
		var entity = new Entity(json.name);
		entity.setZIndex(json.zIndex);
		entity.setState(json.state);
		for(index in json.tags) {
			entity.addTag(json.tags[index]);
		}

		// Rendering
		for(var state in json.stateAnimations) {
			entity.addStateAnimation(state, Animation.fromJson(json.stateAnimations[state]));
		}

		if(typeof json.texture !== 'undefined') {
			entity.setTexture(Texture.fromJson(json.texture));
		}

		if(typeof json.drawCallbacks !== 'undefined') {
			for(index in json.drawCallbacks) {
				entity.addDrawCallback(DrawCallback.fromJson(json.drawCallbacks[index]));
			}
		}

		// Physics
		if(typeof json.body !== 'undefined') {
			entity.setBody(Body.fromJson(json.body, world));
		}

		// Behavior
		if(typeof json.trait !== 'undefined') {
			entity.setTrait(Trait.fromJson(json.trait));
		}

		return entity;
	};

	return Entity;
});


text:
package org.testevol.engine.report;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import org.testevol.domain.Version;
import org.testevol.engine.domain.CategoryC1;
import org.testevol.engine.domain.CategoryC5;
import org.testevol.engine.domain.CategoryC8;
import org.testevol.engine.domain.Results;

public class CSVReport {

	public static void generateReport(Version oldVersion,  Version version,
			Results results, File reportsDir, boolean coverageEnabled) throws IOException {

		File csvResults = new File(reportsDir, "results.txt");

		//File c1Results = new File(version.getDirectory().getParent(), "c1.txt");
		boolean fileAlreadyExists = csvResults.exists();

		if (!fileAlreadyExists) {
			csvResults.createNewFile();
		}

		FileWriter fileWriter = new FileWriter(csvResults, true);
		String lineSeparator = System.getProperty("line.separator");
		if (!fileAlreadyExists) {
			//write header
			fileWriter.append("#");
			fileWriter.append(results.getCategoryC1().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC2().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC3().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC4().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC5().getClassification().getLabel()+" - SAME COVERAGE ");
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC5().getClassification().getLabel()+" - COVERAGE LOSS");
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC6().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC7().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC6().getClassification().getLabel());
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC8().getClassification().getLabel()+" - SAME COVERAGE ");
			fileWriter.append(",");
			fileWriter.append(results.getCategoryC8().getClassification().getLabel()+" - COVERAGE IMPROVED");

			if(!coverageEnabled){
				fileWriter.append(lineSeparator);
				fileWriter.append("#ATTENTION: COVERAGE ANALYSIS WAS NOT PERFORMED IN THIS EXECUTION");
			}
		}
		fileWriter.append(lineSeparator);
		fileWriter.append(oldVersion.getName()).append(",");

		fileWriter.append(version.getName()).append(",");
		CategoryC1 categoryC1 = results.getCategoryC1();

		fileWriter.append(String.valueOf(categoryC1.getNumberOfTests())).append(",");//C1

		fileWriter.append(String.valueOf(results.getCategoryC2().getNumberOfTests())).append(",");//C2
		fileWriter.append(String.valueOf(results.getCategoryC3().getNumberOfTests())).append(",");//C3
		fileWriter.append(String.valueOf(results.getCategoryC4().getNumberOfTests())).append(",");//C4

		CategoryC5 categoryC5 = results.getCategoryC5();
		int sameCoverage = categoryC5.getNumberOfTestsWithSameCoverage();
		int diffCoverage = categoryC5.getNumberOfTests() - sameCoverage;
		fileWriter.append(String.valueOf(sameCoverage)).append(",");//C5
		fileWriter.append(String.valueOf(diffCoverage)).append(",");//C5

		fileWriter.append(String.valueOf(results.getCategoryC6().getNumberOfTests())).append(",");//C6
		fileWriter.append(String.valueOf(results.getCategoryC7().getNumberOfTests())).append(",");//C7

		CategoryC8 categoryC8 = results.getCategoryC8();
		sameCoverage = categoryC8.getNumberOfTestsWithSameCoverage();
		diffCoverage = categoryC8.getNumberOfTests() - sameCoverage;
		fileWriter.append(String.valueOf(sameCoverage)).append(",");//C8
		fileWriter.append(String.valueOf(diffCoverage));//C8

//		fileWriter.append("\n");
//		fileWriter.append(categoryC1.toString());
//		fileWriter.append(results.getCategoryC2().toString());
//		fileWriter.append(results.getCategoryC3().toString());
//		fileWriter.append(results.getCategoryC4().toString());
//		fileWriter.append(categoryC5.toString());
//		fileWriter.append(results.getCategoryC6().toString());
//		fileWriter.append(results.getCategoryC7().toString());
//		fileWriter.append(categoryC8.toString());

		fileWriter.close();
	//	fileWriterC1.close();

	}
}


text:
"""This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com

Copyright 2013 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""

from __future__ import print_function, division

import csv
import numpy
import thinkbayes2
import thinkplot

import matplotlib.pyplot as pyplot

#  FORMATS = ['png', 'pdf', 'eps']
FORMATS = ['png']

def ReadData(filename='ThinkBayes2/code/showcases.2011.csv'):
    """Reads a CSV file of data.

    Args:
      filename: string filename

    Returns: sequence of (price1 price2 bid1 bid2 diff1 diff2) tuples
    """
    fp = open(filename)
    reader = csv.reader(fp)
    res = []

    for t in reader:
        _heading = t[0]
        data = t[1:]
        try:
            data = [int(x) for x in data]
            # print heading, data[0], len(data)
            res.append(data)
        except ValueError:
            pass

    fp.close()
    return list(zip(*res))

class Price(thinkbayes2.Suite):
    """Represents hypotheses about the price of a showcase."""

    def __init__(self, pmf, player, label=None):
        """Constructs the suite.

        pmf: prior distribution of price
        player: Player object
        label: string
        """
        thinkbayes2.Suite.__init__(self, pmf, label=label)
        self.player = player

    def Likelihood(self, data, hypo):
        """Computes the likelihood of the data under the hypothesis.

        hypo: actual price
        data: the contestant's guess
        """
        price = hypo
        guess = data

        error = price - guess
        like = self.player.ErrorDensity(error)

        return like

class GainCalculator(object):
    """Encapsulates computation of expected gain."""

    def __init__(self, player, opponent):
        """Constructs the calculator.

        player: Player
        opponent: Player
        """
        self.player = player
        self.opponent = opponent

    def ExpectedGains(self, low=0, high=75000, n=101):
        """Computes expected gains for a range of bids.

        low: low bid
        high: high bid
        n: number of bids to evaluates

        returns: tuple (sequence of bids, sequence of gains)

        """
        bids = numpy.linspace(low, high, n)

        gains = [self.ExpectedGain(bid) for bid in bids]

        return bids, gains

    def ExpectedGain(self, bid):
        """Computes the expected return of a given bid.

        bid: your bid
        """
        suite = self.player.posterior
        total = 0
        for price, prob in sorted(suite.Items()):
            gain = self.Gain(bid, price)
            total += prob * gain
        return total

    def Gain(self, bid, price):
        """Computes the return of a bid, given the actual price.

        bid: number
        price: actual price
        """
        # if you overbid, you get nothing
        if bid > price:
            return 0

        # otherwise compute the probability of winning
        diff = price - bid
        prob = self.ProbWin(diff)

        # if you are within 250 dollars, you win both showcases
        if diff <= 250:
            return 2 * price * prob
        else:
            return price * prob

    def ProbWin(self, diff):
        """Computes the probability of winning for a given diff.

        diff: how much your bid was off by
        """
        prob = (self.opponent.ProbOverbid() +
                self.opponent.ProbWorseThan(diff))
        return prob

class Player(object):
    """Represents a player on The Price is Right."""

    n = 101
    price_xs = numpy.linspace(0, 75000, n)

    def __init__(self, prices, bids, diffs):
        """Construct the Player.

        prices: sequence of prices
        bids: sequence of bids
        diffs: sequence of underness (negative means over)
        """
        self.pdf_price = thinkbayes2.EstimatedPdf(prices)
        self.cdf_diff = thinkbayes2.MakeCdfFromList(diffs)

        mu = 0
        sigma = numpy.std(diffs)
        self.pdf_error = thinkbayes2.NormalPdf(mu, sigma)

    def ErrorDensity(self, error):
        """Density of the given error in the distribution of error.

        error: how much the bid is under the actual price
        """
        return self.pdf_error.Density(error)

    def PmfPrice(self):
        """Returns a new Pmf of prices.

        A discrete version of the estimated Pdf.
        """
        return self.pdf_price.MakePmf(xs=self.price_xs)

    def CdfDiff(self):
        """Returns a reference to the Cdf of differences (underness).
        """
        return self.cdf_diff

    def ProbOverbid(self):
        """Returns the probability this player overbids.
        """
        return self.cdf_diff.Prob(-1)

    def ProbWorseThan(self, diff):
        """Probability this player's diff is greater than the given diff.

        diff: how much the oppenent is off by (always positive)
        """
        return 1 - self.cdf_diff.Prob(diff)

    def MakeBeliefs(self, guess):
        """Makes a posterior distribution based on estimated price.

        Sets attributes prior and posterior.

        guess: what the player thinks the showcase is worth
        """
        pmf = self.PmfPrice()
        self.prior = Price(pmf, self, label='prior')
        self.posterior = self.prior.Copy(label='posterior')
        self.posterior.Update(guess)

    def OptimalBid(self, guess, opponent):
        """Computes the bid that maximizes expected return.

        guess: what the player thinks the showcase is worth
        opponent: Player

        Returns: (optimal bid, expected gain)
        """
        self.MakeBeliefs(guess)
        calc = GainCalculator(self, opponent)
        bids, gains = calc.ExpectedGains()
        gain, bid = max(zip(gains, bids))
        return bid, gain

    def PlotBeliefs(self, root):
        """Plots prior and posterior beliefs.

        root: string filename root for saved figure
        """
        thinkplot.Clf()
        thinkplot.PrePlot(num=2)
        thinkplot.Pdfs([self.prior, self.posterior])
        thinkplot.Save(root=root,
                    xlabel='price ($)',
                    ylabel='PMF',
                    formats=FORMATS)

def MakePlots(player1, player2):
    """Generates two plots.

    price1 shows the priors for the two players
    price2 shows the distribution of diff for the two players
    """

    # plot the prior distribution of price for both players
    thinkplot.Clf()
    thinkplot.PrePlot(num=2)
    pmf1 = player1.PmfPrice()
    pmf1.label = 'showcase 1'
    pmf2 = player2.PmfPrice()
    pmf2.label = 'showcase 2'
    thinkplot.Pdfs([pmf1, pmf2])
    thinkplot.Save(root='price1',
                xlabel='price ($)',
                ylabel='PDF',
                formats=FORMATS)

    # plot the historical distribution of underness for both players
    thinkplot.Clf()
    thinkplot.PrePlot(num=2)
    cdf1 = player1.CdfDiff()
    cdf1.label = 'player 1'
    cdf2 = player2.CdfDiff()
    cdf2.label = 'player 2'

    print('Player median', cdf1.Percentile(50))
    print('Player median', cdf2.Percentile(50))

    print('Player 1 overbids', player1.ProbOverbid())
    print('Player 2 overbids', player2.ProbOverbid())

    thinkplot.Cdfs([cdf1, cdf2])
    thinkplot.Save(root='price2',
                xlabel='diff ($)',
                ylabel='CDF',
                formats=FORMATS)

def MakePlayers():
    """Reads data and makes player objects."""
    data = ReadData(filename='showcases.2011.csv')
    data += ReadData(filename='showcases.2012.csv')

    cols = zip(*data)
    price1, price2, bid1, bid2, diff1, diff2 = cols

    #print(list(sorted(price1)))
    #print(len(price1))

    player1 = Player(price1, bid1, diff1)
    player2 = Player(price2, bid2, diff2)

    return player1, player2

def PlotExpectedGains(guess1=20000, guess2=40000):
    """Plots expected gains as a function of bid.

    guess1: player1's estimate of the price of showcase 1
    guess2: player2's estimate of the price of showcase 2
    """
    player1, player2 = MakePlayers()
    MakePlots(player1, player2)

    player1.MakeBeliefs(guess1)
    player2.MakeBeliefs(guess2)

    print('Player 1 prior mle', player1.prior.MaximumLikelihood())
    print('Player 2 prior mle', player2.prior.MaximumLikelihood())
    print('Player 1 mean', player1.posterior.Mean())
    print('Player 2 mean', player2.posterior.Mean())
    print('Player 1 mle', player1.posterior.MaximumLikelihood())
    print('Player 2 mle', player2.posterior.MaximumLikelihood())

    player1.PlotBeliefs('price3')
    player2.PlotBeliefs('price4')

    calc1 = GainCalculator(player1, player2)
    calc2 = GainCalculator(player2, player1)

    thinkplot.Clf()
    thinkplot.PrePlot(num=2)

    bids, gains = calc1.ExpectedGains()
    thinkplot.Plot(bids, gains, label='Player 1')
    print('Player 1 optimal bid', max(zip(gains, bids)))

    bids, gains = calc2.ExpectedGains()
    thinkplot.Plot(bids, gains, label='Player 2')
    print('Player 2 optimal bid', max(zip(gains, bids)))

    thinkplot.Save(root='price5',
                xlabel='bid ($)',
                ylabel='expected gain ($)',
                formats=FORMATS)

def PlotOptimalBid():
    """Plots optimal bid vs estimated price.
    """
    player1, player2 = MakePlayers()
    guesses = numpy.linspace(15000, 60000, 21)

    res = []
    for guess in guesses:
        player1.MakeBeliefs(guess)

        mean = player1.posterior.Mean()
        mle = player1.posterior.MaximumLikelihood()

        calc = GainCalculator(player1, player2)
        bids, gains = calc.ExpectedGains()
        gain, bid = max(zip(gains, bids))

        res.append((guess, mean, mle, gain, bid))

    guesses, means, _mles, gains, bids = zip(*res)

    thinkplot.PrePlot(num=3)
    pyplot.plot([15000, 60000], [15000, 60000], color='gray')
    thinkplot.Plot(guesses, means, label='mean')
    #thinkplot.Plot(guesses, mles, label='MLE')
    thinkplot.Plot(guesses, bids, label='bid')
    thinkplot.Plot(guesses, gains, label='gain')
    thinkplot.Save(root='price6',
                   xlabel='guessed price ($)',
                   formats=FORMATS)

def TestCode(calc):
    """Check some intermediate results.

    calc: GainCalculator
    """
    # test ProbWin
    for diff in [0, 100, 1000, 10000, 20000]:
        print(diff, calc.ProbWin(diff))
    print()

    # test Return
    price = 20000
    for bid in [17000, 18000, 19000, 19500, 19800, 20001]:
        print(bid, calc.Gain(bid, price))
    print()

def main():
    PlotExpectedGains()
    PlotOptimalBid()

if __name__ == '__main__':
    main()


text:
package org.xbmc.kore.ui;

import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.transition.TransitionInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

import org.xbmc.kore.R;
import org.xbmc.kore.utils.LogUtils;
import org.xbmc.kore.utils.Utils;

/**
 * Controls the presentation of Addons information (list, details)
 * All the information is presented by specific fragments
 */
public class AddonsActivity extends BaseActivity
        implements AddonListFragment.OnAddonSelectedListener {
    private static final String TAG = LogUtils.makeLogTag(AddonsActivity.class);

    public static final String ADDONID = "addon_id";
    public static final String ADDONTITLE = "addon_title";

    private String selectedAddonId;
    private String selectedAddonTitle;

    private NavigationDrawerFragment navigationDrawerFragment;

    @TargetApi(21)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // Request transitions on lollipop
        if (Utils.isLollipopOrLater()) {
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
        }
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_generic_media);

        // Set up the drawer.
        navigationDrawerFragment = (NavigationDrawerFragment)getSupportFragmentManager()
                .findFragmentById(R.id.navigation_drawer);
        navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));

        if (savedInstanceState == null) {
            AddonListFragment addonListFragment = new AddonListFragment();

            // Setup animations
            if (Utils.isLollipopOrLater()) {
                addonListFragment.setExitTransition(null);
                addonListFragment.setReenterTransition(TransitionInflater
                        .from(this)
                        .inflateTransition(android.R.transition.fade));
            }
            getSupportFragmentManager()
                    .beginTransaction()
                    .add(R.id.fragment_container, addonListFragment)
                    .commit();
        } else {
            selectedAddonId = savedInstanceState.getString(ADDONID, null);
            selectedAddonTitle = savedInstanceState.getString(ADDONTITLE, null);
        }

        setupActionBar(selectedAddonTitle);
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    protected void onSaveInstanceState (Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putString(ADDONID, selectedAddonId);
        outState.putString(ADDONTITLE, selectedAddonTitle);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
//        if (!navigationDrawerFragment.isDrawerOpen()) {
//            getMenuInflater().inflate(R.menu.media_info, menu);
//        }
        getMenuInflater().inflate(R.menu.media_info, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.action_show_remote:
                // Starts remote
                Intent launchIntent = new Intent(this, RemoteActivity.class)
                        .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                startActivity(launchIntent);
                return true;
            case android.R.id.home:
                // Only respond to this if we are showing the details in portrait mode,
                // which can be checked by checking if selected movie != -1, in which case we
                // should go back to the previous fragment, which is the list.
                if (selectedAddonId != null) {
                    selectedAddonId = null;
                    selectedAddonTitle = null;
                    setupActionBar(null);
                    getSupportFragmentManager().popBackStack();
                    return true;
                }
                break;
            default:
                break;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onBackPressed() {
        // If we are showing details in portrait, clear selected and show action bar
        if (selectedAddonId != null) {
            selectedAddonId = null;
            selectedAddonTitle = null;
            setupActionBar(null);
        }
        super.onBackPressed();
    }

    private void setupActionBar(String addonTitle) {
        Toolbar toolbar = (Toolbar)findViewById(R.id.default_toolbar);
        setSupportActionBar(toolbar);

        ActionBar actionBar = getSupportActionBar();
        if (actionBar == null) return;
        actionBar.setDisplayHomeAsUpEnabled(true);
        if (addonTitle != null) {
            navigationDrawerFragment.setDrawerIndicatorEnabled(false);
            actionBar.setTitle(addonTitle);
        } else {
            navigationDrawerFragment.setDrawerIndicatorEnabled(true);
            actionBar.setTitle(R.string.addons);
        }
    }

    /**
     * Callback from list fragment when a addon is selected.
     * Switch fragment in portrait
     * @param addonId Addon selected
     * @param addonTitle Title
     */
    @TargetApi(21)
    public void onAddonSelected(String addonId, String addonTitle) {
        selectedAddonId = addonId;
        selectedAddonTitle = addonTitle;

        // Replace list fragment
        AddonDetailsFragment addonDetailsFragment = AddonDetailsFragment.newInstance(addonId);
        FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction();

        // Set up transitions
        if (Utils.isLollipopOrLater()) {
            addonDetailsFragment.setEnterTransition(TransitionInflater
                    .from(this)
                    .inflateTransition(R.transition.media_details));
            addonDetailsFragment.setReturnTransition(null);
        } else {
            fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0,
                    R.anim.fragment_list_popenter, 0);
        }

        fragTrans.replace(R.id.fragment_container, addonDetailsFragment)
                .addToBackStack(null)
                .commit();
        setupActionBar(selectedAddonTitle);
    }
}


text:
describe XingApi::Company::Update do
  describe '.list' do
    it_behaves_like 'a Xing API call'

    it 'invokes the correct API call' do
      expect_request(:get, '/v1/companies/some_id/updates', {})

      described_class.list('some_id')
    end
  end

  describe '.create' do
    it_behaves_like 'a Xing API call'

    it 'invokes the correct API call' do
      expected_params = {
        headline: 'My headline',
        content:  'My content'
      }

      expect_request(:post, '/v1/companies/some_id/updates', expected_params)

      described_class.create('some_id', 'My headline', 'My content')
    end
  end

  describe '.edit' do
    it_behaves_like 'a Xing API call'

    it 'invokes the correct API call' do
      expect_request(:put, '/v1/companies/updates/some_id', headline: 'My new headline')

      described_class.edit('some_id', headline: 'My new headline')
    end
  end

  describe '.delete' do
    it_behaves_like 'a Xing API call'

    it 'invokes the correct API call' do
      expect_request(:delete, '/v1/companies/updates/some_id', {})

      described_class.delete('some_id')
    end
  end

  describe '.like' do
    it_behaves_like 'a Xing API call'

    it 'invokes the correct API call' do
      expect_request(:put, '/v1/companies/updates/some_id/like', {})

      described_class.like('some_id')
    end
  end

  describe '.unlike' do
    it_behaves_like 'a Xing API call'

    it 'invokes the correct API call' do
      expect_request(:delete, '/v1/companies/updates/some_id/like', {})

      described_class.unlike('some_id')
    end
  end
end


text:
#import <SparkKit/SparkKit.h>

#import "ApplicationAction.h"

@class WBImageView;
@interface ApplicationPlugin : SparkActionPlugIn {
  IBOutlet NSTextField *ibApplication;

  IBOutlet NSTabView *ibTab;
  IBOutlet NSTextField *ibName;
  IBOutlet WBImageView *ibIcon;
}

- (IBAction)back:(id)sender;
- (IBAction)options:(id)sender;
- (IBAction)chooseApplication:(id)sender;

@property(nonatomic) ApplicationActionType action;

@property(nonatomic, readonly) BOOL showOptions;
@property(nonatomic, readonly) BOOL showChooser;

@property(nonatomic) NSInteger visual;

@property(nonatomic, readonly) BOOL notifyLaunch;
@property(nonatomic, readonly) BOOL notifyActivation;

@property(nonatomic, copy) NSURL *URL;

@property(nonatomic) NSWorkspaceLaunchOptions flags;

@property(nonatomic) BOOL dontSwitch;

@property(nonatomic) BOOL newInstance;

@property(nonatomic) BOOL hide;

@property(nonatomic) BOOL hideOthers;

@end


text:
/**
 *
 */
;
(function($, window, document, undefined) {
	var pluginName = "longTextCellEditor";
	var defaults = {
		parent : "",
	};

	var TextCellEditor = function(element, options) {
		this.element = element;
		this.options = $.extend({
			parent : "",
		}, defaults, options);
		this._defaults = defaults;
		this._name = pluginName;
	};

	TextCellEditor.prototype.loadEditor = function(tag, entity, type) {
		var that = this;
		if ($(tag).attr("type") == "h") {
			return;
		}
		var oldvalue = $(tag).text();
		$(tag).text("");
		var inputObj = $("<textarea type='text' class='form-control'/></textarea>");
		inputObj.val(oldvalue).appendTo($(tag)).get(0).select();
		inputObj.focus();
		inputObj.click(function() {
			return false;
		}).keypress(function(event) {
			var keyvalue = event.which;
            if (keyvalue == 27) {
				$(tag).text(oldvalue);
				event.preventDefault();
			}
		}).blur(function() {
			if (that.changeValue(tag, entity, oldvalue)) {
				inputObj.remove();
			} else {
				inputObj.focus();
				return false;
			}
		})
	};

	TextCellEditor.prototype.changeValue = function(tag, entity, oldvalue) {
		var newvalue = $(tag).children("textarea").val();
		if (newvalue != oldvalue) {
			entity.value = newvalue;
			this.options.parent.refreshValues();
		} else {
			$(tag).text(oldvalue);
		}
		return true;
	};

	$.fn[pluginName] = function(options) {
		return this.each(function() {
			if (!$.data(this, pluginName)) {
				$.data(this, pluginName, new TextCellEditor(this, options));
			} else if ($.isFunction(Plugin.prototype[options])) {
				$.data(this, pluginName)[options]();
			}
		});
	};

})(jQuery, window, document);