text:
<?xml version="1.0" encoding="utf-8" ?>
<project name="opentdc-rates-service-opencrx" basedir=".">

	<property environment="env"/>
	<property name="java.build.platform" value="jre-1.7" />
	<property name="cxf.lib" location="${env.CXF_HOME}/lib" />
	<property name="junit.home" location="${env.JUNIT_HOME}" />
	<property name="openmdx.home" location="../opt/openmdx-2.14.0+/" />
	<property name="opencrx.home" location="../opt/opencrx-3.0.0+/" />
	<property name="src.dir" value="src/java" />
	<property name="build.dir" value="build/${java.build.platform}/bin" />

	<path id="project.class.path">
		<fileset dir="${cxf.lib}" includes="*.jar" />
		<fileset dir="${build.dir}" includes="*.class" />
		<fileset dir="${openmdx.home}/${java.build.platform}/core/lib" includes="*.jar" />
		<fileset dir="${opencrx.home}/${java.build.platform}/core/lib" includes="*.jar" />
		<fileset dir="../${java.build.platform}/services-generic/lib/" includes="*.jar" />
		<fileset dir="../${java.build.platform}/services-opencrx/lib/" includes="*.jar" />
		<fileset dir="../${java.build.platform}/rates-service/lib/" includes="*.jar" />
		<fileset dir="../opt/google/${java.build.platform}/gson/lib/" includes="*.jar" />
	</path>

	<target name="javac" description="Compile java source">
		<mkdir dir="${build.dir}"/>
		<javac includeantruntime="false" srcdir="${src.dir}" includes="**" encoding="utf-8"
			destdir="${build.dir}"
			source="1.7" target="1.7" nowarn="false"
			debug="true" debuglevel="lines,vars,source">
			<exclude name="**/test/**"/>
			<classpath refid="project.class.path"/>
		</javac>
	</target>

  <target name="deliverables" depends="javac" description="Create deliverables">
    <jar destfile="../${java.build.platform}/rates-service-opencrx/lib/opentdc-rates-service-opencrx.jar">
    	<zipfileset dir="${build.dir}" />
  	</jar>
  </target>

	<target name="clean" description="Cleans this project">
		<delete dir="${build.dir}" failonerror="false" />
	</target>

</project>


text:
package org.apache.shindig.gadgets.servlet;

import com.google.common.collect.Maps;

import org.apache.shindig.gadgets.GadgetContext;

import junit.framework.TestCase;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

public class JsonRpcGadgetContextTest extends TestCase {
  final static String SPEC_URL = "http://example.org/gadget.xml";
  final static int SPEC_ID = 1234;
  final static String[] PREF_KEYS = new String[] {"hello", "foo"};
  final static String[] PREF_VALUES = new String[] {"world", "bar"};
  final static Map<String, String> prefs = Maps.newHashMap();
  static {
    for (int i = 0, j = PREF_KEYS.length; i < j; ++i) {
      prefs.put(PREF_KEYS[i], PREF_VALUES[i]);
    }
  }

  public void testCorrectExtraction() throws Exception {
    JSONObject gadget = new JSONObject()
        .put("url", SPEC_URL)
        .put("moduleId", SPEC_ID)
        .put("prefs", prefs)
        .put("gadget-field", "gadget-value");

    JSONObject context = new JSONObject()
        .put("language", Locale.US.getLanguage())
        .put("country", Locale.US.getCountry().toUpperCase())
        .put("context-field", "context-value");

    GadgetContext jsonContext = new JsonRpcGadgetContext(context, gadget);
    assertEquals(SPEC_URL, jsonContext.getUrl().toString());
    assertEquals(SPEC_ID, jsonContext.getModuleId());
    assertEquals(Locale.US.getLanguage(),
                 jsonContext.getLocale().getLanguage());
    assertEquals(Locale.US.getCountry(), jsonContext.getLocale().getCountry());

    for (String key : PREF_KEYS) {
      String value = jsonContext.getUserPrefs().getPref(key);
      assertEquals(prefs.get(key), value);
    }

    assertEquals("gadget-value", jsonContext.getParameter("gadget-field"));
    assertEquals("context-value", jsonContext.getParameter("context-field"));
  }
}

redpajama_set_name: RedPajamaGithub


text:
module ProjectServer

  # The Project_Server class represent  the Project Server Component, whose
  # responsability is to manage Projects, distribute Jobs
  class ProjectServer
    def find_pov_file(name)
      povray_scene_string = ''
      file = File.new("povray.pov","r")
      file.each_line do |line|
        povray_scene_string +=line
      end
      file.close
      marshaled_povray_scene_file = Marshal.dump(povray_scene_string)
    end

    def put(marshaled_job, marshaled_image_file)
      image_file_string = Marshal.load(marshaled_image_file)
      job = Marshal.load(marshaled_job)
      return_value = nil
      if image_file_string.size == 0 or job.nil?
        return_value = false
        puts "Error: Received 'put' order to register a completed job, but either Image or Job was corrupted"
      else
        return_value = true
      end
      return return_value
    end
  end

end


text:
package teams.repository;

import org.junit.Test;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import teams.AbstractApplicationTest;
import teams.migration.Team;

import java.util.List;
import java.util.Optional;

import static org.junit.Assert.assertEquals;

public class TeamRepositoryTest extends AbstractApplicationTest {

  @Test
  public void findByNameContainingIgnoreCaseOrderByNameAsc() throws Exception {
    List<Team> teams = teamRepository.findByNameContainingIgnoreCaseOrderByNameAsc("ER");
    assertEquals("gliders", teams.get(0).getName());
    assertEquals("riders", teams.get(1).getName());
  }

  @Test
  public void findByUrn() throws Exception {
    Optional<Team> teamOptional = teamRepository.findByUrn("nl:surfnet:diensten:giants");
    assertEquals("giants", teamOptional.get().getName());
  }

  @Test
  public void findByMembershipsPersonUrn() throws Exception {
    List<Team> teams = teamRepository.findByMembershipsUrnPersonOrderByNameAsc(
      "urn:collab:person:surfnet.nl:jdoe", new PageRequest(0, 10)).getContent();
    assertEquals(3, teams.size());
  }

  @Test
  public void findByNameContainingIgnoreCaseAndMembershipsPersonUrnOrderByNameAsc() throws Exception {
    List<Team> teams = teamRepository.findByNameContainingIgnoreCaseAndMembershipsUrnPersonOrderByNameAsc(
      "ERS", "urn:collab:person:surfnet.nl:jdoe", new PageRequest(0, 10)).getContent();
    assertEquals(2, teams.size());
  }

  @Test(expected = DataIntegrityViolationException.class)
  public void addTeam() throws Exception {
    teamRepository.save(new Team("nl:surfnet:diensten:riders","riders", "we are riders"));
  }

}


text:
	local function execQuiet(cmd, ...)
		cmd = string.format(cmd, ...) .. " > _output_.log 2> _error_.log"
		local z = os.execute(cmd)
		os.remove("_output_.log")
		os.remove("_error_.log")
		return z
	end

---
-- Check the command line arguments, and show some help if needed.
---

	local usage = 'usage is: package <branch> <type>\n' ..
		'       <branch> is the name of the release branch to target\n' ..
		'       <type> is one of "source" or "binary"\n'

	if #_ARGS ~= 2 then
		error(usage, 0)
	end

	local branch = _ARGS[1]
	local kind = _ARGS[2]

	if kind ~= "source" and kind ~= "binary" then
		error(usage, 0)
	end

--
-- Make sure I've got what I've need to be happy.
--

	local required = { "git", "make", "gcc", "premake5", "zip" }
	for _, value in ipairs(required) do
		local z = execQuiet("%s --version", value)
		if z ~= 0 then
			error("required tool '" .. value .. "' not found", 0)
		end
	end

--
-- Figure out what I'm making.
--

	os.chdir("..")
	local text = os.outputof(string.format('git show %s:src/host/premake.h', branch))
	local _, _, version = text:find('VERSION%s*"([%w%p]+)"')

	local pkgName = "premake-" .. version
	local pkgExt = ".zip"

	if not os.istarget("windows") and kind == "binary" then
		pkgExt = ".tar.gz"
	end

--
-- Make sure I'm sure.
--

	printf("")
	printf("I am about to create a %s package", kind:upper())
	printf("  ...named release/%s%s", pkgName, pkgExt)
	printf("  ...from the %s branch", branch)
	printf("")
	printf("Does this look right to you? If so, press [Enter] to begin.")
	io.read()

--
-- Pull down the release branch.
--

	print("Preparing release folder")
	os.mkdir("release")
	os.chdir("release")
	os.rmdir(pkgName)

	print("Cloning source code")
	z = os.executef("git clone .. %s", pkgName)
	if z ~= 0 then
		error("clone failed", 0)
	end

	os.chdir(pkgName)

	z = os.executef("git checkout %s", branch)
	if z ~= 0 then
		error("unable to checkout branch " .. branch, 0)
	end

	z = os.executef("git submodule update --init")
	if z ~= 0 then
		error("unable to clone submodules", 0)
	end

--
-- Make absolutely sure the embedded scripts have been updated
--

	print("Updating embedded scripts...")
	if kind == "source" then
		z = execQuiet("premake5 embed")
	else
		z = execQuiet("premake5 --bytecode embed")
	end
	if z ~= 0 then
		error("failed to update the embedded scripts", 0)
	end

