text:
/* sophist.h - 0.3 - public domain - Sean Barrett 2010
** Knowledge drawn from Brian Hook's posh.h and http://predef.sourceforge.net
** Sophist provides portable types; you typedef/#define them to your own names
**
** defines:
**   - SOPHIST_endian    - either SOPHIST_little_endian or SOPHIST_big_endian
**   - SOPHIST_has_64    - either 0 or 1; if 0, int64 types aren't defined
**   - SOPHIST_pointer64 - either 0 or 1; if 1, pointer is 64-bit
**
**   - SOPHIST_intptr, SOPHIST_uintptr - integer same size as pointer
**   - SOPHIST_int8,  SOPHIST_uint8,  SOPHIST_int16, SOPHIST_uint16
**   - SOPHIST_int32, SOPHIST_uint32, SOPHIST_int64, SOPHIST_uint64
**   - SOPHIST_int64_constant(number)      - macros for creating 64-bit
**   - SOPHIST_uint64_constant(number)       integer constants
**   - SOPHIST_printf_format64 - string for printf format for int64
*/

#ifndef __INCLUDE_SOPHIST_H__
#define __INCLUDE_SOPHIST_H__

#define SOPHIST_compiletime_assert(name,val) \
            typedef int SOPHIST__assert##name[(val) ? 1 : -1]

/* define a couple synthetic rules to make code more readable */
#if (defined(__sparc__) || defined(__sparc)) && \
    (defined(__arch64__) || defined(__sparcv9) || defined(__sparc_v9__))
  #define SOPHIST_sparc64
#endif

#if (defined(linux) || defined(__linux__)) &&   \
    (defined(__alpha)||defined(__alpha__)||defined(__x86_64__)||defined(_M_X64))
  #define SOPHIST_linux64
#endif

/* basic types */
typedef   signed  char SOPHIST_int8;
typedef unsigned  char SOPHIST_uint8;

typedef   signed short SOPHIST_int16;
typedef unsigned short SOPHIST_uint16;

#ifdef __palmos__
  typedef   signed long SOPHIST_int32;
  typedef unsigned long SOPHIST_uint32;
#else
  typedef   signed  int SOPHIST_int32;
  typedef unsigned  int SOPHIST_uint32;
#endif

#ifndef SOPHIST_NO_64
   #if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)     \
       || (defined(__alpha) && defined(__DECC))

     typedef   signed __int64 SOPHIST_int64;
     typedef unsigned __int64 SOPHIST_uint64;
     #define SOPHIST_has_64              1
     #define SOPHIST_int64_constant(x)   (x##i64)
     #define SOPHIST_uint64_constant(x)  (x##ui64)
     #define SOPHIST_printf_format64     "I64"

   #elif defined(__LP64__) || defined(__powerpc64__) || defined(SOPHIST_sparc64)

     typedef   signed long    SOPHIST_int64;
     typedef unsigned long    SOPHIST_uint64;

     #define SOPHIST_has_64              1
     #define SOPHIST_int64_constant(x)   ((SOPHIST_int64) x)
     #define SOPHIST_uint64_constant(x)  ((SOPHIST_uint64) x)
     #define SOPHIST_printf_format64     "l"

   #elif defined(_LONG_LONG) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)  \
       || defined(__GNUC__)  || defined(__MWERKS__) || defined(__APPLE_CC__) \
       || defined(sgi)       || defined (__sgi)     || defined(__sgi__)      \
       || defined(_CRAYC)

     typedef   signed long long SOPHIST_int64;
     typedef unsigned long long SOPHIST_uint64;

     #define SOPHIST_has_64              1
     #define SOPHIST_int64_constant(x)   (x##LL)
     #define SOPHIST_uint64_constant(x)  (x##ULL)
     #define SOPHIST_printf_format64     "ll"
   #endif
#endif

#ifndef SOPHIST_has_64
#define SOPHIST_has_64 0
#endif

SOPHIST_compiletime_assert( int8 , sizeof(SOPHIST_int8 ) == 1);
SOPHIST_compiletime_assert(uint16, sizeof(SOPHIST_int16) == 2);
SOPHIST_compiletime_assert( int32, sizeof(SOPHIST_int32 ) == 4);
SOPHIST_compiletime_assert(uint32, sizeof(SOPHIST_uint32) == 4);

#if SOPHIST_has_64
  SOPHIST_compiletime_assert( int64, sizeof(SOPHIST_int64 ) == 8);
  SOPHIST_compiletime_assert(uint64, sizeof(SOPHIST_uint64) == 8);
#endif

/* determine whether pointers are 64-bit */

#if    defined(SOPHIST_linux64) || defined(SOPHIST_sparc64)      \
    || defined(__osf__) || (defined(_WIN64) && !defined(_XBOX))  \
    || defined(__64BIT__)                                        \
    || defined(__LP64)  || defined(__LP64__) || defined(_LP64)   \
    || defined(_ADDR64) || defined(_CRAYC)                       \

  #define SOPHIST_pointer64 1

  SOPHIST_compiletime_assert(pointer64, sizeof(void*) == 8);

  typedef SOPHIST_int64  SOPHIST_intptr;
  typedef SOPHIST_uint64 SOPHIST_uintptr;
#else

  #define SOPHIST_pointer64 0

  SOPHIST_compiletime_assert(pointer64, sizeof(void*) <= 4);

  /* do we care about pointers that are only 16-bit? */
  typedef SOPHIST_int32  SOPHIST_intptr;
  typedef SOPHIST_uint32 SOPHIST_uintptr;

#endif

SOPHIST_compiletime_assert(intptr, sizeof(SOPHIST_intptr) == sizeof(char *));

/* enumerate known little endian cases; fallback to big-endian */

#define SOPHIST_little_endian 1
#define SOPHIST_big_endian 2

#if    defined(__386__) || defined(i386)    || defined(__i386__)  \
    || defined(__X86)   || defined(_M_IX86)                       \
    || defined(_M_X64)  || defined(__x86_64__)                    \
    || defined(alpha)   || defined(__alpha) || defined(__alpha__) \
    || defined(_M_ALPHA)                                          \
    || defined(ARM)     || defined(_ARM)    || defined(__arm__)   \
    || defined(WIN32)   || defined(_WIN32)  || defined(__WIN32__) \
    || defined(_WIN32_WCE) || defined(__NT__)                     \
    || defined(__MIPSEL__)
  #define SOPHIST_endian  SOPHIST_little_endian
#else
  #define SOPHIST_endian  SOPHIST_big_endian
#endif

