text:
package com.programmaniaks.training.unittest.configuration;

import java.util.Properties;

import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
public class PersistenceConfiguration{

	@Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
        em.setDataSource(dataSource());
        em.setPackagesToScan("com.programmaniaks.training.unittest.entity");

        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        em.setJpaVendorAdapter(vendorAdapter);
        em.setJpaProperties(additionalProperties());
        em.setPersistenceUnitName("unittestPu");
        return em;
    }

    @Bean
    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
        dataSource.setUrl("jdbc:hsqldb:mem:unittesttraining");
        dataSource.setUsername("sa");
        dataSource.setPassword("");
        return dataSource;
    }

    @Bean
    public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
        JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManager.setEntityManagerFactory(emf);
        return transactionManager;
    }

    @Bean
    public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
        return new PersistenceExceptionTranslationPostProcessor();
    }

    Properties additionalProperties() {
        Properties properties = new Properties();
        properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
        properties.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
        return properties;
    }
}


text:
#import "UIColor.h"

@interface UIColor (SUAdditions)
+ (id)colorWithStyleString:(id)arg1;
- (id)initWithStyleString:(id)arg1;
@end

redpajama_set_name: RedPajamaGithub


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/sys/internode.h $                                 */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2014                   */
/*                                                                        */
/* 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.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __INTERNODE_H
#define __INTERNODE_H
// Memory area preserved on MPIPL

#include <vmmconst.h>

enum internode_info_vals_t
{
    MAX_NODES_PER_SYS = 8,
};

enum intr_mpipl_sync_t
{
    INTR_MPIPL_SYNC_CLEAR = 0,
    INTR_MPIPL_UPSTREAM_DISABLED = 1,
    INTR_MPIPL_DRAINED = 2,
};

/**
 * Node information needed across MPIPLs
 */
struct internode_info_t
{
    uint64_t eye_catcher;
    uint64_t version;
    bool  exist[ MAX_NODES_PER_SYS ];       //!< true if HB node exists
    volatile intr_mpipl_sync_t  mpipl_intr_sync;     //!< at sync point
};

#define NODE_INFO_EYE_CATCHER 0x4e4f444544415441ul // "NODEDATA"
#define NODE_INFO_VERSION 1

#define INTERNODE_INFO_SIZE (sizeof(internode_info_t))

#endif


text:
package com.sksamuel.elastic4s

import org.elasticsearch.index.query._
import org.elasticsearch.index.query.CommonTermsQueryBuilder.Operator
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder
import com.sksamuel.elastic4s.DefinitionAttributes._
import org.elasticsearch.common.unit.Fuzziness
import org.elasticsearch.index.query.support.QueryInnerHitBuilder
import org.elasticsearch.search.fetch.innerhits.InnerHitsBuilder.InnerHit

import scala.language.implicitConversions
import scala.util.{Right, Left}

/** @author Stephen Samuel */

trait QueryDsl {

  implicit def string2query(string: String): SimpleStringQueryDefinition = new SimpleStringQueryDefinition(string)
  implicit def tuple2query(kv: (String, String)): TermQueryDefinition = new TermQueryDefinition(kv._1, kv._2)

  def query = this

  @deprecated("use boostingQuery", "1.4.0")
  def boosting: BoostingQueryDefinition = boostingQuery
  def boostingQuery: BoostingQueryDefinition = new BoostingQueryDefinition

  def commonQuery(field: String) = new CommonQueryExpectsText(field)
  def commonQuery = new CommonQueryExpectsField
  class CommonQueryExpectsField {
    def field(name: String) = new CommonQueryExpectsText(name)
  }
  class CommonQueryExpectsText(name: String) {
    def text(q: String): CommonTermsQueryDefinition = new CommonTermsQueryDefinition(name, q)
    def query(q: String): CommonTermsQueryDefinition = text(q)
  }

  @deprecated("use constantScoreQuery or constantScoreFilter to be consistent with other query type syntax", "1.6.5")
  def constantScore = new ConstantScoreExpectsQueryOrFilter
  class ConstantScoreExpectsQueryOrFilter {
    @deprecated("use constantScoreQuery or constantScoreFilter to be consistent with other query type syntax", "1.6.5")
    def query(query: QueryDefinition) = new ConstantScoreDefinition(QueryBuilders.constantScoreQuery(query.builder))
    @deprecated("use constantScoreQuery or constantScoreFilter to be consistent with other query type syntax", "1.6.5")
    def filter(filter: FilterDefinition) = new ConstantScoreDefinition(QueryBuilders.constantScoreQuery(filter.builder))
  }

  def constantScoreQuery(q: QueryDefinition) = constantScore query q
  def constantScoreFilter(f: FilterDefinition) = constantScore filter f

  def dismax = new DisMaxDefinition

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def fuzzylikethis: FuzzyLikeThisDefinitionExpectsText = flt

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def flt: FuzzyLikeThisDefinitionExpectsText = new FuzzyLikeThisDefinitionExpectsText

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def flt(text: String): FuzzyLikeThisExpectsField = new FuzzyLikeThisExpectsField(text)

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def fuzzylikethis(text: String): FuzzyLikeThisExpectsField = flt(text)

  @deprecated("deprecated by elasticsearch", "1.6.5")
  class FuzzyLikeThisDefinitionExpectsText {
    def text(q: String) = new FuzzyLikeThisExpectsField(q)
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  class FuzzyLikeThisExpectsField(text: String) {
    def field(name: String): FuzzyLikeThisDefinition = fields(name)
    def fields(names: String*): FuzzyLikeThisDefinition = new FuzzyLikeThisDefinition(text, names)
  }

  def functionScoreQuery(query: QueryDefinition): FunctionScoreQueryDefinition = new
      FunctionScoreQueryDefinition(Left(query))
  def functionScoreQuery(filter: FilterDefinition): FunctionScoreQueryDefinition = new
      FunctionScoreQueryDefinition(Right(filter))

  def filteredQuery = new FilteredQueryDefinition

  @deprecated("use fuzzyQuery", "1.4.0")
  def fuzzy(name: String, value: Any) = fuzzyQuery(name, value)
  def fuzzyQuery(name: String, value: Any) = new FuzzyQueryDefinition(name, value)

  def indicesQuery(indices: String*) = new {
    def query(query: QueryDefinition): IndicesQueryDefinition = new IndicesQueryDefinition(indices, query)
  }

  def hasChildQuery = new HasChildExpectsType
  def hasChildQuery(`type`: String) = new HasChildExpectsQuery(`type`)
  class HasChildExpectsType {
    def typed(`type`: String): HasChildExpectsQuery = new HasChildExpectsQuery(`type`)
  }
  class HasChildExpectsQuery(`type`: String) {
    def query(q: QueryDefinition): HasChildQueryDefinition = new HasChildQueryDefinition(`type`, q)
  }

  def hasParentQuery = new HasParentExpectsType
  def hasParentQuery(`type`: String) = new HasParentExpectsQuery(`type`)
  class HasParentExpectsType {
    def typed(`type`: String) = new HasParentExpectsQuery(`type`)
  }
  class HasParentExpectsQuery(`type`: String) {
    def query(q: QueryDefinition) = new HasParentQueryDefinition(`type`, q)
  }

  @deprecated("use matchQuery", "1.6.5")
  def matches(tuple: (String, Any)): MatchQueryDefinition = matchQuery(tuple)
  @deprecated("use matchQuery", "1.6.5")
  def matches(field: String, value: Any): MatchQueryDefinition = matchQuery(field, value)

  def matchQuery(tuple: (String, Any)): MatchQueryDefinition = matchQuery(tuple._1, tuple._2)
  def matchQuery(field: String, value: Any): MatchQueryDefinition = new MatchQueryDefinition(field, value)

  @deprecated("use matchPhraseQuery", "1.6.5")
  def matchPhrase(field: String, value: Any): MatchPhraseDefinition = new MatchPhraseDefinition(field, value)
  def matchPhraseQuery(field: String, value: Any): MatchPhraseDefinition = new MatchPhraseDefinition(field, value)

  @deprecated("use matchPhrasePrefixQuery", "1.6.5")
  def matchPhrasePrefix(field: String, value: Any) = new MatchPhrasePrefixDefinition(field, value)
  def matchPhrasePrefixQuery(field: String, value: Any) = new MatchPhrasePrefixDefinition(field, value)

  def multiMatchQuery(text: String) = new MultiMatchQueryDefinition(text)

  @deprecated("use matchAllQuery", "1.6.5")
  def matchall = new MatchAllQueryDefinition
  def matchAllQuery = new MatchAllQueryDefinition

  def morelikeThisQuery(fields: String*) = new MoreLikeThisQueryDefinition(fields: _*)

  @deprecated("use nestedQuery", "1.4.0")
  def nested(path: String): NestedQueryDefinition = nestedQuery(path)
  def nestedQuery(path: String): NestedQueryDefinition = new NestedQueryDefinition(path)

  def query(q: String): QueryStringQueryDefinition = queryStringQuery(q)
  def queryStringQuery(q: String): QueryStringQueryDefinition = new QueryStringQueryDefinition(q)

  @deprecated("use rangeQuery", "1.4.0")
  def range(field: String): RangeQueryDefinition = rangeQuery(field)
  def rangeQuery(field: String): RangeQueryDefinition = new RangeQueryDefinition(field)

  @deprecated("use regexQuery", "1.4.0")
  def regex(tuple: (String, Any)): RegexQueryDefinition = regexQuery(tuple._1, tuple._2)
  @deprecated("use regexQuery", "1.4.0")
  def regex(field: String, value: Any): RegexQueryDefinition = regexQuery(field, value)
  def regexQuery(tuple: (String, Any)): RegexQueryDefinition = regexQuery(tuple._1, tuple._2)
  def regexQuery(field: String, value: Any): RegexQueryDefinition = new RegexQueryDefinition(field, value)

  @deprecated("use prefixQuery", "1.4.0")
  def prefix(tuple: (String, Any)): PrefixQueryDefinition = prefixQuery(tuple)
  @deprecated("use prefixQuery", "1.4.0")
  def prefix(field: String, value: Any): PrefixQueryDefinition = prefixQuery(field, value)
  def prefixQuery(tuple: (String, Any)): PrefixQueryDefinition = prefixQuery(tuple._1, tuple._2)
  def prefixQuery(field: String, value: Any): PrefixQueryDefinition = new PrefixQueryDefinition(field, value)

  def simpleStringQuery(q: String): SimpleStringQueryDefinition = new SimpleStringQueryDefinition(q)
  def stringQuery(q: String): QueryStringQueryDefinition = new QueryStringQueryDefinition(q)

  def spanFirstQuery = new {
    def query(spanQuery: SpanQueryDefinition) = new {
      def end(end: Int) = new SpanFirstQueryDefinition(spanQuery, end)
    }
  }

  def spanOrQuery: SpanOrQueryDefinition = new SpanOrQueryDefinition
  def spanTermQuery(field: String, value: Any): SpanTermQueryDefinition = new SpanTermQueryDefinition(field, value)
  def spanNotQuery: SpanNotQueryDefinition = new SpanNotQueryDefinition
  def spanNearQuery: SpanNearQueryDefinition = new SpanNearQueryDefinition

  def spanMultiTermQuery(query: MultiTermQueryDefinition): SpanMultiTermQueryDefinition = new
      SpanMultiTermQueryDefinition(query)

  @deprecated("use termQuery", "1.4.0")
  def term(tuple: (String, Any)): TermQueryDefinition = termQuery(tuple)
  @deprecated("use termQuery", "1.4.0")
  def term(field: String, value: Any): TermQueryDefinition = termQuery(field, value)
  def termQuery(tuple: (String, Any)): TermQueryDefinition = termQuery(tuple._1, tuple._2)
  def termQuery(field: String, value: Any): TermQueryDefinition = new TermQueryDefinition(field, value)

