text:
<?php

namespace AppBundle\Controller;

use AppBundle\Entity\Page;
use AppBundle\Form\PageType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Doctrine\ORM\EntityManagerInterface;

class PageController extends Controller
{
    public function indexAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $repo = $em->getRepository('AppBundle:Page');
        $articles = $repo->findAll();

        return $this->render('AppBundle:Page:index.html.twig', array(
            'articles' => $articles
        ));
    }

    public function newAction(Request $request)
    {
        $article = new Page();
        $form = $this->createForm(PageType::class, $article);
        $form->add('save', SubmitType::class);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $article = $form->getData();
            $em = $this->getDoctrine()->getManager();

            $user = $this->getUser();
            $article->setUser($user);
            $article->setCreateDate(new \DateTime('now', new \DateTimeZone('Australia/Sydney')));
            $em->persist($article);
            $em->flush();

            $articles = $this->getDoctrine()->getRepository(Page::class)->findBy(array('route' => $article->getRoute()), array('id' => 'DESC'));

            $id = $articles[0]->getId();

            return $this->redirectToRoute('edit-article', array('id' => $id));
        }

        return $this->render('AppBundle:Page:edit.html.twig', array(
            'form' => $form->createView()
        ));
    }

    public function editAction(Request $request, $id)
    {
        $article = $this->getDoctrine()->getRepository('AppBundle:Page')->find($id);

        $form = $this->createForm(PageType::class, $article);
        $form->add('save', SubmitType::class);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            //update the article
            $em->flush();
        }

        return $this->render('AppBundle:Page:edit.html.twig', array(
            'form' => $form->createView()
        ));
    }

    public function deleteAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $article = $em->getRepository('AppBundle:Page')->find($id);
        $em->remove($article);
        $em->flush();

        return $this->redirectToRoute('list-article');
    }

}


text:
package MooseX::Types::Combine;
{
  $MooseX::Types::Combine::VERSION = '0.35';
}

# ABSTRACT: Combine type libraries for exporting

use strict;
use warnings;
use Class::MOP ();

sub import {
    my ($class, @types) = @_;
    my $caller = caller;

    my %types = $class->_provided_types;

    if ( grep { $_ eq ':all' } @types ) {
        $_->import( { -into => $caller }, q{:all} )
            for $class->provide_types_from;
        return;
    }

    my %from;
    for my $type (@types) {
        unless ($types{$type}) {
            my @type_libs = $class->provide_types_from;

            die
                "$caller asked for a type ($type) which is not found in any of the"
                . " type libraries (@type_libs) combined by $class\n";
        }

        push @{ $from{ $types{$type} } }, $type;
    }

    $_->import({ -into => $caller }, @{ $from{ $_ } })
        for keys %from;
}

sub provide_types_from {
    my ($class, @libs) = @_;

    my $store =
     do { no strict 'refs'; \@{ "${class}::__MOOSEX_TYPELIBRARY_LIBRARIES" } };

    if (@libs) {
        $class->_check_type_lib($_) for @libs;
        @$store = @libs;

        my %types = map {
            my $lib = $_;
            map +( $_ => $lib ), $lib->type_names
        } @libs;

        $class->_provided_types(%types);
    }

    @$store;
}

sub _check_type_lib {
    my ($class, $lib) = @_;

    Class::MOP::load_class($lib);

    die "Cannot use $lib in a combined type library, it does not provide any types"
        unless $lib->can('type_names');
}

sub _provided_types {
    my ($class, %types) = @_;

    my $types =
     do { no strict 'refs'; \%{ "${class}::__MOOSEX_TYPELIBRARY_TYPES" } };

    %$types = %types
        if keys %types;

    %$types;
}

1;

__END__
=pod

=head1 NAME

MooseX::Types::Combine - Combine type libraries for exporting

=head1 VERSION

version 0.35

=head1 SYNOPSIS

    package CombinedTypeLib;

    use base 'MooseX::Types::Combine';

    __PACKAGE__->provide_types_from(qw/TypeLib1 TypeLib2/);

    package UserClass;

    use CombinedTypeLib qw/Type1 Type2 ... /;

=head1 DESCRIPTION

Allows you to export types from multiple type libraries.

Libraries on the right side of the type libs passed to L</provide_types_from>
take precedence over those on the left in case of conflicts.

=head1 CLASS METHODS

=head2 provide_types_from

Sets or returns a list of type libraries to re-export from.

=head1 SEE ALSO

L<MooseX::Types>

=head1 LICENSE

This program is free software; you can redistribute it and/or modify
it under the same terms as perl itself.

=head1 AUTHOR

Robert "phaylon" Sedlacek <rs@474.at>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Robert "phaylon" Sedlacek.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut

redpajama_set_name: RedPajamaGithub


text:
using GroupDocs.Metadata.Common;

namespace GroupDocs.Metadata.MVC.Products.Metadata.Entity
{
    public class FilePropertyName
    {
        public string name { get; set; }
        public MetadataPropertyType type { get; set; }
    }
}


text:
package com.basho.riak.spark.japi;

import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.spark.japi.rdd.RiakJavaPairRDD;
import com.basho.riak.spark.japi.rdd.RiakJavaRDD;
import com.basho.riak.spark.japi.rdd.RiakTSJavaRDD;
import com.basho.riak.spark.japi.rdd.mapper.DefaultReadDataMapper;
import com.basho.riak.spark.query.QueryData;
import com.basho.riak.spark.rdd.*;
import com.basho.riak.spark.rdd.connector.RiakConnector$;
import com.basho.riak.spark.rdd.mapper.ReadDataMapperFactory;
import com.basho.riak.spark.rdd.mapper.ReadPairValueDataMapper$;
import com.basho.riak.spark.rdd.mapper.ReadValueDataMapper$;
import org.apache.commons.lang3.StringUtils;
import org.apache.spark.SparkContext;
import org.apache.spark.sql.types.StructType;
import scala.Option;
import scala.Tuple2;
import scala.reflect.ClassTag;

import static com.basho.riak.spark.util.JavaApiHelper.getClassTag;

public class SparkContextJavaFunctions {

    public final SparkContext sparkContext;

    SparkContextJavaFunctions(SparkContext sparkContext) {
        this.sparkContext = sparkContext;
    }

    public <T> RiakJavaRDD<T> toJavaRDD(RiakRDD<T> rdd, Class<T> targetClass) {
        return new RiakJavaRDD<>(rdd, getClassTag(targetClass));
    }

    public <K, V> RiakJavaPairRDD<K, V> toJavaPairRDD(RiakRDD<Tuple2<K, V>> rdd, Class<K> keyClass, Class<V> valueClass) {
        return new RiakJavaPairRDD<>(rdd, getClassTag(keyClass), getClassTag(valueClass));
    }

    public <T> RiakJavaRDD<T> riakBucket(String bucketName, String bucketType, ReadDataMapperFactory<T> rdmf) {
        final String bucketTypeStr = StringUtils.isBlank(bucketType) ? "default" : bucketType;
        final Option<QueryData<?>> queryData = Option.apply(null);
        final ReadConf readConf = ReadConf$.MODULE$.apply(sparkContext.getConf());

        final RiakRDD<T> rdd = RiakRDD$.MODULE$.apply(sparkContext, bucketTypeStr,
                bucketName, queryData, readConf, getClassTag(rdmf.targetClass()), rdmf);
        return toJavaRDD(rdd, rdmf.targetClass());
    }

    public <T> RiakJavaRDD<T> riakBucket(String bucketName, Class<T> valueClass) {
        return riakBucket(bucketName, "default", valueClass);
    }

    public <T> RiakJavaRDD<T> riakBucket(String bucketName, String bucketType, Class<T> valueClass) {
        final ReadDataMapperFactory<T> rdmf = ReadValueDataMapper$.MODULE$.factory(getClassTag(valueClass));
        return this.riakBucket(bucketName, bucketType, rdmf);
    }

    public <T> RiakJavaRDD<T> riakBucket(Namespace ns, ReadDataMapperFactory<T> rdmf) {
        return this.riakBucket(ns.getBucketNameAsString(), ns.getBucketTypeAsString(), rdmf);
    }

    public <T> RiakJavaRDD<T> riakBucket(Namespace ns, Class<T> valueClass) {
        return this.riakBucket(ns.getBucketNameAsString(), ns.getBucketTypeAsString(), valueClass);
    }

    public RiakJavaRDD<Tuple2<String, Object>> riakBucket(Namespace ns) {
        return this.riakBucket(ns.getBucketNameAsString(), ns.getBucketTypeAsString());
    }

    public RiakJavaRDD<Tuple2<String, Object>> riakBucket(String bucketName, String bucketType) {
        return this.riakBucket(bucketName, bucketType, DefaultReadDataMapper.instance);
    }

    public <K extends String, V> RiakJavaPairRDD<K, V> riakBucket(String bucketName,
                                                                  String bucketType,
                                                                  Class<K> keyClass,
                                                                  Class<V> valueClass,
                                                                  ReadDataMapperFactory<Tuple2<K, V>> rdmf) {
        return toJavaPairRDD(this.riakBucket(bucketName, bucketType, rdmf).rdd(), keyClass, valueClass);
    }

    public <K extends String, V> RiakJavaPairRDD<K, V> riakBucket(String bucketName,
                                                                  String bucketType,
                                                                  Class<K> keyClass,
                                                                  Class<V> valueClass) {
        ReadDataMapperFactory<Tuple2<K, V>> rdmf = ReadPairValueDataMapper$.MODULE$
                .factory(getClassTag(keyClass), getClassTag(valueClass));
        return this.riakBucket(bucketName, bucketType, keyClass, valueClass, rdmf);
    }