#endif /* __INCLUDE_SOPHIST_H__ */


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace AspNet.Controllers
{
	public class HomeController : Controller
	{
		public ActionResult Index ()
		{
			var mvcName = typeof(Controller).Assembly.GetName ();
			var isMono = Type.GetType ("Mono.Runtime") != null;

			ViewData ["Version"] = mvcName.Version.Major + "." + mvcName.Version.Minor;
			ViewData ["Runtime"] = isMono ? "Mono" : ".NET";

			return View ();
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
module.exports.register = function (Handlebars) {
  'use strict';

  /* Chain handlebars helpers together. Helpers are listed in the function arguments.
   *
   * @return           string    The value after all helpers are applied.
   */
  Handlebars.registerHelper('chain', function () {
    var helpers = [];
    var i = 0;
    var j = 0;
    var value = '';

    for (; i < arguments.length; i++) {
      value = arguments[i];

      if (Handlebars.helpers[value]) {
        helpers.push(Handlebars.helpers[value]);
      } else {
        // we no longer have a recognised helper
        for (j = 0; j < helpers.length; j++) {
          value = helpers[j](value, arguments[i + 1]);
        }
        return value;
      }
    }
  });
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<folder exportedWithPermissions="true">
    <parent>/public/Samples</parent>
    <name>Topics</name>
    <label>Topics</label>
    <description>Topics</description>
    <creationDate>2015-05-27T15:05:36.494-07:00</creationDate>
    <updateDate>2012-10-15T09:25:52.690-07:00</updateDate>
    <resource>CrosstabDemo</resource>
</folder>


text:
Scala code generation sample
============================

Sample application demonstrating different approaches to code generation in Scala.
See [this blog post](http://yefremov.net/blog/scala-code-generation/) for more info about the project.

To get started with the project:
```
$ sbt
> project sample
> run
```

That will compile everything and run the [sample application](https://github.com/dmitriy-yefremov/scala-code-gen/blob/master/sample/src/main/scala/net/yefremov/sample/codegen/Main.scala).


text:
from django.apps import AppConfig

class BasicSiteAppConfig(AppConfig):
    name = 'basic_site'
    label = 'basic_site'
    verbose_name = "Basic Site Components"


text:
Este plano propõe conduzir as atividades de desenvolvimento da aplicação referente ao [projeto dbook](https://github.com/matheuspiment/dbook/blob/master/docs/DB2017-1-TAP-1.0.md).
O objetivo é organizar é organizar as tarefas dos desenvolvedores e outros envolvidos no projeto.

## 2. Visão Geral do Projeto

O projeto dbook visa produzir uma aplicação, para dispositivos móveis, que permite a troca e doação de livros entre seus usuários
e será desenvolvido por uma equipe com seis integrantes.
Será esclarecido as seguintes etapas abaixo no decorrer do plano de projeto de software.
- Objetivos do Projeto
- Escopo do Projeto
- Organizações Afetadas ou Impactadas
- Recursos Não Humanos e de Ambiente
- Restrições do Projeto
- Estimativas do Projeto
- Riscos do Projeto
- Recursos Humanos
- Ciclo de Vida do Projeto

## 3. Objetivos do Projeto

 O dbook tem como objetivo apoiar a disseminação do conhecimento e a valorização da aprendizagem,
 por meio de uma aplicação para dispositivos móveis. Ele se destaca, dentre outras aplicações,
 pela adoção de padrões e modelos de qualidade e desenvolvimento de software

 O projeto está dividido em duas fases: especificação/desenvolvimento e manutenção.
 A estimativa para a duração da primeira fase é de aproximadamente um mês.

## 4. Escopo do Projeto

Definir o escopo do projeto.

O escopo deste projeto inclui e exclui os seguintes itens.

**No Escopo:**
* Análise e especificação do software: Será realizada uma análise das informações coletadas e através deste procedimento
será gerada a especificação do sistema que será desenvolvido. A especificação do sistema irá conter os diagramas UML,
documento com a especificação de requisitos, etc.
* Desenvolvimento: Desenvolvimento do software.
* Acompanhamento: Acompanhamento semanal do projeto, onde será gerado o Relatório de Monitoramento.

**Fora do Escopo:**
* Testes/Casos de Testes para o sistema
* Implantação do sistema
* Aquisição e instalação de um novo servidor para instalação do software
* Dados e processos de controle financeiros ou de recursos humanos.

## 5. Organizações Afetadas ou Impactadas

Não foram identificadas organizações com possíveis impactos.

## 6. Recursos Não Humanos e de Ambiente

Definir as premissas do projeto, ou seja, os recursos não humanos e o ambiente necessários para o projeto, incluindo, por exemplo, equipamentos, ferramentas, serviços, componentes, viagens e requisitos de processo.

| Recurso             | Tipo          |
| ------------------- |---------------|
| Suíte Office        | Ferramenta    |
| Conexão à internet  | "Ferramenta"  |
| Computadores        | Ferramenta    |

## 7. Restrições do Projeto

* Todo os artefatos produzido serão públicos (licença pública)
* Conhecimento limitado acerca da linguagem de desenvolvimento

## 8. Estimativas do Projeto

### Cronograma

| ID da Atividade | Dependência   | Atividade   | Início     | Término    | Tempo Previsto (dias)   | Recurso   |
|:---------------:|:-------------:|:-----------:|:----------:|:----------:|:-----------------------:|:---------:|
|                 | | Projeto | 01/04/2017 | 29/04/2017 | 25 | |
| AT01 | | Domínio do Problema  | 01/04/2017 | 03/04/2017 | 2 | R1, R2, R3 |
| AT04 | | Relatório de Monitoramento | 08/04/2017 | 08/04/2017 | 1 | R7 |
| AT05 | AT03| Analisar Viabilidade | 10/04/2017 | 10/04/2017 | 1 | R1 |
| AT02 | AT01 | Estabelecer Plano de Configuração do projeto | 11/04/2017 | 18/04/2017 | 6 | R1 |
| AT03 | AT02 | Planejar Projeto | 11/04/2017 | 18/04/2017 | 6 | R1 |
| AT06 | AT05| Elicitar Requisitos | 11/04/2017 | 25/04/2017 | 11 | R2, R3 |
| AT07 | | Relatório de Monitoramento | 15/04/2017 | 15/04/2017 | 1 | R7 |
| AT08 | AT06| Design | 19/04/2017 | 25/04/2017 | 5 | R4, R5 |
| AT09 | | Relatório de Monitoramento | 22/04/2017 | 22/04/2017 | 1 | R7 |
| AT10 | | Relatório de Monitoramento | 25/04/2017 | 25/04/2017 | 1 | R7 |
| AT11 | AT08| Auditoria (V&V) | 26/04/2017 | 28/04/2017 | 3 | R1, R2, R3, R4, R5, R,7 |
| AT12 | | Encerrar Projeto | 29/04/2017 | 29/04/2017 | 1 | R1 |

### Recursos

| ID do Recurso | Recurso |
|:-------------:|:-------:|
| R1 | Gerente de Projeto |
| R2 | Gerente de Requisitos |
| R3 | Analista de Requisitos |
| R4 | Arquiteto de Software |
| R5 | Designer |
| R6 | Desenvolvedor |
| R7 | Analista de Qualidade |

## 9. Riscos do Projeto

| Risco | Nível (A/M/B) Alto/Médio/Baixo | Plano de Risco |
|:-------------:|:-------:|:-------:|
| Desligamento de um membro da equipe | B | Bonificação para os envolvidos no projeto |
| Conhecimento limitado da equipe | B | Realizar treinamento ou oficina |
| Não cumprimento do cronograma | A | Acompanhar execução do projeto |

## 10. Recursos Humanos

| Recurso | Papel |
|-------------|-------|
| Beatriz Nogueira | Gerente e Analista de Requisitos |
| Cauã Martins Pessoa | Revisor/Analista de Qualidade |
| João Lucas | Analista de Requisitos |
| Matheus Pimenta  | Gerente de Projeto e de Configuração, Arquiteto, Designer e "Analista de Qualidade" |
| Samuel Rocha     | Arquiteto e Designer |

## 11. Ciclo de Vida do Projeto

O modelo adotado foi o sequencial (cascata), podendo o mesmo ter suas etapas alteradas ou "violadas" caso aprovado pelo
gerente de projeto.

## 12. Aprovação

_________________________________________________________

Patrocinador do Projeto - Adriana Silveira de Souza

__________________________________________________________

Gerente do Projeto - Matheus Ribeiro Pimenta Nunes


text:
<refentry xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          version="5.0" xml:id="man.font.table.title">
<refmeta>
<refentrytitle>man.font.table.title</refentrytitle>
<refmiscinfo class="other" otherclass="datatype">string</refmiscinfo>
</refmeta>
<refnamediv>
<refname>man.font.table.title</refname>
<refpurpose>Specifies font for table headings</refpurpose>
</refnamediv>

<refsynopsisdiv>
<src:fragment xml:id="man.font.table.title.frag">
  <xsl:param name="man.font.table.title">B</xsl:param>
</src:fragment>
</refsynopsisdiv>

<refsection><info><title>Description</title></info>

<para>The <parameter>man.font.table.title</parameter> parameter
specifies the font for <tag>table</tag> titles. It should be
a valid roff font, such as <literal>B</literal> or
<literal>I</literal>.</para>

</refsection>
</refentry>


text:
ActiveRecord::Schema.define(version: 20151013154004) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "expense_types", force: :cascade do |t|
    t.string   "name",       null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "expenses", force: :cascade do |t|
    t.integer  "user_id",         null: false
    t.integer  "amount",          null: false
    t.datetime "created_at",      null: false
    t.datetime "updated_at",      null: false
    t.integer  "expense_type_id", null: false
  end

  add_index "expenses", ["user_id"], name: "index_expenses_on_user_id", using: :btree

  create_table "purchase_types", force: :cascade do |t|
    t.string   "name",       null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "purchases", force: :cascade do |t|
    t.integer  "user_id",                          null: false
    t.integer  "cost",                             null: false
    t.datetime "created_at",                       null: false
    t.datetime "updated_at",                       null: false
    t.integer  "purchase_type_id",                 null: false
    t.string   "title"
    t.boolean  "purchased?",       default: false
  end

  add_index "purchases", ["user_id"], name: "index_purchases_on_user_id", using: :btree

  create_table "savings", force: :cascade do |t|
    t.integer  "user_id",                null: false
    t.integer  "amount",     default: 0, null: false
    t.datetime "created_at",             null: false
    t.datetime "updated_at",             null: false
  end

  add_index "savings", ["user_id"], name: "index_savings_on_user_id", using: :btree

  create_table "users", force: :cascade do |t|
    t.string   "name",            null: false
    t.string   "email",           null: false
    t.string   "password_digest", null: false
    t.integer  "income"
    t.datetime "created_at",      null: false
    t.datetime "updated_at",      null: false
  end

  add_foreign_key "expenses", "users"
  add_foreign_key "purchases", "users"
  add_foreign_key "savings", "users"
end


text:
var parseURIComponent = require("./parseURIComponent"),
    isNullOrUndefined = require("@nathanfaucett/is_null_or_undefined");

module.exports = filterParams;

function filterParams(regexp, params, path) {
    var ctxults = regexp.exec(path),
        filteredParams, ctxult, i, il, length;

    if (!ctxults) {
        return false;
    } else {
        filteredParams = {};

        il = params.length;
        if (il === 0) {
            return filteredParams;
        }

        i = -1;
        il = il - 1;
        length = ctxults.length;

        while (i++ < il) {
            if (i < length) {
                ctxult = ctxults[i + 1];

                if (!isNullOrUndefined(ctxult)) {
                    filteredParams[params[i].name] = parseURIComponent(ctxult);
                }
            }
        }

        return filteredParams;
    }
}


text:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Example group routes with lang or locale properties
|
*/

Route::group(['middleware' => ['pulsar.navTools']], function() {

    // write here your routes

});


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="VectorIndexRelay.cs" company="DigitalGlobe">
//   Copyright 2015 DigitalGlobe
//
//      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.
// </copyright>
// <summary>
//
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Gbdx.Vector_Index
{
    using ESRI.ArcGIS.Carto;
    using ESRI.ArcGIS.Geometry;

    /// <summary>
    /// Polygon setup complete delegate
    /// </summary>
    /// <param name="poly">
    /// The polygon drawn on the map
    /// </param>
    /// <param name="elm">
    /// The IElement of the bounding box drawn on the map.
    /// </param>
    public delegate void PolygonSetupComplete(IPolygon poly, IElement elm);

    /// <summary>
    /// VectorIndexRelay class is meant to act as a relay between the ITool that has to be called
    /// to get the area of the polygon.  Once called the polygon will be set in the relay which will
    /// in turn fire off an event being listened for in the form.
    /// </summary>
    public class VectorIndexRelay
    {
        /// <summary>
        /// The current instance of the VectorIndexRelay
        /// </summary>
        private static VectorIndexRelay instance;

        /// <summary>
        /// The polygon of the bounding box
        /// </summary>
        private IPolygon poly;

        /// <summary>
        /// The rectangle IElement of the bounding box
        /// </summary>
        private IElement rectElement;

        /// <summary>
        /// Prevents a default instance of the <see cref="VectorIndexRelay"/> class from being created.
        /// </summary>
        private VectorIndexRelay()
        {
        }

        /// <summary>
        /// Event that the polygon has been setup
        /// </summary>
        public event PolygonSetupComplete PolygonHasBeenSet;

        /// <summary>
        /// Gets the instance of the VectorIndexRelay class.
        /// </summary>
        public static VectorIndexRelay Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new VectorIndexRelay();
                }

                return instance;
            }
        }

        /// <summary>
        /// Sets the Polygon.
        /// </summary>
        public IPolygon Polygon
        {
            set
            {
                this.poly = value;
            }
        }

        /// <summary>
        /// Set the polygon and element of the drawn bounding box
        /// </summary>
        /// <param name="polygon">
        /// The IPolygon of the bounding box
        /// </param>
        /// <param name="elm">
        /// The IElement of the bounding box.
        /// </param>
        public void SetPolygonAndElement(IPolygon polygon, IElement elm)
        {
            this.poly = polygon;
            this.rectElement = elm;

            if (this.PolygonHasBeenSet != null)
            {
                this.PolygonHasBeenSet(this.poly, this.rectElement);
            }
        }
    }
}


text:
#include "BaseLib/Files/HttpFileSystem.h"
#include "BaseLib/intern/Errors.h"

namespace BaseLib {
namespace Files {

using namespace BaseLib::Containers;

BL_DEFINE_REFLECTION_CLASS(HttpFileSystem, AbstractFileSystem)
{
}

HttpFileSystem::HttpFileSystem(const String& forURI)
	: AbstractFileSystem(forURI)
{
}

bool HttpFileSystem::areFilesWritable() const
{
	return false;
}

bool HttpFileSystem::areDirectoriesWriteable() const
{
	return false;
}

bool HttpFileSystem::exists(const String& path) const
{
	return false;
}

bool HttpFileSystem::isDirectory(const String& path) const
{
	return false;
}

bool HttpFileSystem::isEmpty(const String& path) const
{
	return true;
}

bool HttpFileSystem::isReadable(const String& path) const
{
	return false;
}

bool HttpFileSystem::isWriteable(const String& path) const
{
	return false;
}

void HttpFileSystem::setWriteable(const String& path, bool writeable) const
{
}

bool HttpFileSystem::isExecuteable(const String& path) const
{
	return false;
}

int64 HttpFileSystem::sizeOf(const String& path) const
{
	return -1;
}

void HttpFileSystem::setCurrentDirectory(const String& newCurrentDirectory)
{
	if (newCurrentDirectory != currentDirectory)
	{
		currentDirectory = newCurrentDirectory;
	}
}

void HttpFileSystem::enumFileNames(const Enumerator<String>& enumerator, const String& path, bool enumHiddenFiles, bool enumSystemFiles) const
{
}

void HttpFileSystem::enumFileInfos(const Enumerator<FileInfo>& enumerator, const String& path, bool enumHiddenFiles, bool enumSystemFiles) const
{
}

void HttpFileSystem::enumDirectoryNames(const Enumerator<String>& enumerator, const String& path, bool enumHiddenDirectories, bool enumSystemDirectories) const
{
}

void HttpFileSystem::copy(const String& sourcePath, const String& destinationPath, bool overwriteExisting) const
{
}

void HttpFileSystem::move(const String& sourcePath, const String& destinationPath, bool overwriteExisting) const
{
}

void HttpFileSystem::remove(const String& path) const
{
}

void HttpFileSystem::createDirectory(const String& path) const
{
}

InputStream* HttpFileSystem::createInputStream(const String& fileName) const
{
	return NULL;
}

OutputStream* HttpFileSystem::createOutputStream(const String& fileName) const
{
	return NULL;
}

int64 HttpFileSystem::writeFile(const String& path, InputStream& sourceStream, bool append, int64 bytes) const
{
	return 0;
}

int64 HttpFileSystem::readFile(const String& path, OutputStream& destinationStream, int64 start, int64 bytes) const
{
	return 0;
}

} // namespace Files
} // namespace BaseLib


text:
package org.eclipse.collections.impl.map.mutable;

import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentMap;

import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.map.ImmutableMapIterable;
import org.eclipse.collections.api.map.MapIterable;
import org.eclipse.collections.api.map.MutableMapIterable;
import org.eclipse.collections.impl.IntegerWithCast;
import org.eclipse.collections.impl.bag.mutable.HashBag;
import org.eclipse.collections.impl.block.factory.Functions;
import org.eclipse.collections.impl.block.function.PassThruFunction0;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.factory.Maps;
import org.eclipse.collections.impl.list.Interval;
import org.eclipse.collections.impl.list.mutable.FastList;
import org.eclipse.collections.impl.map.AbstractSynchronizedMapIterable;
import org.eclipse.collections.impl.map.MapIterableTestCase;
import org.eclipse.collections.impl.set.mutable.UnifiedSet;
import org.eclipse.collections.impl.test.Verify;
import org.eclipse.collections.impl.test.domain.Key;
import org.eclipse.collections.impl.tuple.ImmutableEntry;
import org.eclipse.collections.impl.tuple.Tuples;
import org.eclipse.collections.impl.utility.Iterate;
import org.junit.Assert;
import org.junit.Test;

import static org.eclipse.collections.impl.factory.Iterables.iMap;
import static org.eclipse.collections.impl.factory.Iterables.mList;

/**
 * Abstract JUnit TestCase for {@link MutableMapIterable}s.
 */
public abstract class MutableMapIterableTestCase extends MapIterableTestCase
{
    @Override
    protected abstract <K, V> MutableMapIterable<K, V> newMap();

    @Override
    protected abstract <K, V> MutableMapIterable<K, V> newMapWithKeyValue(K key, V value);

    @Override
    protected abstract <K, V> MutableMapIterable<K, V> newMapWithKeysValues(K key1, V value1, K key2, V value2);

    @Override
    protected abstract <K, V> MutableMapIterable<K, V> newMapWithKeysValues(K key1, V value1, K key2, V value2, K key3, V value3);

    @Override
    protected abstract <K, V> MutableMapIterable<K, V> newMapWithKeysValues(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4);

    @Test
    public void toImmutable()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeyValue(1, "One");
        ImmutableMapIterable<Integer, String> immutable = map.toImmutable();
        Assert.assertEquals(Maps.immutable.with(1, "One"), immutable);
    }

    @Test
    public void clear()
    {
        MutableMapIterable<Integer, Object> map =
                this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three");
        map.clear();
        Verify.assertEmpty(map);

        MutableMapIterable<Object, Object> map2 = this.newMap();
        map2.clear();
        Verify.assertEmpty(map2);
    }

    @Test
    public void removeObject()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        map.remove("Two");
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void removeFromEntrySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertTrue(map.entrySet().remove(ImmutableEntry.of("Two", 2)));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);

        Assert.assertFalse(map.entrySet().remove(ImmutableEntry.of("Four", 4)));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);

        Assert.assertFalse(map.entrySet().remove(null));

        MutableMapIterable<String, Integer> mapWithNullKey = this.newMapWithKeysValues("One", 1, null, 2, "Three", 3);
        Assert.assertTrue(mapWithNullKey.entrySet().remove(new ImmutableEntry<String, Integer>(null, 2)));
    }

    @Test
    public void removeAllFromEntrySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertTrue(map.entrySet().removeAll(FastList.newListWith(
                ImmutableEntry.of("One", 1),
                ImmutableEntry.of("Three", 3))));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("Two", 2), map);

        Assert.assertFalse(map.entrySet().removeAll(FastList.newListWith(ImmutableEntry.of("Four", 4))));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("Two", 2), map);

        Assert.assertFalse(map.entrySet().remove(null));

        MutableMapIterable<String, Integer> mapWithNullKey = this.newMapWithKeysValues("One", 1, null, 2, "Three", 3);
        Assert.assertTrue(mapWithNullKey.entrySet().removeAll(FastList.newListWith(ImmutableEntry.of(null, 2))));
    }

    @Test
    public void retainAllFromEntrySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.entrySet().retainAll(FastList.newListWith(
                ImmutableEntry.of("One", 1),
                ImmutableEntry.of("Two", 2),
                ImmutableEntry.of("Three", 3),
                ImmutableEntry.of("Four", 4))));

        Assert.assertTrue(map.entrySet().retainAll(FastList.newListWith(
                ImmutableEntry.of("One", 1),
                ImmutableEntry.of("Three", 3),
                ImmutableEntry.of("Four", 4))));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);

        MutableMapIterable<Integer, Integer> integers = this.newMapWithKeysValues(1, 1, 2, 2, 3, 3);
        Integer copy = new Integer(1);
        Assert.assertTrue(integers.entrySet().retainAll(mList(ImmutableEntry.of(copy, copy))));
        Assert.assertEquals(iMap(copy, copy), integers);
        Assert.assertNotSame(copy, Iterate.getOnly(integers.entrySet()).getKey());
        Assert.assertNotSame(copy, Iterate.getOnly(integers.entrySet()).getValue());
    }

    @Test
    public void clearEntrySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        map.entrySet().clear();
        Verify.assertEmpty(map);
    }

    @Test
    public void entrySetEqualsAndHashCode()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Verify.assertEqualsAndHashCode(
                UnifiedSet.newSetWith(
                        ImmutableEntry.of("One", 1),
                        ImmutableEntry.of("Two", 2),
                        ImmutableEntry.of("Three", 3)),
                map.entrySet());
    }

    @Test
    public void removeFromKeySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.keySet().remove("Four"));

        Assert.assertTrue(map.keySet().remove("Two"));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void removeNullFromKeySet()
    {
        if (this.newMap() instanceof ConcurrentMap || this.newMap() instanceof SortedMap)
        {
            return;
        }

        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.keySet().remove(null));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Two", 2, "Three", 3), map);
        map.put(null, 4);
        Assert.assertTrue(map.keySet().remove(null));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Two", 2, "Three", 3), map);
    }

    @Test
    public void removeAllFromKeySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.keySet().removeAll(FastList.newListWith("Four")));

        Assert.assertTrue(map.keySet().removeAll(FastList.newListWith("Two", "Four")));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void retainAllFromKeySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.keySet().retainAll(FastList.newListWith("One", "Two", "Three", "Four")));

        Assert.assertTrue(map.keySet().retainAll(FastList.newListWith("One", "Three")));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void clearKeySet()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        map.keySet().clear();
        Verify.assertEmpty(map);
    }

    @Test
    public void keySetEqualsAndHashCode()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3, null, null);
        Verify.assertEqualsAndHashCode(UnifiedSet.newSetWith("One", "Two", "Three", null), map.keySet());
    }

    @Test
    public void keySetToArray()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        MutableList<String> expected = FastList.newListWith("One", "Two", "Three").toSortedList();
        Set<String> keySet = map.keySet();
        Assert.assertEquals(expected, FastList.newListWith(keySet.toArray()).toSortedList());
        Assert.assertEquals(expected, FastList.newListWith(keySet.toArray(new String[keySet.size()])).toSortedList());
    }

    @Test
    public void removeFromValues()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.values().remove(4));

        Assert.assertTrue(map.values().remove(2));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void removeNullFromValues()
    {
        if (this.newMap() instanceof ConcurrentMap)
        {
            return;
        }

        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.values().remove(null));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Two", 2, "Three", 3), map);
        map.put("Four", null);
        Assert.assertTrue(map.values().remove(null));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Two", 2, "Three", 3), map);
    }

    @Test
    public void removeAllFromValues()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.values().removeAll(FastList.newListWith(4)));

        Assert.assertTrue(map.values().removeAll(FastList.newListWith(2, 4)));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void retainAllFromValues()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
        Assert.assertFalse(map.values().retainAll(FastList.newListWith(1, 2, 3, 4)));

        Assert.assertTrue(map.values().retainAll(FastList.newListWith(1, 3)));
        Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
    }

    @Test
    public void put()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two");
        Assert.assertNull(map.put(3, "Three"));
        Assert.assertEquals(UnifiedMap.newWithKeysValues(1, "One", 2, "Two", 3, "Three"), map);

        ImmutableList<Integer> key1 = Lists.immutable.with(null);
        ImmutableList<Integer> key2 = Lists.immutable.with(null);
        Object value1 = new Object();
        Object value2 = new Object();
        MutableMapIterable<ImmutableList<Integer>, Object> map2 = this.newMapWithKeyValue(key1, value1);
        Object previousValue = map2.put(key2, value2);
        Assert.assertSame(value1, previousValue);
        Assert.assertSame(key1, map2.keysView().getFirst());
    }

    @Test
    public void putAll()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "2");
        MutableMapIterable<Integer, String> toAdd = this.newMapWithKeysValues(2, "Two", 3, "Three");

        map.putAll(toAdd);
        Verify.assertSize(3, map);
        Verify.assertContainsAllKeyValues(map, 1, "One", 2, "Two", 3, "Three");

        //Testing JDK map
        MutableMapIterable<Integer, String> map2 = this.newMapWithKeysValues(1, "One", 2, "2");
        HashMap<Integer, String> hashMaptoAdd = new HashMap<>(toAdd);
        map2.putAll(hashMaptoAdd);
        Verify.assertSize(3, map2);
        Verify.assertContainsAllKeyValues(map2, 1, "One", 2, "Two", 3, "Three");
    }

    @Test
    public void removeKey()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "Two");

        Assert.assertEquals("1", map.removeKey(1));
        Verify.assertSize(1, map);
        Verify.denyContainsKey(1, map);

        Assert.assertNull(map.removeKey(42));
        Verify.assertSize(1, map);

        Assert.assertEquals("Two", map.removeKey(2));
        Verify.assertEmpty(map);
    }

    @Test
    public void getIfAbsentPut()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
        Assert.assertNull(map.get(4));
        Assert.assertEquals("4", map.getIfAbsentPut(4, new PassThruFunction0<>("4")));
        Assert.assertEquals("3", map.getIfAbsentPut(3, new PassThruFunction0<>("3")));
        Verify.assertContainsKeyValue(4, "4", map);
    }

    @Test
    public void getIfAbsentPutValue()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
        Assert.assertNull(map.get(4));
        Assert.assertEquals("4", map.getIfAbsentPut(4, "4"));
        Assert.assertEquals("3", map.getIfAbsentPut(3, "5"));
        Verify.assertContainsKeyValue(1, "1", map);
        Verify.assertContainsKeyValue(2, "2", map);
        Verify.assertContainsKeyValue(3, "3", map);
        Verify.assertContainsKeyValue(4, "4", map);
    }

    @Test
    public void getIfAbsentPutWithKey()
    {
        MutableMapIterable<Integer, Integer> map = this.newMapWithKeysValues(1, 1, 2, 2, 3, 3);
        Assert.assertNull(map.get(4));
        Assert.assertEquals(Integer.valueOf(4), map.getIfAbsentPutWithKey(4, Functions.getIntegerPassThru()));
        Assert.assertEquals(Integer.valueOf(3), map.getIfAbsentPutWithKey(3, Functions.getIntegerPassThru()));
        Verify.assertContainsKeyValue(Integer.valueOf(4), Integer.valueOf(4), map);
    }

    @Test
    public void getIfAbsentPutWith()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
        Assert.assertNull(map.get(4));
        Assert.assertEquals("4", map.getIfAbsentPutWith(4, String::valueOf, 4));
        Assert.assertEquals("3", map.getIfAbsentPutWith(3, String::valueOf, 3));
        Verify.assertContainsKeyValue(4, "4", map);
    }

    @Test
    public void getIfAbsentPut_block_throws()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
        Verify.assertThrows(RuntimeException.class, () -> map.getIfAbsentPut(4, () -> {
            throw new RuntimeException();
        }));
        Assert.assertEquals(UnifiedMap.newWithKeysValues(1, "1", 2, "2", 3, "3"), map);
    }

    @Test
    public void getIfAbsentPutWith_block_throws()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
        Verify.assertThrows(RuntimeException.class, () -> map.getIfAbsentPutWith(4, object -> {
            throw new RuntimeException();
        }, null));
        Assert.assertEquals(UnifiedMap.newWithKeysValues(1, "1", 2, "2", 3, "3"), map);
    }

    @Test
    public void getKeysAndGetValues()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
        Verify.assertContainsAll(map.keySet(), 1, 2, 3);
        Verify.assertContainsAll(map.values(), "1", "2", "3");
    }

    @Test
    public void newEmpty()
    {
        MutableMapIterable<Integer, Integer> map = this.newMapWithKeysValues(1, 1, 2, 2);
        Verify.assertEmpty(map.newEmpty());
    }

    @Test
    public void keysAndValues_toString()
    {
        MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2");
        Verify.assertContains(map.keySet().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
        Verify.assertContains(map.values().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
        Verify.assertContains(map.keysView().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
        Verify.assertContains(map.valuesView().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
    }

    @Test
    public void keyPreservation()
    {
        Key key = new Key("key");

        Key duplicateKey1 = new Key("key");
        MapIterable<Key, Integer> map1 = this.newMapWithKeysValues(key, 1, duplicateKey1, 2);
        Verify.assertSize(1, map1);
        Verify.assertContainsKeyValue(key, 2, map1);
        Assert.assertSame(key, map1.keysView().getFirst());

        Key duplicateKey2 = new Key("key");
        MapIterable<Key, Integer> map2 = this.newMapWithKeysValues(key, 1, duplicateKey1, 2, duplicateKey2, 3);
        Verify.assertSize(1, map2);
        Verify.assertContainsKeyValue(key, 3, map2);
        Assert.assertSame(key, map1.keysView().getFirst());

        Key duplicateKey3 = new Key("key");
        MapIterable<Key, Integer> map3 = this.newMapWithKeysValues(key, 1, new Key("not a dupe"), 2, duplicateKey3, 3);
        Verify.assertSize(2, map3);
        Verify.assertContainsAllKeyValues(map3, key, 3, new Key("not a dupe"), 2);
        Assert.assertSame(key, map3.keysView().detect(key::equals));

        Key duplicateKey4 = new Key("key");
        MapIterable<Key, Integer> map4 = this.newMapWithKeysValues(key, 1, new Key("still not a dupe"), 2, new Key("me neither"), 3, duplicateKey4, 4);
        Verify.assertSize(3, map4);
        Verify.assertContainsAllKeyValues(map4, key, 4, new Key("still not a dupe"), 2, new Key("me neither"), 3);
        Assert.assertSame(key, map4.keysView().detect(key::equals));

        MapIterable<Key, Integer> map5 = this.newMapWithKeysValues(key, 1, duplicateKey1, 2, duplicateKey3, 3, duplicateKey4, 4);
        Verify.assertSize(1, map5);
        Verify.assertContainsKeyValue(key, 4, map5);
        Assert.assertSame(key, map5.keysView().getFirst());
    }

    @Test
    public void asUnmodifiable()
    {
        Verify.assertThrows(UnsupportedOperationException.class, () -> this.newMapWithKeysValues(1, 1, 2, 2).asUnmodifiable().put(3, 3));
    }

    @Test
    public void asSynchronized()
    {
        MapIterable<Integer, Integer> map = this.newMapWithKeysValues(1, 1, 2, 2).asSynchronized();
        Verify.assertInstanceOf(AbstractSynchronizedMapIterable.class, map);
    }

    @Test
    public void add()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeyValue("A", 1);

        Assert.assertEquals(Integer.valueOf(1), map.add(Tuples.pair("A", 3)));
        Assert.assertNull(map.add(Tuples.pair("B", 2)));
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 3, "B", 2), map);
    }

    @Test
    public void withKeyValue()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeyValue("A", 1);

        MutableMapIterable<String, Integer> mapWith = map.withKeyValue("B", 2);
        Assert.assertSame(map, mapWith);
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 1, "B", 2), mapWith);

        MutableMapIterable<String, Integer> mapWith2 = mapWith.withKeyValue("A", 11);
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 11, "B", 2), mapWith);
    }

    @Test
    public void withAllKeyValues()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("A", 1, "B", 2);
        MutableMapIterable<String, Integer> mapWith = map.withAllKeyValues(
                FastList.newListWith(Tuples.pair("B", 22), Tuples.pair("C", 3)));
        Assert.assertSame(map, mapWith);
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 1, "B", 22, "C", 3), mapWith);
    }

    @Test
    public void withAllKeyValueArguments()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("A", 1, "B", 2);
        MutableMapIterable<String, Integer> mapWith = map.withAllKeyValueArguments(Tuples.pair("B", 22), Tuples.pair("C", 3));
        Assert.assertSame(map, mapWith);
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 1, "B", 22, "C", 3), mapWith);
    }

    @Test
    public void withoutKey()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("A", 1, "B", 2);
        MutableMapIterable<String, Integer> mapWithout = map.withoutKey("B");
        Assert.assertSame(map, mapWithout);
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 1), mapWithout);
    }

    @Test
    public void withoutAllKeys()
    {
        MutableMapIterable<String, Integer> map = this.newMapWithKeysValues("A", 1, "B", 2, "C", 3);
        MutableMapIterable<String, Integer> mapWithout = map.withoutAllKeys(FastList.newListWith("A", "C"));
        Assert.assertSame(map, mapWithout);
        Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("B", 2), mapWithout);
    }

    @Test
    public void retainAllFromKeySet_null_collision()
    {
        if (this.newMap() instanceof ConcurrentMap || this.newMap() instanceof SortedMap)
        {
            return;
        }

        IntegerWithCast key = new IntegerWithCast(0);
        MutableMapIterable<IntegerWithCast, String> mutableMapIterable = this.newMapWithKeysValues(
                null, "Test 1",
                key, "Test 2");

        Assert.assertFalse(mutableMapIterable.keySet().retainAll(FastList.newListWith(key, null)));

        Assert.assertEquals(
                this.newMapWithKeysValues(
                        null, "Test 1",
                        key, "Test 2"),
                mutableMapIterable);
    }

    @Test
    public void rehash_null_collision()
    {
        if (this.newMap() instanceof ConcurrentMap || this.newMap() instanceof SortedMap)
        {
            return;
        }
        MutableMapIterable<IntegerWithCast, String> mutableMapIterable = this.newMapWithKeyValue(null, null);

        for (int i = 0; i < 256; i++)
        {
            mutableMapIterable.put(new IntegerWithCast(i), String.valueOf(i));
        }
    }

    @Test
    public void updateValue()
    {
        MutableMapIterable<Integer, Integer> map = this.newMap();
        Iterate.forEach(Interval.oneTo(1000), each -> map.updateValue(each % 10, () -> 0, integer -> integer + 1));
        Assert.assertEquals(Interval.zeroTo(9).toSet(), map.keySet());
        Assert.assertEquals(FastList.newList(Collections.nCopies(10, 100)), FastList.newList(map.values()));
    }

    @Test
    public void updateValue_collisions()
    {
        MutableMapIterable<Integer, Integer> map = this.newMap();
        MutableList<Integer> list = Interval.oneTo(2000).toList().shuffleThis();
        Iterate.forEach(list, each -> map.updateValue(each % 1000, () -> 0, integer -> integer + 1));
        Assert.assertEquals(Interval.zeroTo(999).toSet(), map.keySet());
        Assert.assertEquals(
                HashBag.newBag(map.values()).toStringOfItemToCount(),
                FastList.newList(Collections.nCopies(1000, 2)),
                FastList.newList(map.values()));
    }

    @Test
    public void updateValueWith()
    {
        MutableMapIterable<Integer, Integer> map = this.newMap();
        Iterate.forEach(Interval.oneTo(1000), each -> map.updateValueWith(each % 10, () -> 0, (integer, parameter) -> {
            Assert.assertEquals("test", parameter);
            return integer + 1;
        }, "test"));
        Assert.assertEquals(Interval.zeroTo(9).toSet(), map.keySet());
        Assert.assertEquals(FastList.newList(Collections.nCopies(10, 100)), FastList.newList(map.values()));
    }

    @Test
    public void updateValueWith_collisions()
    {
        MutableMapIterable<Integer, Integer> map = this.newMap();
        MutableList<Integer> list = Interval.oneTo(2000).toList().shuffleThis();
        Iterate.forEach(list, each -> map.updateValueWith(each % 1000, () -> 0, (integer, parameter) -> {
            Assert.assertEquals("test", parameter);
            return integer + 1;
        }, "test"));
        Assert.assertEquals(Interval.zeroTo(999).toSet(), map.keySet());
        Assert.assertEquals(
                HashBag.newBag(map.values()).toStringOfItemToCount(),
                FastList.newList(Collections.nCopies(1000, 2)),
                FastList.newList(map.values()));
    }
}


