// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
 * Author: Tarek Dakhran <t.dakhran@samsung.com>
 *
 * Common Clock Framework support for Exynos5410 SoC.
*/

#include <dt-bindings/clock/exynos5410.h>

#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk.h>

#include "clk.h"

#define APLL_LOCK               0x0
#define APLL_CON0               0x100
#define CPLL_LOCK               0x10020
#define CPLL_CON0               0x10120
#define EPLL_LOCK               0x10040
#define EPLL_CON0               0x10130
#define MPLL_LOCK               0x4000
#define MPLL_CON0               0x4100
#define BPLL_LOCK               0x20010
#define BPLL_CON0               0x20110
#define KPLL_LOCK               0x28000
#define KPLL_CON0               0x28100

#define SRC_CPU			0x200
#define DIV_CPU0		0x500
#define SRC_CPERI1		0x4204
#define GATE_IP_G2D		0x8800
#define DIV_TOP0		0x10510
#define DIV_TOP1		0x10514
#define DIV_FSYS0		0x10548
#define DIV_FSYS1		0x1054c
#define DIV_FSYS2		0x10550
#define DIV_PERIC0		0x10558
#define DIV_PERIC3		0x10564
#define SRC_TOP0		0x10210
#define SRC_TOP1		0x10214
#define SRC_TOP2		0x10218
#define SRC_FSYS		0x10244
#define SRC_PERIC0		0x10250
#define SRC_MASK_FSYS		0x10340
#define SRC_MASK_PERIC0		0x10350
#define GATE_BUS_FSYS0		0x10740
#define GATE_TOP_SCLK_FSYS	0x10840
#define GATE_TOP_SCLK_PERIC	0x10850
#define GATE_IP_FSYS		0x10944
#define GATE_IP_PERIC		0x10950
#define GATE_IP_PERIS		0x10960
#define SRC_CDREX		0x20200
#define SRC_KFC			0x28200
#define DIV_KFC0		0x28500

/* list of PLLs */
enum exynos5410_plls {
	apll, cpll, epll, mpll,
	bpll, kpll,
	nr_plls                 /* number of PLLs */
};

/* list of all parent clocks */
PNAME(apll_p)		= { "fin_pll", "fout_apll", };
PNAME(bpll_p)		= { "fin_pll", "fout_bpll", };
PNAME(cpll_p)		= { "fin_pll", "fout_cpll" };
PNAME(epll_p)		= { "fin_pll", "fout_epll" };
PNAME(mpll_p)		= { "fin_pll", "fout_mpll", };
PNAME(kpll_p)		= { "fin_pll", "fout_kpll", };

PNAME(mout_cpu_p)	= { "mout_apll", "sclk_mpll", };
PNAME(mout_kfc_p)	= { "mout_kpll", "sclk_mpll", };

PNAME(mpll_user_p)	= { "fin_pll", "sclk_mpll", };
PNAME(bpll_user_p)	= { "fin_pll", "sclk_bpll", };
PNAME(mpll_bpll_p)	= { "sclk_mpll_muxed", "sclk_bpll_muxed", };
PNAME(sclk_mpll_bpll_p)	= { "sclk_mpll_bpll", "fin_pll", };

PNAME(group2_p)		= { "fin_pll", "fin_pll", "none", "none",
			"none", "none", "sclk_mpll_bpll",
			 "none", "none", "sclk_cpll" };

static const struct samsung_mux_clock exynos5410_mux_clks[] __initconst = {
	MUX(0, "mout_apll", apll_p, SRC_CPU, 0, 1),
	MUX(0, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1),

	MUX(0, "mout_kpll", kpll_p, SRC_KFC, 0, 1),
	MUX(0, "mout_kfc", mout_kfc_p, SRC_KFC, 16, 1),

	MUX(0, "sclk_mpll", mpll_p, SRC_CPERI1, 8, 1),
	MUX(0, "sclk_mpll_muxed", mpll_user_p, SRC_TOP2, 20, 1),

	MUX(0, "sclk_bpll", bpll_p, SRC_CDREX, 0, 1),
	MUX(0, "sclk_bpll_muxed", bpll_user_p, SRC_TOP2, 24, 1),

	MUX(0, "sclk_epll", epll_p, SRC_TOP2, 12, 1),

	MUX(0, "sclk_cpll", cpll_p, SRC_TOP2, 8, 1),

	MUX(0, "sclk_mpll_bpll", mpll_bpll_p, SRC_TOP1, 20, 1),

	MUX(0, "mout_mmc0", group2_p, SRC_FSYS, 0, 4),
	MUX(0, "mout_mmc1", group2_p, SRC_FSYS, 4, 4),
	MUX(0, "mout_mmc2", group2_p, SRC_FSYS, 8, 4),
	MUX(0, "mout_usbd300", sclk_mpll_bpll_p, SRC_FSYS, 28, 1),
	MUX(0, "mout_usbd301", sclk_mpll_bpll_p, SRC_FSYS, 29, 1),

	MUX(0, "mout_uart0", group2_p, SRC_PERIC0, 0, 4),
	MUX(0, "mout_uart1", group2_p, SRC_PERIC0, 4, 4),
	MUX(0, "mout_uart2", group2_p, SRC_PERIC0, 8, 4),
	MUX(0, "mout_uart3", group2_p, SRC_PERIC0, 12, 4),
	MUX(0, "mout_pwm", group2_p, SRC_PERIC0, 24, 4),

	MUX(0, "mout_aclk200", mpll_bpll_p, SRC_TOP0, 12, 1),
	MUX(0, "mout_aclk400", mpll_bpll_p, SRC_TOP0, 20, 1),
};

static const struct samsung_div_clock exynos5410_div_clks[] __initconst = {
	DIV(0, "div_arm", "mout_cpu", DIV_CPU0, 0, 3),
	DIV(0, "div_arm2", "div_arm", DIV_CPU0, 28, 3),

	DIV(0, "div_acp", "div_arm2", DIV_CPU0, 8, 3),
	DIV(0, "div_cpud", "div_arm2", DIV_CPU0, 4, 3),
	DIV(0, "div_atb", "div_arm2", DIV_CPU0, 16, 3),
	DIV(0, "pclk_dbg", "div_arm2", DIV_CPU0, 20, 3),

	DIV(0, "div_kfc", "mout_kfc", DIV_KFC0, 0, 3),
	DIV(0, "div_aclk", "div_kfc", DIV_KFC0, 4, 3),
	DIV(0, "div_pclk", "div_kfc", DIV_KFC0, 20, 3),

	DIV(0, "aclk66_pre", "sclk_mpll_muxed", DIV_TOP1, 24, 3),
	DIV(0, "aclk66", "aclk66_pre", DIV_TOP0, 0, 3),

	DIV(0, "dout_usbphy300", "mout_usbd300", DIV_FSYS0, 16, 4),
	DIV(0, "dout_usbphy301", "mout_usbd301", DIV_FSYS0, 20, 4),
	DIV(0, "dout_usbd300", "mout_usbd300", DIV_FSYS0, 24, 4),
	DIV(0, "dout_usbd301", "mout_usbd301", DIV_FSYS0, 28, 4),

	DIV(0, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4),
	DIV(0, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4),
	DIV(0, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4),

	DIV_F(0, "div_mmc_pre0", "div_mmc0",
			DIV_FSYS1, 8, 8, CLK_SET_RATE_PARENT, 0),
	DIV_F(0, "div_mmc_pre1", "div_mmc1",
			DIV_FSYS1, 24, 8, CLK_SET_RATE_PARENT, 0),
	DIV_F(0, "div_mmc_pre2", "div_mmc2",
			DIV_FSYS2, 8, 8, CLK_SET_RATE_PARENT, 0),

	DIV(0, "div_uart0", "mout_uart0", DIV_PERIC0, 0, 4),
	DIV(0, "div_uart1", "mout_uart1", DIV_PERIC0, 4, 4),
	DIV(0, "div_uart2", "mout_uart2", DIV_PERIC0, 8, 4),
	DIV(0, "div_uart3", "mout_uart3", DIV_PERIC0, 12, 4),

	DIV(0, "dout_pwm", "mout_pwm", DIV_PERIC3, 0, 4),

	DIV(0, "aclk200", "mout_aclk200", DIV_TOP0, 12, 3),
	DIV(0, "aclk266", "mpll_user_p", DIV_TOP0, 16, 3),
	DIV(0, "aclk400", "mout_aclk400", DIV_TOP0, 24, 3),
};