    public <K extends String, V> RiakJavaPairRDD<K, V> riakBucket(Namespace ns,
                                                                  Class<K> keyClass,
                                                                  Class<V> valueClass,
                                                                  ReadDataMapperFactory<Tuple2<K, V>> rdmf) {
        return this.riakBucket(ns.getBucketNameAsString(), ns.getBucketTypeAsString(), keyClass, valueClass, rdmf);
    }

    public <K extends String, V> RiakJavaPairRDD<K, V> riakBucket(Namespace ns,
                                                                  Class<K> keyClass,
                                                                  Class<V> valueClass) {
        return this.riakBucket(ns.getBucketNameAsString(), ns.getBucketTypeAsString(), keyClass, valueClass);
    }

    public <T> RiakTSJavaRDD<T> riakTSTable(String bucketName, Class<T> targetClass) {
        final ClassTag<T> classTag = getClassTag(targetClass);
        final RiakTSRDD<T> rdd = RiakTSRDD$.MODULE$.apply(sparkContext, bucketName, ReadConf$.MODULE$.apply(sparkContext.getConf()),
                classTag, RiakConnector$.MODULE$.apply(sparkContext.getConf()));
        return new RiakTSJavaRDD<>(rdd, classTag);
    }

    public <T> RiakTSJavaRDD<T> riakTSTable(String bucketName, StructType schema, Class<T> targetClass) {
        final ClassTag<T> classTag = getClassTag(targetClass);
        final RiakTSRDD<T> rdd = RiakTSRDD$.MODULE$.apply(sparkContext, bucketName,
                ReadConf$.MODULE$.apply(sparkContext.getConf()), Option.apply(schema),
                classTag, RiakConnector$.MODULE$.apply(sparkContext.getConf()));
        return new RiakTSJavaRDD<>(rdd, classTag);
    }
}


text:
<?php declare(strict_types=1);

namespace Sassnowski\LaravelShareableModel\Shareable;

trait Shareable
{
    public function links()
    {
        return $this->morphMany(ShareableLink::class, 'shareable');
    }
}


text:
package com.datastax.driver.core.schemabuilder;

import org.testng.annotations.Test;

import static org.assertj.core.api.Assertions.assertThat;

import com.datastax.driver.core.DataType;

import static com.datastax.driver.core.schemabuilder.SchemaBuilder.*;

/**
 * Note: some addColumn variants are covered in {@link CreateTypeTest}.
 */
public class CreateTest {