text:
package fr.adbonnin.shalltear.jdownloader.folderwatch;

/**
 * https://github.com/mirror/jdownloader/blob/master/src/org/jdownloader/extensions/folderwatchV2/CrawlJobStorable.java
 */
public class CrawlJob {

    public static final String HIGHEST_PRIORITY = "HIGHEST";
    public static final String HIGHER_PRIORITY = "HIGHER";
    public static final String HIGH_PRIORITY = "HIGH";
    public static final String DEFAULT_PRIORITY = "DEFAULT";
    public static final String LOWER_PRIORITY = "LOWER";

    private String filename;
    private int chunks;
    private Boolean autoConfirm;
    private boolean addOfflineLink = true;

    private Boolean autoStart;
    private Boolean forcedStart;
    private Boolean enabled;
    private String text;
    private boolean deepAnalyseEnabled;
    private String packageName;
    private String priority;
    private Boolean extractAfterDownload;

    private String downloadFolder;
    private String[] extractPasswords;
    private String downloadPassword;
    private boolean overwritePackagizerEnabled = true;

    public String filename() {
        return filename;
    }

    public CrawlJob filename(String filename) {
        this.filename = filename;
        return this;
    }

    public int chunks() {
        return chunks;
    }

    public CrawlJob chunks(int chunks) {
        this.chunks = chunks;
        return this;
    }