--
-- Clear out files I don't want included in any packages.
--

	print("Cleaning up the source tree...")
	os.rmdir("packages")
	os.rmdir(".git")

	local removelist = { ".DS_Store", ".git", ".gitignore", ".gitmodules", ".travis.yml", ".editorconfig", "appveyor.yml", "Bootstrap.mak" }
	for _, removeitem in ipairs(removelist) do
		local founditems = os.matchfiles("**" .. removeitem)
		for _, item in ipairs(founditems) do
			os.remove(item)
		end
	end

--
-- Generate a source package.
--

if kind == "source" then

	print("Generating project files...")
	execQuiet("premake5 /to=build/vs2005 vs2005")
	execQuiet("premake5 /to=build/vs2008 vs2008")
	execQuiet("premake5 /to=build/vs2010 vs2010")
	execQuiet("premake5 /to=build/vs2012 vs2012")
	execQuiet("premake5 /to=build/vs2013 vs2013")
	execQuiet("premake5 /to=build/vs2015 vs2015")
	execQuiet("premake5 /to=build/vs2017 vs2017")
	execQuiet("premake5 /to=build/gmake.windows /os=windows gmake")
	execQuiet("premake5 /to=build/gmake.unix /os=linux gmake")
	execQuiet("premake5 /to=build/gmake.macosx /os=macosx gmake")
	execQuiet("premake5 /to=build/gmake.bsd /os=bsd gmake")

	print("Creating source code package...")
	os.chdir("..")
	execQuiet("zip -r9 %s-src.zip %s/*", pkgName, pkgName)

end

--
-- Create a binary package for this platform. This step requires a working
-- GNU/Make/GCC environment. I use MinGW on Windows as it produces the
-- smallest binaries.
--

if kind == "binary" then

	print("Building binary...")
	execQuiet("premake5 gmake")
	z = execQuiet("make config=release")
	if z ~= 0 then
		error("build failed")
	end

	os.chdir("bin/release")

	local name = string.format("%s-%s%s", pkgName, os.host(), pkgExt)
	if os.ishost("windows") then
		execQuiet("zip -9 %s premake5.exe", name)
	else
		execQuiet("tar czvf %s premake5", name)
	end

	os.copyfile(name, path.join("../../../", name))
	os.chdir("../../..")

end

--
-- Clean up
--

	os.rmdir(pkgName)


text:
package com.b2international.snowowl.core.date;

import java.text.ParseException;
import java.util.Date;

import javax.annotation.Nullable;

import com.b2international.snowowl.core.api.SnowowlRuntimeException;

/**
 * Effective Times should be always in GMT time. Use this class when working with effective times in any ontology, this will ensure the proper parsing
 * and formatting of them.
 *
 * @since 3.9
 */
public abstract class EffectiveTimes {

	private EffectiveTimes() {
	}

	/**
	 * The long timestamp representing unset effective time. Value: {@value}
	 */
	public static final long UNSET_EFFECTIVE_TIME = -1L;

	/**
	 * The string label returned for unset effective time values. Value: {@value}
	 */
	public static final String UNSET_EFFECTIVE_TIME_LABEL = "Unpublished";

	/**
	 * Formats the given object representing an effective time with the {@value DateFormats#DEFAULT} format and returns the result.
	 *
	 * @param effectiveTime
	 *            - the date to format, may be null
	 * @return - the formatted date as string
	 */
	public static final String format(@Nullable Object effectiveTime) {
		return format(effectiveTime, DateFormats.DEFAULT);
	}

	/**
	 * Formats the given object representing an effective time with the given datePattern and returns the result.
	 *

	 * Unset effective times will be represented with the {@link #UNSET_EFFECTIVE_TIME_LABEL} constant.
	 *
	 * @param effectiveTime
	 *            - the date to format, may be null
	 * @param datePattern
	 *            - the pattern to use
	 * @return - the formatted date as string
	 */
	public static String format(@Nullable Object effectiveTime, String datePattern) {
		return format(effectiveTime, datePattern, UNSET_EFFECTIVE_TIME_LABEL);
	}

	/**
	 * Formats the given object representing an effective time with the given datePattern and returns the result.
	 *

	 * Unset effective time values will be represented with the third {@code String} argument.
	 *
	 * @param effectiveTime
	 *            - the date to format, may be null
	 * @param datePattern
	 *            - the pattern to use
	 * @param unsetEffectiveTimeLabel
	 *            - the label to use when the effective time is not set
	 * @return - the formatted date as string
	 */
	public static String format(@Nullable Object effectiveTime, String datePattern, String unsetEffectiveTimeLabel) {
		if (effectiveTime == null) {
			return unsetEffectiveTimeLabel;
		} else if (effectiveTime instanceof Long) {
			if (((long) effectiveTime) == UNSET_EFFECTIVE_TIME) {
				return unsetEffectiveTimeLabel;
			}
			return Dates.formatByGmt(toDate((Long) effectiveTime), datePattern);
		}
		return Dates.formatByGmt(effectiveTime, datePattern);
	}

	/**
	 * Parses the given effectiveTime with the {@value DateFormats#DEFAULT} format and returns the parsed {@link Date}.
	 *
	 * @param effectiveTime
	 *            - the effectiveTime to parse, cannot be null
	 * @return - the parsed date
	 * @throws SnowowlRuntimeException
	 *             - if a {@link ParseException} is throw during execution
	 */
	public static Date parse(String effectiveTime) {
		return parse(effectiveTime, DateFormats.DEFAULT);
	}

	/**
	 * Parses the given effectiveTime with the given datePattern and returns the parsed {@link Date}.
	 *
	 * @param effectiveTime
	 *            - the effectiveTime to parse, cannot be null
	 * @param datePattern
	 *            - the pattern to use, cannot be null
	 * @return - the parsed date, never null.
	 * @throws SnowowlRuntimeException
	 *             - if a {@link ParseException} is throw during execution
	 * @throws NullPointerException
	 *             - if one of the arguments was null
	 */
	public static Date parse(String effectiveTime, String datePattern) {
		if (UNSET_EFFECTIVE_TIME_LABEL.equals(effectiveTime)) {
			return null;
		}
		return Dates.parse(effectiveTime, datePattern);
	}

	/**
	 * Ensures that for effective times the {@link Dates#getTime(Object)} will always return a valid long, for null input it will return
	 * {@link #UNSET_EFFECTIVE_TIME}.
	 *
	 * @param effectiveTime
	 *            - to extract time from
	 * @return the number of milliseconds from the date object
	 */
	public static final long getEffectiveTime(@Nullable Object effectiveTime) {
		if (null == effectiveTime) {
			return UNSET_EFFECTIVE_TIME;
		}
		return Dates.getTime(effectiveTime);
	}

	/**
	 * Converts the given effectiveTime timestamp to a {@link Date} if it is not equals to {@link #UNSET_EFFECTIVE_TIME}, in this case return
	 * null.
	 *
	 * @param effectiveTime
	 *            - the effectiveTime to convert
	 * @return - the converted date, can be null
	 */
	@Nullable
	public static Date toDate(long effectiveTime) {
		return UNSET_EFFECTIVE_TIME == effectiveTime ? null : new Date(effectiveTime);
	}

}


text:
<?php defined('SYSPATH') or die('No direct script access.');

class CSRF_Form extends Kohana_Form {

	/**
	 * Generates an opening HTML form tag.
	 *
	 *     // Form will submit back to the current page using POST
	 *     echo Form::open();
	 *
	 *     // Form will submit to 'search' using GET
	 *     echo Form::open('search', array('method' => 'get'));
	 *
	 *     // When "file" inputs are present, you must include the "enctype"
	 *     echo Form::open(NULL, array('enctype' => 'multipart/form-data'));
	 *
	 * @param   string  form action, defaults to the current request URI
	 * @param   array   html attributes
	 * @return  string
	 * @uses    Request::instance
	 * @uses    URL::site
	 * @uses    HTML::attributes
	 */
	public static function open($action = NULL, array $attributes = NULL)
	{
		if ($action === NULL)
		{
			// Use the current URI
			$action = Request::current()->uri;
		}

		if ($action === '')
		{
			// Use only the base URI
			$action = Kohana::$base_url;
		}
		elseif (strpos($action, '://') === FALSE)
		{
			// Make the URI absolute
			$action = URL::site($action);
		}

		// Add the form action to the attributes
		$attributes['action'] = $action;

		// Only accept the default character set
		$attributes['accept-charset'] = Kohana::$charset;

		if (!isset($attributes['method'])) {
			// Use POST method
			$attributes['method'] = 'post';
		} else {
			$attributes['method'] = strtolower($attributes['method']);
		}

		// begin generating form output
		$output = '<form'.HTML::attributes($attributes).'>';

		// handle CSRF
		if ($attributes['method'] = 'post') {
			$output .= '<input type="hidden" name="csrf_token" id="csrf_token" value="' . CSRF::token(TRUE) . '" />';
			$output .= CSRF::javascript();
		}

		return $output;
	}

}