    @Test(groups = "unit")
    public void should_create_simple_table() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_udt_partition_key() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addUDTPartitionKey("u", frozen("user"));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
                "u frozen<user>,\n\t\t" +
                "PRIMARY KEY(u))"
        );
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class)
    public void should_fail_when_creating_table_without_partition_key() throws Exception {
        createTable("test").addColumn("name", DataType.text()).getQueryString();
    }

    @Test(groups = "unit")
    public void should_create_simple_table_if_not_exists() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .ifNotExists()
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text());
        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE IF NOT EXISTS test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id))");
    }

    @Test(groups = "unit")
    public void should_create_simple_table_with_keyspace() throws Exception {
        //When
        SchemaStatement statement = createTable("ks", "test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text());
        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE ks.test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id))");
    }

    @Test(groups = "unit")
    public void should_create_simple_table_with_list() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("friends", DataType.list(DataType.text()));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "friends list<text>,\n\t\t" +
            "PRIMARY KEY(id))");
    }

    @Test(groups = "unit")
    public void should_create_simple_table_with_set() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("friends", DataType.set(DataType.text()));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "friends set<text>,\n\t\t" +
            "PRIMARY KEY(id))");
    }

    @Test(groups = "unit")
    public void should_create_simple_table_with_map() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("friends", DataType.map(DataType.cint(), DataType.text()));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "friends map<int, text>,\n\t\t" +
            "PRIMARY KEY(id))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_clustering_keys() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col1 uuid,\n\t\t" +
            "col2 uuid,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id, col1, col2))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_udt_clustering_keys() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addUDTClusteringColumn("col2", frozen("address"))
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col1 uuid,\n\t\t" +
            "col2 frozen<address>,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id, col1, col2))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_composite_partition_key() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id1", DataType.bigint())
            .addPartitionKey("id2", DataType.text())
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id1 bigint,\n\t\t" +
            "id2 text,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY((id1, id2)))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_composite_partition_key_and_clustering_keys() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id1", DataType.bigint())
            .addPartitionKey("id2", DataType.text())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id1 bigint,\n\t\t" +
            "id2 text,\n\t\t" +
            "col1 uuid,\n\t\t" +
            "col2 uuid,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY((id1, id2), col1, col2))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_static_column() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col", DataType.uuid())
            .addStaticColumn("bucket", DataType.cint())
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col uuid,\n\t\t" +
            "bucket int static,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id, col))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_udt_static_column() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col", DataType.uuid())
            .addUDTStaticColumn("bucket", frozen("address"))
            .addColumn("name", DataType.text());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col uuid,\n\t\t" +
            "bucket frozen<address> static,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id, col))");
    }

    @Test(groups = "unit")
    public void should_create_table_with_clustering_order() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text())
            .withOptions()
            .clusteringOrder("col1", Direction.ASC)
            .clusteringOrder("col2", Direction.DESC);

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col1 uuid,\n\t\t" +
            "col2 uuid,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id, col1, col2))\n\t" +
            "WITH CLUSTERING ORDER BY(col1 ASC, col2 DESC)");
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class)
    public void should_fail_when_blank_clustering_order_column_provided() throws Exception {
        createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text())
            .withOptions().clusteringOrder("", Direction.DESC);
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class)
    public void should_fail_when_clustering_order_column_does_not_match_declared_clustering_keys() throws Exception {
        createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text())
            .withOptions().clusteringOrder("col3", Direction.ASC);
    }

    @Test(groups = "unit")
    public void should_create_table_with_compact_storage() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text())
            .withOptions()
            .compactStorage();

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col1 uuid,\n\t\t" +
            "col2 uuid,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id, col1, col2))\n\t" +
            "WITH COMPACT STORAGE");
    }

    @Test(groups = "unit")
    public void should_create_table_with_all_options() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addClusteringColumn("col1", DataType.uuid())
            .addClusteringColumn("col2", DataType.uuid())
            .addColumn("name", DataType.text())
            .withOptions()
            .clusteringOrder("col1", Direction.ASC)
            .clusteringOrder("col2", Direction.DESC)
            .compactStorage()
            .bloomFilterFPChance(0.01)
            .caching(Caching.ROWS_ONLY)
            .comment("This is a comment")
            .compactionOptions(leveledStrategy().ssTableSizeInMB(160))
            .compressionOptions(lz4())
            .dcLocalReadRepairChance(0.21)
            .defaultTimeToLive(100)
            .gcGraceSeconds(9999)
            .minIndexInterval(64)
            .maxIndexInterval(512)
            .memtableFlushPeriodInMillis(12)
            .populateIOCacheOnFlush(true)
            .readRepairChance(0.05)
            .replicateOnWrite(true)
            .speculativeRetry(always());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "col1 uuid,\n\t\t" +
            "col2 uuid,\n\t\t" +
            "name text,\n\t\tPRIMARY KEY(id, col1, col2))\n\t" +
            "WITH caching = 'rows_only' " +
            "AND bloom_filter_fp_chance = 0.01 " +
            "AND comment = 'This is a comment' " +
            "AND compression = {'sstable_compression' : 'LZ4Compressor'} " +
            "AND compaction = {'class' : 'LeveledCompactionStrategy', 'sstable_size_in_mb' : 160} " +
            "AND dclocal_read_repair_chance = 0.21 " +
            "AND default_time_to_live = 100 " +
            "AND gc_grace_seconds = 9999 " +
            "AND min_index_interval = 64 " +
            "AND max_index_interval = 512 " +
            "AND memtable_flush_period_in_ms = 12 " +
            "AND populate_io_cache_on_flush = true " +
            "AND read_repair_chance = 0.05 " +
            "AND replicate_on_write = true " +
            "AND speculative_retry = 'ALWAYS' AND CLUSTERING ORDER BY(col1 ASC, col2 DESC) AND COMPACT STORAGE");
    }

    @Test(groups = "unit")
    public void should_build_table_with_new_caching_options() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .caching(KeyCaching.ALL, rows(100));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\tPRIMARY KEY(id))\n\t" +
            "WITH caching = {'keys' : 'all', 'rows_per_partition' : 100}");

        //When
        statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .caching(KeyCaching.ALL, allRows());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\tPRIMARY KEY(id))\n\t" +
            "WITH caching = {'keys' : 'all', 'rows_per_partition' : 'all'}");
    }

    @Test(groups = "unit")
    public void should_build_table_with_custom_option() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .freeformOption("key1", "value1")
            .freeformOption("key2", 1.0);

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\tPRIMARY KEY(id))\n\t" +
            "WITH key1 = 'value1' " +
            "AND key2 = 1.0");
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class)
    public void should_fail_when_both_caching_versions() throws Exception {
        createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .caching(Caching.KEYS_ONLY)
            .caching(KeyCaching.ALL, allRows()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class)
    public void should_fail_when_negative_rows_per_partition() throws Exception {
        createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .caching(KeyCaching.ALL, rows(-3));
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class)
    public void should_fail_when_read_repair_chance_out_of_bound() throws Exception {
        createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .readRepairChance(1.3);
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class)
    public void should_fail_when_read_repair_chance_negative() throws Exception {
        createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .readRepairChance(-1.3);
    }

    @Test(groups = "unit")
    public void should_create_table_with_speculative_retry_none() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .speculativeRetry(noSpeculativeRetry());

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id))\n\t" +
            "WITH speculative_retry = 'NONE'");
    }

    @Test(groups = "unit")
    public void should_create_table_with_speculative_retry_in_percentile() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .speculativeRetry(percentile(95));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id))\n\t" +
            "WITH speculative_retry = '95percentile'");
    }

    @Test(groups = "unit")
    public void should_create_table_with_speculative_retry_in_milli_secs() throws Exception {
        //When
        SchemaStatement statement = createTable("test")
            .addPartitionKey("id", DataType.bigint())
            .addColumn("name", DataType.text())
            .withOptions()
            .speculativeRetry(millisecs(12));

        //Then
        assertThat(statement.getQueryString()).isEqualTo("\n\tCREATE TABLE test(\n\t\t" +
            "id bigint,\n\t\t" +
            "name text,\n\t\t" +
            "PRIMARY KEY(id))\n\t" +
            "WITH speculative_retry = '12ms'");
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and clustering keys at the same time")
    public void should_fail_if_same_partition_and_clustering_column() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("pk", DataType.bigint()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and simple columns at the same time")
    public void should_fail_if_same_partition_and_simple_column() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addColumn("pk", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The '\\[cluster\\]' columns can not be declared as clustering keys and simple columns at the same time")
    public void should_fail_if_same_clustering_and_simple_column() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("cluster", DataType.bigint())
            .addColumn("cluster", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and static columns at the same time")
    public void should_fail_if_same_partition_and_static_column() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addStaticColumn("pk", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The '\\[cluster\\]' columns can not be declared as clustering keys and static columns at the same time")
    public void should_fail_if_same_clustering_and_static_column() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("cluster", DataType.bigint())
            .addStaticColumn("cluster", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The '\\[col\\]' columns can not be declared as simple columns and static columns at the same time")
    public void should_fail_if_same_simple_and_static_column() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("cluster", DataType.uuid())
            .addColumn("col", DataType.bigint())
            .addStaticColumn("col", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "The table 'test' cannot declare static columns '\\[stat\\]' without clustering columns")
    public void should_fail_if_static_column_in_non_clustered_table() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addStaticColumn("stat", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class,
        expectedExceptionsMessageRegExp = "The keyspace name 'add' is not allowed because it is a reserved keyword")
    public void should_fail_if_keyspace_name_is_a_reserved_keyword() throws Exception {
        createTable("add", "test")
            .addPartitionKey("pk", DataType.bigint())
            .addColumn("col", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class,
        expectedExceptionsMessageRegExp = "The table name 'add' is not allowed because it is a reserved keyword")
    public void should_fail_if_table_name_is_a_reserved_keyword() throws Exception {
        createTable("add")
            .addPartitionKey("pk", DataType.bigint())
            .addColumn("col", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class,
        expectedExceptionsMessageRegExp = "The partition key name 'add' is not allowed because it is a reserved keyword")
    public void should_fail_if_partition_key_is_a_reserved_keyword() throws Exception {
        createTable("test")
            .addPartitionKey("add", DataType.bigint())
            .addColumn("col", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class,
        expectedExceptionsMessageRegExp = "The clustering column name 'add' is not allowed because it is a reserved keyword")
    public void should_fail_if_clustering_key_is_a_reserved_keyword() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("add", DataType.uuid())
            .addColumn("col", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class,
        expectedExceptionsMessageRegExp = "The column name 'add' is not allowed because it is a reserved keyword")
    public void should_fail_if_simple_column_is_a_reserved_keyword() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("cluster", DataType.uuid())
            .addColumn("add", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class,
        expectedExceptionsMessageRegExp = "The static column name 'add' is not allowed because it is a reserved keyword")
    public void should_fail_if_static_column_is_a_reserved_keyword() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("cluster", DataType.uuid())
            .addStaticColumn("add", DataType.text())
            .addColumn("col", DataType.text()).getQueryString();
    }

    @Test(groups = "unit", expectedExceptions = IllegalStateException.class,
        expectedExceptionsMessageRegExp = "Cannot create table 'test' with compact storage and static columns '\\[stat\\]'")
    public void should_fail_creating_table_with_static_columns_and_compact_storage() throws Exception {
        createTable("test")
            .addPartitionKey("pk", DataType.bigint())
            .addClusteringColumn("cluster", DataType.uuid())
            .addStaticColumn("stat", DataType.text())
            .withOptions().compactStorage().getQueryString();
    }
}


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

namespace StringMix.Model {

    /// <summary>
    /// Model class to represent a Token that has optionally been tagged with the given lexicon as a guide.
    /// </summary>
    public class TaggedToken {

        public TaggedToken() {
            Tags = new List<string>();
        }

        /// <summary>
        /// Numeric signifying where in the input string this token appeared
        /// </summary>
        public long TokenSequence { get; set; }

        /// <summary>
        /// The string value of the token
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// The list of tags that have been applied to this token.  Given a lexicon, a matching
        /// value will apply all of the classes of that lexicon to the matching token.
        /// </summary>
        public List<string> Tags { get; set; }
    }
}


text:
'use strict';

const Audit = require('../../audits/redirects.js');
const assert = require('assert');

/* eslint-env mocha */
const FAILING_THREE_REDIRECTS = {
  startTime: 17,
  url: 'http://exampel.com/',
  redirects: [
    {
      startTime: 0,
      url: 'http://example.com/',
    },
    {
      startTime: 11,
      url: 'https://example.com/',
    },
    {
      startTime: 12,
      url: 'https://m.example.com/',
    },
  ],
};

const FAILING_TWO_REDIRECTS = {
  startTime: 446.286,
  url: 'http://lisairish.com/',
  redirects: [
    {
      startTime: 445.648,
      url: 'https://lisairish.com/',
    },
    {
      startTime: 445.757,
      url: 'https://www.lisairish.com/',
    },
  ],
};

const SUCCESS_ONE_REDIRECT = {
  startTime: 136.383,
  url: 'https://lisairish.com/',
  redirects: [{
    startTime: 135.873,
    url: 'https://www.lisairish.com/',
  }],
};

const SUCCESS_NOREDIRECT = {
  startTime: 135.873,
  url: 'https://www.google.com/',
  redirects: [],
};

const mockArtifacts = (mockChain) => {
  return {
    devtoolsLogs: {
      [Audit.DEFAULT_PASS]: [],
    },
    requestNetworkRecords: () => {
      return Promise.resolve([]);
    },
    requestMainResource: function() {
      return Promise.resolve(mockChain);
    },
  };
};

describe('Performance: Redirects audit', () => {
  it('fails when 3 redirects detected', () => {
    return Audit.audit(mockArtifacts(FAILING_THREE_REDIRECTS)).then(output => {
      assert.equal(output.score, 0);
      assert.equal(output.details.items.length, 4);
      assert.equal(output.rawValue, 17000);
    });
  });
  it('fails when 2 redirects detected', () => {
    return Audit.audit(mockArtifacts(FAILING_TWO_REDIRECTS)).then(output => {
      assert.equal(output.score, 65);
      assert.equal(output.details.items.length, 3);
      assert.equal(Math.round(output.rawValue), 638);
    });
  });

  it('passes when one redirect detected', () => {
    return Audit.audit(mockArtifacts(SUCCESS_ONE_REDIRECT)).then(output => {
      // If === 1 redirect, perfect score is expected, regardless of latency
      assert.equal(output.score, 100);
      // We will still generate a table and show wasted time
      assert.equal(output.details.items.length, 2);
      assert.equal(Math.round(output.rawValue), 510);
    });
  });

  it('passes when no redirect detected', () => {
    return Audit.audit(mockArtifacts(SUCCESS_NOREDIRECT)).then(output => {
      assert.equal(output.score, 100);
      assert.equal(output.details.items.length, 0);
      assert.equal(output.rawValue, 0);
    });
  });
});


text:
/**
 * Module dependencies
 */
var _ = require('underscore'),
    http = require('http'),
    Request = require('./Request.js'),
    Response = require('./Response.js'),
    Q = require('q'),
    cache = require('./Cache'),
    https = require('https'),
    redisTransporter = require('./cache-transporters/RedisTransporter');

var Requestify = (function() {
    'use strict';

    /**
     * The response encoding
     * @type {string}
     */
    var responseEncoding = 'utf8',

        /**
         * Module API
         */
            api;

    /**
     * Returns http|s instance according to the given protocol
     * @param protocol
     * @returns {http|https}
     */
    function getHttp(protocol) {
        if (protocol === 'https:') {
            return https;
        }

        return http;
    }

    /**
     * Is the request was successful or not
     * @param {number} code
     * @returns {boolean}
     */
    function isSuccessful(code) {
        return code >= 200 && code < 300;
    }

    /**
     * Uses Requestify cache service to store response cache
     * @param {string} url
     * @param {int} code
     * @param {headers} headers
     * @param {string|object} body
     * @param {{cache: boolean, expires: number}} cacheSettings
     */
    function storeCache(url, code, headers, body, cacheSettings) {
        cacheSettings = cacheSettings || { cache: false };

        if (!cacheSettings.cache) {
            return;
        }

        cache.set(url, {
            code: code,
            headers: headers,
            body: body,
            created: new Date().getTime()
        });
    }

    /**
     * Executes the given request object.
     * @param {Request} request
     * @param {Q.defer} defer
     */
    function call(request, defer) {
        var httpRequest,
            options,
            http = getHttp(request.getProtocol()),
            timeout;

        // Define options according to Request object interface
        options = {
            hostname: request.getHost(),
            path: request.getUri(),
            port: request.getPort(),
            method: request.method,
            auth: request.getAuthorization(),
            headers: request.getHeaders()
        };

        /**
         * Handle request callback
         */
        httpRequest = http.request(options, function(res) {
            clearTimeout(timeout);
            var response = new Response(res.statusCode, res.headers);

            res.setEncoding(responseEncoding);
            res.on('data', function(chunk) {
                response.setChunk(chunk);
            });

            res.on('end', function() {
                if (isSuccessful(response.code)) {
                    storeCache(request.getFullUrl(), response.getCode(), response.getHeaders(), response.body, request.cache);
                    defer.resolve(response);
                    return;
                }

                defer.reject(response);
            });
        });

        /**
         * Abort and reject on timeout
         */
        timeout = setTimeout(function() {
            httpRequest.abort();
            defer.reject(new Response(405, {}, 'timeout exceeded'));
        }, request.timeout);

        /**
         * Reject on error and pass the given error object
         */
        httpRequest.on('error', function(error) {
            defer.reject(error);
            console.log(error);
        });

        httpRequest.end(request.getBody());

        return defer.promise;
    }

    /**
     * Request router, handles caching
     * @param {Request} request
     * @returns {Q.promise}
     */
    function callRouter(request) {
        var defer = Q.defer();

        if (!cache.isTransportAvailable() || request.method !== 'GET' || request.cache.cache === false) {
            return call(request, defer);
        }

        /**
         * Get the cache and serve if available
         */
        cache.get(request.getFullUrl())
            .then(function(data) {
                if (!data || (data.created + request.cache.expires > new Date().getTime())) {
                    call(request, defer);
                    return;
                }

                defer.resolve(new Response(data.code, data.headers, data.body));
            })
            .fail(function() {
                call(request, defer);
            }
        );

        return defer.promise;
    }

    /**
     * Module API
     * @type {{request: Function, responseEncoding: Function, get: Function, post: Function, put: Function, delete: Function, head: Function }}
     */
    api = {
        /**
         * Execute HTTP request based on the given method and body
         * @param {string} url - The URL to execute
         * @param {{ method: string, dataType: string, headers: object, body: object, cookies: object, auth: object }} options
         * @returns {Q.promise} - Returns a promise, once resolved || rejected, Response object is given
         */
        request: function(url, options) {
            return callRouter(new Request(url, options));
        },

        /**
         * Getter/setter for the response encoding
         * @param {string} value
         * @returns {string|Requestify}
         */
        responseEncoding: function(value) {
            if (!value) {
                return responseEncoding;
            }

            responseEncoding = value;
            return this;
        },

        /**
         * Getter/Setter for the redis instance
         * @deprecated
         * @param {Redis} redisInstance
         */
        redis: function(redisInstance) {
            if (!redisInstance) {
                return;
            }

            this.cacheTransporter(redisTransporter(redisInstance));
        },

        /**
         * Module core trasporters
         */
        coreCacheTransporters: {
            redis: redisTransporter
        },

        /**
         * Set cache transporter
         * @param {{ get: function, set: function, purge: function }} cacheTransporter
         */
        cacheTransporter: function(cacheTransporter) {
            if (!cacheTransporter) {
                return;
            }

            cache.setCacheTransporter(cacheTransporter);
        }
    };

    /**
     * Short methods generator
     */
    (function createShortMethods(names) {
        names.forEach(function(name) {
            api[name] = function(url, options) {
                options = options || {};
                options.method = name.toUpperCase();

                return api.request(url, options);
            };
        });
    }(['get', 'delete', 'head']));

    /**
     * Short methods with data generator
     */
    (function createShortMethodsWithData(names) {
        names.forEach(function(name) {
            api[name] = function(url, data, options) {
                options = options || {};

                options.method = name.toUpperCase();
                options.body = data;

                return api.request(url, options);
            };
        });
    }(['post', 'put']));

    return api;
}());

module.exports = Requestify;


text:
package TeX::Catcodes;

use strict;
use warnings;

use version; our $VERSION = qv '1.0.0';

use base qw(Exporter);

our %EXPORT_TAGS;

our @EXPORT_OK;

use constant;

sub install($\%) {
    my $tag_name = shift;
    my $hash_ref = shift;

    constant->import($hash_ref);

    $EXPORT_TAGS{$tag_name} = [ keys %{ $hash_ref } ];

    return;
}

my %CATCODES = (
    CATCODE_ESCAPE      =>  0,
    CATCODE_BEGIN_GROUP =>  1,
    CATCODE_END_GROUP   =>  2,
    CATCODE_MATH_SHIFT  =>  3,
    CATCODE_ALIGNMENT   =>  4,
    CATCODE_END_OF_LINE =>  5,
    CATCODE_PARAMETER   =>  6,
    CATCODE_SUPERSCRIPT =>  7,
    CATCODE_SUBSCRIPT   =>  8,
    CATCODE_IGNORED     =>  9,
    CATCODE_SPACE       => 10,
    CATCODE_LETTER      => 11,
    CATCODE_OTHER       => 12,
    CATCODE_ACTIVE      => 13,
    CATCODE_COMMENT     => 14,
    CATCODE_INVALID     => 15,
    ##
    ## EXTENSIONS
    ##
    CATCODE_CSNAME      => 16,
    CATCODE_PARAM_REF   => 17,
    CATCODE_ANONYMOUS   => 18,
);

install catcodes => %CATCODES;

our @EXPORT = @{ $EXPORT_TAGS{catcodes} };

1;

__END__

=head1 NAME

TeX::Catcodes - Constant names for TeX category codes.

=head1 AUTHOR

David M. Jones, C<< <dmj@ams.org> >>

=head1 SUPPORT

This code was developed at the American Mathematical Society (AMS) and
is being released with their permission in hopes that it might be of
interest or use to someone.  However, neither the author nor the AMS
is able to promise any additional support, including bug fixes,
enhancements, or documentation.

=head1 LICENCE AND COPYRIGHT

Copyright (c) 2015 American Mathematical Society

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

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

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


text:
.class public interface abstract Lcom/android/systemui/settings/ToggleSlider;
.super Ljava/lang/Object;
.source "ToggleSlider.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/systemui/settings/ToggleSlider$Listener;
    }
.end annotation

# virtual methods
.method public setChecked(Z)V
    .locals 0

    return-void
.end method

.method public abstract setDualColorSlider()V
.end method

.method public abstract setMax(I)V
.end method

.method public abstract setOnChangedListener(Lcom/android/systemui/settings/ToggleSlider$Listener;)V
.end method

.method public abstract setValue(I)V
.end method

.method public abstract updateHighBrightnessMode(I)V
.end method

.method public abstract updateOutdoorMode(I)V
.end method

.method public abstract updateStrainAlertDialog(I)V
.end method


text:
all: sample_css minified debug_version downloads

.PHONY: all sample_css minified debug_version clean downloads lint style check

# ----------------------------------------------------------------------------
# Sample CSS Generation from LESS files

SAMPLE_CSS_DIR = samples/resources/css
COMMON_SAMPLE_LESS = $(SAMPLE_CSS_DIR)/sample-common.less
COMMON_SAMPLE_CSS = $(patsubst %.less, %.css, $(COMMON_SAMPLE_LESS))
SAMPLE_LESS = $(wildcard $(SAMPLE_CSS_DIR)/sample*-client.less)
SAMPLE_CSS = $(patsubst %.less, %.css, $(SAMPLE_LESS))
LESSC = node_modules/less/bin/lessc

$(COMMON_SAMPLE_CSS): $(COMMON_SAMPLE_LESS)
	cat $< | $(LESSC) - $@

%.css: %.less $(COMMON_SAMPLE_LESS)
	cat $(COMMON_SAMPLE_LESS) $< | $(LESSC) - $@

sample_css: $(SAMPLE_CSS) $(COMMON_SAMPLE_CSS)

# ----------------------------------------------------------------------------
# Compiling of the main source code. NB: We have to explicitly state
# the javascript files in order here, since they have internal
# dependencies.

SRC_FILES = src/compatability.js src/utils.js src/datatypes.js \
	src/document.js src/managers.js \
	src/model.js src/edit.js src/viewer.js

MIN_NAME = giclee.min.js
DEBUG_NAME = giclee.js
OUT_DIR = out
ADDITIONAL_DIRS = samples/resources/js test/resources/js
UGLIFY = node_modules/uglify-js/bin/uglifyjs

MIN_OUT = $(OUT_DIR)/$(MIN_NAME)
ADDITIONAL_MIN = $(addsuffix /$(MIN_NAME), $(ADDITIONAL_DIRS))

DEBUG_OUT = $(OUT_DIR)/$(DEBUG_NAME)
ADDITIONAL_DEBUG = $(addsuffix /$(DEBUG_NAME), $(ADDITIONAL_DIRS))

minified: $(MIN_OUT) $(ADDITIONAL_MIN)
debug_version: $(DEBUG_OUT) $(ADDITIONAL_DEBUG)

$(OUT_DIR):
	mkdir -p $(OUT_DIR)

$(MIN_OUT): $(OUT_DIR) $(SRC_FILES)
	cat $(SRC_FILES) | $(UGLIFY) > $@

$(DEBUG_OUT): $(OUT_DIR) $(SRC_FILES)
	cat $(SRC_FILES) > $@

$(ADDITIONAL_MIN): $(MIN_OUT)
	cp $< $@

$(ADDITIONAL_DEBUG): $(DEBUG_OUT)
	cp $< $@

# ----------------------------------------------------------------------------
# Importing of jquery and qunit

JQUERY_NAME = jquery.min.js
JQUERY_SRC = http://code.jquery.com/$(JQUERY_NAME)

JQUERY_DIRS = samples/resources/js test/resources/js
JQUERY_FILES = $(addsuffix /$(JQUERY_NAME), $(JQUERY_DIRS))
JQUERY_TMP = /tmp/$(JQUERY_NAME)

downloads: $(JQUERY_FILES)

$(JQUERY_TMP):
	wget $(JQUERY_SRC) -O $(JQUERY_TMP)

$(JQUERY_FILES): $(JQUERY_TMP)
	cp $< $@

# ----------------------------------------------------------------------------
# Tidying up

clean:
	rm -f $(MIN_OUT) $(DEBUG_OUT) $(ADDITIONAL_MIN) $(ADDITIONAL_DEBUG)
	rm -f $(SAMPLE_CSS) $(COMMON_SAMPLE_CSS)
	rm -f $(JQUERY_FILES) $(JQUERY_TMP)
	rm -rf $(OUT_DIR)

# ----------------------------------------------------------------------------
# Linting and Styling

JSHINT = ./node_modules/jshint/bin/jshint
JSCS = ./node_modules/jscs/bin/jscs
SAMPLE_JS = $(wildcard samples/resources/js/sample*-client.js)
TEST_JS = $(wildcard test/tests/*.js)

lint:
	$(JSHINT) $(SRC_FILES) $(SAMPLE_JS) $(TEST_JS)

style:
	$(JSCS) $(SRC_FILES) $(SAMPLE_JS) $(TEST_JS)

check: lint style


text:
/*global */
/*jslint browser:true,sloppy:true,nomen:true,unparam:true,plusplus:true */
/*
 | Copyright 2012 Esri
 |
 | Licensed under the Apache License, Version 2.0 (the "License");
 | you may not use this file except in compliance with the License.
 | You may obtain a copy of the License at
 |
 |    http://www.apache.org/licenses/LICENSE-2.0
 |
 | Unless required by applicable law or agreed to in writing, software
 | distributed under the License is distributed on an "AS IS" BASIS,
 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | See the License for the specific language governing permissions and
 | limitations under the License.
 */
dojo.require("js.commonShare");

var commonShare = null;
var getTinyUrl = null;
var newLeft = 0;    //Variable to store the new left value for carousel of polling place
var operationalLayers; //variable for storing the operational layer details
var orientationChange = false; //variable for setting the flag on orientation
var handlePoll;
var selectedPoint; //variable for storing the selected point geometry
var tinyUrl; //variable for storing the tiny URL link

function CreateScrollbar(container, content) {
    var yMax;
    var pxLeft, pxTop, xCoord, yCoord;
    var scrollbar_track;
    var isHandleClicked = false;
    this.container = container;
    this.content = content;
    content.scrollTop = 0;
    if (dojo.dom.byId(container.id + 'scrollbar_track')) {
        RemoveChildren(dojo.dom.byId(container.id + 'scrollbar_track'));
        container.removeChild(dojo.dom.byId(container.id + 'scrollbar_track'));
    }
    if (!dojo.dom.byId(container.id + 'scrollbar_track')) {
        scrollbar_track = document.createElement('div');
        scrollbar_track.id = container.id + "scrollbar_track";
        scrollbar_track.className = "scrollbar_track";
    } else {
        scrollbar_track = dojo.dom.byId(container.id + 'scrollbar_track');
    }
    var containerHeight = dojo['dom-geometry'].getMarginBox(container);
    scrollbar_track.style.height = (containerHeight.h - 6) + "px";
    var scrollbar_handle = document.createElement('div');
    scrollbar_handle.className = 'scrollbar_handle';
    scrollbar_handle.id = container.id + "scrollbar_handle";
    scrollbar_track.appendChild(scrollbar_handle);
    container.appendChild(scrollbar_track);
    if ((content.scrollHeight - content.offsetHeight) <= 5) {
        scrollbar_handle.style.display = 'none';
        scrollbar_track.style.display = 'none';
        return;
    } else {
        scrollbar_handle.style.display = 'block';
        scrollbar_track.style.display = 'block';
        scrollbar_handle.style.height = Math.max(this.content.offsetHeight * (this.content.offsetHeight / this.content.scrollHeight), 25) + 'px';
        yMax = this.content.offsetHeight - scrollbar_handle.offsetHeight;
        yMax = yMax - 5; //for getting rounded bottom of handle
        if (window.addEventListener) {
            content.addEventListener('DOMMouseScroll', ScrollDiv, false);
        }
        content.onmousewheel = function (evt) {
            ScrollDiv(evt);
        }
    }

    function ScrollDiv(evt) {
        var evt = window.event || evt //equalize event object
        var delta = evt.detail ? evt.detail * (-120) : evt.wheelDelta //delta returns +120 when wheel is scrolled up, -120 when scrolled down
        pxTop = scrollbar_handle.offsetTop;
        if (delta <= -120) {
            var y = pxTop + 10;
            if (y > yMax) y = yMax;  // Limit vertical movement
            if (y < 0) y = 0;  // Limit vertical movement
            scrollbar_handle.style.top = y + "px";
            content.scrollTop = Math.round(scrollbar_handle.offsetTop / yMax * (content.scrollHeight - content.offsetHeight));
        } else {
            var y = pxTop - 10;
            if (y > yMax) y = yMax;  // Limit vertical movement
            if (y < 0) y = 2;  // Limit vertical movement
            scrollbar_handle.style.top = (y - 2) + "px";
            content.scrollTop = Math.round(scrollbar_handle.offsetTop / yMax * (content.scrollHeight - content.offsetHeight));
        }
    }
    //Attaching events to scrollbar components - Click and Drag
    scrollbar_track.onclick = function (evt) {
        if (!isHandleClicked) {
            evt = (evt) ? evt : event;
            pxTop = scrollbar_handle.offsetTop // Sliders vertical position at start of slide.
            var offsetY;
            if (!evt.offsetY) {
                var coords = dojo['dom-geometry'].getMarginBox(evt.target);
                offsetY = evt.layerY - coords.t;
            } else offsetY = evt.offsetY;
            if (offsetY < scrollbar_handle.offsetTop) {
                scrollbar_handle.style.top = offsetY + "px";
                content.scrollTop = Math.round(scrollbar_handle.offsetTop / yMax * (content.scrollHeight - content.offsetHeight));
            } else if (offsetY > (scrollbar_handle.offsetTop + scrollbar_handle.clientHeight)) {
                var y = offsetY - scrollbar_handle.clientHeight;
                if (y > yMax) y = yMax; // Limit vertical movement
                if (y < 0) y = 0; // Limit vertical movement
                scrollbar_handle.style.top = y + "px";
                content.scrollTop = Math.round(scrollbar_handle.offsetTop / yMax * (content.scrollHeight - content.offsetHeight));
            } else {
                return;
            }
        }
        isHandleClicked = false;
    };
    //Attaching events to scrollbar components - Using mouse wheel
    scrollbar_handle.onmousedown = function (evt) {
        isHandleClicked = true;
        evt = (evt) ? evt : event;
        evt.cancelBubble = true;
        if (evt.stopPropagation) evt.stopPropagation();
        pxTop = scrollbar_handle.offsetTop // Sliders vertical position at start of slide.
        yCoord = evt.screenY // Vertical mouse position at start of slide.
        document.body.style.MozUserSelect = 'none';
        document.body.style.userSelect = 'none';
        document.onselectstart = function () {
            return false;
        }
        document.onmousemove = function (evt) {
            evt = (evt) ? evt : event;
            evt.cancelBubble = true;
            if (evt.stopPropagation) evt.stopPropagation();
            var y = pxTop + evt.screenY - yCoord;
            if (y > yMax) y = yMax; // Limit vertical movement
            if (y < 0) y = 0; // Limit vertical movement
            scrollbar_handle.style.top = y + "px";
            content.scrollTop = Math.round(scrollbar_handle.offsetTop / yMax * (content.scrollHeight - content.offsetHeight));
        }
    };
    document.onmouseup = function () {
        document.body.onselectstart = null;
        document.onmousemove = null;
    };
    scrollbar_handle.onmouseout = function (evt) {
        document.body.onselectstart = null;
    };

    var startPos;

    dojo.connect(container, "touchstart", function (evt) {
        touchStartHandler(evt);
    });

    dojo.connect(container, "touchmove", function (evt) {
        touchMoveHandler(evt);
    });

    dojo.connect(content, "touchstart", function (evt) {
        // Needed for iOS 8
    });

    dojo.connect(content, "touchmove", function (evt) {
        // Needed for iOS 8
    });

    //Handlers for Touch Events

    function touchStartHandler(e) {
        startPos = e.touches[0].pageY;
    }

    function touchMoveHandler(e) {
        var touch = e.touches[0];
        if (e.cancelBubble) e.cancelBubble = true;
        if (e.stopPropagation) e.stopPropagation();
        e.preventDefault();

        var change = startPos - touch.pageY;
        if (change !== 0) {
            pxTop = scrollbar_handle.offsetTop;
            var y = pxTop + change;

            //setting scrollbar handle
            if (y > yMax) y = yMax // Limit vertical movement
            if (y < 0) y = 0 // Limit vertical movement
            scrollbar_handle.style.top = y + "px";

            //setting content position
            content.scrollTop = Math.round(scrollbar_handle.offsetTop / yMax * (content.scrollHeight - content.offsetHeight));

            startPos = touch.pageY;
        }
    }
}

//Create tap events for the metric pods in the carousel
function CreateHorizontalScrollbar(container, content) {
    var startHPos;
    var scrollingHTimer;

    dojo.connect(container, "touchstart", function (evt) {
        touchHStartHandler(evt);
    });
    if (content.id == "carouselscroll") {
        handlePoll = dojo.connect(container, "touchmove", function (evt) {
            if ((dojo.dom.byId('ServiceLeftArrow').style.display == "block") || (dojo.dom.byId('ServiceRightArrow').style.display == "block")) {
                touchHMoveHandler(evt);
            }
        });
    }

    dojo.connect(container, "touchend", function (evt) {
        touchHEndHandler(evt);
    });

    //Handlers for Touch Events
    function touchHStartHandler(e) {
        startHPos = e.touches[0].pageX;
    }

    function touchHMoveHandler(e) {
        if (!scrollingH) {
            var touch = e.touches[0];
            e.cancelBubble = true;
            if (e.stopPropagation) e.stopPropagation();
            e.preventDefault();

            if (touch.pageX - startHPos >= 2) {
                setTimeout(function () {
                    if (content.id == "carouselscroll") {
                        SlideLeft();
                    }
                }, 100);
            }
            if (startHPos - touch.pageX >= 2) {
                setTimeout(function () {
                    if (content.id == "carouselscroll") {
                        SlideRight();
                    }
                }, 100);
            }
            scrollingH = true;
            startHPos = touch.pageX;
        }
    }
    function touchHEndHandler(e) {
        scrollingHTimer = setTimeout(function () { clearTimeout(scrollingHTimer); scrollingH = false; }, 100);
    }
    //stop touch event
}

//Get the extent based on the map point
function GetBrowserMapExtent(mapPoint, mapCtrl) {
    var width = mapCtrl.extent.getWidth();
    var height = mapCtrl.extent.getHeight();
    var xmin = mapPoint.x - (width / 2);
    var ymin = mapPoint.y - (height / 1.5);
    var xmax = xmin + width;
    var ymax = ymin + height;
    return new esri.geometry.Extent(xmin, ymin, xmax, ymax, map.spatialReference);
}

//Get the extent based on the map point
function GetBrowserMapExtentforInfoWindow(mapPoint) {
    var width = map.extent.getWidth();
    var height = map.extent.getHeight();
    var xmin;
    if ((isTablet) && (window.matchMedia("(orientation: portrait)").matches)) {
        xmin = mapPoint.x - (width / 4.5);
    } else {
        xmin = mapPoint.x - (width / 2.5);
    }
    var ymin = mapPoint.y - (height / 2);
    var xmax = xmin + width;
    var ymax = ymin + height;
    return new esri.geometry.Extent(xmin, ymin, xmax, ymax, map.spatialReference);
}

//Refresh address container
function RemoveChildren(parentNode) {
    if (parentNode) {
        while (parentNode.hasChildNodes()) {
            parentNode.removeChild(parentNode.lastChild);
        }
    }
}

//Validate Email in comments tab
function CheckMailFormat(emailValue) {
    var pattern = /^([a-zA-Z][a-zA-Z0-9\_\-\.]*\@[a-zA-Z0-9\-]*\.[a-zA-Z]{2,4})?$/i;
    return pattern.test(emailValue);
}

//Append '...' for a string
String.prototype.trimString = function (len) {
    return (this.length > len) ? this.substring(0, len) + "..." : this;
}

String.prototype.format = function () {
    return this.toString().split(/(?=(?:\d{3})+(?:\.|$))/g).join(",");
};

//Trim string
String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

//Set height of the login page
function SetLoginPageHeight() {
    if (!isBrowser) {
        if (dojo.query(".dijitDialogUnderlayWrapper")) {
            if (dojo.query(".dijitDialogUnderlayWrapper").length > 0) {
                dojo.query(".dijitDialogUnderlayWrapper")[0].style.left = "0px";
                if (dojo['dom-geometry'].getMarginBox("divLoginScreenContainer").w > 0) {
                    dojo.query(".esriSignInDialog")[0].style.left = ((dojo['dom-geometry'].getMarginBox("divLoginScreenContainer").w / 2) - 165) + "px";
                }
                else {
                    dojo.query(".esriSignInDialog")[0].style.left = ((dojo['dom-geometry'].getMarginBox("divLoadingIndicator").w / 2) - 165) + "px";
                }
            }
        }
    }
    dojo.dom.byId("divWelcomeContent").style.height = (dojo['dom-geometry'].getMarginBox("divLoginScreenContainer").h - 400) + "px";
    setTimeout(function () {
        CreateScrollbar(dojo.dom.byId('divWelcomeContainer'), dojo.dom.byId('divWelcomeContent'));
    }, 100);
}

//Set the height of dashboard page
function SetHomePageHeight() {
    dojo.dom.byId("divLayerContainer").style.height = (dojo['dom-geometry'].getMarginBox("divInfoContainer").h - 85) + "px";
    dojo.dom.byId("divLayerContent").style.height = (dojo['dom-geometry'].getMarginBox("divInfoContainer").h - 85) + "px";
    dojo.dom.byId("divNAEDisplayContainer").style.height = (dojo['dom-geometry'].getMarginBox("divInfoContainer").h - 205) + "px";
    dojo.dom.byId("divNAEDisplayContent").style.height = (dojo['dom-geometry'].getMarginBox("divInfoContainer").h - 205) + "px";
    setTimeout(function () {
        CreateScrollbar(dojo.dom.byId('divLayerContainer'), dojo.dom.byId('divLayerContent'));
        CreateScrollbar(dojo.dom.byId('divNAEDisplayContainer'), dojo.dom.byId('divNAEDisplayContent'));
    }, 100);
}

//Set height of settings page
function SetSettingsHeight() {
    dojo.dom.byId("divRSSFeedContent").style.height = (dojo['dom-geometry'].getMarginBox("divSettingsContainer").h / 2 - 210) + "px";
    dojo.dom.byId("divTwitterFeedContent").style.height = (dojo['dom-geometry'].getMarginBox("divSettingsContainer").h / 2 - 210) + "px";
    CreateScrollbar(dojo.dom.byId('divRSSFeedContainer'), dojo.dom.byId('divRSSFeedContent'));
    CreateScrollbar(dojo.dom.byId('divTwitterFeedContainer'), dojo.dom.byId('divTwitterFeedContent'));
}

//Handle orientation changes
function orientationChanged() {
    orientationChange = true;
    setTimeout(function () {
        if (dojo.dom.byId("divLoginScreenContainer").style.display != "none") {
            SetLoginPageHeight();
        }
        if (dojo.dom.byId("divInfoContainer").style.display != "none") {
            SetHomePageHeight();
        }
        if (dojo.dom.byId("divSettingsContainer").style.display != "none") {
            SetSettingsHeight();
        }
        if (map) {
            dojo.dom.byId("divTempMap").style.left = ((dojo['dom-geometry'].getMarginBox("mapContainer").w + (dojo['dom-geometry'].getMarginBox("holder").l)) - dojo['dom-geometry'].getMarginBox("divMap").w) + "px";
            ResizeChartContainer();
            dojo.dom.byId("tdMapControls").style.width = ((window.matchMedia("(orientation: portrait)").matches) ? "300px" : "330px");
            dojo.dom.byId("tdMapButtons").style.width = ((window.matchMedia("(orientation: portrait)").matches) ? "300px" : "330px");
            setTimeout(function () {
                dojo.dom.byId("divFrozen").style.height = (map.height - 140) + "px";
                OrientationChangesforInfoWindow();
            }, 500);
        }
        orientationChange = false;
    }, 500);
}

function OrientationChangesforInfoWindow() {
    if (selectedPoint) {
        (tempMap) ? tempMap.setExtent(GetBrowserMapExtent(selectedPoint, tempMap)) : map.setExtent(GetBrowserMapExtent(selectedPoint, map));
    }

    if (selectedMapPoint) {
        map.setExtent(GetBrowserMapExtentforInfoWindow(selectedMapPoint));
        var point = selectedMapPoint;
        map.infoWindow.hide();
        setTimeout(function () {
            map.infoWindow.show(point);
            selectedMapPoint = point;
            if (tempMap) {
                if (!isBrowser) {
                    if (dojo.query(".esriPopup .contentPane").length > 0) {
                        dojo.query(".esriPopup .contentPane")[0].style.overflow = "hidden";
                    }
                }
            }
        }, 500);
    }
    if (selectedTempPoint) {
        tempMap.setExtent(GetBrowserMapExtentforInfoWindow(selectedTempPoint));
        var tempPoint = selectedTempPoint;
        tempMap.infoWindow.hide();
        setTimeout(function () {
            tempMap.infoWindow.show(tempPoint);
            selectedTempPoint = tempPoint;
        }, 500);
    }
}

//Fade-out animation
function FadeOut(node) {
    var fadeArgs = {
        node: node,
        duration: 500
    };
    dojo.fadeOut(fadeArgs).play();
}

//Fade-In animation
function FadeIn(node) {
    var fadeArgs = {
        node: node,
        duration: 500
    };
    dojo.fadeIn(fadeArgs).play();
}

//Slide pods to right
function SlideRight() {
    var difference = dojo.dom.byId('divServiceData').offsetWidth - dojo.dom.byId('carouselscroll').offsetWidth;
    if (newLeft >= difference) {
        dojo.dom.byId('ServiceLeftArrow').style.display = "block";
        var node = dojo.dom.byId('carouselscroll');
        newLeft = newLeft - (220);

        var node = dojo.dom.byId('carouselscroll');
        var animate = dojo.animateProperty({
            node: node,
            duration: 700,
            properties: {
                left: { end: newLeft, unit: "px" }
            }
        });
        animG = dojo.fx["chain"]([animate]).play();

        if (newLeft < difference) {
            dojo.dom.byId('ServiceRightArrow').style.display = "none";
        }
        if (dojo.dom.byId('ServiceRightArrow').style.display == "none") {
            dojo.dom.byId('ServiceLeftArrow').style.display = "block";
        }
    }
    if (difference > 0) {
        dojo.dom.byId('ServiceRightArrow').style.display = "none";
    }
    RepositionMetricPods();
}

//Slide pods to left
function SlideLeft() {
    var difference = dojo.dom.byId('divServiceData').offsetWidth - dojo.dom.byId('carouselscroll').offsetWidth;
    if (newLeft < 0) {
        if (newLeft > -(220)) {
            newLeft = 0;
        }
        else {
            newLeft = newLeft + (220);
        }
        var node = dojo.dom.byId('carouselscroll');
        var animate = dojo.animateProperty({
            node: node,
            duration: 700,
            properties: {
                left: { end: newLeft, unit: "px" }
            }
        });
        animG = dojo.fx["chain"]([animate]).play();

        if (dojo.dom.byId('ServiceRightArrow').style.display == "none") {
            if (newLeft > difference) {
                dojo.dom.byId('ServiceRightArrow').style.display = "block";
            }
        }
        if (newLeft == 0) {
            dojo.dom.byId('ServiceLeftArrow').style.display = "none";
        }
    }
    RepositionMetricPods();
}

//Reset pod positions
function ResetSlideControls() {
    dojo.dom.byId("divServiceDetails").style.left = (dojo['dom-geometry'].getMarginBox("holder").l) + "px";
    if (tempMap) {
        dojo.dom.byId("divServiceData").style.width = (dojo['dom-geometry'].getMarginBox("divGroupHolder").w / 2.5) + "px";
    }
    else {
        if (dojo.dom.byId("carouselscroll").offsetWidth > (dojo['dom-geometry'].getMarginBox("divGroupHolder").w - 104)) {
            dojo.dom.byId("divServiceData").style.width = (dojo['dom-geometry'].getMarginBox("divGroupHolder").w - 104) + "px";
        }
        else {
            dojo.dom.byId("divServiceData").style.width = dojo.dom.byId("carouselscroll").offsetWidth + "px";
        }
    }
    dojo.dom.byId('carouselscroll').style.paddingLeft = "0px";

    if (newLeft > (dojo.dom.byId("divServiceData").offsetWidth - dojo.dom.byId("carouselscroll").offsetWidth)) {
        if (!tempMap) {
            dojo.dom.byId('tdServiceRightArrow').style.width = "45px";
            dojo.dom.byId('tdServiceLeftArrow').style.width = "45px";

            dojo.dom.byId('ServiceRightArrow').style.display = "block";
            dojo.dom.byId('ServiceRightArrow').style.cursor = "pointer";
        }
    }
    else {
        if ((dojo.dom.byId("ServiceLeftArrow").style.display == "none") && (dojo.dom.byId("ServiceRightArrow").style.display == "none")) {
            dojo.dom.byId('tdServiceRightArrow').style.width = "1px";
            dojo.dom.byId('tdServiceLeftArrow').style.width = "1px";
        }

        dojo.dom.byId('ServiceRightArrow').style.display = "none";
        dojo.dom.byId('ServiceRightArrow').style.cursor = "default";
    }

    if (newLeft == 0) {
        dojo.dom.byId('ServiceLeftArrow').style.display = "none";
        dojo.dom.byId('ServiceLeftArrow').style.cursor = "default";
    }
    else {
        dojo.dom.byId('ServiceLeftArrow').style.display = "block";
        dojo.dom.byId('ServiceLeftArrow').style.cursor = "pointer";
    }
    RepositionMetricPods();
    setTimeout(function () {
        if (dojo.dom.byId("tblMetricPods")) {
            dojo.dom.byId("tblMetricPods").style.visibility = "visible";
        }
    }, 500);
}

//Reposition the pods based on number of metric pods available for a subject group
function RepositionMetricPods() {
    if (dojo.dom.byId("divServiceData").offsetWidth - dojo.dom.byId("carouselscroll").offsetWidth == 0) {
        if (dojo.dom.byId('ServiceLeftArrow').style.display == "none" && dojo.dom.byId('ServiceRightArrow').style.display == "none") {
            var cal = dojo['dom-geometry'].getMarginBox("divGroupHolder").w - dojo.dom.byId("carouselscroll").offsetWidth;
            if (!tempMap) {
                dojo.dom.byId('divServiceDetails').style.marginLeft = (cal / 2) + "px";
            }
        }
    }
    else {
        dojo.dom.byId('divServiceDetails').style.marginLeft = "0px";
    }
}

//Toggle containers
function ToggleContainers() {
    if (dojo['dom-geometry'].getMarginBox('divBookmarkContent').h > 0) {
        dojo.dom.byId('divBookmarkContent').style.right = (dojo['dom-geometry'].getMarginBox("holder").l + 15) + "px";
    }
    if (dojo['dom-geometry'].getMarginBox('divAddressContent').h > 0) {
        dojo.dom.byId('divAddressContent').style.right = (dojo['dom-geometry'].getMarginBox("holder").l + 15) + "px";
    }
    if (dojo['dom-geometry'].getMarginBox('divMoreContent').h > 0) {
        dojo.dom.byId('divMoreContent').style.right = (dojo['dom-geometry'].getMarginBox("holder").l + 15) + "px";
    }
    if (dojo['dom-geometry'].getMarginBox('divGraphComponent').h > 0) {
        dojo.dom.byId('divGraphComponent').style.right = (dojo['dom-geometry'].getMarginBox("holder").l + 15) + "px";
    }
}

//Get width of a control when text and font size are specified
String.prototype.getWidth = function (fontSize) {
    var test = document.createElement("span");
    document.body.appendChild(test);
    test.style.visibility = "hidden";

    test.style.fontSize = fontSize + "px";

    test.innerHTML = this;
    var w = test.offsetWidth;
    document.body.removeChild(test);
    return w;
}

//Get query string value of the provided key, if not found the function returns empty string
function GetQuerystring(key) {
    var _default;
    if (_default == null) _default = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return _default;
    else
        return qs[1];
}

//Clear default value for text box controls
function ClearDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    target.style.color = "#000";
    target.value = '';
}

//Set default value on blur
function ReplaceDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    ResetTargetValue(target, "defaultAddressTitle", "gray");
}

//Set target value for address
function ResetTargetValue(target, title, color) {
    if (target.value == '' && target.getAttribute(title)) {
        target.value = target.title;
        if (target.title == "") {
            target.value = target.getAttribute(title);
        }
    }
    target.style.color = color;
    lastSearchString = dojo.dom.byId("txtAddress").value.trim();
}

//Converting string to Boolean
String.prototype.bool = function () {
    return (/^true$/i).test(this);
};


text:
<?php

declare(strict_types=1);

/**
 * @Entity(repositoryClass="DDC3231User1NoNamespaceRepository")
 * @Table(name="no_namespace_users")
 */
class DDC3231User1NoNamespace
{
    /**
     * @var int
     * @Id
     * @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     * @Column(type="string", length=255)
     */
    protected $name;
}


text:
package org.gradle.integtests.tooling.r48;

import org.gradle.tooling.BuildAction;
import org.gradle.tooling.BuildController;

public class CustomBuildFinishedAction implements BuildAction<String> {
    // Tasks graph is already calculated and tasks executed. Action or model builders can access tasks results.

    @Override
    public String execute(BuildController controller) {
        // Print something to verify it is after task execution
        System.out.println("buildFinishedAction");
        return controller.getModel(CustomBuildFinishedModel.class).getValue();
    }
}


text:
<?xml version = '1.0' encoding = 'UTF-8'?>
<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="voter report fact congressional district dim FKv2" directorySegmentName="seg_0" id="A4EEDD1B-0109-1010-35CE-E8FC0AE2EEA4">
<createdBy>beng</createdBy>
<createdTime>2016-07-18 15:01:42 UTC</createdTime>
<ownerDesignName>VoterModel</ownerDesignName>
<engineerTo>
<item key="43D80677-0A7E-5735-AC15-B678A10B28E5" value="true"/>
</engineerTo>
<sourcePk>A096459F-4054-E72E-3CC1-DFFFC70E9FB4</sourcePk>
<identifying>false</identifying>
<optionalSource>true</optionalSource>
<optionalTarget>false</optionalTarget>
<sourceCardinality>1</sourceCardinality>
<sourceEntity>CDF9EF95-EFB7-9E8B-F4C4-B535E56B40CE</sourceEntity>
<targetCardinalityString>*</targetCardinalityString>
<targetEntity>6489D753-31B7-E688-704A-24A188D1AF79</targetEntity>
<transferable>true</transferable>
<deleteRule>NO ACTION</deleteRule>
</Relation>


text:
@interface SHUColorMapView ()

@property (weak, nonatomic)   UIImageView *mapImageView;
@property (weak, nonatomic)   UIView      *pickerView;
@property (assign, nonatomic) CGFloat     pickedHue;
@property (assign, nonatomic) CGFloat     pickedSaturation;

@end

@implementation SHUColorMapView

- (id) initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];

    if (self) {
        [self _createMapImageViewWithFrame:[self bounds]];
        [self _createPickerView];
    }

    return self;
}

- (id) initWithCoder:(NSCoder *)aDecoder{

    self = [super initWithCoder:aDecoder];

    if (self) {
        [self _createMapImageViewWithFrame:[self bounds]];
        [self _createPickerView];
    }

    return self;
}

#pragma mark - Public

- (void) setStartHue:(CGFloat)hue saturation:(CGFloat)saturation{
    CGPoint center = CGPointMake(hue * self.mapImageView.frame.size.width,
                                 (1.0f - saturation) * self.mapImageView.frame.size.height);
    self.pickerView.center = center;
    self.pickerView.backgroundColor = [self _getColorFromPosition:center];
}

#pragma mark - Pivate

- (void) _createMapImageViewWithFrame:(CGRect)frame{

    UIImageView *colorMapImageView = [[UIImageView alloc] initWithFrame:frame];
    UIImage *image = [UIImage imageNamed:@"colormap"];

    colorMapImageView.image = image;
    colorMapImageView.layer.cornerRadius = self.frame.size.width < self.frame.size.height ?
    self.frame.size.width / 10.f : self.frame.size.height / 10.f;
    colorMapImageView.layer.borderColor = [UIColor blackColor].CGColor;
    colorMapImageView.layer.borderWidth = .5f;
    colorMapImageView.layer.masksToBounds = YES;

    [self addSubview:colorMapImageView];
    self.mapImageView = colorMapImageView;
}

- (void) _createPickerView{

    UIView *pickerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 32.f, 32.f)];
    pickerView.backgroundColor = [self _getColorFromPosition:pickerView.center];
    pickerView.layer.cornerRadius = pickerView.frame.size.height / 2.f;
    pickerView.layer.borderColor = [UIColor lightTextColor].CGColor;
    pickerView.layer.shadowColor = [UIColor blackColor].CGColor;
    pickerView.layer.shadowOffset = CGSizeZero;
    pickerView.layer.shadowRadius = 1.f;
    pickerView.layer.shadowOpacity = .7f;
    pickerView.layer.borderWidth = 2.f;
    pickerView.layer.masksToBounds = YES;

    [self addSubview:pickerView];
    self.pickerView = pickerView;
    if ([self.delegate respondsToSelector:@selector(colormapView:didChangeHue:saturation:)]) {
        [self.delegate colormapView:self didChangeHue:self.pickedHue saturation:self.pickedSaturation];
    }
}

- (void) _handleTouchs:(NSSet *)touches{
    CGPoint currentTouchPosition = [[touches anyObject] locationInView:self];
    [self _movePickerToPosition:currentTouchPosition];
    if ([self.delegate respondsToSelector:@selector(colormapView:didChangeHue:saturation:)]) {
        [self.delegate colormapView:self didChangeHue:self.pickedHue saturation:self.pickedSaturation];
    }
}

- (void) _movePickerToPosition:(CGPoint)position{
    if (CGRectContainsPoint(self.mapImageView.frame, position)) {
        self.pickerView.center = position;
        self.pickerView.backgroundColor = [self _getColorFromPosition:position];
    }
}

- (UIColor *) _getColorFromPosition:(CGPoint)position{

    self.pickedHue = (position.x - self.mapImageView.frame.origin.x) / self.mapImageView.frame.size.width;
    self.pickedSaturation = 1.0 - (position.y - self.mapImageView.frame.origin.y) / self.mapImageView.frame.size.height;

    UIColor *color = [UIColor colorWithHue:self.pickedHue
                                saturation:self.pickedSaturation
                                brightness:1.f
                                     alpha:1.0];

    return color;
}

#pragma mark - Touch actions

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self _handleTouchs:touches];
}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    [self _handleTouchs:touches];
}