    public Boolean autoConfirm() {
        return autoConfirm;
    }

    public CrawlJob autoConfirm(Boolean autoConfirm) {
        this.autoConfirm = autoConfirm;
        return this;
    }

    public boolean addOfflineLink() {
        return addOfflineLink;
    }

    public CrawlJob addOfflineLink(boolean addOfflineLink) {
        this.addOfflineLink = addOfflineLink;
        return this;
    }

    public Boolean autoStart() {
        return autoStart;
    }

    public CrawlJob autoStart(Boolean autoStart) {
        this.autoStart = autoStart;
        return this;
    }

    public Boolean forcedStart() {
        return forcedStart;
    }

    public CrawlJob forcedStart(Boolean forcedStart) {
        this.forcedStart = forcedStart;
        return this;
    }

    public Boolean enabled() {
        return enabled;
    }

    public CrawlJob enabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    public String text() {
        return text;
    }

    public CrawlJob text(String text) {
        this.text = text;
        return this;
    }

    public boolean deepAnalyseEnabled() {
        return deepAnalyseEnabled;
    }

    public CrawlJob deepAnalyseEnabled(boolean deepAnalyseEnabled) {
        this.deepAnalyseEnabled = deepAnalyseEnabled;
        return this;
    }

    public String packageName() {
        return packageName;
    }

