text:
''' SortedCollection overlays the bisect functionality to utilize quick
    access to sorted lists.
'''

from bisect import bisect_left, bisect_right

class SortedCollection(object):
    ''' Sequence sorted by a key function.

    SortedCollection() is much easier to work with than using bisect() directly.
    It supports key functions like those use in sorted(), min(), and max().
    The result of the key function call is saved so that keys can be searched
    efficiently.

    Instead of returning an insertion-point which can be hard to interpret, the
    five find-methods return a specific item in the sequence. They can scan for
    exact matches, the last item less-than-or-equal to a key, or the first item
    greater-than-or-equal to a key.

    Once found, an item's ordinal position can be located with the index()
    method.  New items can be added with the insert() and insert_right()
    methods.  Old items can be deleted with the remove() method.

    The usual sequence methods are provided to support indexing, slicing,
    length lookup, clearing, copying, forward and reverse iteration, contains
    checking, item counts, item removal, and a nice looking repr.

    Finding and indexing are O(log n) operations while iteration and insertion
    are O(n).  The initial sort is O(n log n).

    The key function is stored in the 'key' attibute for easy introspection or
    so that you can assign a new key function (triggering an automatic re-sort).

    In short, the class was designed to handle all of the common use cases for
    bisect but with a simpler API and support for key functions.

    >>> from pprint import pprint
    >>> from operator import itemgetter

    >>> s = SortedCollection(key=itemgetter(2))
    >>> for record in [
    ...         ('roger', 'young', 30),
    ...         ('angela', 'jones', 28),
    ...         ('bill', 'smith', 22),
    ...         ('david', 'thomas', 32)]:
    ...     s.insert(record)

    >>> pprint(list(s))         # show records sorted by age
    [('bill', 'smith', 22),
     ('angela', 'jones', 28),
     ('roger', 'young', 30),
     ('david', 'thomas', 32)]

    >>> s.find_le(29)           # find oldest person aged 29 or younger
    ('angela', 'jones', 28)
    >>> s.find_lt(28)           # find oldest person under 28
    ('bill', 'smith', 22)
    >>> s.find_gt(28)           # find youngest person over 28
    ('roger', 'young', 30)

    >>> r = s.find_ge(32)       # find youngest person aged 32 or older
    >>> s.index(r)              # get the index of their record
    3
    >>> s[3]                    # fetch the record at that index
    ('david', 'thomas', 32)

    >>> s.key = itemgetter(0)   # now sort by first name
    >>> pprint(list(s))
    [('angela', 'jones', 28),
     ('bill', 'smith', 22),
     ('david', 'thomas', 32),
     ('roger', 'young', 30)]

    '''

    def __init__(self, iterable=(), key=None):
        self._given_key = key
        key = (lambda x: x) if key is None else key
        decorated = sorted((key(item), item) for item in iterable)
        self._keys = [k for k, item in decorated]
        self._items = [item for k, item in decorated]
        self._key = key

    def _getkey(self):
        ''' Property function returns the _key'''
        return self._key
    def _setkey(self, key):
        ''' Property function sets a key if it doesn't exist.'''
        if key is not self._key:
            self.__init__(self._items, key=key)
    def _delkey(self):
        ''' Property function removes the _key'''
        self._setkey(None)
    key = property(_getkey, _setkey, _delkey, 'key function')

    def clear(self):
        ''' clears the collection.'''
        self.__init__([], self._key)

    def copy(self):
        ''' returns a shallow copy of the collection.'''
        return self.__class__(self, self._key)

    def __len__(self):
        return len(self._items)

    def __getitem__(self, idx):
        return self._items[idx]

    def __iter__(self):
        return iter(self._items)

    def __reversed__(self):
        return reversed(self._items)

    def __repr__(self):
        return '%s(%r, key=%s)' % (
            self.__class__.__name__,
            self._items,
            getattr(self._given_key, '__name__', repr(self._given_key))
        )

    def __reduce__(self):
        return self.__class__, (self._items, self._given_key)

    def __contains__(self, item):
        k = self._key(item)
        i = bisect_left(self._keys, k)
        j = bisect_right(self._keys, k)
        return item in self._items[i:j]

    def index(self, item):
        'Find the position of an item.  Raise ValueError if not found.'
        k = self._key(item)
        i = bisect_left(self._keys, k)
        j = bisect_right(self._keys, k)
        return self._items[i:j].index(item) + i

    def count(self, item):
        'Return number of occurrences of item'
        k = self._key(item)
        i = bisect_left(self._keys, k)
        j = bisect_right(self._keys, k)
        return self._items[i:j].count(item)

    def insert(self, item):
        'Insert a new item.  If equal keys are found, add to the left'
        k = self._key(item)
        i = bisect_left(self._keys, k)
        self._keys.insert(i, k)
        self._items.insert(i, item)

    def insert_right(self, item):
        'Insert a new item.  If equal keys are found, add to the right'
        k = self._key(item)
        i = bisect_right(self._keys, k)
        self._keys.insert(i, k)
        self._items.insert(i, item)

    def remove(self, item):
        'Remove first occurence of item.  Raise ValueError if not found'
        i = self.index(item)
        del self._keys[i]
        del self._items[i]

    def pop(self, idx=-1):
        ''' Removes the item with the index i from the array and returns
            it. The optional argument defaults to -1, so that by default
            the last item is removed and returned.
        '''
        rtn = self._items[idx]
        del self._keys[idx]
        del self._items[idx]
        return rtn

    def find(self, k):
        'Return first item with a key == k.  Raise ValueError if not found.'
        i = bisect_left(self._keys, k)
        if i != len(self) and self._keys[i] == k:
            return self._items[i]
        raise ValueError('No item found with key equal to: %r' % (k,))

    def find_all_indexes(self, item):
        'Get a range of indexes that have the same key as the item.'
        k = self._key(item)
        i = bisect_left(self._keys, k)
        j = bisect_right(self._keys, k)
        return range(i, j + 1)

    def find_le(self, k):
        'Return last item with a key <= k.  Raise ValueError if not found.'
        i = bisect_right(self._keys, k)
        if i:
            return self._items[i-1]
        raise ValueError('No item found with key at or below: %r' % (k,))

    def find_lt(self, k):
        'Return last item with a key < k.  Raise ValueError if not found.'
        i = bisect_left(self._keys, k)
        if i:
            return self._items[i-1]
        raise ValueError('No item found with key below: %r' % (k,))

    def find_ge(self, k):
        ''' Return first item with a key >= equal to k.  Raise ValueError
            if not found.
        '''
        i = bisect_left(self._keys, k)
        if i != len(self):
            return self._items[i]
        raise ValueError('No item found with key at or above: %r' % (k,))

    def find_gt(self, k):
        'Return first item with a key > k.  Raise ValueError if not found'
        i = bisect_right(self._keys, k)
        if i != len(self):
            return self._items[i]
        raise ValueError('No item found with key above: %r' % (k,))

# ---------------------------  Simple demo and tests  -------------------------
if __name__ == '__main__':

    def ve2no(funk, *args):
        'Convert ValueError result to -1'
        try:
            return funk(*args)
        except ValueError:
            return -1

    def slow_index(seq, k):
        'Location of match or -1 if not found'
        for i, item in enumerate(seq):
            if item == k:
                return i
        return -1

    def slow_find(seq, k):
        'First item with a key equal to k. -1 if not found'
        for item in seq:
            if item == k:
                return item
        return -1

    def slow_find_le(seq, k):
        'Last item with a key less-than or equal to k.'
        for item in reversed(seq):
            if item <= k:
                return item
        return -1

    def slow_find_lt(seq, k):
        'Last item with a key less-than k.'
        for item in reversed(seq):
            if item < k:
                return item
        return -1

    def slow_find_ge(seq, k):
        'First item with a key-value greater-than or equal to k.'
        for item in seq:
            if item >= k:
                return item
        return -1

    def slow_find_gt(seq, k):
        'First item with a key-value greater-than or equal to k.'
        for item in seq:
            if item > k:
                return item
        return -1

    def main():
        # Calling restricted members in testing
        # pylint: disable=W0212

        'Main execution of tests.'
        from random import choice
        pool = [1.5, 2, 2.0, 3, 3.0, 3.5, 4, 4.0, 4.5]
        for _ in range(500):
            for valn in range(6):
                srtd = [choice(pool) for valj in range(valn)]
                scol = SortedCollection(srtd)
                srtd.sort()
                for probe in pool:
                    assert repr(ve2no(scol.index, probe)) == repr \
                        (slow_index(srtd, probe))
                    assert repr(ve2no(scol.find, probe)) == repr \
                        (slow_find(srtd, probe))
                    assert repr(ve2no(scol.find_le, probe)) == repr \
                        (slow_find_le(srtd, probe))
                    assert repr(ve2no(scol.find_lt, probe)) == repr \
                        (slow_find_lt(srtd, probe))
                    assert repr(ve2no(scol.find_ge, probe)) == repr \
                        (slow_find_ge(srtd, probe))
                    assert repr(ve2no(scol.find_gt, probe)) == repr \
                        (slow_find_gt(srtd, probe))
                for valj, item in enumerate(srtd):
                    assert repr(item) == repr(scol[valj])    # test __getitem__
                    assert item in scol   # test __contains__ and __iter__
                    assert srtd.count(item) == scol.count(item) # test count()
                assert len(scol) == valn                     # test __len__
                assert list(map(repr, reversed(scol))) \
                     == list(map(repr, reversed(srtd)))   # test __reversed__
                assert list(scol.copy()) == list(scol)       # test copy()
                scol.clear()                                 # test clear()
                assert len(scol) == 0

        nextsc = SortedCollection('The quick Brown Fox jumped'.split(),
                                  key=str.lower)
        assert nextsc._keys == ['brown', 'fox', 'jumped', 'quick', 'the']
        assert nextsc._items == ['Brown', 'Fox', 'jumped', 'quick', 'The']
        assert nextsc._key == str.lower
        assert repr(nextsc) == "SortedCollection(['Brown', 'Fox', " \
            + "'jumped', 'quick', 'The'], key=lower)"
        nextsc.key = str.upper
        assert nextsc._key == str.upper
        assert len(nextsc) == 5
        assert list(reversed(nextsc)) == ['The', 'quick', 'jumped',
                                          'Fox', 'Brown']
        for item in nextsc:
            assert item in nextsc
        for i, item in enumerate(nextsc):
            assert item == nextsc[i]
        nextsc.insert('jUmPeD')
        nextsc.insert_right('QuIcK')
        assert nextsc._keys == ['BROWN', 'FOX', 'JUMPED', 'JUMPED', 'QUICK',
                                'QUICK', 'THE']
        assert nextsc._items == ['Brown', 'Fox', 'jUmPeD', 'jumped', 'quick',
                                 'QuIcK', 'The']
        assert nextsc.find_le('JUMPED') == 'jumped', nextsc.find_le('JUMPED')
        assert nextsc.find_ge('JUMPED') == 'jUmPeD'
        assert nextsc.find_le('GOAT') == 'Fox'
        assert nextsc.find_ge('GOAT') == 'jUmPeD'
        assert nextsc.find('FOX') == 'Fox'
        assert nextsc[3] == 'jumped'
        assert nextsc[3:5] == ['jumped', 'quick']
        assert nextsc[-2] == 'QuIcK'
        assert nextsc[-4:-2] == ['jumped', 'quick']
        for i, item in enumerate(nextsc):
            assert nextsc.index(item) == i
        try:
            nextsc.index('xyzpdq')
        except ValueError:
            pass
        else:
            assert 0, 'Oops, failed to notify of missing value'
        nextsc.remove('jumped')
        assert list(nextsc) == ['Brown', 'Fox', 'jUmPeD', 'quick',
                                'QuIcK', 'The']

        import doctest
        print(doctest.testmod())

    # Execute
    main()