  def termsQuery(field: String, values: AnyRef*): TermsQueryDefinition =
    new TermsQueryDefinition(field, values.map(_.toString): _*)

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def topChildren(`type`: String) = new TopChildrenExpectsQuery(`type`)
  class TopChildrenExpectsQuery(`type`: String) {
    @deprecated("deprecated by elasticsearch", "1.6.5")
    def query(q: QueryDefinition): TopChildrenQueryDefinition = new TopChildrenQueryDefinition(`type`, q)
  }

  @deprecated("use wildcardQuery", "1.4.0")
  def wildcard(tuple: (String, Any)): WildcardQueryDefinition = wildcardQuery(tuple)
  @deprecated("use wildcardQuery", "1.4.0")
  def wildcard(field: String, value: Any): WildcardQueryDefinition = wildcardQuery(field, value)
  def wildcardQuery(tuple: (String, Any)): WildcardQueryDefinition = wildcardQuery(tuple._1, tuple._2)
  def wildcardQuery(field: String, value: Any): WildcardQueryDefinition = new WildcardQueryDefinition(field, value)

  def ids(iterable: Iterable[String]): IdQueryDefinition = ids(iterable.toSeq: _*)
  def ids(ids: String*): IdQueryDefinition = new IdQueryDefinition(ids: _*)
  def all: MatchAllQueryDefinition = new MatchAllQueryDefinition

  def bool(block: => BoolQueryDefinition): BoolQueryDefinition = block
  def must(queries: QueryDefinition*): BoolQueryDefinition = new BoolQueryDefinition().must(queries: _*)
  def must(queries: Iterable[QueryDefinition]): BoolQueryDefinition = new BoolQueryDefinition().must(queries)
  def should(queries: QueryDefinition*): BoolQueryDefinition = new BoolQueryDefinition().should(queries: _*)
  def should(queries: Iterable[QueryDefinition]): BoolQueryDefinition = new BoolQueryDefinition().should(queries)
  def not(queries: QueryDefinition*): BoolQueryDefinition = new BoolQueryDefinition().not(queries: _*)
  def not(queries: Iterable[QueryDefinition]): BoolQueryDefinition = new BoolQueryDefinition().not(queries)
}

class BoolQueryDefinition extends QueryDefinition {
  val builder = QueryBuilders.boolQuery()
  def adjustPureNegative(adjustPureNegative: Boolean): this.type = {
    builder.adjustPureNegative(adjustPureNegative)
    this
  }
  def boost(boost: Double): this.type = {
    builder.boost(boost.toFloat)
    this
  }
  def must(queries: QueryDefinition*): this.type = {
    queries.foreach(builder must _.builder)
    this
  }
  def must(queries: Iterable[QueryDefinition]): this.type = {
    queries.foreach(builder must _.builder)
    this
  }
  def not(queries: QueryDefinition*): this.type = {
    queries.foreach(builder mustNot _.builder)
    this
  }
  def not(queries: Iterable[QueryDefinition]): this.type = {
    queries.foreach(builder mustNot _.builder)
    this
  }
  def should(queries: QueryDefinition*): this.type = {
    queries.foreach(builder should _.builder)
    this
  }
  def should(queries: Iterable[QueryDefinition]): this.type = {
    queries.foreach(builder should _.builder)
    this
  }
  def minimumShouldMatch(minimumShouldMatch: String): this.type = {
    builder.minimumShouldMatch(minimumShouldMatch: String)
    this
  }
  def minimumShouldMatch(minimumNumberShouldMatch: Int): this.type = {
    builder.minimumNumberShouldMatch(minimumNumberShouldMatch: Int)
    this
  }
  def disableCoord(disableCoord: Boolean): this.type = {
    builder.disableCoord(disableCoord: Boolean)
    this
  }
  def queryName(queryName: String): this.type = {
    builder.queryName(queryName)
    this
  }
}

trait QueryDefinition {
  def builder: org.elasticsearch.index.query.QueryBuilder
}

class FunctionScoreQueryDefinition(queryOrFilter: Either[QueryDefinition, FilterDefinition])
  extends QueryDefinition
  with DefinitionAttributeBoost
  with DefinitionAttributeBoostMode
  with DefinitionAttributeMaxBoost
  with DefinitionAttributeScoreMode {

  val builder = queryOrFilter match {
    case Left(query) => new FunctionScoreQueryBuilder(query.builder)
    case Right(filter) => new FunctionScoreQueryBuilder(filter.builder)
  }
  val _builder = builder

  def scorers(scorers: ScoreDefinition[_]*): FunctionScoreQueryDefinition = {
    scorers.foreach(scorer => scorer._filter match {
      case None => builder.add(scorer.builder)
      case Some(filter) => builder.add(filter.builder, scorer.builder)
    })
    this
  }
}

class MoreLikeThisQueryDefinition(fields: String*) extends QueryDefinition {

  val _builder = QueryBuilders.moreLikeThisQuery(fields: _*)
  val builder = _builder

  def analyzer(analyser: String): this.type = {
    _builder.analyzer(analyser)
    this
  }

  def analyser(analyser: String): this.type = {
    _builder.analyzer(analyser)
    this
  }

  def ids(ids: String*): this.type = {
    _builder.ids(ids: _*)
    this
  }

  def exclude(): this.type = {
    _builder.include(false)
    this
  }

  def include(): this.type = {
    _builder.include(true)
    this
  }

  def failOnUnsupportedField(): this.type = {
    _builder.failOnUnsupportedField(true)
    this
  }

  def notFailOnUnsupportedField(): this.type = {
    _builder.failOnUnsupportedField(false)
    this
  }

  def likeText(text: String): this.type = {
    _builder.likeText(text)
    this
  }

  def minTermFreq(freq: Int): this.type = {
    _builder.minTermFreq(freq)
    this
  }

  def stopWords(stopWords: String*): this.type = {
    _builder.stopWords(stopWords: _*)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def percentTermsToMatch(percentTermsToMatch: Double): this.type = {
    _builder.percentTermsToMatch(percentTermsToMatch.toFloat)
    this
  }

  def maxWordLength(maxWordLen: Int): this.type = {
    _builder.maxWordLength(maxWordLen)
    this
  }

  def minWordLength(minWordLen: Int): this.type = {
    _builder.minWordLength(minWordLen)
    this
  }

  def boostTerms(boostTerms: Double): this.type = {
    _builder.boostTerms(boostTerms.toFloat)
    this
  }

  def boost(boost: Double): this.type = {
    _builder.boost(boost.toFloat)
    this
  }

  def maxQueryTerms(maxQueryTerms: Int): this.type = {
    _builder.maxQueryTerms(maxQueryTerms)
    this
  }

  def minDocFreq(minDocFreq: Int): this.type = {
    _builder.minDocFreq(minDocFreq)
    this
  }

  def maxDocFreq(maxDocFreq: Int): this.type = {
    _builder.maxDocFreq(maxDocFreq)
    this
  }
}

class MultiMatchQueryDefinition(text: String)
  extends QueryDefinition
  with DefinitionAttributeFuzziness
  with DefinitionAttributePrefixLength
  with DefinitionAttributeFuzzyRewrite
  with DefinitionAttributeCutoffFrequency {

  val _builder = QueryBuilders.multiMatchQuery(text)
  val builder = _builder

  def maxExpansions(maxExpansions: Int): MultiMatchQueryDefinition = {
    builder.maxExpansions(maxExpansions)
    this
  }

  def fields(_fields: Iterable[String]) = {
    for ( f <- _fields ) builder.field(f)
    this
  }

  def fields(_fields: String*): MultiMatchQueryDefinition = fields(_fields.toIterable)

  def boost(boost: Double): MultiMatchQueryDefinition = {
    builder.boost(boost.toFloat)
    this
  }

  def analyzer(a: Analyzer): MultiMatchQueryDefinition = analyzer(a.name)

  def analyzer(a: String): MultiMatchQueryDefinition = {
    builder.analyzer(a)
    this
  }

  def minimumShouldMatch(minimumShouldMatch: Int): MultiMatchQueryDefinition = {
    builder.minimumShouldMatch(minimumShouldMatch.toString)
    this
  }

  def minimumShouldMatch(minimumShouldMatch: String): MultiMatchQueryDefinition = {
    builder.minimumShouldMatch(minimumShouldMatch: String)
    this
  }

  @deprecated("@deprecated use a tieBreaker of 1.0f to disable dis-max query or select the appropriate Type", "1.2.0")
  def useDisMax(useDisMax: Boolean): MultiMatchQueryDefinition = {
    builder.useDisMax(java.lang.Boolean.valueOf(useDisMax))
    this
  }

  def lenient(l: Boolean): MultiMatchQueryDefinition = {
    builder.lenient(l)
    this
  }

  def zeroTermsQuery(q: MatchQueryBuilder.ZeroTermsQuery): MultiMatchQueryDefinition = {
    builder.zeroTermsQuery(q)
    this
  }

  def tieBreaker(tieBreaker: Double): MultiMatchQueryDefinition = {
    builder.tieBreaker(java.lang.Float.valueOf(tieBreaker.toFloat))
    this
  }

  def operator(op: MatchQueryBuilder.Operator): MultiMatchQueryDefinition = {
    builder.operator(op)
    this
  }

  def operator(op: String): MultiMatchQueryDefinition = {
    op match {
      case "AND" => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.AND)
      case _ => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.OR)
    }
    this
  }

  def matchType(t: MultiMatchQueryBuilder.Type): MultiMatchQueryDefinition = {
    builder.`type`(t)
    this
  }

  def matchType(t: String): MultiMatchQueryDefinition = {
    val mt = t match {
      case "most_fields" => MultiMatchQueryBuilder.Type.MOST_FIELDS
      case "cross_fields" => MultiMatchQueryBuilder.Type.CROSS_FIELDS
      case "phrase" => MultiMatchQueryBuilder.Type.PHRASE
      case "phrase_prefix" => MultiMatchQueryBuilder.Type.PHRASE_PREFIX
      case _ => MultiMatchQueryBuilder.Type.BEST_FIELDS
    }

    matchType(mt)
  }
}

class SpanMultiTermQueryDefinition(query: MultiTermQueryDefinition) extends SpanQueryDefinition {
  override val builder = QueryBuilders.spanMultiTermQueryBuilder(query.builder)
}

class FuzzyQueryDefinition(name: String, value: Any)
  extends MultiTermQueryDefinition
  with DefinitionAttributePrefixLength
  with DefinitionAttributeBoost {

  val builder = QueryBuilders.fuzzyQuery(name, value.toString)
  val _builder = builder

  def fuzziness(fuzziness: Fuzziness) = {
    builder.fuzziness(fuzziness)
    this
  }

  def maxExpansions(maxExpansions: Int) = {
    builder.maxExpansions(maxExpansions)
    this
  }
  def transpositions(transpositions: Boolean) = {
    builder.transpositions(transpositions)
    this
  }
}

class HasChildQueryDefinition(`type`: String, q: QueryDefinition)
  extends QueryDefinition with DefinitionAttributeBoost {
  val builder = QueryBuilders.hasChildQuery(`type`, q.builder)
  val _builder = builder
  def scoreType(scoreType: String): HasChildQueryDefinition = {
    builder.scoreType(scoreType)
    this
  }
}

class HasParentQueryDefinition(`type`: String, q: QueryDefinition)
  extends QueryDefinition with DefinitionAttributeBoost {
  val builder = QueryBuilders.hasParentQuery(`type`, q.builder)
  val _builder = builder
  def scoreType(scoreType: String): HasParentQueryDefinition = {
    builder.scoreType(scoreType)
    this
  }
}

class IndicesQueryDefinition(indices: Iterable[String], query: QueryDefinition) extends QueryDefinition {
  override val builder = QueryBuilders.indicesQuery(query.builder, indices.toSeq: _*)
  def noMatchQuery(query: QueryDefinition): this.type = {
    builder.noMatchQuery(query.builder)
    this
  }
  def queryName(queryName: String): this.type = {
    builder.queryName(queryName)
    this
  }
}

class ConstantScoreDefinition(val builder: ConstantScoreQueryBuilder) extends QueryDefinition {
  def boost(b: Double): QueryDefinition = {
    builder.boost(b.toFloat)
    this
  }
}