    public CrawlJob packageName(String packageName) {
        this.packageName = packageName;
        return this;
    }

    public String priority() {
        return priority;
    }

    public CrawlJob priority(String priority) {
        this.priority = priority;
        return this;
    }

    public Boolean extractAfterDownload() {
        return extractAfterDownload;
    }

    public CrawlJob extractAfterDownload(Boolean extractAfterDownload) {
        this.extractAfterDownload = extractAfterDownload;
        return this;
    }

    public String downloadFolder() {
        return downloadFolder;
    }

    public CrawlJob downloadFolder(String downloadFolder) {
        this.downloadFolder = downloadFolder;
        return this;
    }

    public String[] extractPasswords() {
        return extractPasswords;
    }

    public CrawlJob extractPasswords(String[] extractPasswords) {
        this.extractPasswords = extractPasswords;
        return this;
    }

    public String downloadPassword() {
        return downloadPassword;
    }

    public CrawlJob downloadPassword(String downloadPassword) {
        this.downloadPassword = downloadPassword;
        return this;
    }

    public boolean overwritePackagizerEnabled() {
        return overwritePackagizerEnabled;
    }

    public CrawlJob overwritePackagizerEnabled(boolean overwritePackagizerEnabled) {
        this.overwritePackagizerEnabled = overwritePackagizerEnabled;
        return this;
    }
}


text:
package com.google.inject.servlet;

import com.google.inject.Binding;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.internal.Maps;
import com.google.inject.internal.Sets;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import junit.framework.TestCase;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;

/**
 * Basic unit test for lifecycle of a ServletDefinition (wrapper).
 *
 * @author Dhanji R. Prasanna (dhanji@gmail com)
 */
public class ServletDefinitionTest extends TestCase {

  public final void testServletInitAndConfig() throws ServletException {
    Injector injector = createMock(Injector.class);

    expect(injector.getBinding(Key.get(HttpServlet.class)))
        .andReturn(createMock(Binding.class));
    final HttpServlet mockServlet = new HttpServlet() {
    };
    expect(injector.getInstance(Key.get(HttpServlet.class)))
        .andReturn(mockServlet)
        .anyTimes();

    replay(injector);

    //some init params
    //noinspection SSBasedInspection
    final Map<String, String> initParams = new HashMap<String, String>() {
      {
        put("ahsd", "asdas24dok");
        put("ahssd", "asdasd124ok");
        put("ahfsasd", "asda124sdok");
        put("ahsasgd", "a124sdasdok");
        put("ahsd124124", "as124124124dasdok");
      }
    };

    String pattern = "/*";
    final ServletDefinition servletDefinition = new ServletDefinition(pattern,
        Key.get(HttpServlet.class), UriPatternType.get(UriPatternType.SERVLET, pattern), initParams);

    ServletContext servletContext = createMock(ServletContext.class);
    final String contextName = "thing__!@@44__SRV" + getClass();
    expect(servletContext.getServletContextName())
        .andReturn(contextName);

    replay(servletContext);

    servletDefinition.init(servletContext, injector,
        Sets.newSetFromMap(Maps.<HttpServlet, Boolean>newIdentityHashMap()));

    assertNotNull(mockServlet.getServletContext());
    assertEquals(contextName, mockServlet.getServletContext().getServletContextName());
    assertEquals(Key.get(HttpServlet.class).toString(), mockServlet.getServletName());

    final ServletConfig servletConfig = mockServlet.getServletConfig();
    final Enumeration names = servletConfig.getInitParameterNames();
    while (names.hasMoreElements()) {
      String name = (String) names.nextElement();

      assertTrue(initParams.containsKey(name));
      assertEquals(initParams.get(name), servletConfig.getInitParameter(name));
    }
  }
}