static const struct samsung_gate_clock exynos5410_gate_clks[] __initconst = {
	GATE(CLK_SSS, "sss", "aclk266", GATE_IP_G2D, 2, 0, 0),
	GATE(CLK_MCT, "mct", "aclk66", GATE_IP_PERIS, 18, 0, 0),
	GATE(CLK_WDT, "wdt", "aclk66", GATE_IP_PERIS, 19, 0, 0),
	GATE(CLK_RTC, "rtc", "aclk66", GATE_IP_PERIS, 20, 0, 0),
	GATE(CLK_TMU, "tmu", "aclk66", GATE_IP_PERIS, 21, 0, 0),

	GATE(CLK_SCLK_MMC0, "sclk_mmc0", "div_mmc_pre0",
			SRC_MASK_FSYS, 0, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_MMC1, "sclk_mmc1", "div_mmc_pre1",
			SRC_MASK_FSYS, 4, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_MMC2, "sclk_mmc2", "div_mmc_pre2",
			SRC_MASK_FSYS, 8, CLK_SET_RATE_PARENT, 0),

	GATE(CLK_MMC0, "sdmmc0", "aclk200", GATE_BUS_FSYS0, 12, 0, 0),
	GATE(CLK_MMC1, "sdmmc1", "aclk200", GATE_BUS_FSYS0, 13, 0, 0),
	GATE(CLK_MMC2, "sdmmc2", "aclk200", GATE_BUS_FSYS0, 14, 0, 0),
	GATE(CLK_PDMA1, "pdma1", "aclk200", GATE_BUS_FSYS0, 2, 0, 0),
	GATE(CLK_PDMA0, "pdma0", "aclk200", GATE_BUS_FSYS0, 1, 0, 0),

	GATE(CLK_SCLK_USBPHY301, "sclk_usbphy301", "dout_usbphy301",
	     GATE_TOP_SCLK_FSYS, 7, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_USBPHY300, "sclk_usbphy300", "dout_usbphy300",
	     GATE_TOP_SCLK_FSYS, 8, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_USBD300, "sclk_usbd300", "dout_usbd300",
	     GATE_TOP_SCLK_FSYS, 9, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_USBD301, "sclk_usbd301", "dout_usbd301",
	     GATE_TOP_SCLK_FSYS, 10, CLK_SET_RATE_PARENT, 0),

	GATE(CLK_SCLK_PWM, "sclk_pwm", "dout_pwm",
	     GATE_TOP_SCLK_PERIC, 11, CLK_SET_RATE_PARENT, 0),

	GATE(CLK_UART0, "uart0", "aclk66", GATE_IP_PERIC, 0, 0, 0),
	GATE(CLK_UART1, "uart1", "aclk66", GATE_IP_PERIC, 1, 0, 0),
	GATE(CLK_UART2, "uart2", "aclk66", GATE_IP_PERIC, 2, 0, 0),
	GATE(CLK_UART3, "uart3", "aclk66", GATE_IP_PERIC, 3, 0, 0),
	GATE(CLK_I2C0, "i2c0", "aclk66", GATE_IP_PERIC, 6, 0, 0),
	GATE(CLK_I2C1, "i2c1", "aclk66", GATE_IP_PERIC, 7, 0, 0),
	GATE(CLK_I2C2, "i2c2", "aclk66", GATE_IP_PERIC, 8, 0, 0),
	GATE(CLK_I2C3, "i2c3", "aclk66", GATE_IP_PERIC, 9, 0, 0),
	GATE(CLK_USI0, "usi0", "aclk66", GATE_IP_PERIC, 10, 0, 0),
	GATE(CLK_USI1, "usi1", "aclk66", GATE_IP_PERIC, 11, 0, 0),
	GATE(CLK_USI2, "usi2", "aclk66", GATE_IP_PERIC, 12, 0, 0),
	GATE(CLK_USI3, "usi3", "aclk66", GATE_IP_PERIC, 13, 0, 0),
	GATE(CLK_TSADC, "tsadc", "aclk66", GATE_IP_PERIC, 15, 0, 0),
	GATE(CLK_PWM, "pwm", "aclk66", GATE_IP_PERIC, 24, 0, 0),

	GATE(CLK_SCLK_UART0, "sclk_uart0", "div_uart0",
			SRC_MASK_PERIC0, 0, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_UART1, "sclk_uart1", "div_uart1",
			SRC_MASK_PERIC0, 4, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_UART2, "sclk_uart2", "div_uart2",
			SRC_MASK_PERIC0, 8, CLK_SET_RATE_PARENT, 0),
	GATE(CLK_SCLK_UART3, "sclk_uart3", "div_uart3",
			SRC_MASK_PERIC0, 12, CLK_SET_RATE_PARENT, 0),

	GATE(CLK_USBH20, "usbh20", "aclk200_fsys", GATE_IP_FSYS, 18, 0, 0),
	GATE(CLK_USBD300, "usbd300", "aclk200_fsys", GATE_IP_FSYS, 19, 0, 0),
	GATE(CLK_USBD301, "usbd301", "aclk200_fsys", GATE_IP_FSYS, 20, 0, 0),
};

static const struct samsung_pll_rate_table exynos5410_pll2550x_24mhz_tbl[] __initconst = {
	PLL_36XX_RATE(24 * MHZ, 400000000U, 200, 3, 2, 0),
	PLL_36XX_RATE(24 * MHZ, 333000000U, 111, 2, 2, 0),
	PLL_36XX_RATE(24 * MHZ, 300000000U, 100, 2, 2, 0),
	PLL_36XX_RATE(24 * MHZ, 266000000U, 266, 3, 3, 0),
	PLL_36XX_RATE(24 * MHZ, 200000000U, 200, 3, 3, 0),
	PLL_36XX_RATE(24 * MHZ, 192000000U, 192, 3, 3, 0),
	PLL_36XX_RATE(24 * MHZ, 166000000U, 166, 3, 3, 0),
	PLL_36XX_RATE(24 * MHZ, 133000000U, 266, 3, 4, 0),
	PLL_36XX_RATE(24 * MHZ, 100000000U, 200, 3, 4, 0),
	PLL_36XX_RATE(24 * MHZ, 66000000U,  176, 2, 5, 0),
};

static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = {
	[apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK,
		APLL_CON0, NULL),
	[cpll] = PLL(pll_35xx, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
		CPLL_CON0, NULL),
	[epll] = PLL(pll_2650x, CLK_FOUT_EPLL, "fout_epll", "fin_pll", EPLL_LOCK,
		EPLL_CON0, NULL),
	[mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", MPLL_LOCK,
		MPLL_CON0, NULL),
	[bpll] = PLL(pll_35xx, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", BPLL_LOCK,
		BPLL_CON0, NULL),
	[kpll] = PLL(pll_35xx, CLK_FOUT_KPLL, "fout_kpll", "fin_pll", KPLL_LOCK,
		KPLL_CON0, NULL),
};

static const struct samsung_cmu_info cmu __initconst = {
	.pll_clks	= exynos5410_plls,
	.nr_pll_clks	= ARRAY_SIZE(exynos5410_plls),
	.mux_clks	= exynos5410_mux_clks,
	.nr_mux_clks	= ARRAY_SIZE(exynos5410_mux_clks),
	.div_clks	= exynos5410_div_clks,
	.nr_div_clks	= ARRAY_SIZE(exynos5410_div_clks),
	.gate_clks	= exynos5410_gate_clks,
	.nr_gate_clks	= ARRAY_SIZE(exynos5410_gate_clks),
	.nr_clk_ids	= CLK_NR_CLKS,
};

/* register exynos5410 clocks */
static void __init exynos5410_clk_init(struct device_node *np)
{
	struct clk *xxti = of_clk_get(np, 0);

	if (!IS_ERR(xxti) && clk_get_rate(xxti) == 24 * MHZ)
		exynos5410_plls[epll].rate_table = exynos5410_pll2550x_24mhz_tbl;

	samsung_cmu_register_one(np, &cmu);

	pr_debug("Exynos5410: clock setup completed.\n");
}
CLK_OF_DECLARE(exynos5410_clk, "samsung,exynos5410-clock", exynos5410_clk_init);

{'repo_name': 'WireGuard/wireguard-linux', 'stars': '163', 'repo_language': 'C', 'file_name': 'Kconfig', 'mime_type': 'text/plain', 'hash': 4408936051585364804, 'source_dataset': 'data'}