@deprecated("deprecated by elasticsearch", "1.6.5")
class FuzzyLikeThisDefinition(text: String, fields: Iterable[String])
  extends QueryDefinition
  with DefinitionAttributePrefixLength
  with DefinitionAttributeBoost {

  val builder = fields.size match {
    case 0 => QueryBuilders.fuzzyLikeThisQuery().likeText(text)
    case _ => QueryBuilders.fuzzyLikeThisQuery(fields.toSeq: _*).likeText(text)
  }
  val _builder = builder

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def analyzer(a: Analyzer): FuzzyLikeThisDefinition = {
    builder.analyzer(a.name)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def ignoreTF(b: Boolean): FuzzyLikeThisDefinition = {
    builder.ignoreTF(b)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def maxQueryTerms(b: Int): FuzzyLikeThisDefinition = {
    builder.maxQueryTerms(b)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def fuzziness(f: Fuzziness): this.type = {
    _builder.fuzziness(f)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def failOnUnsupportedField(failOnUnsupportedField: Boolean): FuzzyLikeThisDefinition = {
    builder.failOnUnsupportedField(failOnUnsupportedField)
    this
  }
}

class CommonTermsQueryDefinition(name: String, text: String)
  extends QueryDefinition
  with DefinitionAttributeBoost
  with DefinitionAttributeCutoffFrequency {

  val builder = QueryBuilders.commonTermsQuery(name, text)
  val _builder = builder

  def highFreqMinimumShouldMatch(highFreqMinimumShouldMatch: Int): CommonTermsQueryDefinition = {
    builder.highFreqMinimumShouldMatch(highFreqMinimumShouldMatch.toString)
    this
  }
  def highFreqOperator(operator: String): CommonTermsQueryDefinition = {
    builder.highFreqOperator(if (operator.toLowerCase == "and") Operator.AND else Operator.OR)
    this
  }
  def analyzer(analyzer: Analyzer): CommonTermsQueryDefinition = {
    builder.analyzer(analyzer.name)
    this
  }
  def lowFreqMinimumShouldMatch(lowFreqMinimumShouldMatch: Int): CommonTermsQueryDefinition = {
    builder.lowFreqMinimumShouldMatch(lowFreqMinimumShouldMatch.toString)
    this
  }
  def lowFreqOperator(operator: String): CommonTermsQueryDefinition = {
    builder.lowFreqOperator(if (operator.toLowerCase == "and") Operator.AND else Operator.OR)
    this
  }
}

class DisMaxDefinition extends QueryDefinition {
  val builder = QueryBuilders.disMaxQuery()
  def query(queries: QueryDefinition*): DisMaxDefinition = {
    queries.foreach(q => builder.add(q.builder))
    this
  }
  def boost(b: Double): DisMaxDefinition = {
    builder.boost(b.toFloat)
    this
  }
  def tieBreaker(tieBreaker: Double): DisMaxDefinition = {
    builder.tieBreaker(tieBreaker.toFloat)
    this
  }
}

class FilteredQueryDefinition extends QueryDefinition {
  def builder = QueryBuilders.filteredQuery(_query, _filter).boost(_boost.toFloat)
  private var _query: QueryBuilder = QueryBuilders.matchAllQuery
  private var _filter: FilterBuilder = null
  private var _boost: Double = -1d
  def boost(boost: Double): FilteredQueryDefinition = {
    _boost = boost
    this
  }
  def query(query: => QueryDefinition): FilteredQueryDefinition = {
    _query = Option(query).map(_.builder).getOrElse(_query)
    this
  }
  def filter(filter: => FilterDefinition): FilteredQueryDefinition = {
    _filter = Option(filter).map(_.builder).orNull
    this
  }
}

class IdQueryDefinition(ids: String*) extends QueryDefinition {

  def builder = _builder
  private var _builder = QueryBuilders.idsQuery().addIds(ids: _*)
  private var _boost: Double = -1

  def types(types: String*) = {
    _builder = QueryBuilders.idsQuery(types: _*).addIds(ids: _*).boost(_boost.toFloat)
    this
  }
  def boost(boost: Double) = {
    _builder.boost(boost.toFloat)
    _boost = boost
    this
  }
}

class BoostingQueryDefinition extends QueryDefinition {
  val builder = QueryBuilders.boostingQuery()
  def positive(block: => QueryDefinition) = {
    builder.positive(block.builder)
    this
  }
  def negative(block: => QueryDefinition) = {
    builder.negative(block.builder)
    this
  }
  def positiveBoost(b: Double) = {
    builder.boost(b.toFloat)
    this
  }
  def negativeBoost(b: Double) = {
    builder.negativeBoost(b.toFloat)
    this
  }
}

class SpanOrQueryDefinition extends SpanQueryDefinition with DefinitionAttributeBoost {
  val builder = QueryBuilders.spanOrQuery
  val _builder = builder
  def clause(spans: SpanTermQueryDefinition*): SpanOrQueryDefinition = {
    spans.foreach {
      span => builder.clause(span.builder)
    }
    this
  }
}

class SpanTermQueryDefinition(field: String, value: Any) extends SpanQueryDefinition {
  val builder = QueryBuilders.spanTermQuery(field, value.toString)
  def boost(boost: Double) = {
    builder.boost(boost.toFloat)
    this
  }
}

trait MultiTermQueryDefinition extends QueryDefinition {
  override def builder: MultiTermQueryBuilder
}

class WildcardQueryDefinition(field: String, query: Any)
  extends QueryDefinition
  with DefinitionAttributeRewrite
  with DefinitionAttributeBoost {
  val builder = QueryBuilders.wildcardQuery(field, query.toString)
  val _builder = builder
}

class PrefixQueryDefinition(field: String, prefix: Any)
  extends MultiTermQueryDefinition
  with DefinitionAttributeRewrite
  with DefinitionAttributeBoost {
  val builder = QueryBuilders.prefixQuery(field, prefix.toString)
  val _builder = builder
}

class RegexQueryDefinition(field: String, regex: Any)
  extends MultiTermQueryDefinition
  with DefinitionAttributeRewrite
  with DefinitionAttributeBoost {
  val builder = QueryBuilders.regexpQuery(field, regex.toString)
  val _builder = builder
  def flags(flags: RegexpFlag*): RegexQueryDefinition = {
    builder.flags(flags: _*)
    this
  }
}

class TermQueryDefinition(field: String, value: Any) extends QueryDefinition {
  val builder = QueryBuilders.termQuery(field, value.toString)
  def boost(boost: Double) = {
    builder.boost(boost.toFloat)
    this
  }
}

class TermsQueryDefinition(field: String, values: String*) extends QueryDefinition {
  val builder = QueryBuilders.termsQuery(field, values: _*)
  def boost(boost: Double): TermsQueryDefinition = {
    builder.boost(boost.toFloat)
    this
  }
  def minimumShouldMatch(minimumShouldMatch: Int): TermsQueryDefinition = {
    builder.minimumMatch(minimumShouldMatch)
    this
  }
  def disableCoord(disableCoord: Boolean): TermsQueryDefinition = {
    builder.disableCoord(disableCoord)
    this
  }
}

trait SpanQueryDefinition extends QueryDefinition {
  override def builder: SpanQueryBuilder
}

class SpanFirstQueryDefinition(query: SpanQueryDefinition, end: Int) extends QueryDefinition {
  val builder = QueryBuilders.spanFirstQuery(query.builder, end)
}

class SpanNotQueryDefinition extends QueryDefinition {
  val builder = QueryBuilders.spanNotQuery()
  def boost(boost: Double): this.type = {
    builder.boost(boost.toFloat)
    this
  }
  def dist(dist: Int): this.type = {
    builder.dist(dist)
    this
  }
  def exclude(query: SpanQueryDefinition): this.type = {
    builder.exclude(query.builder)
    this
  }
  def include(query: SpanQueryDefinition): this.type = {
    builder.include(query.builder)
    this
  }
  def pre(pre: Int): this.type = {
    builder.pre(pre)
    this
  }
  def post(post: Int): this.type = {
    builder.post(post)
    this
  }
}

class SpanNearQueryDefinition extends SpanQueryDefinition {
  val builder = QueryBuilders.spanNearQuery()
  def boost(boost: Double): this.type = {
    builder.boost(boost.toFloat)
    this
  }
  def inOrder(inOrder: Boolean): this.type = {
    builder.inOrder(inOrder)
    this
  }
  def collectPayloads(collectPayloads: Boolean): this.type = {
    builder.collectPayloads(collectPayloads)
    this
  }
  def clause(query: SpanQueryDefinition): this.type = {
    builder.clause(query.builder)
    this
  }
  def slop(slop: Int): this.type = {
    builder.slop(slop)
    this
  }
}

class TopChildrenQueryDefinition(`type`: String, q: QueryDefinition)
  extends QueryDefinition
  with DefinitionAttributeBoost {

  val builder = QueryBuilders.topChildrenQuery(`type`, q.builder)
  val _builder = builder

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def factor(factor: Int): TopChildrenQueryDefinition = {
    builder.factor(factor)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def incrementalFactor(incrementalFactor: Int): TopChildrenQueryDefinition = {
    builder.incrementalFactor(incrementalFactor)
    this
  }

  @deprecated("deprecated by elasticsearch", "1.6.5")
  def score(score: String): TopChildrenQueryDefinition = {
    builder.score(score)
    this
  }
}

class MatchAllQueryDefinition extends QueryDefinition {

  val builder = QueryBuilders.matchAllQuery

  def normsField(normsField: String): MatchAllQueryDefinition = {
    builder.normsField(normsField)
    this
  }
  def boost(boost: Double): MatchAllQueryDefinition = {
    builder.boost(boost.toFloat)
    this
  }
}

class RangeQueryDefinition(field: String) extends MultiTermQueryDefinition with DefinitionAttributeBoost {

  val builder = QueryBuilders.rangeQuery(field)
  val _builder = builder

  def from(f: Any) = {
    builder.from(f)
    this
  }

  def to(t: Any) = {
    builder.to(t)
    this
  }

  def includeLower(includeLower: Boolean) = {
    builder.includeLower(includeLower)
    this
  }

  def includeUpper(includeUpper: Boolean) = {
    builder.includeUpper(includeUpper)
    this
  }
}

class MatchQueryDefinition(field: String, value: Any)
  extends QueryDefinition
  with DefinitionAttributeBoost
  with DefinitionAttributeFuzziness
  with DefinitionAttributeFuzzyRewrite
  with DefinitionAttributePrefixLength
  with DefinitionAttributeRewrite
  with DefinitionAttributeCutoffFrequency {

  val builder = QueryBuilders.matchQuery(field, value)
  val _builder = builder

  def operator(op: String): MatchQueryDefinition = {
    op match {
      case "AND" => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.AND)
      case _ => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.OR)
    }
    this
  }

  def analyzer(a: Analyzer): MatchQueryDefinition = {
    builder.analyzer(a.name)
    this
  }

  def zeroTermsQuery(z: MatchQueryBuilder.ZeroTermsQuery) = {
    builder.zeroTermsQuery(z)
    this
  }

  def slop(s: Int) = {
    builder.slop(s)
    this
  }

  def setLenient(lenient: Boolean) = {
    builder.setLenient(lenient)
    this
  }

  def operator(op: MatchQueryBuilder.Operator) = {
    builder.operator(op)
    this
  }

  def minimumShouldMatch(a: Any) = {
    builder.minimumShouldMatch(a.toString)
    this
  }

  def maxExpansions(max: Int) = {
    builder.maxExpansions(max)
    this
  }

  def fuzzyTranspositions(f: Boolean): MatchQueryDefinition = {
    builder.fuzzyTranspositions(f)
    this
  }
}

class MatchPhrasePrefixDefinition(field: String, value: Any)
  extends QueryDefinition
  with DefinitionAttributeBoost
  with DefinitionAttributeFuzziness
  with DefinitionAttributeFuzzyRewrite
  with DefinitionAttributePrefixLength
  with DefinitionAttributeRewrite
  with DefinitionAttributeCutoffFrequency {

  def builder = _builder
  val _builder = QueryBuilders.matchPhrasePrefixQuery(field, value.toString)

  def analyzer(a: Analyzer): MatchPhrasePrefixDefinition = {
    builder.analyzer(a.name)
    this
  }

  def analyzer(name: String): MatchPhrasePrefixDefinition = {
    builder.analyzer(name)
    this
  }

  def zeroTermsQuery(z: MatchQueryBuilder.ZeroTermsQuery): MatchPhrasePrefixDefinition = {
    builder.zeroTermsQuery(z)
    this
  }

  def slop(s: Int): MatchPhrasePrefixDefinition = {
    builder.slop(s)
    this
  }

  def setLenient(lenient: Boolean): MatchPhrasePrefixDefinition = {
    builder.setLenient(lenient)
    this
  }

  def operator(op: MatchQueryBuilder.Operator): MatchPhrasePrefixDefinition = {
    builder.operator(op)
    this
  }

  def operator(op: String): MatchPhrasePrefixDefinition = {
    op match {
      case "AND" => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.AND)
      case _ => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.OR)
    }
    this
  }

  def minimumShouldMatch(a: Any): MatchPhrasePrefixDefinition = {
    builder.minimumShouldMatch(a.toString)
    this
  }

  def maxExpansions(max: Int): MatchPhrasePrefixDefinition = {
    builder.maxExpansions(max)
    this
  }

  def fuzzyTranspositions(f: Boolean): MatchPhrasePrefixDefinition = {
    builder.fuzzyTranspositions(f)
    this
  }
}

class MatchPhraseDefinition(field: String, value: Any)
  extends QueryDefinition
  with DefinitionAttributeBoost
  with DefinitionAttributeFuzziness
  with DefinitionAttributeFuzzyRewrite
  with DefinitionAttributePrefixLength
  with DefinitionAttributeRewrite
  with DefinitionAttributeCutoffFrequency {

  val builder = QueryBuilders.matchPhraseQuery(field, value.toString)
  val _builder = builder

  def analyzer(a: Analyzer): MatchPhraseDefinition = {
    builder.analyzer(a.name)
    this
  }

  def zeroTermsQuery(z: MatchQueryBuilder.ZeroTermsQuery) = {
    builder.zeroTermsQuery(z)
    this
  }

  def slop(s: Int): MatchPhraseDefinition = {
    builder.slop(s)
    this
  }

  def setLenient(lenient: Boolean): MatchPhraseDefinition = {
    builder.setLenient(lenient)
    this
  }

  def operator(op: MatchQueryBuilder.Operator): MatchPhraseDefinition = {
    builder.operator(op)
    this
  }

  def operator(op: String): MatchPhraseDefinition = {
    op match {
      case "AND" => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.AND)
      case _ => builder.operator(org.elasticsearch.index.query.MatchQueryBuilder.Operator.OR)
    }
    this
  }

  def minimumShouldMatch(a: Any) = {
    builder.minimumShouldMatch(a.toString)
    this
  }

  def maxExpansions(max: Int) = {
    builder.maxExpansions(max)
    this
  }

  def fuzzyTranspositions(f: Boolean) = {
    builder.fuzzyTranspositions(f)
    this
  }

}