text:
@interface MQFCModel : FCModel

@end


text:
const path = require('path');
const childProcess = require('child_process');
const moduleLinker = require('module-linker');
const recursiveInstaller = require('recursive-installer');
Promise = require('bluebird');

if(process.env.NPM_MODULES)
{
    var modules = process.env.NPM_MODULES.replace(' ','').split(';');
    if(modules.length > 0)
    {
        process.chdir(process.env.HOME_DIR);
        modules.forEach(function(module) {
            childProcess.execSync("npm install "+module);
        });
    }

}

Promise.all([recursiveInstaller([process.env.APP_DIR, process.env.SHARED_DIR], {'maxBuffer': 5 * 1024 * 1024, 'tool': process.env.TOOL, 'lock': false}),
             moduleLinker([process.env.APP_DIR, process.env.SHARED_DIR], [process.env.SHARED_DIR], process.env.TOOL)]).catch((err) => {
    console.log(err);
})


text:
module Ordoro
  module Record
    class OrderTagAdapter < BaseAdapter

      def json_root
        "tag"
      end

      def record_path
        "/#{json_root}/order/"
      end

    end
  end
end


text:
var http = require('http');
var app = require('./config/express')();
var config = require('./config/config')();

require('./config/passport')();
require('./config/database')(config.db);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express Server executando na porta ' + app.get('port'));
});


text:
Xamarin.Android Bindings for Aidan Follestad's [Material Dialogs](https://github.com/afollestad/material-dialogs "material-dialogs") library.

![Screenshots](https://raw.githubusercontent.com/afollestad/material-dialogs/master/art/mdshowcase.png)

### Build ###
You will need to pull the submodule and add `maven { url "https://jitpack.io" }` to `repositories` in `library\build.gradle`.

### Installation ###
You will need the the Roboto fonts (`Roboto-Regular.ttf` and `Roboto-Medium.ttf`) to the `Assets/fonts` folder (case sensitive) in your solution.


text:
@interface TwitterRequest : NSObject

+ (NSArray*)requestTweetsWithMaxCount:(NSUInteger)maxCount;
+ (NSArray*)requestTweetsWithCount:(NSUInteger)count;
+ (void)resetState;

@end


text:
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 *  Test enabled commands in the left pane folder of the Library.
 */

const TEST_URI = "http://www.mozilla.org/";

var gTests = [];
var gLibrary;

//------------------------------------------------------------------------------

gTests.push({
  desc: "Bug 489351 - Date containers under History in Library cannot be deleted/cut",
  run: function() {
    var bhist = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
    // Add a visit.
    PlacesUtils.history.addVisit(PlacesUtils._uri(TEST_URI), Date.now() * 1000,
                                 null, PlacesUtils.history.TRANSITION_TYPED,
                                 false, 0);
    ok(bhist.isVisited(PlacesUtils._uri(TEST_URI)), "Visit has been added");

    // Select and open the left pane "History" query.
    var PO = gLibrary.PlacesOrganizer;
    PO.selectLeftPaneQuery('History');
    isnot(PO._places.selectedNode, null, "We correctly selected History");

    // Check that both delete and cut commands are disabled.
    ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
       "Cut command is disabled");
    ok(!PO._places.controller.isCommandEnabled("cmd_delete"),
       "Delete command is disabled");
    var historyNode = PO._places.selectedNode
                        .QueryInterface(Ci.nsINavHistoryContainerResultNode);
    historyNode.containerOpen = true;

    // Check that we have a child container. It is "Today" container.
    is(historyNode.childCount, 1, "History node has one child");
    var todayNode = historyNode.getChild(0);
    var todayNodeExpectedTitle = PlacesUtils.getString("finduri-AgeInDays-is-0");
    is(todayNode.title, todayNodeExpectedTitle,
       "History child is the expected container");

    // Select "Today" container.
    PO._places.selectNode(todayNode);
    is(PO._places.selectedNode, todayNode,
       "We correctly selected Today container");
    // Check that delete command is enabled but cut command is disabled.
    ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
       "Cut command is disabled");
    ok(PO._places.controller.isCommandEnabled("cmd_delete"),
       "Delete command is enabled");

    // Execute the delete command and check visit has been removed.
    PO._places.controller.doCommand("cmd_delete");
    ok(!bhist.isVisited(PlacesUtils._uri(TEST_URI)), "Visit has been removed");

    // Test live update of "History" query.
    is(historyNode.childCount, 0, "History node has no more children");

    historyNode.containerOpen = false;
    nextTest();
  }
});

//------------------------------------------------------------------------------

gTests.push({
  desc: "Bug 490156 - Can't delete smart bookmark containers",
  run: function() {
    // Select and open the left pane "Bookmarks Toolbar" folder.
    var PO = gLibrary.PlacesOrganizer;
    PO.selectLeftPaneQuery('BookmarksToolbar');
    isnot(PO._places.selectedNode, null, "We have a valid selection");
    is(PlacesUtils.getConcreteItemId(PO._places.selectedNode),
       PlacesUtils.toolbarFolderId,
       "We have correctly selected bookmarks toolbar node.");

    // Check that both cut and delete commands are disabled.
    ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
       "Cut command is disabled");
    ok(!PO._places.controller.isCommandEnabled("cmd_delete"),
       "Delete command is disabled");

    var toolbarNode = PO._places.selectedNode
                        .QueryInterface(Ci.nsINavHistoryContainerResultNode);
    toolbarNode.containerOpen = true;

    // Add an History query to the toolbar.
    PlacesUtils.bookmarks.insertBookmark(PlacesUtils.toolbarFolderId,
                                         PlacesUtils._uri("place:sort=4"),
                                         0, // Insert at start.
                                         "special_query");
    // Get first child and check it is the "Most Visited" smart bookmark.
    ok(toolbarNode.childCount > 0, "Toolbar node has children");
    var queryNode = toolbarNode.getChild(0);
    is(queryNode.title, "special_query", "Query node is correctly selected");

    // Select query node.
    PO._places.selectNode(queryNode);
    is(PO._places.selectedNode, queryNode, "We correctly selected query node");

    // Check that both cut and delete commands are enabled.
    ok(PO._places.controller.isCommandEnabled("cmd_cut"),
       "Cut command is enabled");
    ok(PO._places.controller.isCommandEnabled("cmd_delete"),
       "Delete command is enabled");

    // Execute the delete command and check bookmark has been removed.
    PO._places.controller.doCommand("cmd_delete");
    try {
      PlacesUtils.bookmarks.getFolderIdForItem(queryNode.itemId);
      ok(false, "Unable to remove query node bookmark");
    } catch(ex) {
      ok(true, "Query node bookmark has been correctly removed");
    }

    toolbarNode.containerOpen = false;
    nextTest();
  }
});

//------------------------------------------------------------------------------

function nextTest() {
  if (gTests.length) {
    var test = gTests.shift();
    info("Start of test: " + test.desc);
    test.run();
  }
  else {
    // Close Library window.
    gLibrary.close();
    // No need to cleanup anything, we have a correct left pane now.
    finish();
  }
}

function test() {
  waitForExplicitFinish();
  // Sanity checks.
  ok(PlacesUtils, "PlacesUtils is running in chrome context");
  ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");

  // Open Library.
  gLibrary = openLibrary(nextTest);
}


text:
SET gp_create_table_random_default_distribution=off;
-- end_ignore
CREATE TABLE sync1_hybrid_part1 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part1 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part2 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part2 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part3 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part3 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part4 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part4 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part5 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part5 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part6 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part6 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part7 (
                PS_PARTKEY INTEGER,
                PS_SUPPKEY INTEGER,
                PS_AVAILQTY integer,
                PS_SUPPLYCOST decimal,
                PS_COMMENT VARCHAR(199)
                )
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,   appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')  WITH (checksum=false,appendonly=true,     blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')  WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part7 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

CREATE TABLE sync1_hybrid_part8 (
		PS_PARTKEY INTEGER,
		PS_SUPPKEY INTEGER,
		PS_AVAILQTY integer,
		PS_SUPPLYCOST decimal,
		PS_COMMENT VARCHAR(199)
		)
 partition by range (ps_supplycost)
 subpartition by range (ps_suppkey)
,subpartition by range (ps_partkey) subpartition template (start('1') end('200001') every(66666)

)
(
partition p1 start('1') end('20') inclusive
(
 subpartition sp1 start('1') end('3030')  WITH (checksum=false,	  appendonly=true,blocksize=1171456,compresslevel=3),
 subpartition sp2 end('6096') inclusive,
 subpartition sp3   start('6096') exclusive end('7201') with (orientation='column',appendonly=true),
 subpartition sp4 end('10001')	WITH (checksum=false,appendonly=true,	  blocksize=1171456,compresslevel=3)
),
partition p2 end('1001') inclusive
(
subpartition sp1 start('1') ,
subpartition sp2 start('4139') with (orientation='column',appendonly=true) ,
subpartition sp3 start('4685')	WITH (checksum=false,appendonly=true, blocksize=1171456,compresslevel=3) ,
subpartition sp4 start('5675') )
);

COPY sync1_hybrid_part8 FROM '/data/tangp3/tincrepo/private/tangp3/main/storage/filerep_end_to_end/hybrid_part.data' delimiter as '|';

DROP TABLE sync1_hybrid_part1;