/*
 * This file is part of Sponge, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.common.mixin.core.command;

import net.minecraft.command.CommandServerKick;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.util.text.ITextComponent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.common.bridge.entity.player.EntityPlayerMPBridge;
import org.spongepowered.common.text.SpongeTexts;

@Mixin(CommandServerKick.class)
public abstract class CommandServerKickMixin {

    // Multi-target, any disconnection in the command should have an event associated with it.
    @Redirect(method = "execute", at =
        @At(value = "INVOKE", target = "Lnet/minecraft/network/NetHandlerPlayServer;disconnect(Lnet/minecraft/util/text/ITextComponent;)V"))
    private void impl$fireEventOnDisconnect(final NetHandlerPlayServer netHandlerPlayServer, final ITextComponent textComponent) {
        ((EntityPlayerMPBridge) netHandlerPlayServer.player).bridge$kick(SpongeTexts.toText(textComponent));
    }

}

{'repo_name': 'SpongePowered/SpongeCommon', 'stars': '203', 'repo_language': 'Java', 'file_name': 'HomeBuilder.java', 'mime_type': 'text/x-java', 'hash': 5900237462489346657, 'source_dataset': 'data'}


@using System.Web.Http
@using System.Web.Http.Controllers
@using System.Web.Http.Description
@using ArtifactoryDemo.Web.Areas.HelpPage
@using ArtifactoryDemo.Web.Areas.HelpPage.Models
@model IGrouping<HttpControllerDescriptor, ApiDescription>

@{
    var controllerDocumentation = ViewBag.DocumentationProvider != null ?
        ViewBag.DocumentationProvider.GetDocumentation(Model.Key) :
        null;
}

@Model.Key.ControllerName

@if (!String.IsNullOrEmpty(controllerDocumentation))
{

@controllerDocumentation

}

API	Description

    @foreach (var api in Model)
    {

            @api.HttpMethod.Method @api.RelativePath

            @if (api.Documentation != null)
            {

@api.Documentation

            }
            else
            {

No documentation available.

            }

    }

{'repo_name': 'jfrog/project-examples', 'stars': '685', 'repo_language': 'Java', 'file_name': 'package-info.java', 'mime_type': 'text/plain', 'hash': -6772234816908238622, 'source_dataset': 'data'}


[connection]
id=Test
uuid=2f962388-e5f3-45af-a62c-ac220b8f7baa
type=802-11-wireless

[802-11-wireless]
ssid=98;108;97;104;49;50;51;52;

[ipv4]
method=auto

{'repo_name': 'NetworkManager/NetworkManager', 'stars': '149', 'repo_language': 'C', 'file_name': 'NetworkManager-ovs.conf', 'mime_type': 'text/plain', 'hash': 5342862566840175430, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?colorError" android:alpha="0.05" android:state_enabled="false" />
    <item android:color="@color/transparent" />
</selector>

{'repo_name': 'StepicOrg/stepik-android', 'stars': '151', 'repo_language': 'Kotlin', 'file_name': 'pmd.xml', 'mime_type': 'text/xml', 'hash': 3365336598042204473, 'source_dataset': 'data'}


import React from 'react';

import SPELLS from 'common/SPELLS';

import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import TalentStatisticBox from 'interface/others/TalentStatisticBox';
import { STATISTIC_ORDER } from 'interface/others/StatisticBox';
import { formatNumber } from 'common/format';

const JUDGEMENT_HEALS = 25;

class JudgmentOfLight extends Analyzer {
  counter = JUDGEMENT_HEALS;
  wasted = 0;
  casts = 0;

  constructor(...args) {
    super(...args);
    this.active = this.selectedCombatant.hasTalent(SPELLS.JUDGMENT_OF_LIGHT_TALENT.id);
    if (!this.active) {
      return;
    }
    this.addEventListener(
      Events.cast.by(SELECTED_PLAYER).spell(SPELLS.JUDGMENT_CAST_HOLY),
      this.resetCounter,
    );
    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.JUDGMENT_OF_LIGHT_HEAL),
      this.handleHeals,
    );
  }

  resetCounter(event) {
    this.wasted += JUDGEMENT_HEALS - this.counter;
    this.casts += 1;
    this.counter = 0;
  }

  handleHeals(event) {
    if (this.counter < JUDGEMENT_HEALS) {
      this.counter += 1;
    }
  }

  statistic() {
    this.wasted += JUDGEMENT_HEALS - this.counter;
    return (
      <TalentStatisticBox
        talent={SPELLS.JUDGMENT_OF_LIGHT_TALENT.id}
        position={STATISTIC_ORDER.CORE(10)}
        value={`${formatNumber(this.wasted)} Wasted Stacks`}
        label="Judgment Of Light"
      />
    );
  }
}

export default JudgmentOfLight;

{'repo_name': 'WoWAnalyzer/WoWAnalyzer', 'stars': '284', 'repo_language': 'JavaScript', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': 1435233738481417227, 'source_dataset': 'data'}


from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, Adadelta, Adagrad
from keras.utils import np_utils, generic_utils
from six.moves import range

'''
    Train a (fairly simple) deep CNN on the CIFAR10 small images dataset.

    GPU run command:
        THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python cifar10_cnn.py

    It gets down to 0.65 test logloss in 25 epochs, and down to 0.55 after 50 epochs.
    (it's still underfitting at that point, though).

    Note: the data was pickled with Python 2, and some encoding issues might prevent you
    from loading it in Python 3. You might have to load it in Python 2,
    save it in a different format, load it in Python 3 and repickle it.
'''

batch_size = 32
nb_classes = 10
nb_epoch = 200
data_augmentation = True

# the data, shuffled and split between tran and test sets
(X_train, y_train), (X_test, y_test) = cifar10.load_data()
print('X_train shape:', X_train.shape)
print(X_train.shape[0], 'train samples')
print(X_test.shape[0], 'test samples')

# convert class vectors to binary class matrices
Y_train = np_utils.to_categorical(y_train, nb_classes)
Y_test = np_utils.to_categorical(y_test, nb_classes)

model = Sequential()

model.add(Convolution2D(32, 3, 3, 3, border_mode='full'))
model.add(Activation('relu'))
model.add(Convolution2D(32, 32, 3, 3))
model.add(Activation('relu'))
model.add(MaxPooling2D(poolsize=(2, 2)))
model.add(Dropout(0.25))

model.add(Convolution2D(64, 32, 3, 3, border_mode='full'))
model.add(Activation('relu'))
model.add(Convolution2D(64, 64, 3, 3))
model.add(Activation('relu'))
model.add(MaxPooling2D(poolsize=(2, 2)))
model.add(Dropout(0.25))

model.add(Flatten())
model.add(Dense(64*8*8, 512))
model.add(Activation('relu'))
model.add(Dropout(0.5))

model.add(Dense(512, nb_classes))
model.add(Activation('softmax'))

# let's train the model using SGD + momentum (how original).
sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd)

if not data_augmentation:
    print("Not using data augmentation or normalization")

    X_train = X_train.astype("float32")
    X_test = X_test.astype("float32")
    X_train /= 255
    X_test /= 255
    model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch)
    score = model.evaluate(X_test, Y_test, batch_size=batch_size)
    print('Test score:', score)

else:
    print("Using real time data augmentation")

    # this will do preprocessing and realtime data augmentation
    datagen = ImageDataGenerator(
        featurewise_center=True,  # set input mean to 0 over the dataset
        samplewise_center=False,  # set each sample mean to 0
        featurewise_std_normalization=True,  # divide inputs by std of the dataset
        samplewise_std_normalization=False,  # divide each input by its std
        zca_whitening=False,  # apply ZCA whitening
        rotation_range=20,  # randomly rotate images in the range (degrees, 0 to 180)
        width_shift_range=0.2,  # randomly shift images horizontally (fraction of total width)
        height_shift_range=0.2,  # randomly shift images vertically (fraction of total height)
        horizontal_flip=True,  # randomly flip images
        vertical_flip=False)  # randomly flip images

    # compute quantities required for featurewise normalization
    # (std, mean, and principal components if ZCA whitening is applied)
    datagen.fit(X_train)

    for e in range(nb_epoch):
        print('-'*40)
        print('Epoch', e)
        print('-'*40)
        print("Training...")
        # batch train with realtime data augmentation
        progbar = generic_utils.Progbar(X_train.shape[0])
        for X_batch, Y_batch in datagen.flow(X_train, Y_train):
            loss = model.train_on_batch(X_batch, Y_batch)
            progbar.add(X_batch.shape[0], values=[("train loss", loss)])

        print("Testing...")
        # test time!
        progbar = generic_utils.Progbar(X_test.shape[0])
        for X_batch, Y_batch in datagen.flow(X_test, Y_test):
            score = model.test_on_batch(X_batch, Y_batch)
            progbar.add(X_batch.shape[0], values=[("test loss", score)])

{'repo_name': 'lllcho/CAPTCHA-breaking', 'stars': '226', 'repo_language': 'Python', 'file_name': 'embeddings.py', 'mime_type': 'text/x-python', 'hash': -3230402983345124118, 'source_dataset': 'data'}


class:: RunningMin
summary:: Track minimum level.
related:: Classes/RunningMax, Classes/RunningSum
categories::  UGens>Maths

Description::

Outputs the minimum value received at the input. When a trigger occurs at
the reset input, the minimum output value is reset to the current value.

classmethods::

method::ar, kr

argument::in

The input signal.

argument::trig

Resets the output value to the current input value. A trigger happens when the signal changes from non-positive to positive.

Examples::

code::

(
{
	SinOsc.ar(
			RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,
			0, 0.2
	)

}.play;
)

// follow a sine lfo, reset rate controlled by mouse x
(
{
	SinOsc.ar(
			RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,
			0, 0.2
	)

}.play;
)

::

{'repo_name': 'supercollider/supercollider', 'stars': '3239', 'repo_language': 'C++', 'file_name': 'UIUGens.cpp', 'mime_type': 'text/x-c', 'hash': 5791364520352124251, 'source_dataset': 'data'}


/*
 * Copyright (C) 2016 david.wei (lighters)
 *
 * 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.
 */

package lighters.mockito;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentMatcher;
import org.mockito.InOrder;
import org.mockito.InjectMocks;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.exceptions.verification.NoInteractionsWanted;
import org.mockito.internal.matchers.Any;
import org.mockito.internal.verification.api.VerificationData;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.mockito.verification.Timeout;
import org.mockito.verification.VerificationMode;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.description;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.ignoreStubs;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

/**
 * Created by david on 16/9/1.
 * Email: huangdiv5@gmail.com
 * GitHub: https://github.com/alighters
 */
public class MockTest {

    @Test
    public void testMock() {
        List mockedList = mock(List.class);

        //using mock object
        mockedList.add("one");
        mockedList.clear();

        //verification
        verify(mockedList).clear();
        verify(mockedList).add("one");

    }

    @Test
    public void testMockStub() {
        //You can mock concrete classes, not just interfaces
        LinkedList mockedList = mock(LinkedList.class);

        //stubbing
        when(mockedList.get(0)).thenReturn("first");
        //when(mockedList.get(1)).thenThrow(new RuntimeException());
        //
        ////following prints "first"
        System.out.println(mockedList.get(0));
        //
        ////following throws runtime exception
        //System.out.println(mockedList.get(1));
        //
        ////following prints "null" because get(999) was not stubbed
        //System.out.println(mockedList.get(999));

        //Although it is possible to verify a stubbed invocation, usually it's just redundant
        //If your code cares what get(0) returns, then something else breaks (often even before verify() gets executed).
        //If your code doesn't care what get(0) returns, then it should not be stubbed. Not convinced? See here.
        verify(mockedList).get(0);
    }

    @Test
    public void testArgumentMatchers() {

        Map map = mock(Map.class);
        when(map.get(anyObject())).thenReturn("xiba");
        System.out.println(map.get("1"));

        LinkedList mockedList = mock(LinkedList.class);
        //stubbing using built-in anyInt() argument matcher
        when(mockedList.get(anyInt())).thenReturn("element");

        //stubbing using custom matcher (let's say isValid() returns your own matcher implementation):
        //when(mockedList.contains(argThat(isValid()))).thenReturn("element");

        //following prints "element"
        System.out.println(mockedList.get(999));

        //you can also verify using an argument matcher
        verify(mockedList).get(anyInt());

        //argument matchers can also be written as Java 8 Lambdas

        //verify(mockedList).add(someString -> someString.length() > 5);
    }

    @Test
    public void testNumbersVerify() {
        LinkedList mockedList = mock(LinkedList.class);

        //using mock
        mockedList.add("once");

        mockedList.add("twice");
        mockedList.add("twice");

        mockedList.add("three times");
        mockedList.add("three times");
        mockedList.add("three times");

        //following two verifications work exactly the same - times(1) is used by default
        verify(mockedList).add("once");
        verify(mockedList, times(1)).add("once");

        //exact number of invocations verification
        verify(mockedList, times(2)).add("twice");
        verify(mockedList, times(3)).add("three times");

        //verification using never(). never() is an alias to times(0)
        verify(mockedList, never()).add("never happened");

        //verification using atLeast()/atMost()
        verify(mockedList, atLeastOnce()).add("three times");
        verify(mockedList, atLeast(2)).add("twice");
        verify(mockedList, atMost(5)).add("three times");
    }

    @Test
    public void testExceptions() {
        LinkedList mockedList = mock(LinkedList.class);
        doThrow(new RuntimeException()).when(mockedList).clear();

        //following throws RuntimeException:
        mockedList.clear();
    }

    @Test
    public void testInOrder() {
        // A. Single mock whose methods must be invoked in a particular order
        List singleMock = mock(List.class);

        //using a single mock
        singleMock.add("was added first");
        singleMock.add("was added second");

        //create an inOrder verifier for a single mock
        InOrder inOrder1 = inOrder(singleMock);

        //following will make sure that add is first called with "was added first, then with "was added second"
        inOrder1.verify(singleMock).add("was added first");
        inOrder1.verify(singleMock).add("was added second");

        // B. Multiple mocks that must be used in a particular order
        List firstMock = mock(List.class);
        List secondMock = mock(List.class);

        //using mocks
        firstMock.add("was called first");
        secondMock.add("was called second");

        //create inOrder object passing any mocks that need to be verified in order
        inOrder1 = inOrder(firstMock, secondMock);

        //following will make sure that firstMock was called before secondMock
        inOrder1.verify(firstMock).add("was called first");
        inOrder1.verify(secondMock).add("was called second");
    }

    @Test
    public void testNeverHappen() {
        List mockOne = mock(List.class);
        List mockTwo = mock(List.class);
        List mockThree = mock(List.class);

        //using mocks - only mockOne is interacted
        mockOne.add("one");

        //ordinary verification
        verify(mockOne).add("one");

        //verify that method was never called on a mock
        verify(mockOne, never()).add("two");

        //verify that other mocks were not interacted
        verifyZeroInteractions(mockTwo, mockThree);
    }