class SimpleStringQueryDefinition(query: String) extends QueryDefinition {

  val builder = QueryBuilders.simpleQueryStringQuery(query)

  def analyzer(analyzer: String): SimpleStringQueryDefinition = {
    builder.analyzer(analyzer)
    this
  }

  def analyzer(analyzer: Analyzer): SimpleStringQueryDefinition = {
    builder.analyzer(analyzer.name)
    this
  }

  def defaultOperator(op: String): SimpleStringQueryDefinition = {
    op match {
      case "AND" => builder.defaultOperator(SimpleQueryStringBuilder.Operator.AND)
      case _ => builder.defaultOperator(SimpleQueryStringBuilder.Operator.OR)
    }
    this
  }

  def defaultOperator(d: SimpleQueryStringBuilder.Operator): SimpleStringQueryDefinition = {
    builder.defaultOperator(d)
    this
  }

  def asfields(fields: String*): SimpleStringQueryDefinition = {
    fields foreach field
    this
  }

  def field(name: String): SimpleStringQueryDefinition = {
    builder.field(name)
    this
  }

  def field(name: String, boost: Double): SimpleStringQueryDefinition = {
    builder.field(name, boost.toFloat)
    this
  }

  def flags(flags: SimpleQueryStringFlag*): SimpleStringQueryDefinition = {
    builder.flags(flags: _*)
    this
  }
}

class QueryStringQueryDefinition(query: String)
  extends QueryDefinition
  with DefinitionAttributeRewrite
  with DefinitionAttributeBoost {

  val builder = QueryBuilders.queryStringQuery(query)
  val _builder = builder

  def analyzer(analyzer: String): this.type = {
    builder.analyzer(analyzer)
    this
  }

  def analyzer(analyzer: Analyzer): this.type = {
    builder.analyzer(analyzer.name)
    this
  }

  def defaultOperator(op: String): this.type = {
    op.toUpperCase match {
      case "AND" => builder.defaultOperator(QueryStringQueryBuilder.Operator.AND)
      case _ => builder.defaultOperator(QueryStringQueryBuilder.Operator.OR)
    }
    this
  }

  def defaultOperator(op: QueryStringQueryBuilder.Operator): this.type = {
    builder.defaultOperator(op)
    this
  }

  def asfields(fields: String*): this.type = {
    fields foreach field
    this
  }

  def lowercaseExpandedTerms(lowercaseExpandedTerms: Boolean): this.type = {
    builder.lowercaseExpandedTerms(lowercaseExpandedTerms)
    this
  }

  def fuzzyPrefixLength(fuzzyPrefixLength: Int): this.type = {
    builder.fuzzyPrefixLength(fuzzyPrefixLength)
    this
  }

  def fuzzyMaxExpansions(fuzzyMaxExpansions: Int): this.type = {
    builder.fuzzyMaxExpansions(fuzzyMaxExpansions)
    this
  }

  def fuzzyRewrite(fuzzyRewrite: String): this.type = {
    builder.fuzzyRewrite(fuzzyRewrite)
    this
  }

  def tieBreaker(tieBreaker: Double): this.type = {
    builder.tieBreaker(tieBreaker.toFloat)
    this
  }

  def allowLeadingWildcard(allowLeadingWildcard: Boolean): this.type = {
    builder.allowLeadingWildcard(allowLeadingWildcard)
    this
  }

  def lenient(lenient: Boolean): this.type = {
    builder.lenient(lenient)
    this
  }

  def minimumShouldMatch(minimumShouldMatch: Int): this.type = {
    builder.minimumShouldMatch(minimumShouldMatch.toString)
    this
  }

  def enablePositionIncrements(enablePositionIncrements: Boolean): this.type = {
    builder.enablePositionIncrements(enablePositionIncrements)
    this
  }

  def quoteFieldSuffix(quoteFieldSuffix: String): this.type = {
    builder.quoteFieldSuffix(quoteFieldSuffix)
    this
  }

  def field(name: String): this.type = {
    builder.field(name)
    this
  }

  def field(name: String, boost: Double): this.type = {
    builder.field(name, boost.toFloat)
    this
  }

  def defaultField(field: String): this.type = {
    builder.defaultField(field)
    this
  }

  def analyzeWildcard(analyzeWildcard: Boolean): this.type = {
    builder.analyzeWildcard(analyzeWildcard)
    this
  }

  def autoGeneratePhraseQueries(autoGeneratePhraseQueries: Boolean): this.type = {
    builder.autoGeneratePhraseQueries(autoGeneratePhraseQueries)
    this
  }

  def operator(op: String): this.type = {
    op.toLowerCase match {
      case "and" => builder.defaultOperator(QueryStringQueryBuilder.Operator.AND)
      case _ => builder.defaultOperator(QueryStringQueryBuilder.Operator.OR)
    }
    this
  }

  def phraseSlop(phraseSlop: Int): QueryStringQueryDefinition = {
    builder.phraseSlop(phraseSlop)
    this
  }
}

class NestedQueryDefinition(path: String) extends QueryDefinition {
  private var _query: QueryDefinition = _
  private var _boost: Double = 1.0
  private var _scoreMode: String = _
  private var _inner: QueryInnerHitBuilder = _

  def builder = {
    require(_query != null, "must specify query for nested score query")
    QueryBuilders.nestedQuery(path, _query.builder).scoreMode(_scoreMode).boost(_boost.toFloat).innerHit(_inner)
  }

  def inner(name: String): this.type = {
    _inner = new QueryInnerHitBuilder().setName(name)
    this
  }

  def inner(inner: QueryInnerHitsDefinition): this.type = {
    _inner = inner.builder
    this
  }

  def query(query: QueryDefinition): this.type = {
    _query = query
    this
  }

  def scoreMode(scoreMode: String): this.type = {
    _scoreMode = scoreMode
    this
  }

  def boost(b: Double): this.type = {
    _boost = b
    this
  }
}

class QueryInnerHitsDefinition(private[elastic4s] val name: String) {

  private[elastic4s] val builder = new QueryInnerHitBuilder().setName(name)

  def from(f: Int): this.type = {
    builder.setFrom(f)
    this
  }

  def size(s: Int): this.type = {
    builder.setSize(s)
    this
  }
}

class InnerHitDefinition(private[elastic4s] val name: String) {

  private[elastic4s] val inner = new InnerHit

  def path(p: String): this.type = {
    inner.setPath(p)
    this
  }

  def `type`(t: String): this.type = {
    inner.setType(t)
    this
  }
}


text:
<?php

namespace Zend\EventManager\Exception;

/**
 * Invalid callback exception
 *
 * @category   Zend
 * @package    Zend_EventManager
 */
class InvalidCallbackException extends DomainException implements ExceptionInterface
{
}