text:
<?php
namespace app\components\helpers;

use \app\models\CurrencyCur;

class CurrencyConverter
{

    public static function currencyAsRub($currency_id, $ammount)
    {
        if(!$currency_id && !$ammount)
            return;
        if($currency_id == 1)
            return $ammount;
        $query = CurrencyCur::find();
        $query->where(['currency_id'=>$currency_id]);
        $query->orderBy(['id'=>SORT_DESC]);
        $query->limit(1);
        $rate = $query->one();
        if($rate)
            return $ammount * $rate->rate;
        else
            return false;
    }

    public static function rubAsCurrency($currency_id, $ammount)
    {
        if(!$currency_id && !$ammount)
            return;
        $query = CurrencyCur::find();
        $query->where(['currency_id'=>$currency_id]);
        $query->orderBy(['id'=>SORT_DESC]);
        $query->limit(1);
        $rate = $query->one();
        if($rate)
            return $ammount / $rate->rate;
        else
            return false;

    }

}


text:
import { ApiModelPropertyOptional, ApiModelProperty } from '@nestjs/swagger';
import { TimeSpan } from '../tournament.model';
import { VenueDto } from 'api/graph/venue/dto/venue.dto';
import { ClubDto } from 'api/graph/club/dto/club.dto';

export class TournamentDto {
  @ApiModelProperty({ description: `The tournament primary key` })
  id: number;

  @ApiModelProperty({ description: `The tournaments unique string identifier. Also the header everywhere tournament data is presented.` })
  name: string;

  @ApiModelPropertyOptional({ description: `Norwegian description in markdown` })
  description_no?: string;

  @ApiModelPropertyOptional({ description: `English description in markdown` })
  description_en?: string;

  @ApiModelProperty({ description: `The date for the first day of the event` })
  startDate?: Date;

  @ApiModelProperty({ description: `The date for the last day of the event` })
  endDate?: Date;

  @ApiModelPropertyOptional({ description: `An array of timespans, describing the start and end time for each day in the event.` })
  times?: TimeSpan[];

  venue?: VenueDto;

  @ApiModelProperty({ description: `An object specifying the location of the event.` })
  venueId?: number;

  @ApiModelProperty({ description: `This field is automatically created when a user creates a newevent.` })
  createdById?: number;

  club?: ClubDto;

  @ApiModelProperty({ description: `A reference to the club this tournament is hosted by` })
  clubId?: number;

  // LODGING -----------------------------------------------------
  @ApiModelProperty({ description: `The number of gymnasts this tournament can be able to provide lodging for.` })
  providesLodging: boolean;

  @ApiModelPropertyOptional({
    description: `The price for lodging per head. This will be covered by
      the entry fee for the tournament, and split between all teams entering.` })
  lodingCostPerHead?: number;

  // TRANSPORT ---------------------------------------------------
  @ApiModelProperty({ description: `If true, this tournament can provide transportation for traveling gymnasts.` })
  providesTransport: boolean;

  @ApiModelPropertyOptional({
    description: `The price for transportation per head. This will be covered by
      the entry fee for the tournament, and split between all teams entering.` })
  transportationCostPerHead?: number;

  // BANQUET -----------------------------------------------------
  @ApiModelProperty({ description: `If true, this tournament will throw a banquet in honor of the performing gymnasts.` })
  providesBanquet: boolean;

  @ApiModelPropertyOptional({
    description: `The price for the banquet per head. This will be covered by
      the entry fee for the tournament, and split between all teams entering.` })
  banquetCostPerHead?: number;
}


text:
export { ComponentResolver } from './linker/component_resolver';
export { QueryList } from './linker/query_list';
export { DynamicComponentLoader } from './linker/dynamic_component_loader';
export { ElementRef } from './linker/element_ref';
export { TemplateRef } from './linker/template_ref';
export { EmbeddedViewRef, ViewRef } from './linker/view_ref';
export { ViewContainerRef } from './linker/view_container_ref';
export { ComponentRef, ComponentFactory } from './linker/component_factory';
export { ExpressionChangedAfterItHasBeenCheckedException } from './linker/exceptions';


text:
import multiprocessing

bind = '127.0.0.1:8000'
workers = int(multiprocessing.cpu_count() * 1.5)
timeout = 3600
limit_request_line = 9086


text:
@class CoolButton;

@interface CoolButtonViewController : UIViewController {
    CoolButton *_button;
}

@property (retain) IBOutlet CoolButton *button;

- (IBAction)hueValueChanged:(id)sender;
- (IBAction)saturationValueChanged:(id)sender;
- (IBAction)brightnessValueChanged:(id)sender;

@end


text:
import unittest
from unittest.mock import patch

from airflow.operators.papermill_operator import PapermillOperator

class TestPapermillOperator(unittest.TestCase):
    @patch('airflow.operators.papermill_operator.pm')
    def test_execute(self, mock_papermill):
        in_nb = "/tmp/does_not_exist"
        out_nb = "/tmp/will_not_exist"
        parameters = {"msg": "hello_world",
                      "train": 1}

        po = PapermillOperator(
            input_nb=in_nb, output_nb=out_nb, parameters=parameters,
            task_id="papermill_operator_test",
            dag=None
        )

        po.pre_execute(context={})  # make sure to have the inlets
        po.execute(context={})

        mock_papermill.execute_notebook.assert_called_once_with(
            in_nb,
            out_nb,
            parameters=parameters,
            progress_bar=False,
            report_mode=True
        )


text:
function(check_variable_defined var_name)
  if(NOT DEFINED "${var_name}")
    message(FATAL_ERROR "CMake variable [${var_name}] should be defined !")
  endif()
endfunction()

function(check_variable_not_defined var_name)
  if(DEFINED "${var_name}")
    message(FATAL_ERROR "CMake variable [${var_name}] should not be be defined ! Current value is [${${var_name}}]")
  endif()
endfunction()

function(check_variable var_name expected_value)
  if(NOT "x${${var_name}}" STREQUAL "x${expected_value}")
    message(FATAL_ERROR "CMake variable [${var_name}] is incorrectly set !\n"
                        "current:${${var_name}}\n"
                        "expected:${expected_value}")
  endif()
endfunction()

function(check_env_variable var_name expected_value)
  if(NOT "x$ENV{${var_name}}" STREQUAL "x${expected_value}")
    message(FATAL_ERROR "CMake variable [$ENV{${var_name}}] is incorrectly set !\n"
                        "current:$ENV{${var_name}}\n"
                        "expected:${expected_value}")
  endif()
endfunction()