text:
<?php
/**
 * Created by IntelliJ IDEA.
 * User: gerk
 * Date: 25.12.16
 * Time: 21:01
 */
declare(strict_types=1);

namespace PeekAndPoke\AviatorAllRounder;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Cache\ApcuCache;
use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Cache\CacheProvider;
use Doctrine\Common\Cache\FilesystemCache;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Profiling\Middleware;
use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use PeekAndPoke\Aviator\Authentication\Authenticator;
use PeekAndPoke\Aviator\Authentication\User;
use PeekAndPoke\Aviator\Aviator;
use PeekAndPoke\Aviator\Cache\CacheRecorder;
use PeekAndPoke\Aviator\Cache\ProfilingCacheDecorator;
use PeekAndPoke\Aviator\ErrorHandling\DebugErrorHandler;
use PeekAndPoke\Aviator\ErrorHandling\ErrorHandler;
use PeekAndPoke\Aviator\ErrorHandling\LiveErrorHandler;
use PeekAndPoke\Aviator\I18n\Translator;
use PeekAndPoke\Aviator\Mvc\MvcModule;
use PeekAndPoke\Aviator\Mvc\Security\AccessDecisionMaker;
use PeekAndPoke\Aviator\Mvc\Security\AccessDecisionMakerChain;
use PeekAndPoke\Aviator\Mvc\Security\CanAccessProtectedEndpoint;
use PeekAndPoke\Aviator\Mvc\View\ClearView\ClearView;
use PeekAndPoke\Aviator\Mvc\View\ViewEngine;
use PeekAndPoke\Aviator\Net\HttpClientRecorder;
use PeekAndPoke\Aviator\ServiceContainer\Annotation\Di;
use PeekAndPoke\Aviator\ServiceContainer\Environment;
use PeekAndPoke\Aviator\Session\NativeSessionHandler;
use Psr\Log\LoggerInterface;

/**
 * @Di\ServiceFactory("aviator.all-rounder.defaults")
 *
 * @author Karsten J. Gerber <kontakt@karsten-gerber.de>
 */
class AviatorAllRounderDefaults
{
    /**
     * @Di\Service("aviator.error-handler")
     * @Di\Apply\IfConfig("! env.devMode")
     *
     * @return ErrorHandler
     */
    public function createErrorHandler() : ErrorHandler
    {
        return new LiveErrorHandler();
    }

    /**
     * @Di\Service("aviator.error-handler")
     * @Di\Apply\IfConfig("env.devMode")
     *
     * @return ErrorHandler
     */
    public function createErrorHandlerForDevMode() : ErrorHandler
    {
        return new DebugErrorHandler();
    }

    /**
     * @Di\Service("session.handler")
     */
    public function createSessionHandler() : \SessionHandlerInterface
    {
        return new NativeSessionHandler(
            ini_get('session.save_path'),
            (int) ini_get('session.gc_maxlifetime')
        );
    }

    /**
     * @Di\Service(User::SERVICE_ID)
     *
     * @param Authenticator $authenticator
     *
     * @return User
     */
    public function getCurrentUser(Authenticator $authenticator) : User
    {
        return $authenticator->getCurrentUser();
    }

    /**
     * @Di\Service(AccessDecisionMaker::ID)
     *
     * @param User $user
     *
     * @return AccessDecisionMaker
     */
    public function createAccessDecisionMaker(User $user) : AccessDecisionMaker
    {
        return new AccessDecisionMakerChain([
            new CanAccessProtectedEndpoint($user),
        ]);
    }

    /**
     * @Di\Service("mvc.view-engine", singleton=false)
     *
     * @param Environment $environment
     * @param Translator  $translator
     * @param MvcModule[] $modules
     *
     * @Di\Inject\ByType("modules", type=MvcModule::class)
     *
     * @return ViewEngine
     */
    public function createViewEngine(Environment $environment, Translator $translator, array $modules) : ViewEngine
    {
        $moduleDirs = [];

        foreach ($modules as $module) {
            $moduleDirs[$module->getName()] = $module->getViewDirectory();
        }

        return new ClearView($environment->isDevMode(), $translator, $moduleDirs);
    }

    /**
     * @Di\Service("logger")
     *
     * @return LoggerInterface
     */
    public function createLogger() : LoggerInterface
    {
        return new Logger(
            'aviator',
            [
                new RotatingFileHandler('/tmp/tower.log', 10, Logger::DEBUG, true, 0776),
                new ErrorLogHandler(),
            ]
        );
    }

    /**
     * @Di\Service("cache")
     * @Di\Apply\IfConfig("! env.devMode")
     *
     * @param Environment $env
     *
     * @return CacheProvider
     */
    public function createCache(Environment $env) : CacheProvider
    {
        if (extension_loaded('apcu')) {
            $cache = new ApcuCache();
        } else {
            $cache = new FilesystemCache(Aviator::getInstallDir() . '/tmp/cache/');
        }

        $cache->setNamespace($env->getName() . ($env->isDevMode() ? '-dev' : ''));

        return $cache;
    }

    /**
     * @Di\Service("cache")
     * @Di\Apply\IfConfig("env.devMode")
     *
     * @param CacheRecorder $recorder
     * @param Environment   $env
     *
     * @return CacheProvider
     */
    public function createCacheForDevMode(CacheRecorder $recorder, Environment $env) : CacheProvider
    {
        return new ProfilingCacheDecorator(
            $this->createCache($env), // TODO: we need service decorators so we can avoid the hard call to createCache here
            $recorder
        );
    }

    /**
     * @Di\Service("annotation.reader")
     *
     * @param Cache       $cache
     * @param Environment $environment
     *
     * @return Reader
     */
    public function createAnnotationReader(Cache $cache, Environment $environment) : Reader
    {
        AnnotationRegistry::registerLoader(function ($class) {
            return class_exists($class) || interface_exists($class) || trait_exists($class);
        });

        return new CachedReader(new AnnotationReader(), $cache, $environment->isDevMode());
    }

    /**
     * @Di\Service("aviator.net.http-client", singleton=false)
     * @Di\Apply\IfConfig("! env.devMode")
     *
     * @return Client
     */
    public function createHttpClient() : Client
    {
        return new Client();
    }