    @Test
    public void testNoMore() {
        List mockedList = mock(List.class);

        //using mocks
        mockedList.add("one");
        mockedList.add("two");

        verify(mockedList).add("two");
        verify(mockedList).add("one");

        //following verification will fail
        verifyNoMoreInteractions(mockedList);

    }

    @Test
    public void testConsecutiveCalls() {
        HashMap mock = mock(HashMap.class);
        when(mock.get("some arg")).thenThrow(new RuntimeException()).thenReturn("foo");

        //First call: throws runtime exception:
        try {
            mock.get("some arg");
        } catch (Exception e) {
            System.out.println(e.toString());
        }

        //Second call: prints "foo"
        System.out.println(mock.get("some arg"));

        //Any consecutive call: prints "foo" as well (last stubbing wins).
        System.out.println(mock.get("some arg"));
    }

    @Test
    public void testGenericAnswer() {
        HashMap mock = mock(HashMap.class);

        when(mock.get(anyString())).thenAnswer(new Answer<Object>() {

            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                Object mock = invocation.getMock();
                return "called with arguments: " + args[0];
            }
        });

        //the following prints "called with arguments: foo"
        System.out.println(mock.get("foo"));
    }

    @Test
    public void testDoMethods() {
        List mockedList = mock(LinkedList.class);
        doThrow(new RuntimeException()).when(mockedList).clear();

        //following throws RuntimeException:
        mockedList.clear();
    }

    @Test
    public void testSpyRealObjects() {

        List list = new LinkedList();
        List sypList = spy(list);

        //optionally, you can stub out some methods:
        when(sypList.size()).thenReturn(100);

        LinkedList mock = mock(LinkedList.class);
        when(mock.add(anyInt())).thenCallRealMethod();
        when(mock.get(anyInt())).thenCallRealMethod();
        mock.add(1);
        System.out.println(mock.get(0));

        //using the spy calls *real* methods
        sypList.add("one");
        sypList.add("two");

        //prints "one" - the first element of a list
        System.out.println(sypList.get(0));

        //size() method was stubbed - 100 is printed
        System.out.println(sypList.size());

        //optionally, you can verify
        verify(sypList).add("one");
        verify(sypList).add("two");
    }

    @Test
    public void testSpyLimits() {
        List list = new LinkedList();
        List spy = spy(list);

        //Impossible: real method is called so spy.get(0) throws IndexOutOfBoundsException (the list is yet empty)
        //when(spy.get(0)).thenReturn("foo");

        //You have to use doReturn() for stubbing
        doReturn("foo").when(spy).get(0);
    }

    @Test
    public void testDefaultReturn() {
        Map mock = mock(HashMap.class, Mockito.RETURNS_SMART_NULLS);

        System.out.println(mock.get("b"));
    }

    @Test
    public void testArgumentMatcher() {
        class ListOfTwoElements implements ArgumentMatcher<List> {
            public boolean matches(List list) {
                return list.size() == 2;
            }

            public String toString() {
                //printed in verification errors
                return "[list of 2 elements]";
            }
        }

        List mock = mock(List.class);

        when(mock.addAll(argThat(new ListOfTwoElements()))).thenReturn(true);

        mock.addAll(Arrays.asList("one", "two"));

        verify(mock).addAll(argThat(new ListOfTwoElements()));
    }

    @Test
    public void testPartialRealMock1() {
        //you can create partial mock with spy() method:
        LinkedList linkedList = new LinkedList();
        linkedList.addFirst(1);

        LinkedList list = spy(linkedList);
        list.add(2);
        verify(list).add(2);

        assertThat(list.get(0), is(1));
        assertThat(list.get(1), is(2));
    }

    @Rule public ExpectedException thrown = ExpectedException.none();

    @Test
    public void testPartialRealMock2() {
        //you can enable partial mock capabilities selectively on mocks:
        List mock = mock(LinkedList.class);
        //Be sure the real implementation is 'safe'.
        //If real implementation throws exceptions or depends on specific state of the object then you're in trouble.

        when(mock.get(anyInt())).thenCallRealMethod();

        thrown.expect(Exception.class);
        mock.get(0);
        System.out.println("hahah");
        mock.get(0);
    }

    @Test
    public void testResetMock() {
        List mock = mock(List.class);
        when(mock.size()).thenReturn(10);
        mock.add(1);
        reset(mock);
        assertThat(mock.size(), is(0));
    }

    @Test
    public void testTimeout() {
        List mock = mock(List.class);

        when(mock.get(0)).thenReturn(1);

        System.out.println(mock.get(0));

        verify(mock, timeout(100)).get(0);
        //above is an alias to:
        verify(mock, timeout(100).times(1)).get(0);

        System.out.println(mock.get(0));

        verify(mock, timeout(100).times(2)).get(0);

        verify(mock, timeout(100).atLeast(2)).get(0);

        verify(mock, new Timeout(100, new VerificationMode() {
            @Override
            public void verify(VerificationData data) {
                Assume.assumeNotNull(data);
            }

            @Override
            public VerificationMode description(String description) {
                return null;
            }
        })).get(0);
    }

    @Spy ArrayList list1;
    @InjectMocks ArrayList list2;

    @Test
    public void testMocksInit() {
        MockitoAnnotations.initMocks(this);
        Assert.assertNotNull(list1);
        Assert.assertNotNull(list2);
    }

    @Test
    public void testWriteInOneLine() {
        List list = when(mock(List.class).subList(0, 10)).thenReturn(new ArrayList()).getMock();
    }

    @Test
    public void testIgnoreStubs1() {

        //mocking lists for the sake of the example (if you mock List in real you will burn in hell)
        List mock1 = mock(List.class), mock2 = mock(List.class);

        //stubbing mocks:
        when(mock1.get(0)).thenReturn(10);
        when(mock2.get(0)).thenReturn(20);

        //using mocks by calling stubbed get(0) methods:
        //System.out.println(mock1.get(0)); //prints 10
        System.out.println(mock2.get(0)); //prints 20

        mock1.get(0);
        verify(mock1).get(0);

        //using mocks by calling clear() methods:
        mock1.clear();
        mock2.clear();

        //verification:
        verify(mock1).clear();
        verify(mock2).clear();

        //verifyNoMoreInteractions() fails because get() methods were not accounted for.
        try {
            verifyNoMoreInteractions(mock1, mock2);
        } catch (NoInteractionsWanted e) {
            System.out.println(e);
        }

        //However, if we ignore stubbed methods then we can verifyNoMoreInteractions()
        verifyNoMoreInteractions(ignoreStubs(mock1, mock2));

        //Remember that ignoreStubs() *changes* the input mocks and returns them for convenience.
    }

    @Test
    public void testIgnoreStubs2() {

        List list = mock(List.class);
        when(list.get(0)).thenReturn("foo");

        list.add(0);
        System.out.println(list.get(0)); //we don't want to verify this
        list.clear();

        //verify(list).add(0);
        //verify(list).add(0);
        //verify(list).clear();

        // Same as: InOrder inOrder = inOrder(list);
        InOrder inOrder = inOrder(ignoreStubs(list));

        inOrder.verify(list).add(0);
        // this will have an error..
        //inOrder.verify(list).get(0);
        inOrder.verify(list).clear();
        inOrder.verifyNoMoreInteractions();

    }

    @Test
    public void testMockDetails() {
        List list = mock(List.class);
        assertThat(Mockito.mockingDetails(list).isMock(), is(true));
        assertThat(Mockito.mockingDetails(list).isSpy(), is(false));
    }

    @Test
    public void testCustomMessage(){
        List list = mock(List.class);
        when(list.get(0)).thenReturn(1);
        verify(list, description("should print the get(0) result")).get(0);
    }

}

{'repo_name': 'alighters/AndroidDemos', 'stars': '127', 'repo_language': 'Java', 'file_name': 'refresh_token.js', 'mime_type': 'text/plain', 'hash': -4117234389663944434, 'source_dataset': 'data'}


function A = meanOne(hyp, x, i)

% One mean function. The mean function does not have any parameters.
%
% m(x) = 1
%
% Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2010-08-04.
%
% See also MEANFUNCTIONS.M.

if nargin<2, A = '0'; return; end             % report number of hyperparameters
if nargin==2
  A = ones(size(x,1),1);                                         % evaluate mean
else
  A = zeros(size(x,1),1);                                           % derivative
end

{'repo_name': 'RSL-NEU/person-reid-benchmark', 'stars': '174', 'repo_language': 'HTML', 'file_name': 'GeneratePair.m', 'mime_type': 'text/plain', 'hash': 1207508574508433163, 'source_dataset': 'data'}


//================================================================================
//Copyright (c) 2012, David Yu
//All rights reserved.
//--------------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
// 3. Neither the name of protostuff nor the names of its contributors may be used
//    to endorse or promote products derived from this software without
//    specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//================================================================================

package io.protostuff.runtime;

import static io.protostuff.runtime.RuntimeFieldFactory.ID_COLLECTION;
import static io.protostuff.runtime.RuntimeFieldFactory.ID_ENUM;
import static io.protostuff.runtime.RuntimeFieldFactory.ID_ENUM_SET;
import static io.protostuff.runtime.RuntimeFieldFactory.STR_COLLECTION;
import static io.protostuff.runtime.RuntimeFieldFactory.STR_ENUM;
import static io.protostuff.runtime.RuntimeFieldFactory.STR_ENUM_SET;

import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;

import io.protostuff.GraphInput;
import io.protostuff.Input;
import io.protostuff.Output;
import io.protostuff.Pipe;
import io.protostuff.ProtostuffException;
import io.protostuff.Schema;
import io.protostuff.StatefulOutput;
import io.protostuff.runtime.IdStrategy.Wrapper;
import io.protostuff.runtime.RuntimeEnv.Instantiator;

/**
 * Used when the type is an interface (Collection/List/Set/SortedSet).
 *
 * @author David Yu
 * @created Apr 24, 2012
 */
public abstract class PolymorphicCollectionSchema extends PolymorphicSchema
{

    static final int ID_EMPTY_SET = 1, ID_EMPTY_LIST = 2,

            ID_SINGLETON_SET = 3, ID_SINGLETON_LIST = 4,

            ID_SET_FROM_MAP = 5, ID_COPIES_LIST = 6,

            ID_UNMODIFIABLE_COLLECTION = 7, ID_UNMODIFIABLE_SET = 8,
            ID_UNMODIFIABLE_SORTED_SET = 9, ID_UNMODIFIABLE_LIST = 10,
            ID_UNMODIFIABLE_RANDOM_ACCESS_LIST = 11,

            ID_SYNCHRONIZED_COLLECTION = 12, ID_SYNCHRONIZED_SET = 13,
            ID_SYNCHRONIZED_SORTED_SET = 14, ID_SYNCHRONIZED_LIST = 15,
            ID_SYNCHRONIZED_RANDOM_ACCESS_LIST = 16,