text:
/* eslint-disable no-var */
describe('IDBFactory.deleteDatabase', function () {
    'use strict';
    this.timeout(5000);

    var indexedDB;
    beforeEach(function () {
        indexedDB = env.indexedDB;
    });

    it('should return an IDBOpenDBRequest', function (done) {
        util.createDatabase('inline', function (err, db) {
            if (err) {
                expect(function () { throw err; }).to.not.throw(Error);
                done();
                return;
            }
            db.close();
            var del = indexedDB.deleteDatabase(db.name);

            expect(del).to.be.an.instanceOf(IDBOpenDBRequest);
            done();
        });
    });

    it('should return an IDBOpenDBRequest, even if the database doesn\'t exist', function (done) {
        var del = indexedDB.deleteDatabase('foobar');
        expect(del).to.be.an.instanceOf(IDBOpenDBRequest);

        del.onerror = sinon.spy();
        del.onsuccess = function () {
            sinon.assert.notCalled(del.onerror);
            done();
        };
    });

    it('should pass an IDBVersionChangeEvent to the onsuccess event', function (done) {
        util.createDatabase('inline', function (err, db) {
            if (err) {
                expect(function () { throw err; }).to.not.throw(Error);
                done();
                return;
            }
            db.close();
            var del = indexedDB.deleteDatabase(db.name);

            del.onsuccess = function (event) {
                if (env.isShimmed || (!env.browser.isIE && !env.browser.isSafari)) {
                    expect(event).to.be.an.instanceOf(indexedDB.modules ? indexedDB.modules.ShimEvent : Event);   // IE and Safari use a normal event
                }
                done();
            };
        });
    });

    it('should pass the IDBOpenDBRequest to the onsuccess event', function (done) {
        util.createDatabase('inline', function (err, db) {
            if (err) {
                expect(function () { throw err; }).to.not.throw(Error);
                done();
                return;
            }
            db.close();
            var del = indexedDB.deleteDatabase(db.name);

            del.onsuccess = function (event) {
                expect(event).to.be.an.instanceOf(env.Event);
                expect(event.target).to.equal(del);
                done();
            };
        });
    });

    it('should set IDBOpenDBRequest.result to undefined', function (done) {
        util.createDatabase('inline', function (err, db) {
            if (err) {
                expect(function () { throw err; }).to.not.throw(Error);
                done();
                return;
            }
            db.close();
            var del = indexedDB.deleteDatabase(db.name);

            del.onsuccess = function () {
                expect(del.result).equal(undefined);
                done();
            };
        });
    });

    it('should delete the database', function (done) {
        util.generateDatabaseName(function (err, name) {
            if (err) {
                expect(function () { throw err; }).to.not.throw(Error);
                done();
                return;
            }
            // Create version 5 of the database
            indexedDB.open(name, 5).onsuccess = function (event) {
                var db = event.target.result;
                expect(db.version).to.equal(5);
                db.close();

                // Delete the database
                indexedDB.deleteDatabase(name).onsuccess = function () {
                    // Create version 3 of the database.
                    indexedDB.open(name, 3).onsuccess = function (event) {
                        var db = event.target.result;
                        expect(db.version).to.equal(3);

                        db.close();
                        done();
                    };
                };
            };
        });
    });

    it('should fire the onblocked event if the database is open', function (done) {
        util.createDatabase('inline', function (err, db) {
            if (err) {
                expect(function () { throw err; }).to.not.throw(Error);
                done();
                return;
            }
            var alreadyDone = false;
            var del = indexedDB.deleteDatabase(db.name);
            del.onerror = sinon.spy();

            // It will either be blocked, or it will delete successfully
            del.onsuccess = del.onblocked = function (event) {
                sinon.assert.notCalled(del.onerror);

                expect(event).to.be.an.instanceOf(env.Event);
                expect(event.target).to.equal(del);

                if (!alreadyDone) {
                    alreadyDone = true;
                    db.close();
                    done();
                }
            };
        });
    });

    it('should allow all of these parameter types', function (done) {
        var deletingCounter = 0, deletedCounter = 0;
        if (window.shimIndexedDB) {
            window.shimIndexedDB.__setConfig({databaseNameLengthLimit: util.sampleData.veryLongString.length + 100});
        }

        deleteDatabase(undefined);
        deleteDatabase('');
        deleteDatabase(util.sampleData.veryLongString);
        deleteDatabase(42);
        deleteDatabase(-0.331);
        deleteDatabase(Infinity);
        deleteDatabase(-Infinity);
        deleteDatabase(NaN);
        deleteDatabase([]);
        deleteDatabase(['a', 'b', 'c']);
        deleteDatabase(new Date());
        deleteDatabase({foo: 'bar'});
        deleteDatabase(/^regex$/);

        if (env.isShimmed || !env.browser.isIE) {
            deleteDatabase(null);
        }

        function deleteDatabase (name) {
            deletingCounter++;
            var del = indexedDB.deleteDatabase(name);
            del.onerror = sinon.spy();
            del.onsuccess = function () {
                sinon.assert.notCalled(del.onerror);

                if (++deletedCounter === deletingCounter) {
                    done();
                }
            };
        }
    });

    it('should throw an error if called without params', function () {
        var err;
        try {
            indexedDB.deleteDatabase();
        } catch (e) {
            err = e;
        }

        expect(err).to.be.an.instanceOf(TypeError);
        expect(err.name).to.equal('TypeError');
    });
});


text:
<?xml version='1.0' encoding='UTF-8'?>
<Document>
  <Header>
    <SchemaName>Location</SchemaName>
    <Identifier>location_geonames_2747460</Identifier>
    <DocumentState>public</DocumentState>
    <TimeStamp>1390753463067</TimeStamp>
    <SummaryFields>
      <Title>NL > North Brabant > Schouwloop</Title>
    </SummaryFields>
  </Header>
  <Body>
    <Location>
      <GeopoliticalHierarchy>NL,North Brabant,Schouwloop</GeopoliticalHierarchy>
      <LocationName>
        <Appelation>Schouwloop</Appelation>
        <LocationNameType>stream</LocationNameType>
        <Comments></Comments>
      </LocationName>
      <Coordinates>
        <Longitude>4.9006300000000005</Longitude>
        <Latitude>51.41259</Latitude>
      </Coordinates>
      <GeonamesURI>http://www.geonames.org/2747460</GeonamesURI>
      <WikipediaLink/>
      <DbpediaLink/>
    </Location>
  </Body>
</Document>


text:
namespace SilverNeedle.Characters.Prerequisites
{
    using System.Linq;
    using SilverNeedle.Characters.SpecialAbilities;
    using SilverNeedle.Utility;

    public class SpecialAbilityPrerequisite : IPrerequisite
    {
        public string SpecialAbilityName { get; set; }
        public SpecialAbilityPrerequisite(string name)
        {
            SpecialAbilityName = name;
        }

        /// <summary>
        /// Determines whether this instance is qualified the specified character.
        /// </summary>
        /// <returns>true if the character is qualified</returns>
        /// <param name="character">Character to assess qualification.</param>
        public bool IsQualified(ComponentContainer components)
        {
            return components.GetAll<IFeature>().Any(x => x.Name.EqualsIgnoreCase(SpecialAbilityName));
        }
    }
}


text:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;

using Nucleo.Web.Core;
using Nucleo.Web.Pages;

namespace Nucleo.Web.Scripts
{
	public class ScriptBlock : Control
	{
		#region " Properties "

		/// <summary>
		/// Gets or sets the name of the region.
		/// </summary>
		public string RegionName
		{
			get { return (string)ViewState["RegionName"]; }
			set { ViewState["RegionName"] = value; }
		}

		#endregion

		#region " Methods "

		private IWebSingletonManager GetSingleton()
		{
			IPageDriver page = this.Page as IPageDriver;
			if (page != null)
				return ((IPageDriver)page).CurrentContext.Singletons;

			return WebSingletonManager.GetCurrent();
		}

		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			IWebSingletonManager singleton = this.GetSingleton();
			ScriptSection section = singleton.GetEntry<ScriptSection>(this.RegionName);

			if (section != null)
			{
				if (string.Compare(this.RegionName, section.RegionName, StringComparison.InvariantCultureIgnoreCase) == 0)
					section.Blocks.Add(this);
			}
		}

		protected override void Render(HtmlTextWriter writer)
		{
			//Do not render anything here; parent control does the rendering
		}

		protected internal void RenderScript(HtmlTextWriter writer)
		{
			base.RenderChildren(writer);
		}

		#endregion
	}
}


text:
namespace MassTransit.Analyzers
{
    using System.Collections.Generic;
    using System.Collections.Immutable;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.CodeAnalysis;
    using Microsoft.CodeAnalysis.CSharp.Syntax;

    public static class CommonExpressions
    {
        static readonly IReadOnlyDictionary<string, int> _producerMethods = InitializeProducerMethods();
        static readonly string _taskNamespace = typeof(Task).Namespace;