text:
const carsController = (function () {
  function getAll() {
    contextService.ctxHandler(this);

    //security check
    if (!this.loggedIn) {
      let action = this.path.split('/#/')[1];
      this.redirect(`#/login?ReturnUrl=%2F${action}%2F`);
      drawerService.showInfo('You need to login first!');
      return;
    }

    carModel.all(this)
      .then((res) => {
        if (res.length === 0) {
          this.noCarsFound = true;
        } else {
          res.forEach((a) => {
            if (a._acl.creator === sessionStorage.getItem('userId')) {
              a.isAuthor = true;
            }
          });
        }

        this.cars = res;

        contextService.loadCommon(this)
          .then(function () {
            this.loadPartials({
              car: './views/cars/listing/car.hbs'
            })
          })
          .then(function () {
            this.partial('./views/cars/listing/listingPage.hbs');
          });
      })
      .catch((err) => drawerService.handleError(err));
  }

  function getCreate() {
    contextService.ctxHandler(this);

    //security check
    if (!this.loggedIn) {
      let action = this.path.split('/#/')[1];
      this.redirect(`#/login?ReturnUrl=%2F${action}%2F`);
      drawerService.showInfo('You need to login first!');
      return;
    }

    contextService.loadCommon(this)
      .then(function () {
        this.loadPartials({
          createForm: './views/cars/create/createForm.hbs',
          validatorForm: './views/common/validatorForm.hbs'
        })
      })
      .then(function () {
        this.partial('./views/cars/create/createPage.hbs');
      });
  }

  function postCreate() {
    // boostrap form validation on user's side
    // TBA on server's side

    let car = {
      seller: sessionStorage.getItem('username'),
      title: this.params.title,
      description: this.params.description,
      brand: this.params.brand,
      model: this.params.model,
      year: this.params.year,
      imageUrl: this.params.imageUrl,
      fuelType: this.params.fuelType,
      price: this.params.price
    }

    carModel.create(car)
      .then(() => {
        this.redirect('#/listing');
        drawerService.showInfo('Car created successfully!');
      })
      .catch((err) => drawerService.handleError(err));
  }

  function getEdit() {
    contextService.ctxHandler(this);

    // security check on post

    carModel.details(this.params.id.substring(1))
      .then((res) => {
        this.id = res._id;
        this.title = res.title;
        this.description = res.description;
        this.brand = res.brand;
        this.model = res.model;
        this.year = res.year;
        this.imageUrl = res.imageUrl;
        this.fuelType = res.fuelType;
        this.price = res.price;

        contextService.loadCommon(this)
          .then(function () {
            this.loadPartials({
              editForm: './views/cars/edit/editForm.hbs',
              validatorForm: './views/common/validatorForm.hbs'
            })
          })
          .then(function () {
            this.partial('./views/cars/edit/editPage.hbs');
          });
      })
      .catch((err) => drawerService.handleError(err));
  }

  function putEdit() {
    carModel.details(this.params.id.substring(1))
      .then((res) => {
        // security check
        if (res._acl.creator !== sessionStorage.getItem('userId')) {
          drawerService.showError("You don't have access to this resource!");
          this.redirect('#/listing');
          return;
        }

        // boostrap form validation on user's side
        // TBA on server's side

        try {
          let car = {
            seller: sessionStorage.getItem('username'),
            title: this.params.title,
            description: this.params.description,
            brand: this.params.brand,
            model: this.params.model,
            year: this.params.year,
            imageUrl: this.params.imageUrl,
            fuelType: this.params.fuelType,
            price: this.params.price
          }

          carModel.edit(this.params.id.substring(1), car)
            .then((res) => {
              drawerService.showInfo(`Listing ${res.title} updated!`);
              this.redirect('#/listing');
            })
        } catch (err) {
          (err) => drawerService.handleError(err);
        }
      })
  }

  function postDelete() {
    contextService.ctxHandler(this);

    carModel.details(this.params.id.substring(1))
      .then((res) => {
        // security check
        if (res._acl.creator !== sessionStorage.getItem('userId')) {
          drawerService.showError("You don't have access to this resource!");
          this.redirect('#/listing');
          return;
        }

        try {
          carModel.remove(this.params.id.substring(1))
            .then(() => {
              drawerService.showInfo('Listing deleted!');
              this.redirect('#/listing');
            })
        } catch (err) {
          (err) => drawerService.handleError(err);
        }
      });
  }

  function getMyListing() {
    contextService.ctxHandler(this);

    //security check
    if (!this.loggedIn) {
      let action = this.path.split('/#/')[1];
      this.redirect(`#/login?ReturnUrl=%2F${action}%2F`);
      drawerService.showInfo('You need to login first!');
      return;
    }

    carModel.my(sessionStorage.getItem('username'))
      .then((res) => {
        if (res.length === 0) {
          this.noCarsFound = true;
        }

        this.cars = res;

        contextService.loadCommon(this)
          .then(function () {
            this.loadPartials({
              car: './views/cars/my/my.hbs'
            });
          })
          .then(function () {
            this.partial('./views/cars/my/myPage.hbs');
          });
      })
      .catch((err) => drawerService.handleError(err));
  }

  async function getDetails() {
    contextService.ctxHandler(this);

    //security check
    if (!this.loggedIn) {
      let action = this.path.split('/#/')[1];
      this.redirect(`#/login?ReturnUrl=%2F${action}%2F`);
      drawerService.showInfo('You need to login first!');
      return;
    }

    let car = await carModel.details(this.params.id.substring(1));

    this.id = car._id;
    this.title = car.title;
    this.description = car.description;
    this.brand = car.brand;
    this.model = car.model;
    this.year = car.year;
    this.imageUrl = car.imageUrl;
    this.fuelType = car.fuelType;
    this.price = car.price;

    if (car._acl.creator === sessionStorage.getItem('userId')) {
      this.isAuthor = true;
    }

    try {
      contextService.loadCommon(this)
        .then(function () {
          this.partial('./views/cars/details/details.hbs');
        })
    } catch (err) {
      (err) => drawerService.handleError(err)
    }
  }

  return {
    getAll,
    getCreate,
    postCreate,
    getEdit,
    putEdit,
    postDelete,
    getMyListing,
    getDetails
  }
})();


text:
<?php

namespace Microsoft\Dynamics\Model;

use SaintSystems\OData\Entity;

/**
* LanguageLocale class
*
* LanguageLocale entity
*
* @category  Model
* @package   Microsoft.Dynamics
* @license   https://opensource.org/licenses/MIT MIT License
* @link      https://www.microsoft.com/en-us/dynamics365/
*/
class LanguageLocale extends Entity
{
     /**
     * The entity set name associated with the entity.
     * This is needed for API calls since this is the API endpoint for this Entity
     *
     * @var string
     */
    static $entity = 'languagelocale';

    /**
     * The name of the attribute that is the primary id for the entity.
     * PrimaryIdAttribute from https://msdn.microsoft.com/en-us/library/mt607760.aspx
     *
     * @var string
     */
    static $primaryKey = 'languagelocaleid';
}


text:
<?xml version="1.0"?>
<openerp>
    <data noupdate="0">
    	<record id="login_form_disable_footer" model="ir.config_parameter">
            <field name="key">login_form_disable_footer</field>
            <field name="value">False</field>
        </record>

        <record id="login_form_disable_database_manager" model="ir.config_parameter">
            <field name="key">login_form_disable_database_manager</field>
            <field name="value">False</field>
        </record>

        <record id="login_form_change_background_by_hour" model="ir.config_parameter">
            <field name="key">login_form_change_background_by_hour</field>
            <field name="value">True</field>
        </record>

        <record id="login_form_change_background_timezone" model="ir.config_parameter">
            <field name="key">login_form_change_background_timezone</field>
            <field name="value">Etc/GMT-7</field>
        </record>

        <record id="login_form_background_default" model="ir.config_parameter">
            <field name="key">login_form_background_default</field>
            <field name="value">/vitech_backend_theme/static/src/img/background_login_2.png</field>
        </record>
        <record id="login_form_background_dawn" model="ir.config_parameter">
            <field name="key">login_form_background_dawn</field>
            <field name="value">/vitech_backend_theme/static/src/img/background_login_1.png</field>
        </record>
        <record id="login_form_background_day" model="ir.config_parameter">
            <field name="key">login_form_background_day</field>
            <field name="value">/vitech_backend_theme/static/src/img/background_login_2.png</field>
        </record>
        <record id="login_form_background_dusk" model="ir.config_parameter">
            <field name="key">login_form_background_dusk</field>
            <field name="value">/vitech_backend_theme/static/src/img/background_login_3.png</field>
        </record>
        <record id="login_form_background_night" model="ir.config_parameter">
            <field name="key">login_form_background_night</field>
            <field name="value">/vitech_backend_theme/static/src/img/background_login_4.png</field>
        </record>
    </data>
</openerp>


text:
using Gama.Atenciones.Wpf.Services;
using NHibernate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AdministrationTools.Controllers
{
    public class CitasController : Controller
    {
        private ICitaRepository _Citas;

        public CitasController(ICitaRepository citas, ISession session)
        {
            _Citas = citas;
            _Citas.Session = session;
        }

        // GET: Citas
        public ActionResult Index()
        {
            if (Global.IsLogged)
            {
                var citas = _Citas.GetAll();

                return View(citas);
            }
            else
            {
                return View("~/Views/Account/Login.cshtml");
            }
        }
    }
}


text:
package openframes.entity;

import openframes.blocks.BlockRecord;
import openframes.blocks.BlockRecordSet;
import openframes.carriage.CarriagePackage;
import openframes.carriage.CarriageTranslocatorEntity;
import openframes.core.Configuration;
import openframes.util.Directions;
import openframes.util.ModInteraction;
import openframes.util.TeleportativeSpectreTeleporter;
import openframes.util.WorldUtil;
import net.minecraft.world.WorldServer;

public class TeleportativeSpectreEntity extends MotiveSpectreEntity {
    public boolean Source;

    public int ShiftX;
    public int ShiftY;
    public int ShiftZ;

    public int MinX;
    public int MinY;
    public int MinZ;
    public int MaxX;
    public int MaxY;
    public int MaxZ;

    public int TargetDimension;

    @Override
    public void WriteCommonRecord(net.minecraft.nbt.NBTTagCompound TagCompound) {
        super.WriteCommonRecord(TagCompound);

        TagCompound.setBoolean("Source", Source);

        TagCompound.setInteger("ShiftX", ShiftX);
        TagCompound.setInteger("ShiftY", ShiftY);
        TagCompound.setInteger("ShiftZ", ShiftZ);

        TagCompound.setInteger("MinX", MinX);
        TagCompound.setInteger("MinY", MinY);
        TagCompound.setInteger("MinZ", MinZ);
        TagCompound.setInteger("MaxX", MaxX);
        TagCompound.setInteger("MaxY", MaxY);
        TagCompound.setInteger("MaxZ", MaxZ);

        TagCompound.setInteger("TargetDimension", TargetDimension);
    }

    @Override
    public void ReadCommonRecord(net.minecraft.nbt.NBTTagCompound TagCompound) {
        super.ReadCommonRecord(TagCompound);

        Source = TagCompound.getBoolean("Source");

        ShiftX = TagCompound.getInteger("ShiftX");
        ShiftY = TagCompound.getInteger("ShiftY");
        ShiftZ = TagCompound.getInteger("ShiftZ");

        MinX = TagCompound.getInteger("MinX");
        MinY = TagCompound.getInteger("MinY");
        MinZ = TagCompound.getInteger("MinZ");
        MaxX = TagCompound.getInteger("MaxX");
        MaxY = TagCompound.getInteger("MaxY");
        MaxZ = TagCompound.getInteger("MaxZ");

        TargetDimension = TagCompound.getInteger("TargetDimension");
    }

    public void AbsorbCommon(CarriagePackage Package) {
        ShiftX = -Package.DriveRecord.X + Package.Translocator.xCoord;
        ShiftY = -Package.DriveRecord.Y + Package.Translocator.yCoord;
        ShiftZ = -Package.DriveRecord.Z + Package.Translocator.zCoord;

        MinX = Package.MinX;
        MinY = Package.MinY;
        MinZ = Package.MinZ;
        MaxX = Package.MaxX;
        MaxY = Package.MaxY;
        MaxZ = Package.MaxZ;

        TargetDimension = Package.Translocator.worldObj.provider.dimensionId;

        MotionDirection = Directions.values()[0];
    }

    public void AbsorbSource(CarriagePackage Package) {
        AbsorbCommon(Package);

        Source = true;

        RenderCacheKey = Package.RenderCacheKey;

        DriveRecord = new BlockRecord(Package.DriveRecord);

        {
            Body = new BlockRecordSet();

            for (BlockRecord Record : Package.Body) {
                Body.add(new BlockRecord(Record));
            }
        }

        PendingBlockUpdates = new net.minecraft.nbt.NBTTagList();
    }

    public void AbsorbSink(CarriagePackage Package) {
        Absorb(Package);

        AbsorbCommon(Package);

        DriveRecord = new BlockRecord(Package.Translocator.xCoord, Package.Translocator.yCoord, Package.Translocator.zCoord);
    }

    @Override
    public void ShiftBlockPosition(BlockRecord Record) {
        Record.X += ShiftX;
        Record.Y += ShiftY;
        Record.Z += ShiftZ;
    }

    @Override
    public void ShiftPipeItemPosition(Object Position) throws Throwable {
        ModInteraction.BC_Position_x.set(Position, ((Double) ModInteraction.BC_Position_x.get(Position)) + ShiftX);
        ModInteraction.BC_Position_y.set(Position, ((Double) ModInteraction.BC_Position_y.get(Position)) + ShiftY);
        ModInteraction.BC_Position_z.set(Position, ((Double) ModInteraction.BC_Position_z.get(Position)) + ShiftZ);
    }

    @Override
    public void ScheduleShiftedBlockUpdate(net.minecraft.nbt.NBTTagCompound PendingBlockUpdateRecord) {
        worldObj.scheduleBlockUpdateFromLoad
                (
                        PendingBlockUpdateRecord.getInteger("X") + ShiftX,
                        PendingBlockUpdateRecord.getInteger("Y") + ShiftY,
                        PendingBlockUpdateRecord.getInteger("Z") + ShiftZ,

                        PendingBlockUpdateRecord.getInteger("Id"),

                        PendingBlockUpdateRecord.getInteger("Delay"),

                        PendingBlockUpdateRecord.getInteger("Priority")
                );
    }