            ID_CHECKED_COLLECTION = 17, ID_CHECKED_SET = 18,
            ID_CHECKED_SORTED_SET = 19, ID_CHECKED_LIST = 20,
            ID_CHECKED_RANDOM_ACCESS_LIST = 21;

    static final String STR_EMPTY_SET = "a", STR_EMPTY_LIST = "b",

            STR_SINGLETON_SET = "c", STR_SINGLETON_LIST = "d",

            STR_SET_FROM_MAP = "e", STR_COPIES_LIST = "f",

            STR_UNMODIFIABLE_COLLECTION = "g", STR_UNMODIFIABLE_SET = "h",
            STR_UNMODIFIABLE_SORTED_SET = "i", STR_UNMODIFIABLE_LIST = "j",
            STR_UNMODIFIABLE_RANDOM_ACCESS_LIST = "k",

            STR_SYNCHRONIZED_COLLECTION = "l", STR_SYNCHRONIZED_SET = "m",
            STR_SYNCHRONIZED_SORTED_SET = "n", STR_SYNCHRONIZED_LIST = "o",
            STR_SYNCHRONIZED_RANDOM_ACCESS_LIST = "p",

            STR_CHECKED_COLLECTION = "q", STR_CHECKED_SET = "r",
            STR_CHECKED_SORTED_SET = "s", STR_CHECKED_LIST = "t",
            STR_CHECKED_RANDOM_ACCESS_LIST = "u";

    static final IdentityHashMap<Class<?>, Integer> __nonPublicCollections = new IdentityHashMap<Class<?>, Integer>();

    static final Field fSingletonSet_element, fSingletonList_element,

            fUnmodifiableCollection_c, fUnmodifiableSortedSet_ss,
            fUnmodifiableList_list,

            fSynchronizedCollection_c, fSynchronizedSortedSet_ss,
            fSynchronizedList_list, fSynchronizedCollection_mutex,

            fCheckedCollection_c, fCheckedSortedSet_ss, fCheckedList_list,
            fCheckedCollection_type,

            fSetFromMap_m, fSetFromMap_s,

            fCopiesList_n, fCopiesList_element;

    static final Instantiator<?> iSingletonSet, iSingletonList,

            iUnmodifiableCollection, iUnmodifiableSet, iUnmodifiableSortedSet,
            iUnmodifiableList, iUnmodifiableRandomAccessList,

            iSynchronizedCollection, iSynchronizedSet, iSynchronizedSortedSet,
            iSynchronizedList, iSynchronizedRandomAccessList,

            iCheckedCollection, iCheckedSet, iCheckedSortedSet, iCheckedList,
            iCheckedRandomAccessList,

            iSetFromMap,

            iCopiesList;

    static
    {
        map("java.util.Collections$EmptySet", ID_EMPTY_SET);
        map("java.util.Collections$EmptyList", ID_EMPTY_LIST);

        Class<?> cSingletonSet = map("java.util.Collections$SingletonSet",
                ID_SINGLETON_SET);

        Class<?> cSingletonList = map("java.util.Collections$SingletonList",
                ID_SINGLETON_LIST);

        Class<?> cSetFromMap = map("java.util.Collections$SetFromMap",
                ID_SET_FROM_MAP);

        Class<?> cCopiesList = map("java.util.Collections$CopiesList",
                ID_COPIES_LIST);

        Class<?> cUnmodifiableCollection = map(
                "java.util.Collections$UnmodifiableCollection",
                ID_UNMODIFIABLE_COLLECTION);
        Class<?> cUnmodifiableSet = map(
                "java.util.Collections$UnmodifiableSet", ID_UNMODIFIABLE_SET);
        Class<?> cUnmodifiableSortedSet = map(
                "java.util.Collections$UnmodifiableSortedSet",
                ID_UNMODIFIABLE_SORTED_SET);
        Class<?> cUnmodifiableList = map(
                "java.util.Collections$UnmodifiableList", ID_UNMODIFIABLE_LIST);
        Class<?> cUnmodifiableRandomAccessList = map(
                "java.util.Collections$UnmodifiableRandomAccessList",
                ID_UNMODIFIABLE_RANDOM_ACCESS_LIST);

        Class<?> cSynchronizedCollection = map(
                "java.util.Collections$SynchronizedCollection",
                ID_SYNCHRONIZED_COLLECTION);
        Class<?> cSynchronizedSet = map(
                "java.util.Collections$SynchronizedSet", ID_SYNCHRONIZED_SET);
        Class<?> cSynchronizedSortedSet = map(
                "java.util.Collections$SynchronizedSortedSet",
                ID_SYNCHRONIZED_SORTED_SET);
        Class<?> cSynchronizedList = map(
                "java.util.Collections$SynchronizedList", ID_SYNCHRONIZED_LIST);
        Class<?> cSynchronizedRandomAccessList = map(
                "java.util.Collections$SynchronizedRandomAccessList",
                ID_SYNCHRONIZED_RANDOM_ACCESS_LIST);

        Class<?> cCheckedCollection = map(
                "java.util.Collections$CheckedCollection",
                ID_CHECKED_COLLECTION);
        Class<?> cCheckedSet = map("java.util.Collections$CheckedSet",
                ID_CHECKED_SET);
        Class<?> cCheckedSortedSet = map(
                "java.util.Collections$CheckedSortedSet", ID_CHECKED_SORTED_SET);
        Class<?> cCheckedList = map("java.util.Collections$CheckedList",
                ID_CHECKED_LIST);
        Class<?> cCheckedRandomAccessList = map(
                "java.util.Collections$CheckedRandomAccessList",
                ID_CHECKED_RANDOM_ACCESS_LIST);

        try
        {
            fSingletonSet_element = cSingletonSet.getDeclaredField("element");

            fSingletonList_element = cSingletonList.getDeclaredField("element");

            fSetFromMap_m = cSetFromMap.getDeclaredField("m");
            fSetFromMap_s = cSetFromMap.getDeclaredField("s");

            fCopiesList_n = cCopiesList.getDeclaredField("n");
            fCopiesList_element = cCopiesList.getDeclaredField("element");

            fUnmodifiableCollection_c = cUnmodifiableCollection
                    .getDeclaredField("c");
            fUnmodifiableSortedSet_ss = cUnmodifiableSortedSet
                    .getDeclaredField("ss");
            fUnmodifiableList_list = cUnmodifiableList.getDeclaredField("list");

            fSynchronizedCollection_c = cSynchronizedCollection
                    .getDeclaredField("c");
            fSynchronizedCollection_mutex = cSynchronizedCollection
                    .getDeclaredField("mutex");
            fSynchronizedSortedSet_ss = cSynchronizedSortedSet
                    .getDeclaredField("ss");
            fSynchronizedList_list = cSynchronizedList.getDeclaredField("list");

            fCheckedCollection_c = cCheckedCollection.getDeclaredField("c");
            fCheckedCollection_type = cCheckedCollection
                    .getDeclaredField("type");
            fCheckedSortedSet_ss = cCheckedSortedSet.getDeclaredField("ss");
            fCheckedList_list = cCheckedList.getDeclaredField("list");
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }

        // field accessors

        fSingletonSet_element.setAccessible(true);

        fSingletonList_element.setAccessible(true);

        fSetFromMap_m.setAccessible(true);
        fSetFromMap_s.setAccessible(true);

        fCopiesList_n.setAccessible(true);
        fCopiesList_element.setAccessible(true);

        fUnmodifiableCollection_c.setAccessible(true);
        fUnmodifiableSortedSet_ss.setAccessible(true);
        fUnmodifiableList_list.setAccessible(true);

        fSynchronizedCollection_c.setAccessible(true);
        fSynchronizedCollection_mutex.setAccessible(true);
        fSynchronizedSortedSet_ss.setAccessible(true);
        fSynchronizedList_list.setAccessible(true);

        fCheckedCollection_c.setAccessible(true);
        fCheckedCollection_type.setAccessible(true);
        fCheckedSortedSet_ss.setAccessible(true);
        fCheckedList_list.setAccessible(true);

        // instantiators

        iSingletonSet = RuntimeEnv.newInstantiator(cSingletonSet);

        iSingletonList = RuntimeEnv.newInstantiator(cSingletonList);

        iSetFromMap = RuntimeEnv.newInstantiator(cSetFromMap);

        iCopiesList = RuntimeEnv.newInstantiator(cCopiesList);

        iUnmodifiableCollection = RuntimeEnv
                .newInstantiator(cUnmodifiableCollection);
        iUnmodifiableSet = RuntimeEnv.newInstantiator(cUnmodifiableSet);
        iUnmodifiableSortedSet = RuntimeEnv
                .newInstantiator(cUnmodifiableSortedSet);
        iUnmodifiableList = RuntimeEnv.newInstantiator(cUnmodifiableList);
        iUnmodifiableRandomAccessList = RuntimeEnv
                .newInstantiator(cUnmodifiableRandomAccessList);

        iSynchronizedCollection = RuntimeEnv
                .newInstantiator(cSynchronizedCollection);
        iSynchronizedSet = RuntimeEnv.newInstantiator(cSynchronizedSet);
        iSynchronizedSortedSet = RuntimeEnv
                .newInstantiator(cSynchronizedSortedSet);
        iSynchronizedList = RuntimeEnv.newInstantiator(cSynchronizedList);
        iSynchronizedRandomAccessList = RuntimeEnv
                .newInstantiator(cSynchronizedRandomAccessList);

        iCheckedCollection = RuntimeEnv.newInstantiator(cCheckedCollection);
        iCheckedSet = RuntimeEnv.newInstantiator(cCheckedSet);
        iCheckedSortedSet = RuntimeEnv.newInstantiator(cCheckedSortedSet);
        iCheckedList = RuntimeEnv.newInstantiator(cCheckedList);
        iCheckedRandomAccessList = RuntimeEnv
                .newInstantiator(cCheckedRandomAccessList);
    }

    private static Class<?> map(String className, int id)
    {
        Class<?> clazz = RuntimeEnv.loadClass(className);
        __nonPublicCollections.put(clazz, id);
        return clazz;
    }