        static IReadOnlyDictionary<string, int> InitializeProducerMethods()
        {
            return new Dictionary<string, int>
            {
                { "MassTransit.BehaviorContext.Init", 0 },
                { "MassTransit.ConsumeContext.RespondAsync", 0 },
                { "MassTransit.ConsumeContextSelfSchedulerExtensions.ScheduleSend", 0 },
                { "MassTransit.EndpointConventionExtensions.Send", 0 },
                { "MassTransit.ForwardExtensions.Forward", 0 },
                { "MassTransit.IClientFactory.CreateRequest", 0 },
                { "MassTransit.IMessageScheduler.ScheduleSend", 0 },
                { "MassTransit.IMessageScheduler.SchedulePublish", 0 },
                { "MassTransit.IPublishEndpoint.Publish", 0 },
                { "MassTransit.IRecurringMessageScheduler.ScheduleRecurringSend", 0 },
                { "MassTransit.IRequestClient.Create", -1 },
                { "MassTransit.IRequestClient.GetResponse", -1 },
                { "MassTransit.ISendEndpoint.Send", 0 },
                { "MassTransit.Initializers.MessageInitializerCache.Initialize", -1 },
                { "MassTransit.Initializers.MessageInitializerCache.InitializeMessage", -1 },
                { "MassTransit.PublishExecuteExtensions.Publish", 0 },
                { "MassTransit.PublishEndpointRecurringSchedulerExtensions.ScheduleRecurringSend", 0 },
                { "MassTransit.RequestExtensions.Request", 0 },
                { "MassTransit.RespondAsyncExecuteExtensions.RespondAsync", 0 },
                { "MassTransit.SchedulePublishExtensions.SchedulePublish", 0 },
                { "MassTransit.SendConsumeContextExecuteExtensions.Send", 0 },
                { "MassTransit.SendConsumeContextExtensions.Send", 0 },
                { "MassTransit.SendExecuteExtensions.Send", 0 },
                { "MassTransit.SendEndpointRecurringSchedulerExtensions.ScheduleRecurringSend", 0 },
                { "MassTransit.SendEndpointSchedulerExtensions.ScheduleSend", 0 },
                { "MassTransit.TimeSpanContextScheduleExtensions.ScheduleSend", 0 },
                { "MassTransit.TimeSpanScheduleExtensions.ScheduleSend", 0 },
                { "MassTransit.TimeSpanSchedulePublishExtensions.SchedulePublish", 0 }
            };
        }

        public static bool IsProducerMethod(this IMethodSymbol method, out int index)
        {
            return _producerMethods.TryGetValue($"{method.ContainingNamespace}.{method.ContainingType.Name}.{method.Name}", out index);
        }

        public static bool IsActivator(this ArgumentSyntax argumentSyntax, SemanticModel semanticModel, out ITypeSymbol typeArgument)
        {
            if (argumentSyntax != null
                && argumentSyntax.Parent is ArgumentListSyntax argumentListSyntax
                && argumentListSyntax.Parent is InvocationExpressionSyntax invocationExpressionSyntax
                && invocationExpressionSyntax.Expression is MemberAccessExpressionSyntax memberAccessExpressionSyntax
                && semanticModel.GetSymbolInfo(memberAccessExpressionSyntax).Symbol is IMethodSymbol method
                && IsProducerMethod(method, out var index)
                && method.Parameters[0].Type.SpecialType == SpecialType.System_Object)
            {
                if (index == 0 && method.TypeArguments.Length == 1)
                {
                    typeArgument = method.TypeArguments[0];
                    return true;
                }

                if (index == -1 && method.ContainingType.IsGenericType && method.ContainingType.TypeArguments.Length == 1)
                {
                    typeArgument = method.ContainingType.TypeArguments[0];
                    return true;
                }
            }

            typeArgument = null;
            return false;
        }

        public static bool HasMessageContract(this ITypeSymbol typeArgument, out ITypeSymbol contractType)
        {
            if (typeArgument.TypeKind.IsClassOrInterface())
            {
                contractType = typeArgument;
                return true;
            }

            if (typeArgument.TypeKind == TypeKind.TypeParameter &&
                typeArgument is ITypeParameterSymbol typeParameter &&
                typeParameter.ConstraintTypes.Length == 1 &&
                typeParameter.ConstraintTypes[0].TypeKind.IsClassOrInterface())
            {
                contractType = typeParameter.ConstraintTypes[0];
                return true;
            }

            contractType = null;
            return false;
        }

        public static bool IsImmutableArray(this ITypeSymbol type, out ITypeSymbol typeArgument)
        {
            if (type.TypeKind == TypeKind.Struct &&
                type.Name == "ImmutableArray" &&
                type.ContainingNamespace.ToString() == "System.Collections.Immutable" &&
                type is INamedTypeSymbol immutableArrayType &&
                immutableArrayType.IsGenericType &&
                immutableArrayType.TypeArguments.Length == 1)
            {
                typeArgument = immutableArrayType.TypeArguments[0];
                return true;
            }

            typeArgument = null;
            return false;
        }

        public static bool IsCollection(this ITypeSymbol type, out ITypeSymbol typeArgument)
        {
            if (type.TypeKind == TypeKind.Interface &&
                type.Name == "ICollection" &&
                type.ContainingNamespace.ToString() == "System.Collections.Generic" &&
                type is INamedTypeSymbol collectionType &&
                collectionType.IsGenericType &&
                collectionType.TypeArguments.Length == 1)
            {
                typeArgument = collectionType.TypeArguments[0];
                return true;
            }

            typeArgument = null;
            return false;
        }

        public static bool IsEnumerable(this ITypeSymbol type, out ITypeSymbol typeArgument)
        {
            if (type.TypeKind == TypeKind.Interface &&
                type.Name == "IEnumerable" &&
                type.ContainingNamespace.ToString() == "System.Collections.Generic" &&
                type is INamedTypeSymbol collectionType &&
                collectionType.IsGenericType &&
                collectionType.TypeArguments.Length == 1)
            {
                typeArgument = collectionType.TypeArguments[0];
                return true;
            }

            typeArgument = null;
            return false;
        }

        public static bool IsList(this ITypeSymbol type, out ITypeSymbol typeArgument)
        {
            if ((type.TypeKind == TypeKind.Class && type.Name == "List"
                    || type.TypeKind.IsClassOrInterface() && type.Name == "IReadOnlyList"
                    || type.TypeKind.IsClassOrInterface() && type.Name == "IList")
                && type.ContainingNamespace.ToString() == "System.Collections.Generic"
                && type is INamedTypeSymbol listType
                && listType.IsGenericType
                && listType.TypeArguments.Length == 1)
            {
                typeArgument = listType.TypeArguments[0];
                return true;
            }

            typeArgument = null;
            return false;
        }

        public static List<IPropertySymbol> GetContractProperties(this ITypeSymbol contractType)
        {
            var contractTypes = new List<ITypeSymbol> { contractType };

            contractTypes.AddRange(contractType.AllInterfaces);

        #pragma warning disable RS1024
            return contractTypes.SelectMany(i => i.GetMembers().OfType<IPropertySymbol>().Where(x => x.DeclaredAccessibility == Accessibility.Public))
                .Distinct(PropertyNameEqualityComparer.Instance)
                .ToList();
        }

        public static bool IsDictionary(this ITypeSymbol type, out ITypeSymbol keyType, out ITypeSymbol valueType)
        {
            if ((type.TypeKind == TypeKind.Class && type.Name == "Dictionary"
                    || type.TypeKind.IsClassOrInterface() && type.Name == "IReadOnlyDictionary"
                    || type.TypeKind.IsClassOrInterface() && type.Name == "IDictionary")
                && type.ContainingNamespace.ToString() == "System.Collections.Generic"
                && type is INamedTypeSymbol dictionaryType
                && dictionaryType.IsGenericType
                && dictionaryType.TypeArguments.Length == 2)
            {
                keyType = dictionaryType.TypeArguments[0];
                valueType = dictionaryType.TypeArguments[1];
                return true;
            }

            keyType = null;
            valueType = null;
            return false;
        }

        public static bool IsNullable(this ITypeSymbol type, out ITypeSymbol typeArgument)
        {
            if (type.TypeKind == TypeKind.Struct &&
                type.Name == "Nullable" &&
                type.ContainingNamespace.Name == "System" &&
                type is INamedTypeSymbol nullableType &&
                nullableType.IsGenericType &&
                nullableType.TypeArguments.Length == 1)
            {
                typeArgument = nullableType.TypeArguments[0];
                return true;
            }

            typeArgument = null;
            return false;
        }

        public static bool IsArray(this ITypeSymbol type, out ITypeSymbol elementType)
        {
            if (type.TypeKind == TypeKind.Array &&
                type is IArrayTypeSymbol arrayTypeSymbol)
            {
                elementType = arrayTypeSymbol.ElementType;
                return true;
            }

            elementType = null;
            return false;
        }

        public static bool IsInVar(this ITypeSymbol type, out ITypeSymbol inVarType)
        {
            if (type.TypeKind == TypeKind.Class
                && type.ContainingNamespace.Name == "Variables"
                && type.ContainingNamespace.ContainingNamespace.Name == "Initializers"
                && type.ContainingNamespace.ContainingNamespace.ContainingNamespace.Name == "MassTransit")
            {
                var inVar = type.Interfaces.FirstOrDefault(i => i.Name == "IInitializerVariable");
                if (inVar != null &&
                    inVar.IsGenericType &&
                    inVar.TypeArguments.Length == 1)
                {
                    inVarType = inVar.TypeArguments[0];
                    return true;
                }
            }

            inVarType = null;
            return false;
        }

        public static bool ReturnsTask(this IMethodSymbol method)
        {
            return method.ReturnType.Name == nameof(Task) && method.ReturnType.ContainingNamespace.ToString() == _taskNamespace;
        }