#pragma mark - SHUBrightnessPickerViewDataSource

- (void ) getStartHue:(CGFloat *)startHue saturetion:(CGFloat *)saturation{
    *startHue = self.pickedHue;
    *saturation = self.pickedSaturation;
}

@end


text:
package com.smartcodeltd.jenkinsci.plugins.build_monitor.user_interface;

import net.serenitybdd.screenplay.jenkins.targets.Link;
import net.serenitybdd.screenplay.targets.Target;

public class BuildMonitorDashboard {
    public static final Target Add_Some_Projects_link = Link.called("add some projects");
    public static final Target Project_Widget                 = Target.the("Project Widget").locatedBy("//li[header/h2[.='{0}']]");
    public static final Target Project_Widget_Builds          = Target.the("Project Widget Builds").locatedBy("//li[header/h2[.='{0}']]//*[contains(@class, 'build-number')]");
    public static final Target Project_Widget_Details         = Target.the("Project Widget Details").locatedBy("//li[header/h2[.='{0}']]//*[@class='details']");
    public static final Target Project_Widget_Badges          = Target.the("Project Widget Badges").locatedBy("//li[header/h2[.='{0}']]//*[@class='badges']");
    public static final Target Project_Widget_Pipeline_Stages = Target.the("Project Widget Builds").locatedBy("//li[header/h2[.='{0}']]//*[contains(@class, 'build-stages')]");
    public static final Target Project_Widget_Progress_Bars   = Target.the("Project Widget Progress Bars").locatedBy("//li[header/h2[.='{0}']]//*[@class='realtime-tests']");