    static String name(int number)
    {
        switch (number)
        {
            case ID_EMPTY_SET:
                return STR_EMPTY_SET;
            case ID_EMPTY_LIST:
                return STR_EMPTY_LIST;
            case ID_SINGLETON_SET:
                return STR_SINGLETON_SET;
            case ID_SINGLETON_LIST:
                return STR_SINGLETON_LIST;
            case ID_SET_FROM_MAP:
                return STR_SET_FROM_MAP;
            case ID_COPIES_LIST:
                return STR_COPIES_LIST;
            case ID_UNMODIFIABLE_COLLECTION:
                return STR_UNMODIFIABLE_COLLECTION;
            case ID_UNMODIFIABLE_SET:
                return STR_UNMODIFIABLE_SET;
            case ID_UNMODIFIABLE_SORTED_SET:
                return STR_UNMODIFIABLE_SORTED_SET;
            case ID_UNMODIFIABLE_LIST:
                return STR_UNMODIFIABLE_LIST;
            case ID_UNMODIFIABLE_RANDOM_ACCESS_LIST:
                return STR_UNMODIFIABLE_RANDOM_ACCESS_LIST;
            case ID_SYNCHRONIZED_COLLECTION:
                return STR_SYNCHRONIZED_COLLECTION;
            case ID_SYNCHRONIZED_SET:
                return STR_SYNCHRONIZED_SET;
            case ID_SYNCHRONIZED_SORTED_SET:
                return STR_SYNCHRONIZED_SORTED_SET;
            case ID_SYNCHRONIZED_LIST:
                return STR_SYNCHRONIZED_LIST;
            case ID_SYNCHRONIZED_RANDOM_ACCESS_LIST:
                return STR_SYNCHRONIZED_RANDOM_ACCESS_LIST;
            case ID_CHECKED_COLLECTION:
                return STR_CHECKED_COLLECTION;
            case ID_CHECKED_SET:
                return STR_CHECKED_SET;
            case ID_CHECKED_SORTED_SET:
                return STR_CHECKED_SORTED_SET;
            case ID_CHECKED_LIST:
                return STR_CHECKED_LIST;
            case ID_CHECKED_RANDOM_ACCESS_LIST:
                return STR_CHECKED_RANDOM_ACCESS_LIST;
            case ID_ENUM_SET:
                return STR_ENUM_SET;
            case ID_ENUM:
                return STR_ENUM;
            case ID_COLLECTION:
                return STR_COLLECTION;
            default:
                return null;
        }
    }

    static int number(String name)
    {
        return name.length() != 1 ? 0 : number(name.charAt(0));
    }

    static int number(char c)
    {
        switch (c)
        {
            case 'a':
                return 1;
            case 'b':
                return 2;
            case 'c':
                return 3;
            case 'd':
                return 4;
            case 'e':
                return 5;
            case 'f':
                return 6;
            case 'g':
                return 7;
            case 'h':
                return 8;
            case 'i':
                return 9;
            case 'j':
                return 10;
            case 'k':
                return 11;
            case 'l':
                return 12;
            case 'm':
                return 13;
            case 'n':
                return 14;
            case 'o':
                return 15;
            case 'p':
                return 16;
            case 'q':
                return 17;
            case 'r':
                return 18;
            case 's':
                return 19;
            case 't':
                return 20;
            case 'u':
                return 21;
            case 'v':
                return ID_ENUM_SET;
            case 'x':
                return ID_ENUM;
            case 'y':
                return ID_COLLECTION;
            default:
                return 0;
        }
    }

    protected final Pipe.Schema<Object> pipeSchema = new Pipe.Schema<Object>(
            this)
    {
        @Override
        protected void transfer(Pipe pipe, Input input, Output output)
                throws IOException
        {
            transferObject(this, pipe, input, output, strategy);
        }
    };

    public PolymorphicCollectionSchema(IdStrategy strategy)
    {
        super(strategy);
    }

    @Override
    public Pipe.Schema<Object> getPipeSchema()
    {
        return pipeSchema;
    }

    @Override
    public String getFieldName(int number)
    {
        return name(number);
    }

    @Override
    public int getFieldNumber(String name)
    {
        return number(name);
    }

    @Override
    public String messageFullName()
    {
        return Collection.class.getName();
    }

    @Override
    public String messageName()
    {
        return Collection.class.getSimpleName();
    }

    @Override
    public void mergeFrom(Input input, Object owner) throws IOException
    {
        setValue(readObjectFrom(input, this, owner, strategy), owner);
    }

    @Override
    public void writeTo(Output output, Object value) throws IOException
    {
        writeObjectTo(output, value, this, strategy);
    }

    static int idFrom(Class<?> clazz)
    {
        final Integer id = __nonPublicCollections.get(clazz);
        if (id == null)
            throw new RuntimeException("Unknown collection: " + clazz);

        return id.intValue();
    }

    static Object instanceFrom(final int id)
    {
        switch (id)
        {
            case ID_EMPTY_SET:
                return Collections.EMPTY_SET;
            case ID_EMPTY_LIST:
                return Collections.EMPTY_LIST;

            case ID_SINGLETON_SET:
                return iSingletonSet.newInstance();
            case ID_SINGLETON_LIST:
                return iSingletonList.newInstance();

            case ID_SET_FROM_MAP:
                return iSetFromMap.newInstance();
            case ID_COPIES_LIST:
                return iCopiesList.newInstance();

            case ID_UNMODIFIABLE_COLLECTION:
                return iUnmodifiableCollection.newInstance();
            case ID_UNMODIFIABLE_SET:
                return iUnmodifiableSet.newInstance();
            case ID_UNMODIFIABLE_SORTED_SET:
                return iUnmodifiableSortedSet.newInstance();
            case ID_UNMODIFIABLE_LIST:
                return iUnmodifiableList.newInstance();
            case ID_UNMODIFIABLE_RANDOM_ACCESS_LIST:
                return iUnmodifiableRandomAccessList.newInstance();

            case ID_SYNCHRONIZED_COLLECTION:
                return iSynchronizedCollection.newInstance();
            case ID_SYNCHRONIZED_SET:
                return iSynchronizedSet.newInstance();
            case ID_SYNCHRONIZED_SORTED_SET:
                return iSynchronizedSortedSet.newInstance();
            case ID_SYNCHRONIZED_LIST:
                return iSynchronizedList.newInstance();
            case ID_SYNCHRONIZED_RANDOM_ACCESS_LIST:
                return iSynchronizedRandomAccessList.newInstance();

            case ID_CHECKED_COLLECTION:
                return iCheckedCollection.newInstance();
            case ID_CHECKED_SET:
                return iCheckedSet.newInstance();
            case ID_CHECKED_SORTED_SET:
                return iCheckedSortedSet.newInstance();
            case ID_CHECKED_LIST:
                return iCheckedList.newInstance();
            case ID_CHECKED_RANDOM_ACCESS_LIST:
                return iCheckedRandomAccessList.newInstance();

            default:
                throw new RuntimeException("Unknown id: " + id);
        }
    }

    @SuppressWarnings("unchecked")
    static void writeObjectTo(Output output, Object value,
            Schema<?> currentSchema, IdStrategy strategy) throws IOException
    {
        if (Collections.class == value.getClass().getDeclaringClass())
        {
            writeNonPublicCollectionTo(output, value, currentSchema, strategy);
            return;
        }

        if (EnumSet.class.isAssignableFrom(value.getClass()))
        {
            strategy.writeEnumIdTo(output, ID_ENUM_SET,
                    EnumIO.getElementTypeFromEnumSet(value));

            // TODO optimize
        }
        else
        {
            strategy.writeCollectionIdTo(output, ID_COLLECTION,
                    value.getClass());
        }

        if (output instanceof StatefulOutput)
        {
            // update using the derived schema.
            ((StatefulOutput) output).updateLast(strategy.COLLECTION_SCHEMA,
                    currentSchema);
        }

        strategy.COLLECTION_SCHEMA.writeTo(output, (Collection<Object>) value);
    }