        public static IEnumerable<INamedTypeSymbol> GetAllInterfaces(this ITypeSymbol type)
        {
            ImmutableArray<INamedTypeSymbol> allInterfaces = type.AllInterfaces;
            if (type is INamedTypeSymbol namedType && namedType.TypeKind.IsClassOrInterface() && !allInterfaces.Contains(namedType))
            {
                var result = new List<INamedTypeSymbol>(allInterfaces.Length + 1) { namedType };
                result.AddRange(allInterfaces);
                return result;
            }

            return allInterfaces;
        }

        /// <summary>
        /// Return the type, and any base types
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static IEnumerable<ITypeSymbol> GetAllTypes(this ITypeSymbol type)
        {
            var current = type;
            while (current != null)
            {
                yield return current;
                current = current.BaseType;
            }
        }

        public static bool IsClassOrInterface(this TypeKind typeKind)
        {
            return typeKind == TypeKind.Interface || typeKind == TypeKind.Class;
        }

        public static bool ImplementsInterface(this ITypeSymbol symbol, ITypeSymbol type)
        {
            return symbol.AllInterfaces.Any(i => SymbolEqualityComparer.Default.Equals(i, type));
        }

        public static bool InheritsFromType(this ITypeSymbol symbol, ITypeSymbol type)
        {
            return GetAllTypes(symbol).Any(x => SymbolEqualityComparer.Default.Equals(x, type));
        }

        public static bool ImplementsType(this ITypeSymbol type, ITypeSymbol otherType)
        {
            IEnumerable<ITypeSymbol> types = GetAllTypes(type);
            IEnumerable<INamedTypeSymbol> interfaces = GetAllInterfaces(type);

            return types.Any(baseType => SymbolEqualityComparer.Default.Equals(baseType, otherType))
                || interfaces.Any(baseInterfaceType => SymbolEqualityComparer.Default.Equals(baseInterfaceType, otherType));
        }
    }
}


text:
<?php

namespace yiiunit\framework\web;

use yii\web\Controller;
use yiiunit\framework\di\stubs\QuxInterface;
use yiiunit\framework\web\stubs\Bar;
use yii\validators\EmailValidator;

/**
 * @author Misbahul D Munir <misbahuldmunir@gmail.com>
 * @since 2.0
 */
class FakeController extends Controller
{
    public $enableCsrfValidation = false;

    public function actionAksi1($fromGet, $other = 'default')
    {
    }

}


text:
package db

import (
	"context"
	"fmt"
	"sync"
	"testing"

	"github.com/couchbase/sync_gateway/base"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

// Test node operations on SGReplicateManager
func TestReplicateManagerReplications(t *testing.T) {

	testBucket := base.GetTestBucket(t)
	defer testBucket.Close()
	bucket := testBucket.Bucket

	testCfg, err := base.NewCfgSG(bucket)
	require.NoError(t, err)

	manager, err := NewSGReplicateManager(testCfg, "test")
	require.NoError(t, err)

	replication1_id := "replication1"
	err = manager.AddReplication(testReplicationCfg(replication1_id, ""))

	r, err := manager.GetReplication(replication1_id)
	require.NoError(t, err)
	assert.Equal(t, replication1_id, r.ID)

	// Request non-existent replication
	r, err = manager.GetReplication("dne")
	require.Error(t, err, base.ErrNotFound)

	// Attempt to add existing replication
	err = manager.AddReplication(testReplicationCfg(replication1_id, ""))
	require.Error(t, err, base.ErrAlreadyExists)

	// Add a second replication
	replication2_id := "replication2"
	err = manager.AddReplication(testReplicationCfg(replication2_id, ""))
	require.NoError(t, err)

	r, err = manager.GetReplication(replication1_id)
	require.NoError(t, err)
	assert.Equal(t, replication1_id, r.ID)

	replications, err := manager.GetReplications()
	require.NoError(t, err)
	assert.Equal(t, 2, len(replications))

	// Remove replication
	err = manager.DeleteReplication(replication1_id)
	require.NoError(t, err)
	replications, err = manager.GetReplications()
	require.NoError(t, err)
	assert.Equal(t, 1, len(replications))

	// Remove non-existent replication
	err = manager.DeleteReplication(replication1_id)
	require.Error(t, base.ErrNotFound, err)
	replications, err = manager.GetReplications()
	require.NoError(t, err)
	assert.Equal(t, 1, len(replications))

	// Remove last replication
	err = manager.DeleteReplication(replication2_id)
	require.NoError(t, err)
	replications, err = manager.GetReplications()
	require.NoError(t, err)
	assert.Equal(t, 0, len(replications))
}

// Test node operations on SGReplicateManager
func TestReplicateManagerNodes(t *testing.T) {

	testBucket := base.GetTestBucket(t)
	defer testBucket.Close()
	bucket := testBucket.Bucket

	testCfg, err := base.NewCfgSG(bucket)
	require.NoError(t, err)

	manager, err := NewSGReplicateManager(testCfg, "test")
	require.NoError(t, err)

	err = manager.RegisterNode("node1", "host1")
	require.NoError(t, err)

	nodes, err := manager.getNodes()
	require.NoError(t, err)
	assert.Equal(t, 1, len(nodes))

	err = manager.RegisterNode("node2", "host2")
	require.NoError(t, err)

	nodes, err = manager.getNodes()
	require.NoError(t, err)
	assert.Equal(t, 2, len(nodes))

	// re-adding an existing node is a no-op
	err = manager.RegisterNode("node1", "host1")
	require.NoError(t, err)

	nodes, err = manager.getNodes()
	require.NoError(t, err)
	assert.Equal(t, 2, len(nodes))

	// Remove node
	err = manager.RemoveNode("node1")
	require.NoError(t, err)

	nodes, err = manager.getNodes()
	require.NoError(t, err)
	require.Equal(t, 1, len(nodes))
	node2, ok := nodes["node2"]
	require.True(t, ok)
	require.Equal(t, node2.UUID, "node2")

	// Removing an already removed node is a no-op
	err = manager.RemoveNode("node1")
	require.NoError(t, err)

	replications, err := manager.GetReplications()
	require.NoError(t, err)
	assert.Equal(t, 0, len(replications))
}

// Test concurrent node operations on SGReplicateManager
func TestReplicateManagerConcurrentNodeOperations(t *testing.T) {

	testBucket := base.GetTestBucket(t)
	defer testBucket.Close()
	bucket := testBucket.Bucket

	testCfg, err := base.NewCfgSG(bucket)
	require.NoError(t, err)
	manager, err := NewSGReplicateManager(testCfg, "test")
	require.NoError(t, err)

	var nodeWg sync.WaitGroup

	for i := 0; i < 20; i++ {
		nodeWg.Add(1)
		go func(i int) {
			defer nodeWg.Done()
			err := manager.RegisterNode(fmt.Sprintf("node_%d", i), fmt.Sprintf("host_%d", i))
			assert.NoError(t, err)
		}(i)
	}

	nodeWg.Wait()
	nodes, err := manager.getNodes()
	require.NoError(t, err)
	require.Equal(t, 20, len(nodes))

	for i := 0; i < 20; i++ {
		nodeWg.Add(1)
		go func(i int) {
			defer nodeWg.Done()
			err := manager.RemoveNode(fmt.Sprintf("node_%d", i))
			assert.NoError(t, err)
		}(i)
	}

	nodeWg.Wait()
	nodes, err = manager.getNodes()
	require.NoError(t, err)
	require.Equal(t, 0, len(nodes))
}

// Test concurrent replication operations on SGReplicateManager
func TestReplicateManagerConcurrentReplicationOperations(t *testing.T) {

	testBucket := base.GetTestBucket(t)
	defer testBucket.Close()
	bucket := testBucket.Bucket

	testCfg, err := base.NewCfgSG(bucket)
	require.NoError(t, err)
	manager, err := NewSGReplicateManager(testCfg, "test")
	require.NoError(t, err)

	var replicationWg sync.WaitGroup

	for i := 0; i < 20; i++ {
		replicationWg.Add(1)
		go func(i int) {
			defer replicationWg.Done()
			err := manager.AddReplication(testReplicationCfg(fmt.Sprintf("r_%d", i), ""))
			assert.NoError(t, err)
		}(i)
	}

	replicationWg.Wait()
	replications, err := manager.GetReplications()
	require.NoError(t, err)
	require.Equal(t, 20, len(replications))

	for i := 0; i < 20; i++ {
		replicationWg.Add(1)
		go func(i int) {
			defer replicationWg.Done()
			err := manager.DeleteReplication(fmt.Sprintf("r_%d", i))
			assert.NoError(t, err)
		}(i)
	}

	replicationWg.Wait()
	replications, err = manager.GetReplications()
	require.NoError(t, err)
	require.Equal(t, 0, len(replications))
}

func testReplicationCfg(id, assignedNode string) *ReplicationCfg {
	return &ReplicationCfg{
		ReplicationConfig: ReplicationConfig{ID: id},
		AssignedNode:      assignedNode,
	}
}

func TestRebalanceReplications(t *testing.T) {

	defer base.SetUpTestLogging(base.LevelDebug, base.KeyReplicate)()

	type rebalanceTest struct {
		name                  string                     // Test name
		nodes                 map[string]*SGNode         // Initial node set
		replications          map[string]*ReplicationCfg // Initial replication assignment
		expectedMinPerNode    int                        // Minimum replications per node after rebalance
		expectedMaxPerNode    int                        // Maximum replications per node after rebalance
		expectedTotalAssigned int                        // Expected total number of assigned replications post-rebalance
	}
	testCases := []rebalanceTest{
		{
			name: "new nodes",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
				"n3": {UUID: "n3"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n1"),
				"r2": testReplicationCfg("r2", "n1"),
				"r3": testReplicationCfg("r3", "n1"),
			},
			expectedMinPerNode:    1,
			expectedMaxPerNode:    1,
			expectedTotalAssigned: 3,
		},
		{
			name: "new replications",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
				"n3": {UUID: "n3"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", ""),
				"r2": testReplicationCfg("r2", ""),
				"r3": testReplicationCfg("r3", ""),
			},
			expectedMinPerNode:    1,
			expectedMaxPerNode:    1,
			expectedTotalAssigned: 3,
		},
		{
			name: "remove nodes",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n1"),
				"r2": testReplicationCfg("r2", "n2"),
				"r3": testReplicationCfg("r3", "n3"),
				"r4": testReplicationCfg("r4", "n4"),
			},
			expectedMinPerNode:    2,
			expectedMaxPerNode:    2,
			expectedTotalAssigned: 4,
		},
		{
			name:  "no nodes",
			nodes: map[string]*SGNode{},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n1"),
				"r2": testReplicationCfg("r2", "n1"),
				"r3": testReplicationCfg("r3", "n2"),
			},
			expectedMinPerNode:    0,
			expectedMaxPerNode:    0,
			expectedTotalAssigned: 0,
		},
		{
			name: "single node",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n1"),
				"r2": testReplicationCfg("r2", "n2"),
				"r3": testReplicationCfg("r3", ""),
			},
			expectedMinPerNode:    3,
			expectedMaxPerNode:    3,
			expectedTotalAssigned: 3,
		},
		{
			name: "unbalanced distribution",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n1"),
				"r2": testReplicationCfg("r2", "n1"),
				"r3": testReplicationCfg("r3", "n1"),
			},
			expectedMinPerNode:    1,
			expectedMaxPerNode:    2,
			expectedTotalAssigned: 3,
		},
		{
			name: "multiple reassignments new nodes",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
				"n3": {UUID: "n3"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n1"),
				"r2": testReplicationCfg("r2", "n1"),
				"r3": testReplicationCfg("r3", "n1"),
				"r4": testReplicationCfg("r4", "n1"),
				"r5": testReplicationCfg("r5", "n1"),
				"r6": testReplicationCfg("r6", "n1"),
			},
			expectedMinPerNode:    2,
			expectedMaxPerNode:    2,
			expectedTotalAssigned: 6,
		},
		{
			name: "multiple reassignments new replications",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
				"n3": {UUID: "n3"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", ""),
				"r2": testReplicationCfg("r2", ""),
				"r3": testReplicationCfg("r3", ""),
				"r4": testReplicationCfg("r4", ""),
				"r5": testReplicationCfg("r5", "n1"),
				"r6": testReplicationCfg("r6", "n1"),
			},
			expectedMinPerNode:    2,
			expectedMaxPerNode:    2,
			expectedTotalAssigned: 6,
		},
		{
			name: "reassignment from unknown host",
			nodes: map[string]*SGNode{
				"n1": {UUID: "n1"},
				"n2": {UUID: "n2"},
			},
			replications: map[string]*ReplicationCfg{
				"r1": testReplicationCfg("r1", "n3"),
				"r2": testReplicationCfg("r2", "n3"),
				"r3": testReplicationCfg("r3", "n3"),
				"r4": testReplicationCfg("r4", "n3"),
			},
			expectedMinPerNode:    2,
			expectedMaxPerNode:    2,
			expectedTotalAssigned: 4,
		},
	}

	for _, testCase := range testCases {
		t.Run(fmt.Sprintf("%s", testCase.name), func(t *testing.T) {

			cluster := NewSGRCluster()
			cluster.loggingCtx = context.WithValue(context.Background(), base.LogContextKey{},
				base.LogContext{CorrelationID: sgrClusterMgrContextID + "test"})
			cluster.Nodes = testCase.nodes
			cluster.Replications = testCase.replications
			cluster.RebalanceReplications()

			// Verify post-rebalance distribution
			for host, _ := range cluster.Nodes {
				nodeReplications := cluster.GetReplicationIDsForNode(host)
				assert.True(t, len(nodeReplications) >= testCase.expectedMinPerNode)
				assert.True(t, len(nodeReplications) <= testCase.expectedMaxPerNode)
			}

			// Verify replications are all assigned
			assignedCount := 0
			for _, replication := range cluster.Replications {
				if replication.AssignedNode != "" {
					assignedCount++
				}
			}
			assert.Equal(t, testCase.expectedTotalAssigned, assignedCount)
		})
	}
}