    public static final Target Control_Panel = Target.the("Control Panel").locatedBy("//label[@for='settings-toggle']");
    public static final Target Show_Badges = Target.the("Show Badges Toggle").locatedBy("//input[@id='settings-show-badges']");
}


text:
package dispatcher

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"sync"

	"github.com/gorilla/websocket"
	"github.com/satori/go.uuid"
)

type MessageData struct {
	Event   string      `json:"e"`
	System  bool        `json:"s"`
	Message interface{} `json:"m"`
}

type BroadcastMessage struct {
	Room    string      `json:"r"`
	Message interface{} `json:"m"`
}

type DispatcherConfig struct {
	ReadBufferSize  int
	WriteBufferSize int
}

type Dispatcher struct {
	config   *DispatcherConfig
	upgrader websocket.Upgrader

	handlers    map[string]map[string]Handler
	rooms       map[string]map[string]*Conn
	connections map[string]*Conn
}

var defaultDispatcherConfig = &DispatcherConfig{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

//NewDispatcher create dispatcher
func NewDispatcher(config *DispatcherConfig) *Dispatcher {

	if config == nil {
		config = defaultDispatcherConfig
	}

	d := &Dispatcher{
		upgrader: websocket.Upgrader{
			ReadBufferSize:  config.ReadBufferSize,
			WriteBufferSize: config.WriteBufferSize,
		},
		handlers:    map[string]map[string]Handler{},
		rooms:       map[string]map[string]*Conn{},
		connections: map[string]*Conn{},
	}

	return d
}

//Handle upgrades http connection to websocket connection
func (d *Dispatcher) Handle(w http.ResponseWriter, r *http.Request, h *http.Header) (*Conn, error) {

	var c *websocket.Conn
	var err error

	if h == nil {
		c, err = d.upgrader.Upgrade(w, r, nil)
	} else {
		c, err = d.upgrader.Upgrade(w, r, *h)
	}

	if err != nil {
		return nil, err
	}

	id := uuid.NewV4().String()

	conn := &Conn{
		dispatcher: d,
		conn:       c,
		ID:         id,
		rooms:      map[string]map[string]*Conn{},
		lock:       &sync.Mutex{},
	}

	d.connections[id] = conn
	d.handlers[id] = map[string]Handler{}

	go d.readMessages(id)

	return conn, nil
}

func (d *Dispatcher) readMessages(connectionID string) {

	c := d.connections[connectionID]

	for {
		_, message, err := c.conn.ReadMessage()
		if err != nil {
			if websocket.IsCloseError(err, websocket.CloseNormalClosure,
				websocket.CloseGoingAway,
			) == false {
				log.Println("read:", err)
			}

			break
		}

		msg := &MessageData{}
		json.Unmarshal(message, msg)
		if err != nil {
			log.Println("MessageData unmarshal:", err)
			break
		}

		// handle system events
		if msg.System {

			if msg.Event == "join" {

				d.join(c, msg.Message.(string))
			} else if msg.Event == "leave" {

				d.leave(c, msg.Message.(string))
			} else if msg.Event == "emitTo" {

				m := msg.Message.(map[string]interface{})

				recipient := m["r"].(string)
				event := m["e"].(string)

				err := d.EmitTo(recipient, event, m["m"])
				if err != nil {
					log.Println(err)
				}
			} else if msg.Event == "broadcast" {

				m := msg.Message.(map[string]interface{})
				room := m["r"].(string)

				err := d.Broadcast(room, m["m"])
				if err != nil {
					log.Println(err)
				}
			}

			//all the system event handling ends here
			continue
		}

		if handler, ok := d.handlers[c.ID][msg.Event]; ok {
			handler(c, msg.Message)
		}
	}

	//close connection if message reading stoped
	d.Close(connectionID)
}

//EmitTo send message to all connections in the room
func (d *Dispatcher) EmitTo(recipient string, event string, msg interface{}) error {

	conn, ok := d.connections[recipient]
	if ok == false {
		return fmt.Errorf("Recipient '%s' doesn't exist.", recipient)
	}

	err := conn.Emit(event, msg)
	if err != nil {
		return err
	}

	return nil
}

//Broadcast send message to a room subscribers
func (d *Dispatcher) Broadcast(room string, message interface{}) error {

	connections, ok := d.rooms[room]
	if ok == false {
		return nil
	}

	msg := MessageData{
		Event:  "broadcast",
		System: true,
		Message: BroadcastMessage{
			Room:    room,
			Message: message,
		},
	}

	for _, conn := range connections {
		err := conn.emit(msg)
		if err != nil {
			return err
		}
	}

	return nil
}

//Close connection
func (d *Dispatcher) Close(ConnectionID string) error {

	conn, ok := d.connections[ConnectionID]
	if ok == false {
		return fmt.Errorf("Connection with '%s' ID not found", ConnectionID)
	}

	// remove connection from all the rooms it belongs to
	for name, room := range conn.rooms {
		if len(room) > 1 {
			// remove connection from the room
			delete(room, ConnectionID)
		} else {
			// delete room
			delete(d.rooms, name)
		}
	}

	delete(d.handlers, ConnectionID)
	delete(d.connections, ConnectionID)
	conn.close()

	return nil
}

func (d *Dispatcher) join(conn *Conn, roomName string) {

	_, ok := d.rooms[roomName]
	if ok == false {
		d.rooms[roomName] = map[string]*Conn{}
	}

	d.rooms[roomName][conn.ID] = conn

	conn.rooms[roomName] = d.rooms[roomName]
}

func (d *Dispatcher) leave(conn *Conn, roomName string) {

	_, ok := d.rooms[roomName]
	if ok == false {
		return // can't find room, so there is nothing to leve
	}

	// check if room has more than one connection
	if len(conn.rooms[roomName]) > 1 {
		// remove connection from the room
		delete(conn.rooms[roomName], conn.ID)
	} else {
		// room has only one connection so we will remove the room
		delete(d.rooms, roomName)

	}

	// remove room data from connection
	delete(conn.rooms, roomName)
}

//DispatcherJs handles client js code requests
func DispatcherJs(w http.ResponseWriter, r *http.Request) {

	w.Header()["Content-Type"] = []string{"application/javascript"}

	w.Write(ClientJs)
}