function(configure_external_projects_for_test name)
  set(depends "${expected_${name}_DEPENDS}")
  set(indent "${ARGV1}")
  if(ARGC EQUAL 1)
    message(STATUS "----------------------------------------")
    message(STATUS "Configuring external projects")
    set(indent "")
  endif()
  set(txt ${indent})
  if(depends STREQUAL "")
    set(txt "${txt}\\-")
    set(indent "${indent}  ")
  else()
    set(txt "${txt}|-")
    set(indent "${indent}| ")
  endif()
  set(txt "${txt}${name}")
  if(optional_${name})
    set(txt "${txt} [Optional]")
  endif()
  message("\# ${txt}")

  foreach(dep ${depends})
    set(_ep_file ${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
    if(NOT EXISTS ${_ep_file})
      set(PROJECT_NAME_CONFIG ${dep})
      set(PROJECT_DEPENDS_CONFIG ${expected_${dep}_DEPENDS})
      set(PROJECT_REQUIRED_DEPENDS_CONFIG ${expected_${dep}_REQUIRED_DEPENDS})
      set(LIB_EXTERNAL_PROJECT_INCLUDE_DEPENDENCIES_EXTRA_ARGS "${${dep}_EXTERNAL_PROJECT_INCLUDE_DEPENDENCIES_EXTRA_ARGS}")
      configure_file(../External_Lib.cmake.in ${_ep_file} @ONLY)
      set(LIB_EXTERNAL_PROJECT_INCLUDE_DEPENDENCIES_EXTRA_ARGS "")
    endif()
    configure_external_projects_for_test(${dep} ${indent})
  endforeach()
  if(ARGC EQUAL 1)
    message(STATUS "----------------------------------------")
  endif()
endfunction()

function(check_for_uses_terminal proj varname)
  ExternalProject_Message(${proj} "Checking for USES_TERMINAL_* in variable ${varname}")
  foreach(step IN ITEMS DOWNLOAD UPDATE CONFIGURE BUILD TEST INSTALL)
    list(FIND ${varname} USES_TERMINAL_${step} _uses_terminal_index)
    if(CMAKE_VERSION VERSION_EQUAL "3.4" OR CMAKE_VERSION VERSION_GREATER "3.4")
      if(_uses_terminal_index EQUAL -1)
        message(FATAL_ERROR "USES_TERMINAL_${step} is expected to be in list ${varname} [${${varname}}]")
      endif()
    else()
      if(NOT _uses_terminal_index EQUAL -1)
        message(FATAL_ERROR "USES_TERMINAL_${step} is NOT expected to be in list ${varname} [${${varname}}]")
      endif()
    endif()
  endforeach()
endfunction()


text:
import mock
from oslo_config import cfg
from oslo_log import log as logging

from mistral.db.v2 import api as db_api
from mistral.engine import default_engine as de
from mistral import exceptions as exc
from mistral.services import workflows as wf_service
from mistral.tests.unit.engine import base
from mistral.workflow import states

LOG = logging.getLogger(__name__)

# Use the set_default method to set value otherwise in certain test cases
# the change in value is not permanent.
cfg.CONF.set_default('auth_enable', False, group='pecan')

class DirectWorkflowEngineTest(base.EngineTestCase):
    def _run_workflow(self, workflow_yaml):
        wf_service.create_workflows(workflow_yaml)

        wf_ex = self.engine.start_workflow('wf', {})

        self._await(lambda: self.is_execution_error(wf_ex.id))

        return db_api.get_workflow_execution(wf_ex.id)

    def test_direct_workflow_on_closures(self):
        wf_text = """
        version: '2.0'

        wf:
          # type: direct - 'direct' is default

          tasks:
            task1:
              description: |
                Explicit 'fail' command should lead to workflow failure.
              action: std.echo output="Echo"
              on-success:
                - task2
                - succeed
              on-complete:
                - task3
                - task4
                - fail
                - never_gets_here

            task2:
              action: std.noop

            task3:
              action: std.noop

            task4:
              action: std.noop

            never_gets_here:
              action: std.noop
        """

        wf_ex = self._run_workflow(wf_text)

        tasks = wf_ex.task_executions

        task1 = self._assert_single_item(tasks, name='task1')
        task3 = self._assert_single_item(tasks, name='task3')
        task4 = self._assert_single_item(tasks, name='task4')

        self.assertEqual(3, len(tasks))

        self._await(lambda: self.is_task_success(task1.id))
        self._await(lambda: self.is_task_success(task3.id))
        self._await(lambda: self.is_task_success(task4.id))

        self.assertTrue(wf_ex.state, states.ERROR)

    def test_direct_workflow_wrong_task_name(self):
        wf_text = """
        version: '2.0'

        wf:
          tasks:
            task1:
              action: std.echo output="Echo"
              on-success:
                - wrong_name
        """

        wf_service.create_workflows(wf_text)
        wf_ex = self.engine.start_workflow('wf', {})

        self._await(lambda: self.is_execution_error(wf_ex.id))
        wf_ex = db_api.get_workflow_execution(wf_ex.id)

        self.assertIn("'wrong_name' not found", wf_ex.state_info)

    def test_direct_workflow_change_state_after_success(self):
        wf_text = """
        version: '2.0'

        wf:
          tasks:
            task1:
              action: std.echo output="Echo"
              on-success:
                - task2

            task2:
              action: std.noop
        """

        wf_service.create_workflows(wf_text)
        wf_ex = self.engine.start_workflow('wf', {})

        self._await(lambda: self.is_execution_success(wf_ex.id))

        self.assertEqual(
            states.SUCCESS,
            self.engine.resume_workflow(wf_ex.id).state
        )
        self.assertRaises(
            exc.WorkflowException,
            self.engine.pause_workflow, wf_ex.id
        )
        self.assertEqual(
            states.SUCCESS,
            self.engine.stop_workflow(wf_ex.id, states.ERROR).state
        )

    def test_wrong_task_input(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct

          tasks:
            task1:
              action: std.echo output="Echo"
              on-complete:
                - task2

            task2:
              description: Wrong task output should lead to workflow failure
              action: std.echo wrong_input="Hahaha"
        """

        wf_ex = self._run_workflow(wf_text)

        self.assertIn(
            'Invalid input',
            wf_ex.state_info
        )

        self.assertTrue(wf_ex.state, states.ERROR)

    def test_wrong_first_task_input(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct

          tasks:
            task1:
              action: std.echo wrong_input="Ha-ha"
        """

        self.assertRaises(
            exc.InputException,
            self._run_workflow,
            wf_text
        )

    def test_wrong_action(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct

          tasks:
            task1:
              action: std.echo output="Echo"
              on-complete:
                - task2

            task2:
              action: action.doesnt_exist
        """

        wf_ex = self._run_workflow(wf_text)

        # TODO(dzimine): Catch tasks caused error, and set them to ERROR:
        # TODO(dzimine): self.assertTrue(task_ex.state, states.ERROR)

        self.assertTrue(wf_ex.state, states.ERROR)
        self.assertIn("Failed to find action", wf_ex.state_info)

    def test_wrong_action_first_task(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct

          tasks:
            task1:
              action: wrong.task
        """

        wf_service.create_workflows(wf_text)

        with mock.patch.object(de.DefaultEngine, '_fail_workflow') as mock_fw:
            self.assertRaises(
                exc.InvalidActionException,
                self.engine.start_workflow, 'wf', None)

            self.assertEqual(1, mock_fw.call_count)

            self.assertTrue(
                issubclass(
                    type(mock_fw.call_args[0][1]),
                    exc.InvalidActionException
                ),
                "Called with a right exception"
            )

    def test_messed_yaql(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct

          tasks:
            task1:
              action: std.echo output="Echo"
              on-complete:
                - task2

            task2:
              action: std.echo output=<% wrong(yaql) %>
        """

        wf_ex = self._run_workflow(wf_text)

        self.assertTrue(wf_ex.state, states.ERROR)

    def test_messed_yaql_in_first_task(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct
          tasks:
            task1:
              action: std.echo output=<% wrong(yaql) %>
        """

        wf_service.create_workflows(wf_text)

        with mock.patch.object(de.DefaultEngine, '_fail_workflow') as mock_fw:
            self.assertRaises(
                exc.YaqlEvaluationException,
                self.engine.start_workflow, 'wf', None
            )

            self.assertEqual(1, mock_fw.call_count)
            self.assertTrue(
                issubclass(
                    type(mock_fw.call_args[0][1]),
                    exc.YaqlEvaluationException
                ),
                "Called with a right exception"
            )

    def test_mismatched_yaql_in_first_task(self):
        wf_text = """
        version: '2.0'

        wf:
          input:
            - var
          tasks:
            task1:
              action: std.echo output=<% $.var + $.var2 %>
        """

        wf_service.create_workflows(wf_text)

        exception = self.assertRaises(
            exc.YaqlEvaluationException,
            self.engine.start_workflow, 'wf', {'var': 2}
        )

        self.assertIn("Can not evaluate YAQL expression", exception.message)

    def test_one_line_syntax_in_on_clauses(self):
        wf_text = """
        version: '2.0'

        wf:
          type: direct

          tasks:
            task1:
              action: std.echo output=1
              on-success: task2

            task2:
              action: std.echo output=1
              on-complete: task3

            task3:
              action: std.fail
              on-error: task4

            task4:
              action: std.echo output=4
        """

        wf_service.create_workflows(wf_text)

        wf_ex = self.engine.start_workflow('wf', {})

        self._await(lambda: self.is_execution_success(wf_ex.id))


text:
module ApiV1
  class StageSummaryRepresenter < ApiV1::BaseRepresenter
    alias_method :stage, :represented

    link :self do |opts|
      opts[:url_builder].apiv1_stage_instance_by_counter_api_url(pipeline_name:    stage.pipeline_name,
                                                                 pipeline_counter: stage.pipeline_counter,
                                                                 stage_counter:    stage.stage_counter,
                                                                 stage_name:       stage.stage_name)
    end

    link :doc do |opts|
      'https://api.go.cd/#get-stage-instance'
    end

    property :stage_name, as: :name
    property :stage_counter, as: :counter
  end
end


text:
import {expect} from 'chai';
import {UrlService} from 'src/ts/util/url-service';

describe('url service', () => {
  const fixture = UrlService;

  it('should get the current page\'s URL', () => {
    expect(fixture.getCurrentUrl()).to.be.equal(document.location.href);
  });
});


text:
#pragma once
#include <stdint.h>
#include "v_array.h"
#include "simple_label.h"
#include "multiclass.h"
#include "cost_sensitive.h"
#include "cb.h"

const size_t wap_ldf_namespace  = 126;
const size_t history_namespace  = 127;
const size_t constant_namespace = 128;
const size_t nn_output_namespace  = 129;
const size_t autolink_namespace  = 130;
const size_t neighbor_namespace  = 131;   // this is \x83 -- to do quadratic, say "-q a`printf "\x83"` on the command line
const size_t affix_namespace     = 132;   // this is \x84
const size_t spelling_namespace  = 133;   // this is \x85
const size_t conditioning_namespace = 134;
const size_t dictionary_namespace  = 135;

struct feature {
  float x;
  uint32_t weight_index;
  bool operator==(feature j){return weight_index == j.weight_index;}
};

struct audit_data {
  char* space;
  char* feature;
  size_t weight_index;
  float x;
  bool alloced;
};

typedef union {
  label_data simple;
  MULTICLASS::label_t multi;
  COST_SENSITIVE::label cs;
  CB::label cb;
  CB_EVAL::label cb_eval;
} polylabel;

typedef union {
  float scalar;
  uint32_t multiclass;
} polyprediction;

struct example // core example datatype.
{//output prediction
  polyprediction pred;

  // input fields
  polylabel l;
  v_array<char> tag;//An identifier for the example.
  size_t example_counter;
  v_array<unsigned char> indices;
  v_array<feature> atomics[256]; // raw parsed data
  uint32_t ft_offset;

  //helpers
  v_array<audit_data> audit_features[256];
  size_t num_features;//precomputed, cause it's fast&easy.
  float partial_prediction;//shared data for prediction.
  float updated_prediction;//estimated post-update prediction.
  v_array<float> topic_predictions;
  float loss;
  float example_t;//sum of importance weights so far.
  float sum_feat_sq[256];//helper for total_sum_feat_sq.
  float total_sum_feat_sq;//precomputed, cause it's kind of fast & easy.
  float revert_weight;

  bool test_only;
  bool end_pass;//special example indicating end of pass.
  bool sorted;//Are the features sorted or not?
  bool in_use; //in use or not (for the parser)
};

 struct vw;

struct flat_example
{
  polylabel l;

  size_t tag_len;
  char* tag;//An identifier for the example.

  size_t example_counter;
  uint32_t ft_offset;
  float global_weight;

  size_t num_features;//precomputed, cause it's fast&easy.
  float total_sum_feat_sq;//precomputed, cause it's kind of fast & easy.
  size_t feature_map_len;
  feature* feature_map; //map to store sparse feature vectors
};

flat_example* flatten_example(vw& all, example *ec);
flat_example* flatten_sort_example(vw& all, example *ec);
void free_flatten_example(flat_example* fec);

example *alloc_examples(size_t,size_t);
void dealloc_example(void(*delete_label)(void*), example&);

inline int example_is_newline(example& ec)
{
  // if only index is constant namespace or no index
  return ((ec.indices.size() == 0) ||
          ((ec.indices.size() == 1) &&
           (ec.indices.last() == constant_namespace)));
}