    static void writeNonPublicCollectionTo(Output output, Object value,
            Schema<?> currentSchema, IdStrategy strategy) throws IOException
    {
        final Integer num = __nonPublicCollections.get(value.getClass());
        if (num == null)
            throw new RuntimeException("Unknown collection: "
                    + value.getClass());
        final int id = num.intValue();
        switch (id)
        {
            case ID_EMPTY_SET:
                output.writeUInt32(id, 0, false);
                break;

            case ID_EMPTY_LIST:
                output.writeUInt32(id, 0, false);
                break;

            case ID_SINGLETON_SET:
            {
                output.writeUInt32(id, 0, false);

                final Object element;
                try
                {
                    element = fSingletonSet_element.get(value);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                if (element != null)
                    output.writeObject(1, element, strategy.OBJECT_SCHEMA, false);

                break;
            }

            case ID_SINGLETON_LIST:
            {
                output.writeUInt32(id, 0, false);

                // faster path (reflection not needed to get the single element).
                final Object element = ((List<?>) value).get(0);

                if (element != null)
                    output.writeObject(1, element, strategy.OBJECT_SCHEMA, false);

                break;
            }

            case ID_SET_FROM_MAP:
            {
                final Object m;
                try
                {
                    m = fSetFromMap_m.get(value);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                output.writeObject(id, m, strategy.POLYMORPHIC_MAP_SCHEMA, false);

                break;
            }

            case ID_COPIES_LIST:
            {
                output.writeUInt32(id, 0, false);

                final int n = ((List<?>) value).size();
                final Object element;
                try
                {
                    element = fCopiesList_element.get(value);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                output.writeUInt32(1, n, false);

                if (element != null)
                    output.writeObject(2, element, strategy.OBJECT_SCHEMA, false);

                break;
            }
            case ID_UNMODIFIABLE_COLLECTION:
                writeUnmodifiableCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_UNMODIFIABLE_SET:
                writeUnmodifiableCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_UNMODIFIABLE_SORTED_SET:
                writeUnmodifiableCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_UNMODIFIABLE_LIST:
                writeUnmodifiableCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_UNMODIFIABLE_RANDOM_ACCESS_LIST:
                writeUnmodifiableCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;

            case ID_SYNCHRONIZED_COLLECTION:
                writeSynchronizedCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_SYNCHRONIZED_SET:
                writeSynchronizedCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_SYNCHRONIZED_SORTED_SET:
                writeSynchronizedCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_SYNCHRONIZED_LIST:
                writeSynchronizedCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;
            case ID_SYNCHRONIZED_RANDOM_ACCESS_LIST:
                writeSynchronizedCollectionTo(output, value, currentSchema,
                        strategy, id);
                break;

            case ID_CHECKED_COLLECTION:
                writeCheckedCollectionTo(output, value, currentSchema, strategy, id);
                break;
            case ID_CHECKED_SET:
                writeCheckedCollectionTo(output, value, currentSchema, strategy, id);
                break;
            case ID_CHECKED_SORTED_SET:
                writeCheckedCollectionTo(output, value, currentSchema, strategy, id);
                break;
            case ID_CHECKED_LIST:
                writeCheckedCollectionTo(output, value, currentSchema, strategy, id);
                break;
            case ID_CHECKED_RANDOM_ACCESS_LIST:
                writeCheckedCollectionTo(output, value, currentSchema, strategy, id);
                break;

            default:
                throw new RuntimeException("Should not happen.");
        }
    }

    private static void writeUnmodifiableCollectionTo(Output output,
            Object value, Schema<?> currentSchema, IdStrategy strategy, int id)
            throws IOException
    {
        final Object c;
        try
        {
            c = fUnmodifiableCollection_c.get(value);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
    }

    private static void writeSynchronizedCollectionTo(Output output,
            Object value, Schema<?> currentSchema, IdStrategy strategy, int id)
            throws IOException
    {
        final Object c, mutex;
        try
        {
            c = fSynchronizedCollection_c.get(value);
            mutex = fSynchronizedCollection_mutex.get(value);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        if (mutex != value)
        {
            // TODO for future release, introduce an interface(GraphOutput) so
            // we
            // can check whether the output can retain references.
            throw new RuntimeException(
                    "This exception is thrown to fail fast. "
                            + "Synchronized collections with a different mutex would only "
                            + "work if graph format is used, since the reference is retained.");
        }

        output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
    }

    private static void writeCheckedCollectionTo(Output output, Object value,
            Schema<?> currentSchema, IdStrategy strategy, int id)
            throws IOException
    {
        final Object c, type;
        try
        {
            c = fCheckedCollection_c.get(value);
            type = fCheckedCollection_type.get(value);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
        output.writeObject(1, type, strategy.CLASS_SCHEMA, false);
    }

    static Object readObjectFrom(Input input, Schema<?> schema, Object owner,
            IdStrategy strategy) throws IOException
    {
        return readObjectFrom(input, schema, owner, strategy,
                input.readFieldNumber(schema));
    }

    @SuppressWarnings("unchecked")
    static Object readObjectFrom(Input input, Schema<?> schema, Object owner,
            IdStrategy strategy, final int number) throws IOException
    {
        final boolean graph = input instanceof GraphInput;
        Object ret = null;
        switch (number)
        {
            case ID_EMPTY_SET:
                if (0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");

                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(Collections.EMPTY_SET, owner);
                }

                ret = Collections.EMPTY_SET;
                break;

            case ID_EMPTY_LIST:
                if (0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");

                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(Collections.EMPTY_LIST, owner);
                }

                ret = Collections.EMPTY_LIST;
                break;

            case ID_SINGLETON_SET:
            {
                if (0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");

                final Object collection = iSingletonSet.newInstance();
                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(collection, owner);
                }

                final int next = input.readFieldNumber(schema);
                if (next == 0)
                {
                    // null element
                    return collection;
                }

                if (next != 1)
                    throw new ProtostuffException("Corrupt input");

                final Wrapper wrapper = new Wrapper();
                Object element = input.mergeObject(wrapper, strategy.OBJECT_SCHEMA);
                if (!graph || !((GraphInput) input).isCurrentMessageReference())
                    element = wrapper.value;

                try
                {
                    fSingletonSet_element.set(collection, element);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                ret = collection;
                break;
            }

            case ID_SINGLETON_LIST:
            {
                if (0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");

                final Object collection = iSingletonList.newInstance();
                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(collection, owner);
                }

                final int next = input.readFieldNumber(schema);
                if (next == 0)
                {
                    // null element
                    return collection;
                }

                if (next != 1)
                    throw new ProtostuffException("Corrupt input.");

                final Wrapper wrapper = new Wrapper();
                Object element = input.mergeObject(wrapper, strategy.OBJECT_SCHEMA);
                if (!graph || !((GraphInput) input).isCurrentMessageReference())
                    element = wrapper.value;

                try
                {
                    fSingletonList_element.set(collection, element);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                ret = collection;
                break;
            }

            case ID_SET_FROM_MAP:
            {
                final Object collection = iSetFromMap.newInstance();
                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(collection, owner);
                }

                final Wrapper wrapper = new Wrapper();
                Object m = input.mergeObject(wrapper,
                        strategy.POLYMORPHIC_MAP_SCHEMA);
                if (!graph || !((GraphInput) input).isCurrentMessageReference())
                    m = wrapper.value;

                try
                {
                    fSetFromMap_m.set(collection, m);
                    fSetFromMap_s.set(collection, ((Map<?, ?>) m).keySet());
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                ret = collection;
                break;
            }

            case ID_COPIES_LIST:
            {
                if (0 != input.readUInt32())
                    throw new ProtostuffException("Corrupt input.");

                final Object collection = iCopiesList.newInstance();
                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(collection, owner);
                }

                if (1 != input.readFieldNumber(schema))
                    throw new ProtostuffException("Corrupt input.");

                final int n = input.readUInt32(), next = input
                        .readFieldNumber(schema);

                if (next == 0)
                {
                    // null element
                    try
                    {
                        fCopiesList_n.setInt(collection, n);
                    }
                    catch (IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                    catch (IllegalArgumentException e)
                    {
                        throw new RuntimeException(e);
                    }

                    return collection;
                }

                if (next != 2)
                    throw new ProtostuffException("Corrupt input.");

                final Wrapper wrapper = new Wrapper();
                Object element = input.mergeObject(wrapper, strategy.OBJECT_SCHEMA);
                if (!graph || !((GraphInput) input).isCurrentMessageReference())
                    element = wrapper.value;

                try
                {
                    fCopiesList_n.setInt(collection, n);
                    fCopiesList_element.set(collection, element);
                }
                catch (IllegalAccessException e)
                {
                    throw new RuntimeException(e);
                }
                catch (IllegalArgumentException e)
                {
                    throw new RuntimeException(e);
                }

                ret = collection;
                break;
            }

            case ID_UNMODIFIABLE_COLLECTION:
                ret = readUnmodifiableCollectionFrom(input, schema, owner,
                        strategy, graph, iUnmodifiableCollection.newInstance(),
                        false, false);
                break;
            case ID_UNMODIFIABLE_SET:
                ret = readUnmodifiableCollectionFrom(input, schema, owner,
                        strategy, graph, iUnmodifiableSet.newInstance(), false,
                        false);
                break;
            case ID_UNMODIFIABLE_SORTED_SET:
                ret = readUnmodifiableCollectionFrom(input, schema, owner,
                        strategy, graph, iUnmodifiableSortedSet.newInstance(),
                        true, false);
                break;
            case ID_UNMODIFIABLE_LIST:
                ret = readUnmodifiableCollectionFrom(input, schema, owner,
                        strategy, graph, iUnmodifiableList.newInstance(), false,
                        true);
                break;
            case ID_UNMODIFIABLE_RANDOM_ACCESS_LIST:
                ret = readUnmodifiableCollectionFrom(input, schema, owner,
                        strategy, graph,
                        iUnmodifiableRandomAccessList.newInstance(), false, true);
                break;

            case ID_SYNCHRONIZED_COLLECTION:
                ret = readSynchronizedCollectionFrom(input, schema, owner,
                        strategy, graph, iSynchronizedCollection.newInstance(),
                        false, false);
                break;
            case ID_SYNCHRONIZED_SET:
                ret = readSynchronizedCollectionFrom(input, schema, owner,
                        strategy, graph, iSynchronizedSet.newInstance(), false,
                        false);
                break;
            case ID_SYNCHRONIZED_SORTED_SET:
                ret = readSynchronizedCollectionFrom(input, schema, owner,
                        strategy, graph, iSynchronizedSortedSet.newInstance(),
                        true, false);
                break;
            case ID_SYNCHRONIZED_LIST:
                ret = readSynchronizedCollectionFrom(input, schema, owner,
                        strategy, graph, iSynchronizedList.newInstance(), false,
                        true);
                break;
            case ID_SYNCHRONIZED_RANDOM_ACCESS_LIST:
                ret = readSynchronizedCollectionFrom(input, schema, owner,
                        strategy, graph,
                        iSynchronizedRandomAccessList.newInstance(), false, true);
                break;

            case ID_CHECKED_COLLECTION:
                ret = readCheckedCollectionFrom(input, schema, owner, strategy,
                        graph, iCheckedCollection.newInstance(), false, false);
                break;
            case ID_CHECKED_SET:
                ret = readCheckedCollectionFrom(input, schema, owner, strategy,
                        graph, iCheckedSet.newInstance(), false, false);
                break;
            case ID_CHECKED_SORTED_SET:
                ret = readCheckedCollectionFrom(input, schema, owner, strategy,
                        graph, iCheckedSortedSet.newInstance(), true, false);
                break;
            case ID_CHECKED_LIST:
                ret = readCheckedCollectionFrom(input, schema, owner, strategy,
                        graph, iCheckedList.newInstance(), false, true);
                break;
            case ID_CHECKED_RANDOM_ACCESS_LIST:
                ret = readCheckedCollectionFrom(input, schema, owner, strategy,
                        graph, iCheckedRandomAccessList.newInstance(), false, true);
                break;

            case ID_ENUM_SET:
            {
                final Collection<?> es = strategy.resolveEnumFrom(input)
                        .newEnumSet();

                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(es, owner);
                }

                // TODO enum schema
                strategy.COLLECTION_SCHEMA
                        .mergeFrom(input, (Collection<Object>) es);
                return es;
            }

            case ID_COLLECTION:
            {
                final Collection<Object> collection = strategy
                        .resolveCollectionFrom(input).newMessage();

                if (graph)
                {
                    // update the actual reference.
                    ((GraphInput) input).updateLast(collection, owner);
                }

                strategy.COLLECTION_SCHEMA.mergeFrom(input, collection);

                return collection;
            }

            default:
                throw new ProtostuffException("Corrupt input.");
        }

        if (0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");

        return ret;
    }

    private static Object readUnmodifiableCollectionFrom(Input input,
            Schema<?> schema, Object owner, IdStrategy strategy, boolean graph,
            Object collection, boolean ss, boolean list) throws IOException
    {
        if (graph)
        {
            // update the actual reference.
            ((GraphInput) input).updateLast(collection, owner);
        }

        final Wrapper wrapper = new Wrapper();
        Object c = input.mergeObject(wrapper,
                strategy.POLYMORPHIC_COLLECTION_SCHEMA);
        if (!graph || !((GraphInput) input).isCurrentMessageReference())
            c = wrapper.value;
        try
        {
            fUnmodifiableCollection_c.set(collection, c);

            if (ss)
                fUnmodifiableSortedSet_ss.set(collection, c);

            if (list)
                fUnmodifiableList_list.set(collection, c);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        return collection;
    }

    private static Object readSynchronizedCollectionFrom(Input input,
            Schema<?> schema, Object owner, IdStrategy strategy, boolean graph,
            Object collection, boolean ss, boolean list) throws IOException
    {
        if (graph)
        {
            // update the actual reference.
            ((GraphInput) input).updateLast(collection, owner);
        }

        final Wrapper wrapper = new Wrapper();
        Object c = input.mergeObject(wrapper,
                strategy.POLYMORPHIC_COLLECTION_SCHEMA);
        if (!graph || !((GraphInput) input).isCurrentMessageReference())
            c = wrapper.value;
        try
        {
            fSynchronizedCollection_c.set(collection, c);
            // mutex is the object itself.
            fSynchronizedCollection_mutex.set(collection, collection);

            if (ss)
                fSynchronizedSortedSet_ss.set(collection, c);

            if (list)
                fSynchronizedList_list.set(collection, c);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        return collection;
    }

    private static Object readCheckedCollectionFrom(Input input,
            Schema<?> schema, Object owner, IdStrategy strategy, boolean graph,
            Object collection, boolean ss, boolean list) throws IOException
    {
        if (graph)
        {
            // update the actual reference.
            ((GraphInput) input).updateLast(collection, owner);
        }

        final Wrapper wrapper = new Wrapper();
        Object c = input.mergeObject(wrapper,
                strategy.POLYMORPHIC_COLLECTION_SCHEMA);
        if (!graph || !((GraphInput) input).isCurrentMessageReference())
            c = wrapper.value;

        if (1 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");

        Object type = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);
        if (!graph || !((GraphInput) input).isCurrentMessageReference())
            type = wrapper.value;
        try
        {
            fCheckedCollection_c.set(collection, c);
            fCheckedCollection_type.set(collection, type);

            if (ss)
                fCheckedSortedSet_ss.set(collection, c);

            if (list)
                fCheckedList_list.set(collection, c);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        return collection;
    }

    static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe,
            Input input, Output output, IdStrategy strategy) throws IOException
    {
        transferObject(pipeSchema, pipe, input, output, strategy,
                input.readFieldNumber(pipeSchema.wrappedSchema));
    }

    static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe,
            Input input, Output output, IdStrategy strategy,
            final int number) throws IOException
    {
        switch (number)
        {
            case ID_EMPTY_SET:
                output.writeUInt32(number, input.readUInt32(), false);
                break;

            case ID_EMPTY_LIST:
                output.writeUInt32(number, input.readUInt32(), false);
                break;

            case ID_SINGLETON_SET:
            case ID_SINGLETON_LIST:
            {
                output.writeUInt32(number, input.readUInt32(), false);

                final int next = input.readFieldNumber(pipeSchema.wrappedSchema);
                if (next == 0)
                {
                    // null element
                    return;
                }

                if (next != 1)
                    throw new ProtostuffException("Corrupt input.");

                output.writeObject(1, pipe, strategy.OBJECT_PIPE_SCHEMA, false);
                break;
            }
            case ID_SET_FROM_MAP:
                output.writeObject(number, pipe,
                        strategy.POLYMORPHIC_MAP_PIPE_SCHEMA, false);
                break;

            case ID_COPIES_LIST:
            {
                output.writeUInt32(number, input.readUInt32(), false);

                if (1 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");

                // size
                output.writeUInt32(1, input.readUInt32(), false);

                final int next = input.readFieldNumber(pipeSchema.wrappedSchema);
                if (next == 0)
                {
                    // null element
                    return;
                }

                if (next != 2)
                    throw new ProtostuffException("Corrupt input.");

                output.writeObject(2, pipe, strategy.OBJECT_PIPE_SCHEMA, false);
                break;
            }
            case ID_UNMODIFIABLE_COLLECTION:
            case ID_UNMODIFIABLE_SET:
            case ID_UNMODIFIABLE_SORTED_SET:
            case ID_UNMODIFIABLE_LIST:
            case ID_UNMODIFIABLE_RANDOM_ACCESS_LIST:
                output.writeObject(number, pipe,
                        strategy.POLYMORPHIC_COLLECTION_PIPE_SCHEMA, false);
                break;

            case ID_SYNCHRONIZED_COLLECTION:
            case ID_SYNCHRONIZED_SET:
            case ID_SYNCHRONIZED_SORTED_SET:
            case ID_SYNCHRONIZED_LIST:
            case ID_SYNCHRONIZED_RANDOM_ACCESS_LIST:
                output.writeObject(number, pipe,
                        strategy.POLYMORPHIC_COLLECTION_PIPE_SCHEMA, false);
                break;

            case ID_CHECKED_COLLECTION:
            case ID_CHECKED_SET:
            case ID_CHECKED_SORTED_SET:
            case ID_CHECKED_LIST:
            case ID_CHECKED_RANDOM_ACCESS_LIST:
                output.writeObject(number, pipe,
                        strategy.POLYMORPHIC_COLLECTION_PIPE_SCHEMA, false);

                if (1 != input.readFieldNumber(pipeSchema.wrappedSchema))
                    throw new ProtostuffException("Corrupt input.");

                output.writeObject(1, pipe, strategy.CLASS_PIPE_SCHEMA, false);
                break;

            case ID_ENUM_SET:
                strategy.transferEnumId(input, output, number);

                if (output instanceof StatefulOutput)
                {
                    // update using the derived schema.
                    ((StatefulOutput) output).updateLast(
                            strategy.COLLECTION_PIPE_SCHEMA, pipeSchema);
                }

                // TODO use enum schema
                Pipe.transferDirect(strategy.COLLECTION_PIPE_SCHEMA, pipe, input,
                        output);
                return;
            case ID_COLLECTION:
                strategy.transferCollectionId(input, output, number);

                if (output instanceof StatefulOutput)
                {
                    // update using the derived schema.
                    ((StatefulOutput) output).updateLast(
                            strategy.COLLECTION_PIPE_SCHEMA, pipeSchema);
                }

                Pipe.transferDirect(strategy.COLLECTION_PIPE_SCHEMA, pipe, input,
                        output);
                return;
            default:
                throw new ProtostuffException("Corrupt input.");
        }

        if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");
    }
}

{'repo_name': 'protostuff/protostuff', 'stars': '1446', 'repo_language': 'Java', 'file_name': 'ListAdapterTest.java', 'mime_type': 'text/x-java', 'hash': 3051788297322563789, 'source_dataset': 'data'}


/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------

Copyright (c) 2006-2017, assimp team

All rights reserved.

Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.

* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the
  following disclaimer in the documentation and/or other
  materials provided with the distribution.

* Neither the name of the assimp team, nor the names of its
  contributors may be used to endorse or promote products
  derived from this software without specific prior
  written permission of the assimp team.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------
*/

/** @file Defines a post processing step to remove specific parts of the scene */
#ifndef AI_REMOVEVCPROCESS_H_INCLUDED
#define AI_REMOVEVCPROCESS_H_INCLUDED

#include "BaseProcess.h"
#include <assimp/mesh.h>

class RemoveVCProcessTest;

namespace Assimp {

// ---------------------------------------------------------------------------
/** RemoveVCProcess: Class to exclude specific parts of the data structure
 *  from further processing by removing them,
*/
class ASSIMP_API RemoveVCProcess : public BaseProcess {
public:
    /// The default class constructor.
    RemoveVCProcess();

    /// The class destructor.
    ~RemoveVCProcess();

    // -------------------------------------------------------------------
    /** Returns whether the processing step is present in the given flag field.
    * @param pFlags The processing flags the importer was called with. A bitwise
    *   combination of #aiPostProcessSteps.
    * @return true if the process is present in this flag fields, false if not.
    */
    bool IsActive( unsigned int pFlags) const;

    // -------------------------------------------------------------------
    /** Executes the post processing step on the given imported data.
    * At the moment a process is not supposed to fail.
    * @param pScene The imported data to work at.
    */
    void Execute( aiScene* pScene);

    // -------------------------------------------------------------------
    /** Called prior to ExecuteOnScene().
    * The function is a request to the process to update its configuration
    * basing on the Importer's configuration property list.
    */
    virtual void SetupProperties(const Importer* pImp);

    // -------------------------------------------------------------------
    /** Manually setup the configuration flags for the step
     *
     *  @param Bitwise combination of the #aiComponent enumerated values.
    */
    void SetDeleteFlags(unsigned int f)
    {
        configDeleteFlags = f;
    }

    // -------------------------------------------------------------------
    /** Query the current configuration.
    */
    unsigned int GetDeleteFlags() const
    {
        return configDeleteFlags;
    }

private:

    bool ProcessMesh (aiMesh* pcMesh);

    /** Configuration flag
     */
    unsigned int configDeleteFlags;

    /** The scene we're working with
     */
    aiScene* mScene;
};

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

} // end of namespace Assimp

#endif // !!AI_REMOVEVCPROCESS_H_INCLUDED

{'repo_name': 'rokups/rbfx', 'stars': '268', 'repo_language': 'C++', 'file_name': 'footer.html', 'mime_type': 'text/plain', 'hash': 6022508021185277548, 'source_dataset': 'data'}


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
processing.pdf Class Hierarchy
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Hierarchy For Package processing.pdf

Package Hierarchies:
All Packages

Class Hierarchy

java.lang.Object

processing.core.PImage (implements java.lang.Cloneable, processing.core.PConstants)

processing.core.PGraphics (implements processing.core.PConstants)

processing.core.PGraphicsJava2D

processing.pdf.PGraphicsPDF

      Overview
      Package
      Class
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

{'repo_name': 'chipKIT32/chipKIT32-MAX', 'stars': '107', 'repo_language': 'Java', 'file_name': 'org.eclipse.jdt.ui.prefs', 'mime_type': 'text/plain', 'hash': 1204867426545706918, 'source_dataset': 'data'}


<?php

/**
 * Pre-transform that changes deprecated name attribute to ID if necessary
 */
class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
{

    /**
     * @param array $attr
     * @param HTMLPurifier_Config $config
     * @param HTMLPurifier_Context $context
     * @return array
     */
    public function transform($attr, $config, $context)
    {
        // Abort early if we're using relaxed definition of name
        if ($config->get('HTML.Attr.Name.UseCDATA')) {
            return $attr;
        }
        if (!isset($attr['name'])) {
            return $attr;
        }
        $id = $this->confiscateAttr($attr, 'name');
        if (isset($attr['id'])) {
            return $attr;
        }
        $attr['id'] = $id;
        return $attr;
    }
}

// vim: et sw=4 sts=4

{'repo_name': 'ecjia/ecjia-daojia', 'stars': '537', 'repo_language': 'PHP', 'file_name': 'route.php', 'mime_type': 'text/x-php', 'hash': 4612774304348343562, 'source_dataset': 'data'}