    /**
     * @Di\Service("aviator.net.http-client", singleton=false)
     * @Di\Apply\IfConfig("env.devMode")
     *
     * @param HttpClientRecorder $recorder
     *
     * @return Client
     */
    public function createHttpClientForDevMode(HttpClientRecorder $recorder) : Client
    {
        $client = $this->createHttpClient(); // TODO: we need service decorators so we can avoid the hard call to createCache here

        /** @var HandlerStack $stack */
        $stack = $client->getConfig('handler');

        if ($stack instanceof HandlerStack) {
            $stack->unshift(new Middleware($recorder), 'profiler');
        }

        return $client;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.typesafe.config

class ConfigValueType private() {}
object ConfigValueType {
  val OBJECT, LIST, NUMBER, BOOLEAN, NULL, STRING = new ConfigValueType()
}


text:
function literalText = escapeAllCharacters(text)
% Escapes all special characters in a text string to produce a literal text
% string.
%
% https://stackoverflow.com/questions/15486611/how-to-add-before-all-special-characters-in-matlab

%%

literalText = regexprep(text, '([[\]{}()=''.(),\;:%%{%}!@])|_', '\\$0');

end


text:
FROM gcr.io/oss-fuzz-base/base-builder-python
RUN git clone https://github.com/googleapis/python-crc32c
COPY build.sh *.py $SRC/
WORKDIR python-crc32c


text:
package fredboat.command.music.seeking;

import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import fredboat.audio.player.GuildPlayer;
import fredboat.audio.player.PlayerRegistry;
import fredboat.audio.queue.AudioTrackContext;
import fredboat.command.util.HelpCommand;
import fredboat.commandmeta.abs.Command;
import fredboat.commandmeta.abs.CommandContext;
import fredboat.commandmeta.abs.ICommandRestricted;
import fredboat.commandmeta.abs.IMusicCommand;
import fredboat.messaging.internal.Context;
import fredboat.perms.PermissionLevel;
import fredboat.util.TextUtils;

import javax.annotation.Nonnull;

public class ForwardCommand extends Command implements IMusicCommand, ICommandRestricted {

    public ForwardCommand(String name, String... aliases) {
        super(name, aliases);
    }

    @Override
    public void onInvoke(@Nonnull CommandContext context) {
        GuildPlayer player = PlayerRegistry.getExisting(context.guild);

        if(player == null || player.isQueueEmpty()) {
            context.replyWithName(context.i18n("unpauseQueueEmpty"));
            return;
        }

        if (!context.hasArguments()) {
            HelpCommand.sendFormattedCommandHelp(context);
            return;
        }

        long t;
        try {
            t = TextUtils.parseTimeString(context.args[0]);
        } catch (IllegalStateException e){
            HelpCommand.sendFormattedCommandHelp(context);
            return;
        }

        AudioTrackContext atc = player.getPlayingTrack();
        AudioTrack at = atc.getTrack();

        //Ensure bounds
        t = Math.max(0, t);
        t = Math.min(atc.getEffectiveDuration(), t);

        player.seekTo(player.getPosition() + t);
        context.reply(context.i18nFormat("fwdSuccess", atc.getEffectiveTitle(), TextUtils.formatTime(t)));
    }

    @Nonnull
    @Override
    public String help(@Nonnull Context context) {
        String usage = "{0}{1} [[hh:]mm:]ss\n#";
        String example = "  {0}{1} 2:30";
        return usage + context.i18n("helpForwardCommand") + example;
    }

    @Nonnull
    @Override
    public PermissionLevel getMinimumPerms() {
        return PermissionLevel.DJ;
    }
}


text:
SWIFT_VER="5.1.3"

if [[ $TRAVIS_OS_NAME = 'osx' ]]; then
  swiftformat --lint . && swiftlint
elif [[ $TRAVIS_OS_NAME = 'linux' ]]; then
  # What to do in Ubunutu
  RELEASE_DOT=$(lsb_release -r)
  RELEASE_NUM=$(cut -f2 <<< "$RELEASE_DOT")
  export PATH="${PWD}/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}/usr/bin:$PATH"
fi

swift build
swift test  --enable-code-coverage

if [[ $TRAVIS_OS_NAME = 'osx' ]]; then
  xcrun llvm-cov export -format="lcov" .build/debug/${{FRAMEWORK_NAME}}PackageTests.xctest/Contents/MacOS/${{FRAMEWORK_NAME}}PackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
  bash <(curl https://codecov.io/bash) -F travis -F macOS -n $TRAVIS_JOB_NUMBER-$TRAVIS_OS_NAME
else
  llvm-cov export -format="lcov" .build/x86_64-unknown-linux/debug/${{FRAMEWORK_NAME}}PackageTests.xctest -instr-profile .build/debug/codecov/default.profdata > info.lcov
  bash <(curl https://codecov.io/bash) -F travis -F bionic -n $TRAVIS_JOB_NUMBER-$TRAVIS_OS_NAME
fi

if [[ $TRAVIS_OS_NAME = 'osx' ]]; then
  swift package dump-package | jq -e ".products | length > 0"
  pod lib lint
  swift package generate-xcodeproj
  pod install --project-directory=Example
  ./Example/Shared/autorevision/autorevision.sh -t swift > Example/Source/VCS.swift
  xcodebuild -workspace Example/Examples.xcworkspace -scheme "iOS Example"  ONLY_ACTIVE_ARCH=NO  CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO  CODE_SIGNING_ALLOWED=NO
  xcodebuild -workspace Example/Examples.xcworkspace -scheme "tvOS Example"  ONLY_ACTIVE_ARCH=NO   CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO  CODE_SIGNING_ALLOWED=NO
  xcodebuild -workspace Example/Examples.xcworkspace -scheme "macOS Example"  ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO  CODE_SIGNING_ALLOWED=NO
fi


text:
var containerRepository = require('../lib/container-repository'),
    expect = require("chai").expect;

describe("Container repository", function(){
	describe("create()", function(){
		it("should initialize an empty set", function() {
			var repository = containerRepository.create();
			expect(repository.get()).to.be.empty;
		});

		it("should add containers", function() {
			var repository = containerRepository.create();
			repository.add({ Id: "1a2b3c" });
			repository.add({ Id: "2a3b4c" });
			expect(repository.get()[0].Id).to.eq("1a2b3c");
			expect(repository.get()[1].Id).to.eq("2a3b4c");
		});

		it("should remove containers", function() {
			var repository = containerRepository.create();
			repository.add({ Id: "1a2b3c" });
			repository.add({ Id: "2a3b4c" });
			repository.add({ Id: "3a4b5c" });
			repository.remove("2a3b4c");
			expect(repository.get()[0].Id).to.eq("1a2b3c");
			expect(repository.get()[1].Id).to.eq("3a4b5c");

			repository.remove("4a5b6c");
			expect(repository.get().length).to.eq(2);

			repository.remove("1a2b3c");
			expect(repository.get()[0].Id).to.eq("3a4b5c");
		});

		it("should clear containers", function() {
			var repository = containerRepository.create();
			repository.add({ Id: "1a2b3c" });
			repository.add({ Id: "2a3b4c" });
			expect(repository.get()[0].Id).to.eq("1a2b3c");
			expect(repository.get()[1].Id).to.eq("2a3b4c");
			expect(repository.get().length).to.eq(2);

			repository.clear();
			expect(repository.get().length).to.eq(0);
			repository.add({ Id: "1a2b3c" });
			expect(repository.get()[0].Id).to.eq("1a2b3c");
			expect(repository.get().length).to.eq(1);
		});
	});
});


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

  <title>LLVM's Analysis and Transform Passes</title>
  <link rel="stylesheet" href="llvm.css" type="text/css">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

LLVM's Analysis and Transform Passes

Introduction

Analysis Passes

Transform Passes

Utility Passes

Written by Reid Spencer
            and Gordon Henriksen

 Introduction

This document serves as a high level summary of the optimization features
  that LLVM provides. Optimizations are implemented as Passes that traverse some
  portion of a program to either collect information or transform the program.
  The table below divides the passes that LLVM provides into three categories.
  Analysis passes compute information that other passes can use or for debugging
  or program visualization purposes. Transform passes can use (or invalidate)
  the analysis passes. Transform passes all mutate the program in some way.
  Utility passes provides some utility but don't otherwise fit categorization.
  For example passes to extract functions to bitcode or write a module to
  bitcode are neither analysis nor transform passes.

The table below provides a quick summary of each pass and links to the more
  complete pass description later in the document.

ANALYSIS PASSES

Option	Name

-aa-eval	Exhaustive Alias Analysis Precision Evaluator

-basicaa	Basic Alias Analysis (default AA impl)

-basiccg	Basic CallGraph Construction

-codegenprepare	Optimize for code generation

-count-aa	Count Alias Analysis Query Responses

-debug-aa	AA use debugger

-domfrontier	Dominance Frontier Construction

-domtree	Dominator Tree Construction

-dot-callgraph	Print Call Graph to 'dot' file

-dot-cfg	Print CFG of function to 'dot' file

-dot-cfg-only	Print CFG of function to 'dot' file (with no function bodies)

-globalsmodref-aa	Simple mod/ref analysis for globals

-instcount	Counts the various types of Instructions

-intervals	Interval Partition Construction

-loops	Natural Loop Construction

-memdep	Memory Dependence Analysis

-no-aa	No Alias Analysis (always returns 'may' alias)

-no-profile	No Profile Information

-postdomfrontier	Post-Dominance Frontier Construction

-postdomtree	Post-Dominator Tree Construction

-print-alias-sets	Alias Set Printer

-print-callgraph	Print a call graph

-print-callgraph-sccs	Print SCCs of the Call Graph

-print-cfg-sccs	Print SCCs of each function CFG

-print-externalfnconstants	Print external fn callsites passed constants

-print-function	Print function to stderr

-print-module	Print module to stderr

-print-used-types	Find Used Types

-profile-loader	Load profile information from llvmprof.out

-scalar-evolution	Scalar Evolution Analysis

-targetdata	Target Data Layout

TRANSFORM PASSES

Option	Name

-adce	Aggressive Dead Code Elimination

-argpromotion	Promote 'by reference' arguments to scalars

-block-placement	Profile Guided Basic Block Placement

-break-crit-edges	Break critical edges in CFG

-codegenprepare	Prepare a function for code generation

-condprop	Conditional Propagation

-constmerge	Merge Duplicate Global Constants

-constprop	Simple constant propagation

-dce	Dead Code Elimination

-deadargelim	Dead Argument Elimination

-deadtypeelim	Dead Type Elimination

-die	Dead Instruction Elimination

-dse	Dead Store Elimination

-globaldce	Dead Global Elimination

-globalopt	Global Variable Optimizer

-gvn	Global Value Numbering

-indmemrem	Indirect Malloc and Free Removal

-indvars	Canonicalize Induction Variables

-inline	Function Integration/Inlining

-insert-block-profiling	Insert instrumentation for block profiling

-insert-edge-profiling	Insert instrumentation for edge profiling

-insert-function-profiling	Insert instrumentation for function profiling

-insert-null-profiling-rs	Measure profiling framework overhead

-insert-rs-profiling-framework	Insert random sampling instrumentation framework

-instcombine	Combine redundant instructions

-internalize	Internalize Global Symbols

-ipconstprop	Interprocedural constant propagation

-ipsccp	Interprocedural Sparse Conditional Constant Propagation

-jump-threading	Thread control through conditional blocks

-lcssa	Loop-Closed SSA Form Pass

-licm	Loop Invariant Code Motion

-loop-deletion	Dead Loop Deletion Pass

-loop-extract	Extract loops into new functions

-loop-extract-single	Extract at most one loop into a new function

-loop-index-split	Index Split Loops

-loop-reduce	Loop Strength Reduction

-loop-rotate	Rotate Loops

-loop-unroll	Unroll loops

-loop-unswitch	Unswitch loops

-loopsimplify	Canonicalize natural loops

-lowerallocs	Lower allocations from instructions to calls

-lowerinvoke	Lower invoke and unwind, for unwindless code generators

-lowersetjmp	Lower Set Jump

-lowerswitch	Lower SwitchInst's to branches

-mem2reg	Promote Memory to Register

-memcpyopt	Optimize use of memcpy and friends

-mergereturn	Unify function exit nodes

-prune-eh	Remove unused exception handling info

-reassociate	Reassociate expressions

-reg2mem	Demote all values to stack slots

-scalarrepl	Scalar Replacement of Aggregates

-sccp	Sparse Conditional Constant Propagation

-simplify-libcalls	Simplify well-known library calls

-simplifycfg	Simplify the CFG

-strip	Strip all symbols from a module

-strip-dead-prototypes	Remove unused function declarations

-sretpromotion	Promote sret arguments

-tailcallelim	Tail Call Elimination

-tailduplicate	Tail Duplication

UTILITY PASSES

Option	Name

-deadarghaX0r	Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)

-extract-blocks	Extract Basic Blocks From Module (for bugpoint use)

-preverify	Preliminary module verification

-verify	Module Verifier

-view-cfg	View CFG of function

-view-cfg-only	View CFG of function (with no function bodies)

 Analysis Passes

This section describes the LLVM Analysis Passes.

  Exhaustive Alias Analysis Precision Evaluator

This is a simple N^2 alias analysis accuracy evaluator.
  Basically, for each function in the program, it simply queries to see how the
  alias analysis implementation answers alias queries between each pair of
  pointers in the function.

This is inspired and adapted from code by: Naveen Neelakantam, Francesco
  Spadini, and Wojciech Stryjewski.

  Basic Alias Analysis (default AA impl)

  This is the default implementation of the Alias Analysis interface
  that simply implements a few identities (two different globals cannot alias,
  etc), but otherwise does no analysis.

  Basic CallGraph Construction

Yet to be written.

  Optimize for code generation

  This pass munges the code in the input function to better prepare it for
  SelectionDAG-based code generation.  This works around limitations in it's
  basic-block-at-a-time approach.  It should eventually be removed.

  Count Alias Analysis Query Responses

  A pass which can be used to count how many alias queries
  are being made and how the alias analysis implementation being used responds.

  AA use debugger

  This simple pass checks alias analysis users to ensure that if they
  create a new value, they do not query AA without informing it of the value.
  It acts as a shim over any other AA pass you want.

  Yes keeping track of every value in the program is expensive, but this is
  a debugging pass.

  Dominance Frontier Construction

  This pass is a simple dominator construction algorithm for finding forward
  dominator frontiers.

  Dominator Tree Construction

  This pass is a simple dominator construction algorithm for finding forward
  dominators.

  Print Call Graph to 'dot' file

  This pass, only available in opt, prints the call graph into a
  .dot graph.  This graph can then be processed with the "dot" tool
  to convert it to postscript or some other suitable format.

  Print CFG of function to 'dot' file

  This pass, only available in opt, prints the control flow graph
  into a .dot graph.  This graph can then be processed with the
  "dot" tool to convert it to postscript or some other suitable format.

  Print CFG of function to 'dot' file (with no function bodies)

  This pass, only available in opt, prints the control flow graph
  into a .dot graph, omitting the function bodies.  This graph can
  then be processed with the "dot" tool to convert it to postscript or some
  other suitable format.

  Simple mod/ref analysis for globals

  This simple pass provides alias and mod/ref information for global values
  that do not have their address taken, and keeps track of whether functions
  read or write memory (are "pure").  For this simple (but very common) case,
  we can provide pretty accurate and useful information.

  Counts the various types of Instructions

  This pass collects the count of all instructions and reports them

  Interval Partition Construction

  This analysis calculates and represents the interval partition of a function,
  or a preexisting interval partition.

  In this way, the interval partition may be used to reduce a flow graph down
  to its degenerate single node interval partition (unless it is irreducible).

  Natural Loop Construction

  This analysis is used to identify natural loops and determine the loop depth
  of various nodes of the CFG.  Note that the loops identified may actually be
  several natural loops that share the same header node... not just a single
  natural loop.

  Memory Dependence Analysis

  An analysis that determines, for a given memory operation, what preceding
  memory operations it depends on.  It builds on alias analysis information, and
  tries to provide a lazy, caching interface to a common kind of alias
  information query.

  No Alias Analysis (always returns 'may' alias)

  Always returns "I don't know" for alias queries.  NoAA is unlike other alias
  analysis implementations, in that it does not chain to a previous analysis. As
  such it doesn't follow many of the rules that other alias analyses must.

  No Profile Information

  The default "no profile" implementation of the abstract
  ProfileInfo interface.

  Post-Dominance Frontier Construction

  This pass is a simple post-dominator construction algorithm for finding
  post-dominator frontiers.

  Post-Dominator Tree Construction

  This pass is a simple post-dominator construction algorithm for finding
  post-dominators.

  Alias Set Printer

Yet to be written.

  Print a call graph

  This pass, only available in opt, prints the call graph to
  standard output in a human-readable form.

  Print SCCs of the Call Graph

  This pass, only available in opt, prints the SCCs of the call
  graph to standard output in a human-readable form.

  Print SCCs of each function CFG

  This pass, only available in opt, prints the SCCs of each
  function CFG to standard output in a human-readable form.

  Print external fn callsites passed constants

  This pass, only available in opt, prints out call sites to
  external functions that are called with constant arguments.  This can be
  useful when looking for standard library functions we should constant fold
  or handle in alias analyses.

  Print function to stderr

  The PrintFunctionPass class is designed to be pipelined with
  other FunctionPasses, and prints out the functions of the module
  as they are processed.

  Print module to stderr

  This pass simply prints out the entire module when it is executed.

  Find Used Types

  This pass is used to seek out all of the types in use by the program.  Note
  that this analysis explicitly does not include types only used by the symbol
  table.

  Load profile information from llvmprof.out

  A concrete implementation of profiling information that loads the information
  from a profile dump file.

  Scalar Evolution Analysis

  The ScalarEvolution analysis can be used to analyze and
  catagorize scalar expressions in loops.  It specializes in recognizing general
  induction variables, representing them with the abstract and opaque
  SCEV class.  Given this analysis, trip counts of loops and other
  important properties can be obtained.

  This analysis is primarily useful for induction variable substitution and
  strength reduction.

  Target Data Layout

Provides other passes access to information on how the size and alignment
  required by the the target ABI for various data types.

 Transform Passes

This section describes the LLVM Transform Passes.

  Aggressive Dead Code Elimination

ADCE aggressively tries to eliminate code. This pass is similar to
  DCE but it assumes that values are dead until proven
  otherwise. This is similar to SCCP, except applied to
  the liveness of values.

  Promote 'by reference' arguments to scalars

  This pass promotes "by reference" arguments to be "by value" arguments.  In
  practice, this means looking for internal functions that have pointer
  arguments.  If it can prove, through the use of alias analysis, that an
  argument is *only* loaded, then it can pass the value into the function
  instead of the address of the value.  This can cause recursive simplification
  of code and lead to the elimination of allocas (especially in C++ template
  code like the STL).

  This pass also handles aggregate arguments that are passed into a function,
  scalarizing them if the elements of the aggregate are only loaded.  Note that
  it refuses to scalarize aggregates which would require passing in more than
  three operands to the function, because passing thousands of operands for a
  large array or structure is unprofitable!

  Note that this transformation could also be done for arguments that are only
  stored to (returning the value instead), but does not currently.  This case
  would be best handled when and if LLVM starts supporting multiple return
  values from functions.

  Profile Guided Basic Block Placement

This pass is a very simple profile guided basic block placement algorithm.
  The idea is to put frequently executed blocks together at the start of the
  function and hopefully increase the number of fall-through conditional
  branches.  If there is no profile information for a particular function, this
  pass basically orders blocks in depth-first order.

  Break critical edges in CFG

  Break all of the critical edges in the CFG by inserting a dummy basic block.
  It may be "required" by passes that cannot deal with critical edges. This
  transformation obviously invalidates the CFG, but can update forward dominator
  (set, immediate dominators, tree, and frontier) information.

  Prepare a function for code generation

  This pass munges the code in the input function to better prepare it for
  SelectionDAG-based code generation. This works around limitations in it's
  basic-block-at-a-time approach. It should eventually be removed.

  Conditional Propagation

This pass propagates information about conditional expressions through the
  program, allowing it to eliminate conditional branches in some cases.

  Merge Duplicate Global Constants

  Merges duplicate global constants together into a single constant that is
  shared.  This is useful because some passes (ie TraceValues) insert a lot of
  string constants into the program, regardless of whether or not an existing
  string is available.

  Simple constant propagation

This file implements constant propagation and merging. It looks for
  instructions involving only constant operands and replaces them with a
  constant value instead of an instruction. For example:

add i32 1, 2

becomes

i32 3

NOTE: this pass has a habit of making definitions be dead.  It is a good
  idea to to run a DIE (Dead Instruction Elimination) pass
  sometime after running this pass.

  Dead Code Elimination

  Dead code elimination is similar to dead instruction
  elimination, but it rechecks instructions that were used by removed
  instructions to see if they are newly dead.

  Dead Argument Elimination

  This pass deletes dead arguments from internal functions.  Dead argument
  elimination removes arguments which are directly dead, as well as arguments
  only passed into function calls as dead arguments of other functions.  This
  pass also deletes dead arguments in a similar way.

  This pass is often useful as a cleanup pass to run after aggressive
  interprocedural passes, which add possibly-dead arguments.

  Dead Type Elimination

  This pass is used to cleanup the output of GCC.  It eliminate names for types
  that are unused in the entire translation unit, using the find used types pass.

  Dead Instruction Elimination

  Dead instruction elimination performs a single pass over the function,
  removing instructions that are obviously dead.

  Dead Store Elimination

  A trivial dead store elimination that only considers basic-block local
  redundant stores.

  Dead Global Elimination

  This transform is designed to eliminate unreachable internal globals from the
  program.  It uses an aggressive algorithm, searching out globals that are
  known to be alive.  After it finds all of the globals which are needed, it
  deletes whatever is left over.  This allows it to delete recursive chunks of
  the program which are unreachable.

  Global Variable Optimizer

  This pass transforms simple global variables that never have their address
  taken.  If obviously true, it marks read/write globals as constant, deletes
  variables only stored to, etc.

  Global Value Numbering

  This pass performs global value numbering to eliminate fully and partially
  redundant instructions.  It also performs redundant load elimination.

  Indirect Malloc and Free Removal

  This pass finds places where memory allocation functions may escape into
  indirect land.  Some transforms are much easier (aka possible) only if free
  or malloc are not called indirectly.

  Thus find places where the address of memory functions are taken and construct
  bounce functions with direct calls of those functions.

  Canonicalize Induction Variables

  This transformation analyzes and transforms the induction variables (and
  computations derived from them) into simpler forms suitable for subsequent
  analysis and transformation.

  This transformation makes the following changes to each loop with an
  identifiable induction variable:

All loops are transformed to have a single canonical
        induction variable which starts at zero and steps by one.

The canonical induction variable is guaranteed to be the first PHI node
        in the loop header block.

Any pointer arithmetic recurrences are raised to use array
        subscripts.

  If the trip count of a loop is computable, this pass also makes the following
  changes:

The exit condition for the loop is canonicalized to compare the
        induction value against the exit value.  This turns loops like:

for (i = 7; i*i < 1000; ++i)

        into

for (i = 0; i != 25; ++i)

Any use outside of the loop of an expression derived from the indvar
        is changed to compute the derived value outside of the loop, eliminating
        the dependence on the exit value of the induction variable.  If the only
        purpose of the loop is to compute the exit value of some derived
        expression, this transformation will make the loop dead.

  This transformation should be followed by strength reduction after all of the
  desired loop transformations have been performed.  Additionally, on targets
  where it is profitable, the loop could be transformed to count down to zero
  (the "do loop" optimization).

  Function Integration/Inlining

  Bottom-up inlining of functions into callees.

  Insert instrumentation for block profiling

  This pass instruments the specified program with counters for basic block
  profiling, which counts the number of times each basic block executes.  This
  is the most basic form of profiling, which can tell which blocks are hot, but
  cannot reliably detect hot paths through the CFG.

  Note that this implementation is very naïve.  Control equivalent regions of
  the CFG should not require duplicate counters, but it does put duplicate
  counters in.

  Insert instrumentation for edge profiling

  This pass instruments the specified program with counters for edge profiling.
  Edge profiling can give a reasonable approximation of the hot paths through a
  program, and is used for a wide variety of program transformations.

  Note that this implementation is very naïve.  It inserts a counter for
  every edge in the program, instead of using control flow information
  to prune the number of counters inserted.

  Insert instrumentation for function profiling

  This pass instruments the specified program with counters for function
  profiling, which counts the number of times each function is called.

  Measure profiling framework overhead

  The basic profiler that does nothing.  It is the default profiler and thus
  terminates RSProfiler chains.  It is useful for  measuring
  framework overhead.

  Insert random sampling instrumentation framework

  The second stage of the random-sampling instrumentation framework, duplicates
  all instructions in a function, ignoring the profiling code, then connects the
  two versions together at the entry and at backedges.  At each connection point
  a choice is made as to whether to jump to the profiled code (take a sample) or
  execute the unprofiled code.

  After this pass, it is highly recommended to runmem2reg
  and adce. instcombine,
  load-vn, gdce, and
  dse also are good to run afterwards.

  Combine redundant instructions

  Combine instructions to form fewer, simple
  instructions.  This pass does not modify the CFG This pass is where algebraic
  simplification happens.

  This pass combines things like:

%Y = add i32 %X, 1
%Z = add i32 %Y, 1

  into:

%Z = add i32 %X, 2

  This is a simple worklist driven algorithm.

  This pass guarantees that the following canonicalizations are performed on
  the program:

If a binary operator has a constant operand, it is moved to the right-
        hand side.

Bitwise operators with constant operands are always grouped so that
        shifts are performed first, then ors, then
        ands, then xors.

Compare instructions are converted from <,
        >, ≤, or ≥ to
        = or ≠ if possible.

All cmp instructions on boolean values are replaced with
        logical operations.

add <var>X</var>, <var>X</var> is represented as
        mul <var>X</var>, 2 ⇒ shl <var>X</var>, 1

Multiplies with a constant power-of-two argument are transformed into
        shifts.

… etc.

  Internalize Global Symbols

  This pass loops over all of the functions in the input module, looking for a
  main function.  If a main function is found, all other functions and all
  global variables with initializers are marked as internal.

  Interprocedural constant propagation

  This pass implements an extremely simple interprocedural constant
  propagation pass.  It could certainly be improved in many different ways,
  like using a worklist.  This pass makes arguments dead, but does not remove
  them.  The existing dead argument elimination pass should be run after this
  to clean up the mess.

  Interprocedural Sparse Conditional Constant Propagation

  An interprocedural variant of Sparse Conditional Constant
  Propagation.

  Thread control through conditional blocks

  Jump threading tries to find distinct threads of control flow running through
  a basic block. This pass looks at blocks that have multiple predecessors and
  multiple successors.  If one or more of the predecessors of the block can be
  proven to always cause a jump to one of the successors, we forward the edge
  from the predecessor to the successor by duplicating the contents of this
  block.

  An example of when this can occur is code like this:

if () { ...
  X = 4;
}
if (X < 3) {

  In this case, the unconditional branch at the end of the first if can be
  revectored to the false side of the second if.

  Loop-Closed SSA Form Pass

  This pass transforms loops by placing phi nodes at the end of the loops for
  all values that are live across the loop boundary.  For example, it turns
  the left into the right code:

for (...)                for (...)
  if (c)                   if (c)
    X1 = ...                 X1 = ...
  else                     else
    X2 = ...                 X2 = ...
  X3 = phi(X1, X2)         X3 = phi(X1, X2)
... = X3 + 4              X4 = phi(X3)
                          ... = X4 + 4

  This is still valid LLVM; the extra phi nodes are purely redundant, and will
  be trivially eliminated by InstCombine.  The major benefit of
  this transformation is that it makes many other loop optimizations, such as
  LoopUnswitching, simpler.

  Loop Invariant Code Motion

  This pass performs loop invariant code motion, attempting to remove as much
  code from the body of a loop as possible.  It does this by either hoisting
  code into the preheader block, or by sinking code to the exit blocks if it is
  safe.  This pass also promotes must-aliased memory locations in the loop to
  live in registers, thus hoisting and sinking "invariant" loads and stores.

  This pass uses alias analysis for two purposes:

Moving loop invariant loads and calls out of loops.  If we can determine
        that a load or call inside of a loop never aliases anything stored to,
        we can hoist it or sink it like any other instruction.

Scalar Promotion of Memory - If there is a store instruction inside of
        the loop, we try to move the store to happen AFTER the loop instead of
        inside of the loop.  This can only happen if a few conditions are true:

The pointer stored through is loop invariant.

There are no stores or loads in the loop which may alias
              the pointer.  There are no calls in the loop which mod/ref the
              pointer.

        If these conditions are true, we can promote the loads and stores in the
        loop of the pointer to use a temporary alloca'd variable.  We then use
        the mem2reg functionality to construct the appropriate SSA form for the
        variable.

  Dead Loop Deletion Pass

  This file implements the Dead Loop Deletion Pass.  This pass is responsible
  for eliminating loops with non-infinite computable trip counts that have no
  side effects or volatile instructions, and do not contribute to the
  computation of the function's return value.

  Extract loops into new functions

  A pass wrapper around the ExtractLoop() scalar transformation to
  extract each top-level loop into its own new function. If the loop is the
  only loop in a given function, it is not touched. This is a pass most
  useful for debugging via bugpoint.

  Extract at most one loop into a new function

  Similar to Extract loops into new functions,
  this pass extracts one natural loop from the program into a function if it
  can. This is used by bugpoint.

  Index Split Loops

  This pass divides loop's iteration range by spliting loop such that each
  individual loop is executed efficiently.

  Loop Strength Reduction

  This pass performs a strength reduction on array references inside loops that
  have as one or more of their components the loop induction variable.  This is
  accomplished by creating a new value to hold the initial value of the array
  access for the first iteration, and then creating a new GEP instruction in
  the loop to increment the value by the appropriate amount.

  Rotate Loops

A simple loop rotation transformation.

  Unroll loops

  This pass implements a simple loop unroller.  It works best when loops have
  been canonicalized by the <tt>-indvars</tt> pass,
  allowing it to determine the trip counts of loops easily.

  Unswitch loops

  This pass transforms loops that contain branches on loop-invariant conditions
  to have multiple loops.  For example, it turns the left into the right code:

for (...)                  if (lic)
  A                          for (...)
  if (lic)                     A; B; C
    B                      else
  C                          for (...)
                               A; C

  This can increase the size of the code exponentially (doubling it every time
  a loop is unswitched) so we only unswitch if the resultant code will be
  smaller than a threshold.

  This pass expects LICM to be run before it to hoist invariant conditions out
  of the loop, to make the unswitching opportunity obvious.

  Canonicalize natural loops

  This pass performs several transformations to transform natural loops into a
  simpler form, which makes subsequent analyses and transformations simpler and
  more effective.

  Loop pre-header insertion guarantees that there is a single, non-critical
  entry edge from outside of the loop to the loop header.  This simplifies a
  number of analyses and transformations, such as LICM.

  Loop exit-block insertion guarantees that all exit blocks from the loop
  (blocks which are outside of the loop that have predecessors inside of the
  loop) only have predecessors from inside of the loop (and are thus dominated
  by the loop header).  This simplifies transformations such as store-sinking
  that are built into LICM.

  This pass also guarantees that loops will have exactly one backedge.

  Note that the simplifycfg pass will clean up blocks which are split out but
  end up being unnecessary, so usage of this pass should not pessimize
  generated code.

  This pass obviously modifies the CFG, but updates loop information and
  dominator information.

  Lower allocations from instructions to calls

  Turn <tt>malloc</tt> and <tt>free</tt> instructions into <tt>@malloc</tt> and
  <tt>@free</tt> calls.

  This is a target-dependent tranformation because it depends on the size of
  data types and alignment constraints.

  Lower invoke and unwind, for unwindless code generators

  This transformation is designed for use by code generators which do not yet
  support stack unwinding.  This pass supports two models of exception handling
  lowering, the 'cheap' support and the 'expensive' support.

  'Cheap' exception handling support gives the program the ability to execute
  any program which does not "throw an exception", by turning 'invoke'
  instructions into calls and by turning 'unwind' instructions into calls to
  abort().  If the program does dynamically use the unwind instruction, the
  program will print a message then abort.

  'Expensive' exception handling support gives the full exception handling
  support to the program at the cost of making the 'invoke' instruction
  really expensive.  It basically inserts setjmp/longjmp calls to emulate the
  exception handling as necessary.

  Because the 'expensive' support slows down programs a lot, and EH is only
  used for a subset of the programs, it must be specifically enabled by the
  <tt>-enable-correct-eh-support</tt> option.

  Note that after this pass runs the CFG is not entirely accurate (exceptional
  control flow edges are not correct anymore) so only very simple things should
  be done after the lowerinvoke pass has run (like generation of native code).
  This should not be used as a general purpose "my LLVM-to-LLVM pass doesn't
  support the invoke instruction yet" lowering pass.

  Lower Set Jump

   Lowers <tt>setjmp</tt> and <tt>longjmp</tt> to use the LLVM invoke and unwind
   instructions as necessary.

   Lowering of <tt>longjmp</tt> is fairly trivial. We replace the call with a
   call to the LLVM library function <tt>__llvm_sjljeh_throw_longjmp()</tt>.
   This unwinds the stack for us calling all of the destructors for
   objects allocated on the stack.

   At a <tt>setjmp</tt> call, the basic block is split and the <tt>setjmp</tt>
   removed. The calls in a function that have a <tt>setjmp</tt> are converted to
   invoke where the except part checks to see if it's a <tt>longjmp</tt>
   exception and, if so, if it's handled in the function. If it is, then it gets
   the value returned by the <tt>longjmp</tt> and goes to where the basic block
   was split. <tt>invoke</tt> instructions are handled in a similar fashion with
   the original except block being executed if it isn't a <tt>longjmp</tt>
   except that is handled by that function.

  Lower SwitchInst's to branches

  Rewrites <tt>switch</tt> instructions with a sequence of branches, which
  allows targets to get away with not implementing the switch instruction until
  it is convenient.

  Promote Memory to Register

  This file promotes memory references to be register references.  It promotes
  <tt>alloca</tt> instructions which only have <tt>load</tt>s and
  <tt>store</tt>s as uses.  An <tt>alloca</tt> is transformed by using dominator
  frontiers to place <tt>phi</tt> nodes, then traversing the function in
  depth-first order to rewrite <tt>load</tt>s and <tt>store</tt>s as
  appropriate. This is just the standard SSA construction algorithm to construct
  "pruned" SSA form.

  Optimize use of memcpy and friend

  This pass performs various transformations related to eliminating memcpy
  calls, or transforming sets of stores into memset's.

  Unify function exit nodes

  Ensure that functions have at most one <tt>ret</tt> instruction in them.
  Additionally, it keeps track of which node is the new exit node of the CFG.

  Remove unused exception handling info

  This file implements a simple interprocedural pass which walks the call-graph,
  turning <tt>invoke</tt> instructions into <tt>call</tt> instructions if and
  only if the callee cannot throw an exception. It implements this as a
  bottom-up traversal of the call-graph.

  Reassociate expressions

  This pass reassociates commutative expressions in an order that is designed
  to promote better constant propagation, GCSE, LICM, PRE, etc.

  For example: 4 + (<var>x</var> + 5) ⇒ <var>x</var> + (4 + 5)

  In the implementation of this algorithm, constants are assigned rank = 0,
  function arguments are rank = 1, and other values are assigned ranks
  corresponding to the reverse post order traversal of current function
  (starting at 2), which effectively gives values in deep loops higher rank
  than values not in loops.

  Demote all values to stack slots

  This file demotes all registers to memory references.  It is intented to be
  the inverse of <tt>-mem2reg</tt>.  By converting to
  <tt>load</tt> instructions, the only values live across basic blocks are
  <tt>alloca</tt> instructions and <tt>load</tt> instructions before
  <tt>phi</tt> nodes. It is intended that this should make CFG hacking much
  easier. To make later hacking easier, the entry block is split into two, such
  that all introduced <tt>alloca</tt> instructions (and nothing else) are in the
  entry block.

  Scalar Replacement of Aggregates

  The well-known scalar replacement of aggregates transformation.  This
  transform breaks up <tt>alloca</tt> instructions of aggregate type (structure
  or array) into individual <tt>alloca</tt> instructions for each member if
  possible.  Then, if possible, it transforms the individual <tt>alloca</tt>
  instructions into nice clean scalar SSA form.

  This combines a simple scalar replacement of aggregates algorithm with the <tt>mem2reg</tt> algorithm because often interact,
  especially for C++ programs.  As such, iterating between <tt>scalarrepl</tt>,
  then <tt>mem2reg</tt> until we run out of things to
  promote works well.

  Sparse Conditional Constant Propagation

  Sparse conditional constant propagation and merging, which can be summarized
  as:

Assumes values are constant unless proven otherwise

Assumes BasicBlocks are dead unless proven otherwise

Proves values to be constant, and replaces them with constants

Proves conditional branches to be unconditional

  Note that this pass has a habit of making definitions be dead.  It is a good
  idea to to run a DCE pass sometime after running this pass.

  Simplify well-known library calls

  Applies a variety of small optimizations for calls to specific well-known
  function calls (e.g. runtime library functions). For example, a call
   <tt>exit(3)</tt> that occurs within the <tt>main()</tt> function can be
   transformed into simply <tt>return 3</tt>.

  Simplify the CFG

  Performs dead code elimination and basic block merging. Specifically:

Removes basic blocks with no predecessors.

Merges a basic block into its predecessor if there is only one and the
        predecessor only has one successor.

Eliminates PHI nodes for basic blocks with a single predecessor.

Eliminates a basic block that only contains an unconditional
        branch.

  Strip all symbols from a module

  Performs code stripping. This transformation can delete:

names for virtual registers

symbols for internal globals and functions

debug information

  Note that this transformation makes code much less readable, so it should
  only be used in situations where the <tt>strip</tt> utility would be used,
  such as reducing code size or making it harder to reverse engineer code.

  Remove unused function declarations

  This pass loops over all of the functions in the input module, looking for
  dead declarations and removes them. Dead declarations are declarations of
  functions for which no implementation is available (i.e., declarations for
  unused library functions).

  Promote sret arguments

  This pass finds functions that return a struct (using a pointer to the struct
  as the first argument of the function, marked with the '<tt>sret</tt>' attribute) and
  replaces them with a new function that simply returns each of the elements of
  that struct (using multiple return values).

  This pass works under a number of conditions:

The returned struct must not contain other structs

The returned struct must only be used to load values from

The placeholder struct passed in is the result of an <tt>alloca</tt>

  Tail Call Elimination

  This file transforms calls of the current function (self recursion) followed
  by a return instruction with a branch to the entry of the function, creating
  a loop.  This pass also implements the following extensions to the basic
  algorithm:

Trivial instructions between the call and return do not prevent the
      transformation from taking place, though currently the analysis cannot
      support moving any really useful instructions (only dead ones).

This pass transforms functions that are prevented from being tail
      recursive by an associative expression to use an accumulator variable,
      thus compiling the typical naive factorial or <tt>fib</tt> implementation
      into efficient code.

TRE is performed if the function returns void, if the return
      returns the result returned by the call, or if the function returns a
      run-time constant on all exits from the function.  It is possible, though
      unlikely, that the return returns something else (like constant 0), and
      can still be TRE'd.  It can be TRE'd if all other return
      instructions in the function return the exact same value.

If it can prove that callees do not access theier caller stack frame,
      they are marked as eligible for tail call elimination (by the code
      generator).

  Tail Duplication

  This pass performs a limited form of tail duplication, intended to simplify
  CFGs by removing some unconditional branches.  This pass is necessary to
  straighten out loops created by the C front-end, but also is capable of
  making other code nicer.  After this pass is run, the CFG simplify pass
  should be run to clean up the mess.

 Utility Passes

This section describes the LLVM Utility Passes.

  Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)

  Same as dead argument elimination, but deletes arguments to functions which
  are external.  This is only for use by bugpoint.

  Extract Basic Blocks From Module (for bugpoint use)

  This pass is used by bugpoint to extract all blocks from the module into their
  own functions.

  Preliminary module verification

  Ensures that the module is in the form required by the Module Verifier pass.

  Running the verifier runs this pass automatically, so there should be no need
  to use it directly.

  Module Verifier

  Verifies an LLVM IR code. This is useful to run after an optimization which is
  undergoing testing. Note that <tt>llvm-as</tt> verifies its input before
  emitting bitcode, and also that malformed bitcode is likely to make LLVM
  crash. All language front-ends are therefore encouraged to verify their output
  before performing optimizing transformations.

Both of a binary operator's parameters are of the same type.

Verify that the indices of mem access instructions match other
        operands.

Verify that arithmetic and other things are only performed on
        first-class types.  Verify that shifts and logicals only happen on
        integrals f.e.

All of the constants in a switch statement are of the correct type.

The code is in valid SSA form.

It is illegal to put a label into any other type (like a structure) or
        to return one.

Only phi nodes can be self referential: <tt>%x = add i32 %x, %x</tt> is
        invalid.

PHI nodes must have an entry for each predecessor, with no extras.

PHI nodes must be the first thing in a basic block, all grouped
        together.

PHI nodes must have at least one entry.

All basic blocks should only end with terminator insts, not contain
        them.

The entry node to a function must not have predecessors.

All Instructions must be embedded into a basic block.

Functions cannot take a void-typed parameter.

Verify that a function's argument list agrees with its declared
        type.

It is illegal to specify a name for a void value.

It is illegal to have a internal global value with no initializer.

It is illegal to have a ret instruction that returns a value that does
        not agree with the function return value type.

Function call argument types match the function prototype.

All other things that are tested by asserts spread about the code.

  Note that this does not provide full security verification (like Java), but
  instead just tries to ensure that code is well-formed.

  View CFG of function

  Displays the control flow graph using the GraphViz tool.

  View CFG of function (with no function bodies)

  Displays the control flow graph using the GraphViz tool, but omitting function
  bodies.

<address>

  Reid Spencer

  LLVM Compiler Infrastructure

  Last modified: $Date: 2010-03-01 13:24:17 -0600 (Mon, 01 Mar 2010) $
</address>


text:
/**
 * @module decorators
 */
import { Attribute } from '../../../mapper/type/attribute.type'
import { ModelConstructor } from '../../../model/model-constructor'
import { PropertyMetadata, TypeInfo } from '../../metadata/property-metadata.model'
import { getMetadataType } from '../../util'
import { KEY_PROPERTY } from './key-property.const'

/**
 * @hidden
 */
export function initOrUpdateProperty(
  propertyMetadata: Partial<PropertyMetadata<any, Attribute>> = {},
  target: any,
  propertyKey: string,
): void {
  // the new or updated property
  let property: PropertyMetadata<any>

  // Update the attribute array
  let properties: Array<PropertyMetadata<any>> = Reflect.getMetadata(KEY_PROPERTY, target.constructor) || []
  const existingProperty = properties.find((p) => p.name === propertyKey)
  if (existingProperty) {
    // create new property with merged options
    property = { ...existingProperty, ...propertyMetadata }
    // remove existing from array
    properties = properties.filter((p) => p !== existingProperty)
  } else {
    // add new options
    property = createNewProperty(propertyMetadata, target, propertyKey)
  }

  Reflect.defineMetadata(KEY_PROPERTY, [...properties, property], target.constructor)
}

/**
 * @hidden
 */
function createNewProperty(
  propertyOptions: Partial<PropertyMetadata<any, Attribute>> = {},
  target: any,
  propertyKey: string,
): PropertyMetadata<any> {
  const propertyType: ModelConstructor<any> = getMetadataType(target, propertyKey)

  if (propertyType === undefined) {
    throw new Error(
      'make sure you have enabled the typescript compiler options which enable us to work with decorators (see doc)',
    )
  }

  const typeInfo: TypeInfo = { type: propertyType }

  propertyOptions = {
    name: propertyKey,
    nameDb: propertyKey,
    typeInfo,
    ...propertyOptions,
  }

  return <PropertyMetadata<any>>propertyOptions
}


text:
package com.alow.service;

import com.alow.exception.DaoException;
import com.alow.exception.EntityExistsException;
import com.alow.model.Pessoa;
import com.alow.model.plus.User;
import com.alow.service.crud.CrudService;

public interface PessoaService {

	public abstract CrudService<Pessoa,Long> getCrud();
	public abstract Pessoa getPessoaByGoogleUserId(String googleUserId);
	public abstract Pessoa generateOrUpdatePessoa(User user) throws DaoException, EntityExistsException;
	public abstract Pessoa generateOrUpdatePessoa(String googleUserId, String deviceId, String registrationId) throws DaoException, EntityExistsException;

}


text:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/demo_progress_bar"/>


text:
<?php

interface Wires_Injector_Interface
{
   function create($class, $context = null);
   function with(array $bindings);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        style="@style/DemoButton"
        android:onClick="onClickMultitask"
        android:text="@string/multitask_test_title" />

    <Button
        style="@style/DemoButton"
        android:onClick="onClickSingle"
        android:text="@string/single_task_test_title" />

    <Button
        style="@style/DemoButton"
        android:onClick="onClickHybridTest"
        android:text="@string/hybrid_test_title" />

    <Button
        style="@style/DemoButton"
        android:onClick="onClickTasksManager"
        android:text="@string/tasks_manager_demo_title" />

    <Button
        style="@style/DemoButton"
        android:onClick="onClickPerformance"
        android:text="@string/performance_test_title" />

    <Button
        style="@style/DemoButton"
        android:onClick="onClickNotification"
        android:text="@string/notification_demo_title" />

</LinearLayout>


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/vision/v1/image_annotator.proto

namespace Google\Cloud\Vision\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * External image source (Google Cloud Storage or web URL image location).
 *
 * Generated from protobuf message google.cloud.vision.v1.ImageSource
 */
class ImageSource extends \Google\Protobuf\Internal\Message
{
    /**
     * **Use `image_uri` instead.**
     * The Google Cloud Storage  URI of the form
     * `gs://bucket_name/object_name`. Object versioning is not supported. See
     * [Google Cloud Storage Request
     * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
     *
     * Generated from protobuf field string gcs_image_uri = 1;
     */
    private $gcs_image_uri = '';
    /**
     * The URI of the source image. Can be either:
     * 1. A Google Cloud Storage URI of the form
     *    `gs://bucket_name/object_name`. Object versioning is not supported. See
     *    [Google Cloud Storage Request
     *    URIs](https://cloud.google.com/storage/docs/reference-uris) for more
     *    info.
     * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
     *    HTTP/HTTPS URLs, Google cannot guarantee that the request will be
     *    completed. Your request may fail if the specified host denies the
     *    request (e.g. due to request throttling or DOS prevention), or if Google
     *    throttles requests to the site for abuse prevention. You should not
     *    depend on externally-hosted images for production applications.
     * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
     * precedence.
     *
     * Generated from protobuf field string image_uri = 2;
     */
    private $image_uri = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $gcs_image_uri
     *           **Use `image_uri` instead.**
     *           The Google Cloud Storage  URI of the form
     *           `gs://bucket_name/object_name`. Object versioning is not supported. See
     *           [Google Cloud Storage Request
     *           URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
     *     @type string $image_uri
     *           The URI of the source image. Can be either:
     *           1. A Google Cloud Storage URI of the form
     *              `gs://bucket_name/object_name`. Object versioning is not supported. See
     *              [Google Cloud Storage Request
     *              URIs](https://cloud.google.com/storage/docs/reference-uris) for more
     *              info.
     *           2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
     *              HTTP/HTTPS URLs, Google cannot guarantee that the request will be
     *              completed. Your request may fail if the specified host denies the
     *              request (e.g. due to request throttling or DOS prevention), or if Google
     *              throttles requests to the site for abuse prevention. You should not
     *              depend on externally-hosted images for production applications.
     *           When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
     *           precedence.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce();
        parent::__construct($data);
    }

    /**
     * **Use `image_uri` instead.**
     * The Google Cloud Storage  URI of the form
     * `gs://bucket_name/object_name`. Object versioning is not supported. See
     * [Google Cloud Storage Request
     * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
     *
     * Generated from protobuf field string gcs_image_uri = 1;
     * @return string
     */
    public function getGcsImageUri()
    {
        return $this->gcs_image_uri;
    }

    /**
     * **Use `image_uri` instead.**
     * The Google Cloud Storage  URI of the form
     * `gs://bucket_name/object_name`. Object versioning is not supported. See
     * [Google Cloud Storage Request
     * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
     *
     * Generated from protobuf field string gcs_image_uri = 1;
     * @param string $var
     * @return $this
     */
    public function setGcsImageUri($var)
    {
        GPBUtil::checkString($var, True);
        $this->gcs_image_uri = $var;

        return $this;
    }

    /**
     * The URI of the source image. Can be either:
     * 1. A Google Cloud Storage URI of the form
     *    `gs://bucket_name/object_name`. Object versioning is not supported. See
     *    [Google Cloud Storage Request
     *    URIs](https://cloud.google.com/storage/docs/reference-uris) for more
     *    info.
     * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
     *    HTTP/HTTPS URLs, Google cannot guarantee that the request will be
     *    completed. Your request may fail if the specified host denies the
     *    request (e.g. due to request throttling or DOS prevention), or if Google
     *    throttles requests to the site for abuse prevention. You should not
     *    depend on externally-hosted images for production applications.
     * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
     * precedence.
     *
     * Generated from protobuf field string image_uri = 2;
     * @return string
     */
    public function getImageUri()
    {
        return $this->image_uri;
    }

    /**
     * The URI of the source image. Can be either:
     * 1. A Google Cloud Storage URI of the form
     *    `gs://bucket_name/object_name`. Object versioning is not supported. See
     *    [Google Cloud Storage Request
     *    URIs](https://cloud.google.com/storage/docs/reference-uris) for more
     *    info.
     * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
     *    HTTP/HTTPS URLs, Google cannot guarantee that the request will be
     *    completed. Your request may fail if the specified host denies the
     *    request (e.g. due to request throttling or DOS prevention), or if Google
     *    throttles requests to the site for abuse prevention. You should not
     *    depend on externally-hosted images for production applications.
     * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
     * precedence.
     *
     * Generated from protobuf field string image_uri = 2;
     * @param string $var
     * @return $this
     */
    public function setImageUri($var)
    {
        GPBUtil::checkString($var, True);
        $this->image_uri = $var;

        return $this;
    }

}


text:
package com.danielasfregola.twitter4s.http.clients.rest.friendships.parameters

import com.danielasfregola.twitter4s.http.marshalling.Parameters

private[twitter4s] final case class FollowParameters(user_id: Option[Long],
                                                     screen_name: Option[String],
                                                     follow: Boolean)
    extends Parameters


text:
{% extends 'publisher/base.html' %}
{% load staticfiles %}
{% block content %}

            Publication
            View others publications and peer review them

                 Catalog

                Publication #{{ publication.publication_id }}

{{ publication.title }}

{{ publication.description }}

                <button onclick="ajax_peer_review_modal(0);"
                             id="add_review_btn"
                           name="add_review_btn"
                          style="float: right;"
                           type="button"
                          class="btn btn-lg btn-success"
                    {% if user_review.user == user %}
                       disabled='true'
                    {% endif %}>
                     Add Review
                </button>

            Reviews

                   {% include "publisher/publication/table.html" with form=form %}

        {% if HAS_ADVERTISMENT %}
        {% include "publisher/publication/ad.html" %}
        {% endif %}

{% include 'publisher/publication/js.html' %}
{% endblock content %}


text:
$( document ).ready(function() {
  var fadedout = false;
  $('.map-outline-path').css('animation', 'dash 3s linear forwards');

  $('#path3643')[0].addEventListener('webkitAnimationEnd', function(event) {
    $('.title-tint').addClass('fade-out');
    fadedout = true;
  }, false );

  $('.title-tint')[0].addEventListener('webkitTransitionEnd', function(event) {
      if(fadedout==true){
        $('.title-tint').removeClass('fade-out');
        $('.title-tint').addClass('vid-fade-in');
        $('#drone-footage').toggle();
        $('#drone-footage')[0].play();
        fadedout = false
      };
  }, false );

  $('#MainOutline')[0].addEventListener('webkitAnimationEnd', function(event) {
    $('.province-path').css('animation', 'dash 3s linear forwards')
  }, false );

  $('.province-path')[0].addEventListener('webkitAnimationEnd', function(event) {
    $('.color-path').css('animation', 'dash 2s linear forwards')
  }, false );
}); //end of document ready function


text:
package org.springframework.web.method.annotation;

import java.util.LinkedHashMap;
import java.util.Map;

import org.springframework.core.MethodParameter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;

/**
 * Resolves {@link Map} method arguments annotated with an @{@link RequestParam}
 * where the annotation does not specify a request parameter name.
 * See {@link RequestParamMethodArgumentResolver} for resolving {@link Map}
 * method arguments with a request parameter name.
 *
 * <p>The created {@link Map} contains all request parameter name/value pairs.
 * If the method parameter type is {@link MultiValueMap} instead, the created
 * map contains all request parameters and all there values for cases where
 * request parameters have multiple values.
 *
 * @author Arjen Poutsma
 * @author Rossen Stoyanchev
 * @since 3.1
 * @see RequestParamMethodArgumentResolver
 */
public class RequestParamMapMethodArgumentResolver implements HandlerMethodArgumentResolver {

	@Override
	public boolean supportsParameter(MethodParameter parameter) {
		RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class);
		if (requestParam != null) {
			if (Map.class.isAssignableFrom(parameter.getParameterType())) {
				return !StringUtils.hasText(requestParam.name());
			}
		}
		return false;
	}

	@Override
	public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
			NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {

		Class<?> paramType = parameter.getParameterType();

		Map<String, String[]> parameterMap = webRequest.getParameterMap();
		if (MultiValueMap.class.isAssignableFrom(paramType)) {
			MultiValueMap<String, String> result = new LinkedMultiValueMap<String, String>(parameterMap.size());
			for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
				for (String value : entry.getValue()) {
					result.add(entry.getKey(), value);
				}
			}
			return result;
		}
		else {
			Map<String, String> result = new LinkedHashMap<String, String>(parameterMap.size());
			for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
				if (entry.getValue().length > 0) {
					result.put(entry.getKey(), entry.getValue()[0]);
				}
			}
			return result;
		}
	}
}


text:
package workbench.db;

import static org.junit.Assert.*;
import org.junit.Test;

/**
 *
 * @author Thomas Kellerer
 */
public class DomainIdentifierTest
{

	@Test
	public void testDomain()
		throws Exception
	{
		DomainIdentifier domain = new DomainIdentifier("public", "pagila", "year");
		domain.setCheckConstraint("CHECK (VALUE >= 1901 AND VALUE <= 2155)");
		domain.setDataType("integer");
		domain.setDefaultValue(null);
		domain.setNullable(false);
		String source = domain.getSummary();
		assertEquals("integer NOT NULL CHECK (VALUE >= 1901 AND VALUE <= 2155);", source);

		domain.setNullable(true);
		source = domain.getSummary();
		assertEquals("integer CHECK (VALUE >= 1901 AND VALUE <= 2155);", source);

		domain.setDefaultValue("2009");
		domain.setNullable(false);
		source = domain.getSummary();
		assertEquals("integer NOT NULL DEFAULT 2009 CHECK (VALUE >= 1901 AND VALUE <= 2155);", source);
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">种子猎手</string>

    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>

    <string name="action_example">Example action</string>

    <string name="action_settings">Settings</string>
    <string name="action_search">Search</string>
    <string name="search_hint">Need for speed</string>
    <string name="link_copied">链接已拷贝</string>
</resources>


text:
.login #loginForm{
  border: 3px solid #da5045;
  border-radius: 10px;
  background: #fff;
}
.login #loginForm .login-inner{
  padding: 20px 30px;
}
.login #loginForm .btn{
  border-radius: 0;
  font-size: 20px;
  text-transform: uppercase;
}

body{
  padding-top: 80px;
  background: #ececec;
}
.navbar-custom {
  background: #cb3b30;
  font-weight: 700;
  border: none;
}
.navbar-custom a:focus {
  outline: none;
}
.navbar-custom .navbar-brand {
  color: white;
}
.navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus,
.navbar-custom .navbar-brand:active,
.navbar-custom .navbar-brand.active {
  color: white;
}
.navbar-custom .navbar-nav {
  letter-spacing: 1px;
}
.navbar-custom .navbar-nav li a {
  color: white;
}
.navbar-custom .navbar-nav li a:hover {
  color: #18BC9C;
  outline: none;
}
.navbar-custom .navbar-nav li a:focus,
.navbar-custom .navbar-nav li a:active {
  color: white;
}
.navbar-custom .navbar-nav li.active a {
  color: white;
  background: #18BC9C;
}
.navbar-custom .navbar-nav li.active a:hover,
.navbar-custom .navbar-nav li.active a:focus,
.navbar-custom .navbar-nav li.active a:active {
  color: white;
  background: #18BC9C;
}
.navbar-custom .navbar-toggle {
  color: white;
  text-transform: uppercase;
  font-size: 10px;
  border-color: white;
}
.navbar-custom .navbar-toggle:hover,
.navbar-custom .navbar-toggle:focus {
  background-color: #18BC9C;
  color: white;
  border-color: #18BC9C;
}
@media (min-width: 768px) {
  .navbar-custom {
    padding: 10px 0;
    -webkit-transition: padding 0.3s;
    -moz-transition: padding 0.3s;
    transition: padding 0.3s;
  }
  .navbar-custom .navbar-brand {
    font-size: 2em;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
  }
  .navbar-custom.affix {
    padding: 10px 0;
  }
  .navbar-custom.affix .navbar-brand {
    font-size: 1.5em;
  }
}
/************--navigation--***************/
.theboss-nav.navbar-default{
  background-color: #da5045;
  border-color: #cb3a2f;
}
.theboss-nav.navbar-default .navbar-nav > li > a{
  color: #fff;
  font-weight: bold;
}

.theboss-nav.navbar-default i{
  display: block;
  color: #000;
  text-align: center;
  font-size: 30px;
}
.theboss-nav.navbar-default .navbar-nav > li > a:focus, .navbar-default .navbar-nav > li > a:hover,
.theboss-nav.navbar-default .navbar-nav > li > a:focus i, .navbar-default .navbar-nav > li > a:hover i{
  background-color:#000;
  color:#fff;
}
.theboss-nav .navbar-nav > li > a{
  padding-bottom: 10px;
  padding-top: 10px;
}
.theboss-nav .navbar-form .form-control{
  background-color: #c73529;
   border: 1px solid #c73529;
   color:#fff;
}

.theboss-nav .navbar-right.navbar-nav > li > a:focus, .theboss-nav .navbar-right.navbar-nav > li > a:hover, .theboss-nav .navbar-right.navbar-nav > li > a:focus i, .theboss-nav .navbar-right.navbar-nav > li > a:hover i{
  background-color:transparent;
}
.panel-danger > .panel-heading{
  background-color: #cb3b2f;
  border-color: #cb3b2f;
  color: #fff;
}
.panel{
  border-radius: 8px;
}
.panel-danger {
    border-color: #cb3b2f;
    border-width: 2px;
}
.panel-title{
  font-weight: bold;
  font-size: 22px;
}
.panel-heading {
  padding: 6px 15px;
}
.msg-panel dl dd{
  border-bottom:1px dashed #ccc;
  font-weight: bold;
  margin-bottom: 10px;
}
.msg-panel h3{
  margin:0;
  margin-bottom: 10px;
}
.msg-panel h3 a{
  color: #9d0c00;
}
.msg-panel ul li a{
  color: #666;
  font-weight: normal;
}
.msg-panel ul li{
  border-left: 1px solid #aaa;
}
.msg-panel ul li:first-child{
  border-left:none;
}
footer{
  background: #d6d6d6;
  padding: 10px 0;
  font-size: 13px;
}
footer p, footer ul{
  margin:0;
}
footer a{
  color: #c7201e;
}
.employee-inner{
  padding: 20px;
  background: #fff;
  .quick_links
  {

  }
  margin: 10px 0 30px 0;
}
.employee-inner h3{
  margin-top: 0;
  margin-bottom: 20px;
}
.employee-inner ul{
  text-align: center;
}
.employee-inner ul li{
  margin:0 15px;
  max-width: 150px;
  vertical-align: top;
}

.employee-inner img{
  border: 4px solid #d0d0d0;
  width: 100px;
}
.employee-inner h5{
  color: #cb3b30;
  font-weight: bold;
  margin-top: 20px;
}
.quick_links a
{
  color: #000;
}
.quick_links li
{
  margin: 5px 0;
}


text:
package wm.fix.manager.data;

public interface FixDataConstants
{
    public static final int FIX_INSTALL_INIT 	= 0;
    public static final int FIX_INSTALL_OK  	= 1;
	public static final int FIX_INSTALL_ERROR   = 2;
	public static final int FIX_INSTALL_WARNING = 3;
	public static final int FIX_INSTALL_UNDEF 	= 4;

//	Install Icons
    public static final String FIX_ICON_OK 		= "images/fix_ok.gif";
    public static final String FIX_ICON_ERROR   = "images/fix_error.gif";
    public static final String FIX_ICON_WARN    = "images/fix_warn.gif";
    public static final String FIX_ICON_UNDEF   = "images/fix.gif";
}


text:
package de.ubuntix.android.birthdayreminder.view.helper;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import de.ubuntix.android.birthdayreminder.model.Contact;
import de.ubuntix.android.birthdayreminder.model.DateOfBirth;
import de.ubuntix.android.birthdayreminder.model.RawContact;

public class BirthContactHelper {