func TestUpsertReplicationConfig(t *testing.T) {

	defer base.SetUpTestLogging(base.LevelDebug, base.KeyReplicate)()

	type rebalanceTest struct {
		name           string                   // Test name
		existingConfig *ReplicationConfig       // Initial replication definition
		updatedConfig  *ReplicationUpsertConfig // Initial replication assignment
		expectedConfig *ReplicationConfig       // Minimum replications per node after rebalance
	}
	testCases := []rebalanceTest{
		{
			name: "modify string parameter",
			existingConfig: &ReplicationConfig{
				ID:        "foo",
				Remote:    "remote",
				Direction: "pull",
			},
			updatedConfig: &ReplicationUpsertConfig{
				Direction: base.StringPtr("push"),
			},
			expectedConfig: &ReplicationConfig{
				ID:        "foo",
				Remote:    "remote",
				Direction: "push",
			},
		},
		{
			name: "remove string parameter",
			existingConfig: &ReplicationConfig{
				ID:                   "foo",
				Remote:               "remote",
				Direction:            "pull",
				ConflictResolutionFn: "func(){}",
			},
			updatedConfig: &ReplicationUpsertConfig{
				ConflictResolutionFn: base.StringPtr(""),
			},
			expectedConfig: &ReplicationConfig{
				ID:                   "foo",
				Remote:               "remote",
				Direction:            "pull",
				ConflictResolutionFn: "",
			},
		},
		{
			name: "switch QueryParams type",
			existingConfig: &ReplicationConfig{
				ID:          "foo",
				Remote:      "remote",
				Direction:   "pull",
				QueryParams: []string{"ABC"},
			},
			updatedConfig: &ReplicationUpsertConfig{
				QueryParams: map[string]interface{}{"ABC": true},
			},
			expectedConfig: &ReplicationConfig{
				ID:          "foo",
				Remote:      "remote",
				Direction:   "pull",
				QueryParams: map[string]interface{}{"ABC": true},
			},
		},
		{
			name: "modify all",
			existingConfig: &ReplicationConfig{
				ID:                     "foo",
				Remote:                 "a",
				Direction:              "a",
				ConflictResolutionType: "a",
				ConflictResolutionFn:   "a",
				PurgeOnRemoval:         true,
				DeltaSyncEnabled:       true,
				MaxBackoff:             5,
				State:                  "a",
				Continuous:             true,
				Filter:                 "a",
				QueryParams:            []interface{}{"ABC"},
				Cancel:                 true,
			},
			updatedConfig: &ReplicationUpsertConfig{
				ID:                     "foo",
				Remote:                 base.StringPtr("b"),
				Direction:              base.StringPtr("b"),
				ConflictResolutionType: base.StringPtr("b"),
				ConflictResolutionFn:   base.StringPtr("b"),
				PurgeOnRemoval:         base.BoolPtr(false),
				DeltaSyncEnabled:       base.BoolPtr(false),
				MaxBackoff:             base.IntPtr(10),
				State:                  base.StringPtr("b"),
				Continuous:             base.BoolPtr(false),
				Filter:                 base.StringPtr("b"),
				QueryParams:            []interface{}{"DEF"},
				Cancel:                 base.BoolPtr(false),
			},
			expectedConfig: &ReplicationConfig{
				ID:                     "foo",
				Remote:                 "b",
				Direction:              "b",
				ConflictResolutionType: "b",
				ConflictResolutionFn:   "b",
				PurgeOnRemoval:         false,
				DeltaSyncEnabled:       false,
				MaxBackoff:             10,
				State:                  "b",
				Continuous:             false,
				Filter:                 "b",
				QueryParams:            []interface{}{"DEF"},
				Cancel:                 false,
			},
		},
	}
	for _, testCase := range testCases {
		t.Run(fmt.Sprintf("%s", testCase.name), func(t *testing.T) {
			testCase.existingConfig.Upsert(testCase.updatedConfig)
			equal, err := testCase.existingConfig.Equals(testCase.expectedConfig)
			assert.NoError(t, err)
			assert.True(t, equal)
		})
	}
}


text:
struct CefNavigateParams {
  CefNavigateParams(const GURL& a_url,
                    content::PageTransition a_transition);
  ~CefNavigateParams();

  // The following parameters are sent to the renderer via CefMsg_LoadRequest.
  // ---------------------------------------------------------------------------

  // Request method.
  std::string method;

  // The URL/referrer to be loaded.
  GURL url;
  content::Referrer referrer;

  // The frame that the request should be loaded in or -1 to use the main frame.
  int64 frame_id;

  // Usually the URL of the document in the top-level window, which may be
  // checked by the third-party cookie blocking policy. Leaving it empty may
  // lead to undesired cookie blocking. Third-party cookie blocking can be
  // bypassed by setting first_party_for_cookies = url, but this should ideally
  // only be done if there really is no way to determine the correct value.
  GURL first_party_for_cookies;