    @Override
    public void updateEntity() {
        TicksExisted++;

        if (worldObj.isRemote) {
            return;
        }

        if (TicksExisted < Configuration.CarriageMotion.TeleportationDuration) {
            return;
        }

        if (Source) {
            try {
                ((CarriageTranslocatorEntity) worldObj.getBlockTileEntity(DriveRecord.X, DriveRecord.Y, DriveRecord.Z)).ToggleActivity();
            } catch (Throwable Throwable) {
                Throwable.printStackTrace();
            }

            for (BlockRecord Record : Body) {
                WorldUtil.ClearBlock(worldObj, Record.X, Record.Y, Record.Z);
            }

            CaptureEntities(MinX, MinY, MinZ, MaxX, MaxY, MaxZ);

            return;
        }

        Release();
    }

    @Override
    public boolean ShouldCaptureEntity(net.minecraft.entity.Entity Entity) {
        if (!Configuration.CarriageMotion.TeleportEntities) {
            return (false);
        }

        return (super.ShouldCaptureEntity(Entity));
    }

    @Override
    public void ProcessCapturedEntity(net.minecraft.entity.Entity Entity) {
        if (Entity.riddenByEntity == null) {
            TeleportEntity(Entity);
        }
    }

    public net.minecraft.entity.Entity TeleportEntity(net.minecraft.entity.Entity Entity) {
        net.minecraft.server.MinecraftServer Server = cpw.mods.fml.common.FMLCommonHandler.instance().getMinecraftServerInstance();

        WorldServer HomeWorld = (WorldServer) worldObj;

        WorldServer TargetWorld = Server.worldServerForDimension(TargetDimension);

        TeleportativeSpectreTeleporter Teleporter = new TeleportativeSpectreTeleporter(worldObj);

        boolean Transdimensional = (HomeWorld.provider.dimensionId != TargetWorld.provider.dimensionId);

        double X = Entity.posX + ShiftX;
        double Y = Entity.posY + ShiftY;
        double Z = Entity.posZ + ShiftZ;
        float Yaw = Entity.rotationYaw;
        float Pitch = Entity.rotationPitch;

        net.minecraft.entity.Entity Mount = Entity.ridingEntity;

        if (Mount != null) {
            Entity.mountEntity(null);

            Mount = TeleportEntity(Mount);
        }

        if (Entity instanceof net.minecraft.entity.player.EntityPlayerMP) {
            net.minecraft.entity.player.EntityPlayerMP Player = (net.minecraft.entity.player.EntityPlayerMP) Entity;

            if (Transdimensional) {
                Server.getConfigurationManager().transferPlayerToDimension(Player, TargetDimension, Teleporter);
            }

            Player.playerNetServerHandler.setPlayerLocation(X, Y, Z, Yaw, Pitch);

            Player.setLocationAndAngles(X, Y, Z, Yaw, Pitch);
        } else {
            if (Transdimensional) {
                Entity.dimension = TargetDimension;

                HomeWorld.removeEntity(Entity);

                Entity.isDead = false;

                Server.getConfigurationManager().transferEntityToWorld(Entity, TargetDimension, HomeWorld, TargetWorld);

                net.minecraft.entity.Entity NewEntity = net.minecraft.entity.EntityList.createEntityByName(net.minecraft.entity.EntityList.getEntityString(Entity), TargetWorld);

                NewEntity.copyDataFrom(Entity, true);

                NewEntity.setLocationAndAngles(X, Y, Z, Yaw, Pitch);

                TargetWorld.spawnEntityInWorld(NewEntity);

                Entity.isDead = true;

                HomeWorld.resetUpdateEntityTick();

                TargetWorld.resetUpdateEntityTick();

                Entity = NewEntity;
            } else {
                Entity.setLocationAndAngles(X, Y, Z, Yaw, Pitch);

                TargetWorld.updateEntityWithOptionalForce(Entity, false);
            }
        }

        if (Mount != null) {
            Entity.mountEntity(Mount);
        }

        return (Entity);
    }
}


text:
package edu.ida.dataformat;

/**
 * A parse error in an ArffFile.
 *
 * Constructs an error message including the line number.
 *
 * @author Mikio L. Braun, mikio@cs.tu-berlin.de
 */
public class ArffFileParseError extends Exception {

    /** Construct a new ArffFileParseErrro object. */
    public ArffFileParseError(int lineno, String string) {
        super("Parse error line " + lineno + ": " + string);
    }

}


text:
Maintainers
====
Copyright 2014, Merchant Warehouse, LLC. Released under the [Apache 2.0 license](LICENSE.txt).