	public static List<BirthContact> createBirthContactList(List<Contact> contacts) {
		List<BirthContact> birthContacts = new ArrayList<BirthContact>();

		for (Contact contact : contacts) {
			Set<Calendar> dates = new LinkedHashSet<Calendar>();

			for (RawContact rawContact : contact.getRawContacts()) {
				for (DateOfBirth dateOfBirth : rawContact.getDatesOfBirth()) {
					if (!dates.contains(dateOfBirth.getDate())) {
						birthContacts.add(new BirthContact(contact, dateOfBirth));
						dates.add(dateOfBirth.getDate());
					}
				}
			}

			if (dates.isEmpty()) {
				birthContacts.add(new BirthContact(contact, null));
			}
		}

		return birthContacts;
	}
}


text:
function __processArg(obj, key) {
    var arg = null;
    if (obj) {
        arg = obj[key] || null;
        delete obj[key];
    }
    return arg;
}

function Controller() {
    function closeWindow() {
        $.NewGameWindow.close();
    }
    function newGame() {
        $.NewGameWindow.close();
        $.NewGameWindow.fireEvent("restart", {
            retour: 0
        });
    }
    require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments));
    this.__controllerPath = "newGame";
    if (arguments[0]) {
        {
            __processArg(arguments[0], "__parentSymbol");
        }
        {
            __processArg(arguments[0], "$model");
        }
        {
            __processArg(arguments[0], "__itemTemplate");
        }
    }
    var $ = this;
    var exports = {};
    var __defers = {};
    $.__views.NewGameWindow = Ti.UI.createWindow({
        id: "NewGameWindow"
    });
    $.__views.NewGameWindow && $.addTopLevelView($.__views.NewGameWindow);
    $.__views.__alloyId7 = Ti.UI.createView({
        backgroundColor: "#FFF",
        opacity: .9,
        id: "__alloyId7"
    });
    $.__views.NewGameWindow.add($.__views.__alloyId7);
    $.__views.__alloyId8 = Ti.UI.createView({
        layout: "vertical",
        backgroundColor: "#FFF",
        opacity: 1,
        width: 250,
        height: 400,
        id: "__alloyId8"
    });
    $.__views.__alloyId7.add($.__views.__alloyId8);
    $.__views.generateNewGame = Ti.UI.createLabel({
        height: 100,
        width: 250,
        textAlign: "center",
        opacity: 1,
        id: "generateNewGame",
        text: "Voulez vous générer un nouveau sudoku "
    });
    $.__views.__alloyId8.add($.__views.generateNewGame);
    $.__views.__alloyId9 = Ti.UI.createView({
        layout: "horizontal",
        height: 200,
        opacity: 1,
        width: "100%",
        id: "__alloyId9"
    });
    $.__views.__alloyId8.add($.__views.__alloyId9);
    $.__views.buttonNo = Ti.UI.createButton({
        height: 100,
        width: "30%",
        top: 50,
        borderRadius: 10,
        opacity: 1,
        backgroundColor: "#ED0D27",
        left: "5%",
        id: "buttonNo",
        title: "Non"
    });
    $.__views.__alloyId9.add($.__views.buttonNo);
    closeWindow ? $.__views.buttonNo.addEventListener("click", closeWindow) : __defers["$.__views.buttonNo!click!closeWindow"] = true;
    $.__views.buttonOui = Ti.UI.createButton({
        height: 100,
        width: "30%",
        top: 50,
        borderRadius: 10,
        opacity: 1,
        backgroundColor: "#07E937",
        left: "30%",
        id: "buttonOui",
        title: "Oui"
    });
    $.__views.__alloyId9.add($.__views.buttonOui);
    newGame ? $.__views.buttonOui.addEventListener("click", newGame) : __defers["$.__views.buttonOui!click!newGame"] = true;
    exports.destroy = function() {};
    _.extend($, $.__views);
    arguments[0] || {};
    __defers["$.__views.buttonNo!click!closeWindow"] && $.__views.buttonNo.addEventListener("click", closeWindow);
    __defers["$.__views.buttonOui!click!newGame"] && $.__views.buttonOui.addEventListener("click", newGame);
    _.extend($, exports);
}