  // Additional HTTP request headers.
  std::string headers;

  // net::URLRequest load flags (0 by default).
  int load_flags;

  // Upload data (may be NULL).
  scoped_refptr<net::UploadData> upload_data;

  // The following parameters are used to define browser behavior when servicing
  // the navigation request.
  // ---------------------------------------------------------------------------

  // The disposition requested by the navigation source. Default is CURRENT_TAB.
  WindowOpenDisposition disposition;

  // The transition type of the navigation.
  content::PageTransition transition;

  // Whether this navigation was initiated by the renderer process.
  bool is_renderer_initiated;

  // If non-empty, the new tab contents encoding is overriden by this value.
  std::string override_encoding;

  // If false then the navigation was not initiated by a user gesture. Default
  // is true.
  bool user_gesture;

  // Refers to a navigation that was parked in the browser in order to be
  // transferred to another RVH. Only used in case of a redirection of a request
  // to a different site that created a new RVH.
  content::GlobalRequestID transferred_global_request_id;

 private:
  CefNavigateParams();
};

#endif  // CEF_LIBCEF_BROWSER_NAVIGATE_PARAMS_H_


text:
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Gentallela Alela! | </title>

    <!-- Bootstrap core CSS -->

    <link href="<?=base_url()?>assets/admin/css/bootstrap.min.css" rel="stylesheet">

    <link href="<?=base_url()?>assets/admin/fonts/css/font-awesome.min.css" rel="stylesheet">
    <link href="<?=base_url()?>assets/admin/css/animate.min.css" rel="stylesheet">

    <!-- Custom styling plus plugins -->
    <link href="<?=base_url()?>assets/admin/css/custom.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="<?=base_url()?>assets/admin/css/maps/jquery-jvectormap-2.0.1.css" />
    <link href="<?=base_url()?>assets/admin/css/icheck/flat/green.css" rel="stylesheet" />
    <link href="<?=base_url()?>assets/admin/css/floatexamples.css" rel="stylesheet" type="text/css" />

    <script src="<?=base_url()?>assets/admin/js/jquery.min.js"></script>
    <script src="<?=base_url()?>assets/admin/js/nprogress.js"></script>
    <script>
        NProgress.start();
    </script>

    <!--[if lt IE 9]>
        <script src="<?=base_url()?>assets/admin/../assets/js/ie8-responsive-file-warning.js"></script>
        <![endif]-->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
          <script src="<?=base_url()?>assets/admin/https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="<?=base_url()?>assets/admin/https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

</head>


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>TodoMVC example</title>
  <link rel="stylesheet" href="TodoMVC.css">

todos

      <input class="new-todo" type="text" placeholder="What needs to be done?" autofocus>

      <input class="toggle-all" type="checkbox">

All

Active

Completed

        <button class="clear-completed">Clear completed</button>


text:
// <copyright file="IMotionCaptureHandler.cs" company="Techyian">
// Copyright (c) Ian Auty and contributors. All rights reserved.
// Licensed under the MIT License. Please see LICENSE.txt for License info.
// </copyright>

using MMALSharp.Processors.Motion;
using System;

namespace MMALSharp.Handlers
{
    /// <summary>
    /// Represents a capture handler which can detect motion.
    /// </summary>
    public interface IMotionCaptureHandler
    {
        /// <summary>
        /// The motion type associated with this MotionCaptureHandler.
        /// </summary>
        MotionType MotionType { get; set; }

        /// <summary>
        /// Call to configure motion detection.
        /// </summary>
        /// <param name="config">The motion configuration.</param>
        /// <param name="onDetect">A callback for when motion is detected.</param>
        void ConfigureMotionDetection(MotionConfig config, Action onDetect);

        /// <summary>
        /// Enables motion detection. When configured, this will instruct the capture handler to detect motion.
        /// </summary>
        void EnableMotionDetection();

        /// <summary>
        /// Disables motion detection. When configured, this will instruct the capture handler not to detect motion.
        /// </summary>
        /// <param name="disableCallbackOnly">When true, motion detection will continue but the OnDetect callback
        /// will not be invoked. Call <see cref="EnableMotionDetection"/> to re-enable the callback.</param>
        void DisableMotionDetection(bool disableCallbackOnly = false);
    }
}


text:
<?php

namespace LengthOfRope\JSONLD\Schema;

/**
 * The act of applying an object to its intended purpose.
 *
 * @author LengthOfRope, Bas de Kort <bdekort@gmail.com>
 **/
class UseActionSchema extends ConsumeActionSchema
{
    public static function factory()
    {
        return new UseActionSchema('http://schema.org/', 'UseAction');
    }

}


text:
function mergeData() {
  for (var e, a, s = {}, t = arguments.length; t--;) {
    for (var r = 0, c = Object.keys(arguments[t]); r < c.length; r++) {
      switch (e = c[r]) {case "class":case "style":case "directives":
          Array.isArray(s[e]) || (s[e] = []), s[e] = s[e].concat(arguments[t][e]);break;case "staticClass":
          if (!arguments[t][e]) break;void 0 === s[e] && (s[e] = ""), s[e] && (s[e] += " "), s[e] += arguments[t][e].trim();break;case "on":case "nativeOn":
          s[e] || (s[e] = {});for (var o = 0, n = Object.keys(arguments[t][e]); o < n.length; o++) {
            a = n[o], s[e][a] ? s[e][a] = [].concat(s[e][a], arguments[t][e][a]) : s[e][a] = arguments[t][e][a];
          }break;case "attrs":case "props":case "domProps":case "scopedSlots":case "staticStyle":case "hook":case "transition":
          s[e] || (s[e] = {}), s[e] = __assign({}, arguments[t][e], s[e]);break;case "slot":case "key":case "ref":case "tag":case "show":case "keepAlive":default:
          s[e] || (s[e] = arguments[t][e]);}
    }
  }return s;
}var __assign = Object.assign || function (e) {
  for (var a, s = 1, t = arguments.length; s < t; s++) {
    a = arguments[s];for (var r in a) {
      Object.prototype.hasOwnProperty.call(a, r) && (e[r] = a[r]);
    }
  }return e;
};

var linkMixin = {
  props: {
    // <a> props
    href: String,
    target: String,
    // <router-link> props
    to: null,
    replace: {
      type: Boolean,
      default: false
    },
    append: {
      type: Boolean,
      default: false
    },
    exact: {
      type: Boolean,
      default: false
    }
  }
};

var defineProperty = function (obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
};

var BtnGroup = {
  functional: true,
  render: function render(h, _ref) {
    var props = _ref.props,
        children = _ref.children,
        data = _ref.data;

    return h('div', mergeData(data, {
      class: defineProperty({
        'btn-group': !props.vertical,
        'btn-group-vertical': props.vertical,
        'btn-group-justified': props.justified
      }, 'btn-group-' + props.size, props.size),
      attrs: {
        role: 'group',
        'data-toggle': 'buttons'
      }
    }), children);
  },

  props: {
    size: String,
    vertical: {
      type: Boolean,
      default: false
    },
    justified: {
      type: Boolean,
      default: false
    }
  }
};

var INPUT_TYPE_CHECKBOX = 'checkbox';
var INPUT_TYPE_RADIO = 'radio';

var Btn = {
  functional: true,
  mixins: [linkMixin],
  render: function render(h, _ref) {
    var _classes;

    var children = _ref.children,
        props = _ref.props,
        data = _ref.data;

    // event listeners
    var listeners = data.on || {};
    // checkbox: model contain inputValue
    // radio: model === inputValue
    var isInputActive = props.inputType === INPUT_TYPE_CHECKBOX ? props.value.indexOf(props.inputValue) >= 0 : props.value === props.inputValue;
    // button class
    var classes = (_classes = {
      btn: true,
      active: props.inputType ? isInputActive : props.active,
      disabled: props.disabled,
      'btn-block': props.block
    }, defineProperty(_classes, 'btn-' + props.type, Boolean(props.type)), defineProperty(_classes, 'btn-' + props.size, Boolean(props.size)), _classes);
    // prevent event for disabled links
    var on = {
      click: function click(e) {
        if (props.disabled && e instanceof Event) {
          e.preventDefault();
          e.stopPropagation();
        }
      }
    };
    // render params
    var tag = void 0,
        options = void 0,
        slot = void 0;

    if (props.href) {
      // is native link
      tag = 'a';
      slot = children;
      options = mergeData(data, {
        on: on,
        class: classes,
        attrs: {
          role: 'button',
          href: props.href,
          target: props.target
        }
      });
    } else if (props.to) {
      // is vue router link
      tag = 'router-link';
      slot = children;
      options = mergeData(data, {
        nativeOn: on,
        class: classes,
        props: {
          event: props.disabled ? '' : 'click', // prevent nav while disabled
          to: props.to,
          replace: props.replace,
          append: props.append,
          exact: props.exact
        },
        attrs: {
          role: 'button'
        }
      });
    } else if (props.inputType) {
      // is input checkbox or radio
      tag = 'label';
      options = mergeData(data, {
        on: on,
        class: classes
      });
      slot = [h('input', {
        attrs: {
          autocomplete: 'off',
          type: props.inputType,
          checked: isInputActive ? 'checked' : null,
          disabled: props.disabled
        },
        domProps: {
          checked: isInputActive // required
        },
        on: {
          input: function input(evt) {
            evt.stopPropagation();
          },
          change: function change() {
            if (props.inputType === INPUT_TYPE_CHECKBOX) {
              var valueCopied = props.value.slice();
              if (isInputActive) {
                valueCopied.splice(valueCopied.indexOf(props.inputValue), 1);
              } else {
                valueCopied.push(props.inputValue);
              }
              listeners['input'](valueCopied);
            } else {
              listeners['input'](props.inputValue);
            }
          }
        }
      }), children];
    } else if (props.justified) {
      // is in justified btn-group
      tag = BtnGroup;
      options = {};
      slot = [h('button', mergeData(data, {
        on: on,
        class: classes,
        attrs: {
          type: props.nativeType,
          disabled: props.disabled
        }
      }), children)];
    } else {
      // is button
      tag = 'button';
      slot = children;
      options = mergeData(data, {
        on: on,
        class: classes,
        attrs: {
          type: props.nativeType,
          disabled: props.disabled
        }
      });
    }

    return h(tag, options, slot);
  },

  props: {
    justified: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: 'default'
    },
    nativeType: {
      type: String,
      default: 'button'
    },
    size: String,
    block: {
      type: Boolean,
      default: false
    },
    active: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    // <input> props
    value: null,
    inputValue: null,
    inputType: {
      type: String,
      validator: function validator(value) {
        return value === INPUT_TYPE_CHECKBOX || value === INPUT_TYPE_RADIO;
      }
    }
  }
};