Find us on the [syslog4net Google Group](https://groups.google.com/forum/#!forum/syslog4net).

Original Authors
====
* Dominic Lachowicz (domlachowicz@gmail.com)
* Joe Polino (joe@polino.net)

Contributors
====
* Joe Magly


text:
// Copyright 2015 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es6id: 8.1.1.2.1
description: >
    Behavior when accessing `Symbol.unscopables` property value throws an error
info: >
    [...]
    6. If the withEnvironment flag of envRec is false, return true.
    7. Let unscopables be Get(bindings, @@unscopables).
    8. ReturnIfAbrupt(unscopables).

    ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
    [...]
    6. Set the withEnvironment flag of newEnv's EnvironmentRecord to true.
    [...]
flags: [noStrict]
features: [Symbol.unscopables]
---*/

var env = { x: 86 };
Object.defineProperty(env, Symbol.unscopables, {
  get: function() {
    throw new Test262Error();
  }
});

with (env) {
  assert.throws(Test262Error, function() {
    void x;
  });
}


text:
package com.appleframework.data.hbase.literal.interpreter;

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

import com.appleframework.data.hbase.literal.AbstractLiteralInterpreter;
import com.appleframework.data.hbase.util.DateUtil;

/**
 * DateInterpreter.
 *
 * @author xinzhi.zhang
 * */
public class DateInterpreter extends AbstractLiteralInterpreter {
    private static List<String> dateFormats = new ArrayList<String>();

    static {
        dateFormats.add(DateUtil.MSFormat);
        dateFormats.add(DateUtil.SecondFormat);
        dateFormats.add(DateUtil.MinuteFormat);
        dateFormats.add(DateUtil.HourFormat);
        dateFormats.add(DateUtil.DayFormat);
    }

    @Override
    public Class<?> getTypeCanInterpret() {
        return Date.class;
    }

    @Override
    protected Object interpret_internal(String literalValue) {
        for (String s : dateFormats) {
            Date date = DateUtil.parse(literalValue, s);
            if (date != null) {
                return date;
            }
        }
        return null;
    }

}


text:
class AddEquipmentTypeIdToModels < ActiveRecord::Migration[5.0]
  def change
    add_column :models, :equipment_type_id, :integer
  end
end


text:
package io.github.jdiemke.triangulation;

import java.util.Arrays;

/**
 * 2D triangle class implementation.
 *
 * @author Johannes Diemke
 */
public class Triangle2D {

    public Vector2D a;
    public Vector2D b;
    public Vector2D c;

    /**
     * Constructor of the 2D triangle class used to create a new triangle
     * instance from three 2D vectors describing the triangle's vertices.
     *
     * @param a
     *            The first vertex of the triangle
     * @param b
     *            The second vertex of the triangle
     * @param c
     *            The third vertex of the triangle
     */
    public Triangle2D(Vector2D a, Vector2D b, Vector2D c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    /**
     * Tests if a 2D point lies inside this 2D triangle. See Real-Time Collision
     * Detection, chap. 5, p. 206.
     *
     * @param point
     *            The point to be tested
     * @return Returns true iff the point lies inside this 2D triangle
     */
    public boolean contains(Vector2D point) {
        double pab = point.sub(a).cross(b.sub(a));
        double pbc = point.sub(b).cross(c.sub(b));

        if (!hasSameSign(pab, pbc)) {
            return false;
        }

        double pca = point.sub(c).cross(a.sub(c));

        if (!hasSameSign(pab, pca)) {
            return false;
        }

        return true;
    }

    /**
     * Tests if a given point lies in the circumcircle of this triangle. Let the
     * triangle ABC appear in counterclockwise (CCW) order. Then when det >
     * 0, the point lies inside the circumcircle through the three points a, b
     * and c. If instead det < 0, the point lies outside the circumcircle.
     * When det = 0, the four points are cocircular. If the triangle is oriented
     * clockwise (CW) the result is reversed. See Real-Time Collision Detection,
     * chap. 3, p. 34.
     *
     * @param point
     *            The point to be tested
     * @return Returns true iff the point lies inside the circumcircle through
     *         the three points a, b, and c of the triangle
     */
    public boolean isPointInCircumcircle(Vector2D point) {
        double a11 = a.x - point.x;
        double a21 = b.x - point.x;
        double a31 = c.x - point.x;

        double a12 = a.y - point.y;
        double a22 = b.y - point.y;
        double a32 = c.y - point.y;

        double a13 = (a.x - point.x) * (a.x - point.x) + (a.y - point.y) * (a.y - point.y);
        double a23 = (b.x - point.x) * (b.x - point.x) + (b.y - point.y) * (b.y - point.y);
        double a33 = (c.x - point.x) * (c.x - point.x) + (c.y - point.y) * (c.y - point.y);

        double det = a11 * a22 * a33 + a12 * a23 * a31 + a13 * a21 * a32 - a13 * a22 * a31 - a12 * a21 * a33
                - a11 * a23 * a32;

        if (isOrientedCCW()) {
            return det > 0.0d;
        }

        return det < 0.0d;
    }

    /**
     * Test if this triangle is oriented counterclockwise (CCW). Let A, B and C
     * be three 2D points. If det > 0, C lies to the left of the directed
     * line AB. Equivalently the triangle ABC is oriented counterclockwise. When
     * det < 0, C lies to the right of the directed line AB, and the triangle
     * ABC is oriented clockwise. When det = 0, the three points are colinear.
     * See Real-Time Collision Detection, chap. 3, p. 32
     *
     * @return Returns true iff the triangle ABC is oriented counterclockwise
     *         (CCW)
     */
    public boolean isOrientedCCW() {
        double a11 = a.x - c.x;
        double a21 = b.x - c.x;

        double a12 = a.y - c.y;
        double a22 = b.y - c.y;

        double det = a11 * a22 - a12 * a21;

        return det > 0.0d;
    }

    /**
     * Returns true if this triangle contains the given edge.
     *
     * @param edge
     *            The edge to be tested
     * @return Returns true if this triangle contains the edge
     */
    public boolean isNeighbour(Edge2D edge) {
        return (a == edge.a || b == edge.a || c == edge.a) && (a == edge.b || b == edge.b || c == edge.b);
    }

    /**
     * Returns the vertex of this triangle that is not part of the given edge.
     *
     * @param edge
     *            The edge
     * @return The vertex of this triangle that is not part of the edge
     */
    public Vector2D getNoneEdgeVertex(Edge2D edge) {
        if (a != edge.a && a != edge.b) {
            return a;
        } else if (b != edge.a && b != edge.b) {
            return b;
        } else if (c != edge.a && c != edge.b) {
            return c;
        }

        return null;
    }

    /**
     * Returns true if the given vertex is one of the vertices describing this
     * triangle.
     *
     * @param vertex
     *            The vertex to be tested
     * @return Returns true if the Vertex is one of the vertices describing this
     *         triangle
     */
    public boolean hasVertex(Vector2D vertex) {
        if (a == vertex || b == vertex || c == vertex) {
            return true;
        }

        return false;
    }

    /**
     * Returns an EdgeDistancePack containing the edge and its distance nearest
     * to the specified point.
     *
     * @param point
     *            The point the nearest edge is queried for
     * @return The edge of this triangle that is nearest to the specified point
     */
    public EdgeDistancePack findNearestEdge(Vector2D point) {
        EdgeDistancePack[] edges = new EdgeDistancePack[3];

        edges[0] = new EdgeDistancePack(new Edge2D(a, b),
                computeClosestPoint(new Edge2D(a, b), point).sub(point).mag());
        edges[1] = new EdgeDistancePack(new Edge2D(b, c),
                computeClosestPoint(new Edge2D(b, c), point).sub(point).mag());
        edges[2] = new EdgeDistancePack(new Edge2D(c, a),
                computeClosestPoint(new Edge2D(c, a), point).sub(point).mag());

        Arrays.sort(edges);
        return edges[0];
    }

    /**
     * Computes the closest point on the given edge to the specified point.
     *
     * @param edge
     *            The edge on which we search the closest point to the specified
     *            point
     * @param point
     *            The point to which we search the closest point on the edge
     * @return The closest point on the given edge to the specified point
     */
    private Vector2D computeClosestPoint(Edge2D edge, Vector2D point) {
        Vector2D ab = edge.b.sub(edge.a);
        double t = point.sub(edge.a).dot(ab) / ab.dot(ab);

        if (t < 0.0d) {
            t = 0.0d;
        } else if (t > 1.0d) {
            t = 1.0d;
        }

        return edge.a.add(ab.mult(t));
    }

    /**
     * Tests if the two arguments have the same sign.
     *
     * @param a
     *            The first floating point argument
     * @param b
     *            The second floating point argument
     * @return Returns true iff both arguments have the same sign
     */
    private boolean hasSameSign(double a, double b) {
        return Math.signum(a) == Math.signum(b);
    }

    @Override
    public String toString() {
        return "Triangle2D[" + a + ", " + b + ", " + c + "]";
    }

}


text:
var rush = rush || {};

window.onload = function() {
  // entry point
  rush.game = new rush.Game();
};


text:
<?php

namespace fkooman\Rest\Plugin\Authentication\Form;

use fkooman\Rest\Plugin\Authentication\UserInfoInterface;

class FormUserInfo implements UserInfoInterface
{
    /** @var string */
    private $userId;

    public function __construct($userId)
    {
        $this->userId = $userId;
    }

    public function getUserId()
    {
        return $this->userId;
    }
}


text:
from google.cloud import retail_v2

async def sample_set_inventory():
    # Create a client
    client = retail_v2.ProductServiceAsyncClient()

    # Initialize request argument(s)
    inventory = retail_v2.Product()
    inventory.title = "title_value"

    request = retail_v2.SetInventoryRequest(
        inventory=inventory,
    )

    # Make the request
    operation = client.set_inventory(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)

# [END retail_v2_generated_ProductService_SetInventory_async]


text:
<!DOCTYPE html>

    <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Bootstrap em Português (Brasil), agradável, intuítivo, e poderoso framework front-end para criar facilmente de forma ágil projetos web responsivos e mobile-first.">
<meta name="author" content="Bootstrap Brasil, Bootstrap team and contributors">

<title>

    Migrando para v3.x · Bootstrap em Português (Brasil)

</title>

<link href="{{ site.baseurl }}/docs/3.3/dist/css/bootstrap.css" rel="stylesheet">

<link href="{{ site.baseurl }}/docs/3.3/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<link href="{{ site.baseurl }}/docs/3.3/assets/css/src/pygments-manni.css" rel="stylesheet">
<link href="{{ site.baseurl }}/docs/3.3/assets/css/src/docs.css" rel="stylesheet">

<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="icon" href="/favicon.ico">

<meta property="og:type" content="article">
<meta property="og:title" content="Migrando para v3.x - Bootstrap em Português (Brasil)">
<meta property="og:description" content="Guia de como migrar do Bootstrap v2.x para v3.x, o que há de novo, e o que foi removido.">
<meta property="og:url" content="http://bootstrapbrasil.github.io/migration/">
<meta property="og:site_name" content="Bootstrap em Português (Brasil)">
<meta property="og:image" content="{{ site.baseurl }}/docs/3.3/assets/img/bootstrap-cover.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@getbootstrap">
<meta name="twitter:creator" content="@getbootstrap">

Pular para conteúdo

    Bootstrap 4 aqui!

      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false">
        Alternar navegação

      </button>
      Bootstrap

          Ponto de partida

          CSS

          Componentes

          JavaScript

          Personalize

Themes

Expo

Blog (em português)

Migrando para v3.x

Guia de como migrar do Bootstrap v2.x para v3.x, o que há de novo, e o que foi removido.

Migrating from 2.x to 3.0

Bootstrap 3 is not backwards compatible with v2.x. Use this section as a general guide to upgrading from v2.x to v3.0. For a broader overview, see what's new in the v3.0 release announcement.

Major class changes

This table shows the style changes between v2.x and v3.0.

          Bootstrap 2.x
          Bootstrap 3.0

          .row-fluid
          .row

          .span*
          .col-md-*

          .offset*
          .col-md-offset-*

          .brand
          .navbar-brand

          .navbar .nav
          .navbar-nav

          .nav-collapse
          .navbar-collapse

          .nav-toggle
          .navbar-toggle

          .btn-navbar
          .navbar-btn

          .hero-unit
          .jumbotron

          .icon-*
          .glyphicon .glyphicon-*

          .btn
          .btn .btn-default

          .btn-mini
          .btn-xs

          .btn-small
          .btn-sm

          .btn-large
          .btn-lg

          .alert
          .alert .alert-warning

          .alert-error
          .alert-danger

          .visible-phone
          .visible-xs

          .visible-tablet
          .visible-sm

          .visible-desktop
          Split into .visible-md .visible-lg

          .hidden-phone
          .hidden-xs

          .hidden-tablet
          .hidden-sm

          .hidden-desktop
          Split into .hidden-md .hidden-lg

          .input-block-level
          .form-control

          .control-group
          .form-group

          .control-group.warning .control-group.error .control-group.success
          .form-group.has-*

          .checkbox.inline .radio.inline
          .checkbox-inline .radio-inline

          .input-prepend .input-append
          .input-group

          .add-on
          .input-group-addon

          .img-polaroid
          .img-thumbnail

          ul.unstyled
          .list-unstyled

          ul.inline
          .list-inline

          .muted
          .text-muted

          .label
          .label .label-default

          .label-important
          .label-danger

          .text-error
          .text-danger

          .table .error
          .table .danger

          .bar
          .progress-bar

          .bar-*
          .progress-bar-*

          .accordion
          .panel-group

          .accordion-group
          .panel .panel-default

          .accordion-heading
          .panel-heading

          .accordion-body
          .panel-collapse

          .accordion-inner
          .panel-body

What's new

We've added new elements and changed some existing ones. Here are the new or updated styles.

          Element
          Description

          Panels
          .panel .panel-default .panel-body .panel-title .panel-heading .panel-footer .panel-collapse

          List groups
          .list-group .list-group-item .list-group-item-text .list-group-item-heading

          Glyphicons
          .glyphicon

          Jumbotron
          .jumbotron

          Extra small grid (<768px)
          .col-xs-*

          Small grid (≥768px)
          .col-sm-*

          Medium grid (≥992px)
          .col-md-*

          Large grid (≥1200px)
          .col-lg-*

          Responsive utility classes (≥1200px)
          .visible-lg .hidden-lg

          Offsets
          .col-sm-offset-* .col-md-offset-* .col-lg-offset-*

          Push
          .col-sm-push-* .col-md-push-* .col-lg-push-*

          Pull
          .col-sm-pull-* .col-md-pull-* .col-lg-pull-*

          Input height sizes
          .input-sm .input-lg

          Input groups
          .input-group .input-group-addon .input-group-btn

          Form controls
          .form-control .form-group

          Button group sizes
          .btn-group-xs .btn-group-sm .btn-group-lg

          Navbar text
          .navbar-text

          Navbar header
          .navbar-header

          Justified tabs / pills
          .nav-justified

          Responsive images
          .img-responsive

          Contextual table rows
          .success .danger .warning .active .info

          Contextual panels
          .panel-success .panel-danger .panel-warning .panel-info

          Modal
          .modal-dialog .modal-content

          Thumbnail image
          .img-thumbnail

          Well sizes
          .well-sm .well-lg

          Alert links
          .alert-link

What's removed

The following elements have been dropped or changed in v3.0.

          Element
          Removed from 2.x
          3.0 Equivalent

          Form actions
          .form-actions
          N/A

          Search form
          .form-search
          N/A

          Form group with info
          .control-group.info
          N/A

          Fixed-width input sizes
          .input-mini .input-small .input-medium .input-large .input-xlarge .input-xxlarge
          Use .form-control and the grid system instead.

          Block level form input
          .input-block-level
          No direct equivalent, but forms controls are similar.

          Inverse buttons
          .btn-inverse
          N/A

          Fluid row
          .row-fluid
          .row (no more fixed grid)

          Controls wrapper
          .controls
          N/A

          Controls row
          .controls-row
          .row or .form-group

          Navbar inner
          .navbar-inner
          N/A

          Navbar vertical dividers
          .navbar .divider-vertical
          N/A

          Dropdown submenu
          .dropdown-submenu
          N/A

          Tab alignments
          .tabs-left .tabs-right .tabs-below
          N/A

          Pill-based tabbable area
          .pill-content
          .tab-content

          Pill-based tabbable area pane
          .pill-pane
          .tab-pane

          Nav lists
          .nav-list .nav-header
          No direct equivalent, but list groups and .panel-groups are similar.

          Inline help for form controls
          .help-inline
          No exact equivalent, but .help-block is similar.

          Non-bar-level progress colors
          .progress-info .progress-success .progress-warning .progress-danger
          Use .progress-bar-* on the .progress-bar instead.

Additional notes

Other changes in v3.0 are not immediately apparent. Base classes, key styles, and behaviors have been adjusted for flexibility and our mobile first approach. Here's a partial list:

By default, text-based form controls now receive only minimal styling.  For focus colors and rounded corners, apply the .form-control class on the element to style.

Text-based form controls with the .form-control class applied are now 100% wide by default. Wrap inputs inside <div class="col-*"></div> to control input widths.

.badge no longer has contextual (-success,-primary,etc..) classes.

.btn must also use .btn-default to get the "default" button.

.row is now fluid.

Images are no longer responsive by default. Use .img-responsive for fluid <img> size.

The icons, now .glyphicon, are now font based. Icons also require a base and icon class (e.g. .glyphicon .glyphicon-asterisk).

Typeahead has been dropped, in favor of using Twitter Typeahead.

Modal markup has changed significantly. The .modal-header, .modal-body, and .modal-footer sections are now wrapped in .modal-content and .modal-dialog for better mobile styling and behavior. Also, you should no longer apply .hide to .modal in your markup.

As of v3.1.0, the HTML loaded by the remote modal option is now injected into the .modal-content (from v3.0.0 to v3.0.3, into the .modal) instead of into the .modal-body. This allows you to also easily vary the header and footer of the modal, not just the modal body.

The checkbox and radio features of the button.js plugin now both use data-toggle="buttons" instead of data-toggle="buttons-checkbox" or data-toggle="buttons-radio" in their markup.

JavaScript events are namespaced. For example, to handle the modal "show" event, use 'show.bs.modal'. For tabs "shown" use 'shown.bs.tab', etc.

For more information on upgrading to v3.0, and code snippets from the community, see Bootply.

  Major class changes

  What's new

  What's removed

  Additional notes

              Back to top

GitHub

Twitter

Exemplos

Sobre

Projetado e construído com todo amor do mundo por @mdo and @fat. Mantido pela equipe core com ajuda dos nossos contribuidores.

Código licenciado sob MIT, documentação sob CC BY 3.0.


text:
"""Tests for chord_symbols_lib."""

# internal imports
import tensorflow as tf

from magenta.music import chord_symbols_lib

CHORD_QUALITY_MAJOR = chord_symbols_lib.CHORD_QUALITY_MAJOR
CHORD_QUALITY_MINOR = chord_symbols_lib.CHORD_QUALITY_MINOR
CHORD_QUALITY_AUGMENTED = chord_symbols_lib.CHORD_QUALITY_AUGMENTED
CHORD_QUALITY_DIMINISHED = chord_symbols_lib.CHORD_QUALITY_DIMINISHED
CHORD_QUALITY_OTHER = chord_symbols_lib.CHORD_QUALITY_OTHER

class ChordSymbolFunctionsTest(tf.test.TestCase):

  def setUp(self):
    self.chord_symbol_functions = chord_symbols_lib.ChordSymbolFunctions.get()

  def testTranspose(self):
    # Test basic triads.
    figure = self.chord_symbol_functions.transpose_chord_symbol('C', 2)
    self.assertEqual('D', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('Abm', -3)
    self.assertEqual('Fm', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('F#', 0)
    self.assertEqual('F#', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('Cbb', 6)
    self.assertEqual('Fb', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('C#', -5)
    self.assertEqual('G#', figure)

    # Test more complex chords.
    figure = self.chord_symbol_functions.transpose_chord_symbol('Co7', 7)
    self.assertEqual('Go7', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('D+', -3)
    self.assertEqual('B+', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('Fb9/Ab', 2)
    self.assertEqual('Gb9/Bb', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('A6/9', -7)
    self.assertEqual('D6/9', figure)
    figure = self.chord_symbol_functions.transpose_chord_symbol('E7(add#9)', 0)
    self.assertEqual('E7(add#9)', figure)

  def testPitches(self):
    pitches = self.chord_symbol_functions.chord_symbol_pitches('Am')
    pitch_classes = set(pitch % 12 for pitch in pitches)
    self.assertEqual(set([0, 4, 9]), pitch_classes)
    pitches = self.chord_symbol_functions.chord_symbol_pitches('D7b9')
    pitch_classes = set(pitch % 12 for pitch in pitches)
    self.assertEqual(set([0, 2, 3, 6, 9]), pitch_classes)
    pitches = self.chord_symbol_functions.chord_symbol_pitches('F/o')
    pitch_classes = set(pitch % 12 for pitch in pitches)
    self.assertEqual(set([3, 5, 8, 11]), pitch_classes)
    pitches = self.chord_symbol_functions.chord_symbol_pitches('C-(M7)')
    pitch_classes = set(pitch % 12 for pitch in pitches)
    self.assertEqual(set([0, 3, 7, 11]), pitch_classes)
    pitches = self.chord_symbol_functions.chord_symbol_pitches('E##13')
    pitch_classes = set(pitch % 12 for pitch in pitches)
    self.assertEqual(set([1, 3, 4, 6, 8, 10, 11]), pitch_classes)
    pitches = self.chord_symbol_functions.chord_symbol_pitches('G(add2)(#5)')
    pitch_classes = set(pitch % 12 for pitch in pitches)
    self.assertEqual(set([3, 7, 9, 11]), pitch_classes)

  def testRoot(self):
    root = self.chord_symbol_functions.chord_symbol_root('Dm9')
    self.assertEqual(2, root)
    root = self.chord_symbol_functions.chord_symbol_root('E/G#')
    self.assertEqual(4, root)
    root = self.chord_symbol_functions.chord_symbol_root('Bsus2')
    self.assertEqual(11, root)
    root = self.chord_symbol_functions.chord_symbol_root('Abmaj7')
    self.assertEqual(8, root)
    root = self.chord_symbol_functions.chord_symbol_root('D##5(add6)')
    self.assertEqual(4, root)
    root = self.chord_symbol_functions.chord_symbol_root('F(b7)(#9)(b13)')
    self.assertEqual(5, root)

  def testBass(self):
    bass = self.chord_symbol_functions.chord_symbol_bass('Dm9')
    self.assertEqual(2, bass)
    bass = self.chord_symbol_functions.chord_symbol_bass('E/G#')
    self.assertEqual(8, bass)
    bass = self.chord_symbol_functions.chord_symbol_bass('Bsus2/A')
    self.assertEqual(9, bass)
    bass = self.chord_symbol_functions.chord_symbol_bass('Abm7/Cb')
    self.assertEqual(11, bass)
    bass = self.chord_symbol_functions.chord_symbol_bass('C#6/9/E#')
    self.assertEqual(5, bass)
    bass = self.chord_symbol_functions.chord_symbol_bass('G/o')
    self.assertEqual(7, bass)

  def testQuality(self):
    # Test major chords.
    quality = self.chord_symbol_functions.chord_symbol_quality('B13')
    self.assertEqual(CHORD_QUALITY_MAJOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('E7#9')
    self.assertEqual(CHORD_QUALITY_MAJOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Fadd2/Eb')
    self.assertEqual(CHORD_QUALITY_MAJOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('C6/9/Bb')
    self.assertEqual(CHORD_QUALITY_MAJOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Gmaj13')
    self.assertEqual(CHORD_QUALITY_MAJOR, quality)

    # Test minor chords.
    quality = self.chord_symbol_functions.chord_symbol_quality('C#-9')
    self.assertEqual(CHORD_QUALITY_MINOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Gm7/Bb')
    self.assertEqual(CHORD_QUALITY_MINOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Cbmmaj7')
    self.assertEqual(CHORD_QUALITY_MINOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('A-(M7)')
    self.assertEqual(CHORD_QUALITY_MINOR, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Bbmin')
    self.assertEqual(CHORD_QUALITY_MINOR, quality)

    # Test augmented chords.
    quality = self.chord_symbol_functions.chord_symbol_quality('D+/A#')
    self.assertEqual(CHORD_QUALITY_AUGMENTED, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('A+')
    self.assertEqual(CHORD_QUALITY_AUGMENTED, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('G7(#5)')
    self.assertEqual(CHORD_QUALITY_AUGMENTED, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Faug(add2)')
    self.assertEqual(CHORD_QUALITY_AUGMENTED, quality)

    # Test diminished chords.
    quality = self.chord_symbol_functions.chord_symbol_quality('Am7b5')
    self.assertEqual(CHORD_QUALITY_DIMINISHED, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Edim7')
    self.assertEqual(CHORD_QUALITY_DIMINISHED, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Bb/o')
    self.assertEqual(CHORD_QUALITY_DIMINISHED, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Fo')
    self.assertEqual(CHORD_QUALITY_DIMINISHED, quality)

    # Test other chords.
    quality = self.chord_symbol_functions.chord_symbol_quality('G5')
    self.assertEqual(CHORD_QUALITY_OTHER, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Bbsus2')
    self.assertEqual(CHORD_QUALITY_OTHER, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('Dsus')
    self.assertEqual(CHORD_QUALITY_OTHER, quality)
    quality = self.chord_symbol_functions.chord_symbol_quality('E(no3)')
    self.assertEqual(CHORD_QUALITY_OTHER, quality)

if __name__ == '__main__':
  tf.test.main()


text:
{-@ automatic-instances makeIndicesNull @-}

makeIndicesNull :: RString -> RString -> Integer -> Integer -> Proof
{-@ makeIndicesNull
  :: s:RString
  -> t:RString
  -> lo:INat
  -> hi:{Integer | (stringLen t < 2 + stringLen s && 1 + stringLen s - stringLen t <= lo && lo <= hi)
             || (1 + stringLen s <= stringLen t)
             || (stringLen s < lo + stringLen t)
             || (stringLen s < stringLen t)}
  -> {makeIndices s t lo hi == N } / [hi - lo +1] @-}
makeIndicesNull s1 t lo hi
  | hi < lo
  = trivial
makeIndicesNull s1 t lo hi
  | not (isGoodIndex s1 t lo)
  = makeIndicesNull s1 t (lo+1) hi


text:
.header-panel {
    background-color: #009587;
    color: #fff;

}

.page {
    transform: translateY(1080px);
    transition: transform 0 linear;
    display: none;
    opacity: 0;
    font-size: 16px;
    margin-left: 1em;
}

.page.active {
    transform: translateY(0px);
    transition: all 0.3s ease-out;
    display: block;
    opacity: 1;
}


text:
/**
 * @requires OpenLayers/Layer/Vector.js
 */

/**
 * Class: OpenLayers.Layer.Vector.RootContainer
 * A special layer type to combine multiple vector layers inside a single
 *     renderer root container. This class is not supposed to be instantiated
 *     from user space, it is a helper class for controls that require event
 *     processing for multiple vector layers.
 *
 * Inherits from:
 *  - <OpenLayers.Layer.Vector>
 */
OpenLayers.Layer.Vector.RootContainer = OpenLayers.Class(OpenLayers.Layer.Vector, {

    /**
     * Property: displayInLayerSwitcher
     * Set to false for this layer type
     */
    displayInLayerSwitcher: false,

    /**
     * APIProperty: layers
     * Layers that are attached to this container. Required config option.
     */
    layers: null,

    /**
     * Constructor: OpenLayers.Layer.Vector.RootContainer
     * Create a new root container for multiple vector layer. This constructor
     * is not supposed to be used from user space, it is only to be used by
     * controls that need feature selection across multiple vector layers.
     *
     * Parameters:
     * name - {String} A name for the layer
     * options - {Object} Optional object with non-default properties to set on
     *           the layer.
     *
     * Required options properties:
     * layers - {Array(<OpenLayers.Layer.Vector>)} The layers managed by this
     *     container
     *
     * Returns:
     * {<OpenLayers.Layer.Vector.RootContainer>} A new vector layer root
     *     container
     */

    /**
     * Method: display
     */
    display: function() {},

    /**
     * Method: getFeatureFromEvent
     * walk through the layers to find the feature returned by the event
     *
     * Parameters:
     * evt - {Object} event object with a feature property
     *
     * Returns:
     * {<OpenLayers.Feature.Vector>}
     */
    getFeatureFromEvent: function(evt) {
        var layers = this.layers;
        var feature;
        for(var i=0; i<layers.length; i++) {
            feature = layers[i].getFeatureFromEvent(evt);
            if(feature) {
                return feature;
            }
        }
    },

    /**
     * Method: setMap
     *
     * Parameters:
     * map - {<OpenLayers.Map>}
     */
    setMap: function(map) {
        OpenLayers.Layer.Vector.prototype.setMap.apply(this, arguments);
        this.collectRoots();
        map.events.register("changelayer", this, this.handleChangeLayer);
    },

    /**
     * Method: removeMap
     *
     * Parameters:
     * map - {<OpenLayers.Map>}
     */
    removeMap: function(map) {
        map.events.unregister("changelayer", this, this.handleChangeLayer);
        this.resetRoots();
        OpenLayers.Layer.Vector.prototype.removeMap.apply(this, arguments);
    },

    /**
     * Method: collectRoots
     * Collects the root nodes of all layers this control is configured with
     * and moveswien the nodes to this control's layer
     */
    collectRoots: function() {
        var layer;
        // walk through all map layers, because we want to keep the order
        for(var i=0; i<this.map.layers.length; ++i) {
            layer = this.map.layers[i];
            if(OpenLayers.Util.indexOf(this.layers, layer) != -1) {
                layer.renderer.moveRoot(this.renderer);
            }
        }
    },

    /**
     * Method: resetRoots
     * Resets the root nodes back into the layers they belong to.
     */
    resetRoots: function() {
        var layer;
        for(var i=0; i<this.layers.length; ++i) {
            layer = this.layers[i];
            if(this.renderer && layer.renderer.getRenderLayerId() == this.id) {
                this.renderer.moveRoot(layer.renderer);
            }
        }
    },

    /**
     * Method: handleChangeLayer
     * Event handler for the map's changelayer event. We need to rebuild
     * this container's layer dom if order of one of its layers changes.
     * This handler is added with the setMap method, and removed with the
     * removeMap method.
     *
     * Parameters:
     * evt - {Object}
     */
    handleChangeLayer: function(evt) {
        var layer = evt.layer;
        if(evt.property == "order" &&
                        OpenLayers.Util.indexOf(this.layers, layer) != -1) {
            this.resetRoots();
            this.collectRoots();
        }
    },

    CLASS_NAME: "OpenLayers.Layer.Vector.RootContainer"
});