var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._;

module.exports = Controller;


text:
get '/signup' do
  @user = User.new
  erb :'user/signup'
end

post '/registering' do
  @user = User.new(params[:user])
  @user.password = params[:password]
  if @user.save && !params[:password].empty?
    session[:user_id] = @user.id
    redirect "/users/#{@user.id}"
  else
    if params[:password].empty?
      @user.errors.add("password", message = "password field blank")
    end
    @errors = @user.errors.full_messages
    erb :'user/signup'
  end
end

get '/signout' do
  session[:user_id] = nil
  redirect "/decks"
end

get '/signin' do
  @user = User.new
  erb :'user/signin'
end

post '/login' do
  @user = User.find_by(email: params[:email])
  if @user.password == params[:password]
    session[:user_id] = @user.id
    redirect "/users/#{@user.id}s"
  else
    @errors = ["we didnt find a match check your email and password again"]
    erb :'user/signin'
  end
end

get '/users/:user_id' do
  @user = User.find(params[:user_id])
  erb :'user/show'
end

get '/decks/new' do
  @user = User.find(session[:user_id])
  erb :'deck/new'
end

post '/decks' do
  @deck = Deck.new(params[:deck])
  if @deck.save
    redirect "/decks/#{@deck.id}/cards/new"
  else
    @errors = @deck.errors.full_messages
    erb :'deck/new'
  end
end