export default Btn;
//# sourceMappingURL=Btn.js.map


text:
import os.path
import sys
import dsltool

#
# When the DSL is executed, the methods and attributes of these objects
# are called
#

class Ingredients(object):

    def __init__(self):

        # special list that allows += to add items
        self.add = dsltool.ItemList()

class Steps(object):
    '''Example of how to record whatever the user throws at you'''

    def __init__(self):
        self._steps = []

    def __getattr__(self, name):
        return lambda *args: self._steps.append([name] + list(args))

class Instructions(object):
    preheat_oven = None

    #
    # When the DSL is executed, attributes that have a class object assigned
    # to them are used by the DSL in 'with' statements. The attribute
    # must be a snake cased version of the class name.
    #

    ingredients = Ingredients
    steps = Steps

    def __init__(self, name):
        self.name = name

class Recipe(object):
    '''This is the base object, so the DSL code is interpreted with this
       object's methods/attributes as its context'''

    author = None
    level = None

    def __init__(self):
        self.instructions = dsltool.list_of(Instructions)

#
# Main
#

if __name__ == '__main__':

    if len(sys.argv) == 1:
        filename = os.path.join(os.path.dirname(__file__), 'cookies.pydsl')
    else:
        filename = sys.argv[1]

    recipe = dsltool.parse_dsl_file(filename, Recipe())

    # display the parsed recipe
    print 'Author: %s' % recipe.author
    print 'Level : %s' % recipe.level

    for instructions in recipe.instructions:
        print 'Instructions for %s:' % instructions.name
        print '  Preheat oven: %s' % instructions.preheat_oven
        print '  Ingredients:'

        if instructions.ingredients is not None:
            for quantity, ingredient in instructions.ingredients.add:
                print '    %s %s' % (quantity, ingredient)

        print '  Steps:'
        if instructions.steps is not None:
            for step in instructions.steps._steps:
                print '    %s' % ' '.join(step)


text:
const express = require('express');
const fetch = require('node-fetch');
const passport = require('../../passport');

const app = express();

app.get('/login', passport.authenticate('vkontakte'));

app.get(
    '/callback',
    passport.authenticate('vkontakte', { failureRedirect: '/' }),
    (req, res) => {
        setTimeout(() => {
            req.session.vkontakte = req.user.vkontakte.accessToken;
            res.send('<script>window.close();</script>')
        })
    }
);

module.exports = app;


text:
<!DOCTYPE html>

	<title>Cadastro de cerveja</title>

	<link rel="stylesheet" th:href="@{/stylesheets/vendors/upload.min.css}"/>

Cadastro de cerveja

Edição de cerveja

							 Pesquisa de cervejas

		<form method="POST" th:object="${cerveja}" th:action="${cerveja.nova} ? @{/cervejas/novo} : @{/cervejas/{codigo}(codigo=${cerveja.codigo})}" class="form-vertical  js-form-loading">
			<brewer:message/>

			<input type="hidden" th:field="*{codigo}"/>

					SKU
					<input id="sku" type="text" class="form-control" th:field="*{sku}"/>

					Nome
					<input id="nome" type="text" class="form-control" th:field="*{nome}"/>

				Descrição
				<textarea id="descricao" rows="3" class="form-control" th:field="*{descricao}"></textarea>

					Estilo

							<select id="estilo" class="form-control" th:field="*{estilo}">
								<option value="">Selecione o estilo</option>
								<option th:each="estilo : ${estilos}" th:value="${estilo.codigo}" th:text="${estilo.nome}">Pale lager</option>
							</select>

					Sabor
					<select id="sabor" class="form-control" th:field="*{sabor}">
						<option value="">Selecione o sabor</option>
						<option th:each="sabor : ${sabores}" th:value="${sabor}" th:text="${sabor.descricao}">Adocicada</option>
					</select>

					Teor alcoólico

						<input id="teorAlcoolico" type="text" class="form-control js-decimal" th:field="*{teorAlcoolico}"/>

%

					Origem

								<input th:id="|id_${origem}|" type="radio" th:value="${origem}" th:field="*{origem}">
								Nacional

					Valor

R$

						<input id="valor" type="text" class="form-control js-decimal" th:field="*{valor}"/>

					Comissão

						<input id="comissao" type="text" class="form-control js-decimal" th:field="*{comissao}"/>

%

					Estoque
					<input id="estoque" type="text" class="form-control js-plain" th:field="*{quantidadeEstoque}"/>

					<input type="hidden" th:field="*{foto}"/>
					<input type="hidden" th:field="*{contentType}"/>
					<input type="hidden" th:field="*{novaFoto}"/>

					Foto

							Arraste a foto aqui ou
							selecione<input id="upload-select" type="file" accept=".jpg,.jpeg,.png"/>

				<button class="btn  btn-primary" type="submit">Salvar</button>

		</form>


text:
package jp.coppermine.samples.hk2.named;

import javax.inject.Named;

import org.jvnet.hk2.annotations.Service;

@Named("English")
@Service
public class HelloImpl implements Hello {

    @Override
    public String say() {
        return "Hello";
    }

}


text:
/*===-- include/llvm-c/DataTypes.h - Define fixed size types ------*- C -*-===*\
|*                                                                            *|
|*                     The LLVM Compiler Infrastructure                       *|
|*                                                                            *|
|* This file is distributed under the University of Illinois Open Source      *|
|* License. See LICENSE.TXT for details.                                      *|
|*                                                                            *|
|*===----------------------------------------------------------------------===*|
|*                                                                            *|
|* This file contains definitions to figure out the size of _HOST_ data types.*|
|* This file is important because different host OS's define different macros,*|
|* which makes portability tough.  This file exports the following            *|
|* definitions:                                                               *|
|*                                                                            *|
|*   [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
|*   [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.     *|
|*                                                                            *|
|* No library is required when using these functions.                         *|
|*                                                                            *|
|*===----------------------------------------------------------------------===*/

/* Please leave this file C-compatible. */

#ifndef LLVM_C_DATATYPES_H
#define LLVM_C_DATATYPES_H

#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif

#include <inttypes.h>
#include <stdint.h>

#ifndef _MSC_VER

#if !defined(UINT32_MAX)
# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
        "__STDC_LIMIT_MACROS before #including llvm-c/DataTypes.h"
#endif

#if !defined(UINT32_C)
# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
        "__STDC_CONSTANT_MACROS before #including llvm-c/DataTypes.h"
#endif

/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
#include <sys/types.h>

#ifdef _AIX
// GCC is strict about defining large constants: they must have LL modifier.
#undef INT64_MAX
#undef INT64_MIN
#endif

#else /* _MSC_VER */
#ifdef __cplusplus
#include <cstddef>
#include <cstdlib>
#else
#include <stddef.h>
#include <stdlib.h>
#endif
#include <sys/types.h>

#if defined(_WIN64)
typedef signed __int64 ssize_t;
#else
typedef signed int ssize_t;
#endif /* _WIN64 */

#endif /* _MSC_VER */

/* Set defaults for constants which we cannot find. */
#if !defined(INT64_MAX)
# define INT64_MAX 9223372036854775807LL
#endif
#if !defined(INT64_MIN)
# define INT64_MIN ((-INT64_MAX)-1)
#endif
#if !defined(UINT64_MAX)
# define UINT64_MAX 0xffffffffffffffffULL
#endif

#ifndef HUGE_VALF
#define HUGE_VALF (float)HUGE_VAL
#endif

#endif /* LLVM_C_DATATYPES_H */


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xerces-C++: DOMLSParserFilter.hpp File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Related Pages

Classes

Files

DOMLSParserFilter.hpp File Reference

Go to the source code of this file.

Classes

class  	DOMLSParserFilter

Defines

#define 	XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP

Define Documentation

          #define XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP

<address style="text-align: right;">Generated on Wed Apr 21 17:55:49 2010 for Xerces-C++ by

 1.5.6 </address>