text:
inherit STD_ENHANCER;
inherit STD_LORE;
inherit STD_ARRAYS;

object *rune_readers = ({});
object book_opener;

void create_object(void);
void init(void);
int do_open(string str);
int do_runes(string str);
int attune(string arg);
int query_spellbook_multiplier(void);

void create_object(void)
{
    set_name("book");
    add_id("spellbook");
    set_short("The Spellbook of Aldarak");
    set_long("A thick, black leatherbound book. Strange runes are written " +
             "on it's cover and a strange, evil power is emanating from " +
             "the book. The book is cold to the touch, and it almost seems " +
             "to draw the warmth from the air around it.\n");
    set_value(300);
    set_weight(2);
    set_adder(5);
    set_multiplier(5);
    set_multiplier_fun("query_spellbook_multiplier");
    set_difficulty(30);
    set_material("paper");

    add_lore("The spellbook of Aldarak... You remember your mother used to " +
             "scare you with that name when you didn't want to eat all your " +
             "porridge when you were a child.\n",1,19);
    add_lore("Aldarak the Soulstealer was the most powerful wizard who ever " +
             "lived, and this is his spellbook... It must hold untold " +
             "powers.\n",20);
    add_lore("It is told that the mighty wyrmkin wizard documented every " +
             "single known spell in this tome. Indeed, this book is the " +
             "single most sought after artifact in the Kingdoms among the " +
             "Brotherhood of dark mages.\n",30);
    add_lore("Untold powers would be granted those who master the spells in " +
             "this book, but the elder also tell of unholy protective " +
             "spells laid upon it. The one who tries, but fails to master " +
             "the book would suffer a terrible fate.\n",40);
    set_property("godlike");
}

void init(void)
{
    add_action("do_open","open");
    add_multi_action("do_runes","l|look|read|examine");
    spell_enhancer_init();
}

int do_open(string str)
{
    if(str == "book" || str == "book now")
    {
        if(ENV(TO) != TP)
        {
            W("You need to hold the book to open it.\n");
            return 1;
        }
        if(book_opener != TP)
        {
            if(!is_in(TP,rune_readers) && str != "book now")
            {
                W("As you try to open the book, the runes on the cover " +
                  "begin to glow softly. You could <open book now> if you " +
                  "do not wish to pay any attention to the runes...\n");
                return 1;
            }
            if(TP->query_alignment() > 299)
            {
                W("There is a bright flash as you touch the book and you " +
                  "are struck with a bolt of lightning!\nAs you throw the " +
                  "book onto the floor, a dark shape rises from it... " +
                  "The shape grins at you for a moment and then fades " +
                  "away.\n");
                S("There is a bright flash and " + TP->QN + " doubles over " +
                  "in pain as " + TP->QPR + " is struck by a bolt of " +
                  "lightning and throws a black spellbook onto the floor.\n");
                TP->do_spell_damage(random(50) + 30,"electric");
                TP->command("drop book");
                return 1;
            }
            else if(TP->query_alignment() > -300)
            {
                W("There is a bright flash as you touch the book and you " +
                  "are struck with a bolt of lightning!\nYou throw the book " +
                  "to the floor and double over in pain.\n");
                S("There is a bright flash and " + TP->QN + " doubles over " +
                  "in pain as " + TP->QPR + " is struck with a bolt of " +
                  "lightning!\n");
                TP->do_spell_damage(random(20) + 20,"electric");
                TP->command("drop book");
                return 1;
            }
            else
            {
                W("You open the book. Runes of magic appear on the page " +
                  "before you, glowing softly, beckoning you to " +
                  "<choose book>.\n");
                S(TP->QN + " opens the black spellbook.\n");
                book_opener = TP;
                return 1;
            }
        }
        W("You have already opened the spellbook!\n");
        return 1;
    }
    return 0;
}

int do_runes(string str)
{
    if(str == "runes" || str == "at runes")
    {
        rune_readers += ({ TP });
        if(TP->query_skill("runes") < 1)
        {
            W("You can make nothing out of these runes.\n");
            S(TP->QN+" is baffled by the runes on the cover of the " +
              "spellbook.\n");
            return 1;
        }
        else if(TP->query_skill("runes") < 10)
        {
            W("These runes are evil. For kind souls to open this book " +
              "would be foolish.\n");
            S(TP->QN + " studies the runes on the cover of the spellbook.\n");
            return 1;
        }
        else if(TP->query_skill("runes") < 20)
        {
            W("These runes are evil. For kind souls to open this book would " +
              "be foolish. The runes are magic runes of warding and " +
              "conjuring.\n");
            S(TP->QN + " studies the runes on the cover of the spellbook.\n");
            return 1;
        }
        else if(TP->query_skill("runes") < 30)
        {
            W("These runes are evil. For kind souls to open this book would " +
              "be foolish. The runes are magic runes of warding and " +
              "conjuring and you notice several magic seals that would be " +
              "broken by anyone trying to open the book.\n");
            S(TP->QN + " studies the runes on the cover of the spellbook.\n");
            return 1;
        }
        else if(TP->query_skill("runes") < 40)
        {
            W("These evil runes are magic seals that will release " +
              "conjurning spells upon any kind souled person trying to open " +
              "the spellbook. The spells would summon dark spirits against " +
              "good, but would invite evil, as evil is the purpose of this " +
              "spellbook.\n");
            S(TP->QN+" studies the runes on the cover of the spellbook.\n");
            return 1;
        }
        else if(TP->query_skill("runes") > 39)
        {
            W("According to the runes, this book will bring doom for the " +
              "one with a kind soul why tries to wield it's powers. The " +
              "evil will prosper as the purpose of the book is evil, but " +
              "only the highest ranking and most black souled ones will be " +
              "able to fully utilise its powers.\n");
            S(TP->QN + " studies the runes on the cover of the " +
              "spellbook.\n");
            return 1;
        }
    }
}

int attune(string arg)
{
    if(book_opener != TP)
    {
        W("You have to open the book to be able to read the spells and draw " +
          "power from it.\n");
        return 1;
    }
    W("Your blood starts to burn with magic as you begin to study the " +
      "spells.\n");
    S(TP->QN + " opens the black spellbook and begins to study the spells.\n");
    return ::attune(arg);
}

int query_spellbook_multiplier(void)
{
    if(TP->query_alignment() <-1000 && TP->query_level() > 18)
        return 5;
    else if(TP->query_alignment() <-1000 && TP->query_level() > 15)
        return 4;
    else if(TP->query_alignment() <-1000 && TP->query_level() > 11)
        return 3;
    else if(TP->query_alignment() <-1000 && TP->query_level() < 12)
        return 2;
    else if(TP->query_alignment() <-800 && TP->query_level() > 18)
        return 4;
    else if(TP->query_alignment() <-800 && TP->query_level() > 15)
        return 4;
    else if(TP->query_alignment() <-800 && TP->query_level() > 11)
        return 3;
    else if(TP->query_alignment() <-800 && TP->query_level() < 12)
        return 2;
    else if(TP->query_alignment() <-550 && TP->query_level() > 18)
        return 4;
    else if(TP->query_alignment() <-550 && TP->query_level() > 15)
        return 3;
    else if(TP->query_alignment() <-550 && TP->query_level() > 11)
        return 2;
    else if(TP->query_alignment() <-550 && TP->query_level() < 12)
        return 2;
    else if(TP->query_level() > 18)
        return 3;
    else
        return 2;
}


text:
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
    (global = global || self, (global.FullCalendarLocales = global.FullCalendarLocales || {}, global.FullCalendarLocales.de = factory()));
}(this, (function () { 'use strict';

    var de = {
        code: "de",
        week: {
            dow: 1,
            doy: 4 // The week that contains Jan 4th is the first week of the year.
        },
        buttonText: {
            prev: "Zurück",
            next: "Vor",
            today: "Heute",
            year: "Jahr",
            month: "Monat",
            week: "Woche",
            day: "Tag",
            list: "Terminübersicht"
        },
        weekLabel: "KW",
        allDayText: "Ganztägig",
        eventLimitText: function (n) {
            return "+ weitere " + n;
        },
        noEventsMessage: "Keine Ereignisse anzuzeigen"
    };

    return de;

})));

redpajama_set_name: RedPajamaGithub


text:
namespace Yetibyte.Himalaya.Gui {
    public enum GuiScalingUnit { Pixels, Percent }

}


text:
using System;
using System.Threading.Tasks;

namespace Alluvial
{
    /// <summary>
    /// A link in the aggregator pipeline.
    /// </summary>
    /// <typeparam name="TProjection">The type of the projection.</typeparam>
    /// <typeparam name="TData">The type of the data.</typeparam>
    /// <param name="projection">The projection.</param>
    /// <param name="batch">The batch.</param>
    /// <param name="next">The next function in the pipeline.</param>
    /// <returns>The updated projection.</returns>
    public delegate Task<TProjection> PipeAsync<TProjection, TData>(
        TProjection projection,
        IStreamBatch<TData> batch,
        AggregateAsync<TProjection, TData> next);
}


text:
package org.apiwatch.analyser.java;

import java.util.HashSet;
import java.util.Set;

import org.antlr.runtime.tree.Tree;
import org.apiwatch.analyser.APITreeWalker;
import org.apiwatch.models.APIScope;
import org.apiwatch.models.ComplexType;
import org.apiwatch.models.Function;
import org.apiwatch.models.Variable;
import org.apiwatch.models.Visibility;
import org.apiwatch.util.antlr.IterableTree;

public class JavaTreeWalker extends APITreeWalker {

    public JavaTreeWalker(String language, String sourceFile) {
        super(language, sourceFile);
    }

    /**
     * Walk a Java Tree and fill "globalScope" with generic API information from
     * it.
     */
    @Override
    public void walk(IterableTree ast) {

        if (ast == null) {
            return;
        }

        switch (ast.getType()) {

        case JavaParser.JAVA_SOURCE:
            __root(ast);
            break;

        case JavaParser.IMPORT:
            __import(ast);
            break;

        case JavaParser.ENUM:
        case JavaParser.CLASS:
        case JavaParser.INTERFACE:
            __object(ast);
            break;

        case JavaParser.EXTENDS_CLAUSE:
        case JavaParser.IMPLEMENTS_CLAUSE:
            __extends(ast);
            break;

        case JavaParser.CLASS_TOP_LEVEL_SCOPE:
        case JavaParser.INTERFACE_TOP_LEVEL_SCOPE:
        case JavaParser.ENUM_TOP_LEVEL_SCOPE:
            walkChildren(ast);
            break;

        case JavaParser.VAR_DECLARATION:
            __variable(ast);
            break;

        case JavaParser.CONSTRUCTOR_DECL:
        case JavaParser.FUNCTION_METHOD_DECL:
        case JavaParser.VOID_METHOD_DECL:
            __function(ast);
            break;

        case JavaParser.FORMAL_PARAM_LIST:
            walkChildren(ast);
            break;

        case JavaParser.FORMAL_PARAM_VARARG_DECL:
            ((Function) scopeStack.peek()).hasVarArgs = true;
            /* fallback to next case option */
        case JavaParser.FORMAL_PARAM_STD_DECL:
            __argument(ast);
            break;

        case JavaParser.THROWS_CLAUSE:
            __exceptions(ast);
            break;

        default:
            break;
        }
    }

    /**
     * Handle root node ^(JAVA_SOURCE ...)
     */
    private void __root(IterableTree ast) {
        IterableTree packageDecl = ast.firstChildOfType(JavaParser.PACKAGE);
        String packageName;
        if (packageDecl != null) {
            packageName = _dottedName(packageDecl.getChild(0));
        } else {
            packageName = "";
        }

        APIScope packageScope = new APIScope(packageName, language, _source(ast), Visibility.PUBLIC,
                scopeStack.peek(), null, null, null);
        ((APIScope) scopeStack.peek()).subScopes.add(packageScope);

        scopeStack.push(packageScope);
        walkChildren(ast, JavaParser.IMPORT);

        /* only one of these three will actually be walked */
        walk(ast.firstChildOfType(JavaParser.CLASS));
        walk(ast.firstChildOfType(JavaParser.INTERFACE));
        walk(ast.firstChildOfType(JavaParser.ENUM));
        scopeStack.pop();
    }

    /**
     * Handle import nodes ^(IMPORT ...)
     */
    private void __import(IterableTree ast) {
        for (IterableTree node : ast) {
            if (node.getType() != JavaParser.STATIC) {
                String importName = _dottedName(node);
                ((APIScope) scopeStack.peek()).dependencies.add(importName);
                return;
            }
        }
    }

    /**
     * Handle typedef nodes ^(ENUM|CLASS|INTERFACE ...)
     */
    private void __object(IterableTree ast) {

        IterableTree modList = ast.firstChildOfType(JavaParser.MODIFIER_LIST);

        Set<String> modifiers = _javaModifiers(modList);
        Visibility visibility = _javaVisibility(modList);

        String name = ast.firstChildOfType(JavaParser.IDENT).getText();

        IterableTree genericTypeParams = ast.firstChildOfType(JavaParser.GENERIC_TYPE_PARAM_LIST);
        if (genericTypeParams != null) {
            name += "<" + _genericsTypeList(genericTypeParams) + ">";
        }

        ComplexType complexType = new ComplexType(name, language, _source(ast), visibility,
                scopeStack.peek(), modifiers, null, null);

        if (scopeStack.peek() instanceof ComplexType) {
            ((ComplexType) scopeStack.peek()).symbols.add(complexType);
        } else if (scopeStack.peek() instanceof APIScope) {
            ((APIScope) scopeStack.peek()).symbols.add(complexType);
        }

        scopeStack.push(complexType);
        walk(ast.firstChildOfType(JavaParser.EXTENDS_CLAUSE));
        walk(ast.firstChildOfType(JavaParser.IMPLEMENTS_CLAUSE));

        /* only one of these three will actually be walked */
        walk(ast.firstChildOfType(JavaParser.CLASS_TOP_LEVEL_SCOPE));
        walk(ast.firstChildOfType(JavaParser.INTERFACE_TOP_LEVEL_SCOPE));
        walk(ast.firstChildOfType(JavaParser.ENUM_TOP_LEVEL_SCOPE));
        scopeStack.pop();
    }

    /**
     * Handle supertype nodes ^(EXTENDS_CLAUSE|IMPLEMENTS_CLAUSE ...)
     */
    private void __extends(IterableTree ast) {
        for (IterableTree child : ast) {
            ((ComplexType) scopeStack.peek()).superTypes.add(_typeName(child));
        }
    }

    /**
     * Handle variable declaration nodes ^(VAR_DECLARATION ...)
     */
    private void __variable(IterableTree ast) {
        IterableTree modList = ast.firstChildOfType(JavaParser.MODIFIER_LIST);

        Set<String> modifiers = _javaModifiers(modList);
        Visibility visibility = _javaVisibility(modList);
        String type = _typeName(ast.firstChildOfType(JavaParser.TYPE));

        for (IterableTree varDecl : ast.firstChildOfType(JavaParser.VAR_DECLARATOR_LIST)) {
            String varName = varDecl.firstChildOfType(JavaParser.IDENT).getText();
            Variable var = new Variable(varName, language, _source(ast), visibility,
                    scopeStack.peek(), modifiers, type, null);
            ((ComplexType) scopeStack.peek()).symbols.add(var);
        }
    }

    /**
     * Handle function nodes ^(CONSTRUCTOR_DECL|FUNCTION_METHOD_DECL|VOID_METHOD_DECL ...)
     */
    private void __function(IterableTree ast) {
        IterableTree modList = ast.firstChildOfType(JavaParser.MODIFIER_LIST);

        Set<String> modifiers = _javaModifiers(modList);
        Visibility visibility = _javaVisibility(modList);
        Tree funcNameAst = ast.firstChildOfType(JavaParser.IDENT);
        String name;
        if (funcNameAst != null) {
            name = funcNameAst.getText();
        } else {
            /* constructor nodes do not have a IDENT child, we take the name of the parent class */
            name = scopeStack.peek().name;
        }
        String returnType = _typeName(ast.firstChildOfType(JavaParser.TYPE));

        Function func = new Function(name, language, _source(ast), visibility, scopeStack.peek(),
                modifiers, returnType, null, false, null);
        ((ComplexType) scopeStack.peek()).symbols.add(func);

        scopeStack.push(func);
        walkChildren(ast, JavaParser.FORMAL_PARAM_LIST);
        walkChildren(ast, JavaParser.THROWS_CLAUSE);
        scopeStack.pop();
    }

    /**
     * Handle function arg nodes ^(FORMAL_PARAM_STD_DECL ...)
     */
    private void __argument(IterableTree ast) {
        Set<String> modifiers = _javaModifiers(ast.firstChildOfType(JavaParser.LOCAL_MODIFIER_LIST));
        String type = _typeName(ast.firstChildOfType(JavaParser.TYPE));
        String name = ast.firstChildOfType(JavaParser.IDENT).getText();

        Variable arg = new Variable(name, language, _source(ast), Visibility.SCOPE,
                scopeStack.peek(), modifiers, type, null);

        ((Function) scopeStack.peek()).arguments.add(arg);
    }

    private void __exceptions(IterableTree ast) {
        for (IterableTree child : ast) {
            /* java forbids generics on exceptions, we can do this safely. */
            String exceptionClass = _dottedName(child);
            ((Function) scopeStack.peek()).exceptions.add(exceptionClass);
        }
    }

    /* ======================================================================= */
    /* UTILITY METHODS */
    /* ======================================================================= */

    private static String _dottedName(IterableTree ast) {
        StringBuilder buffer = new StringBuilder();
        switch (ast.getType()) {
        case JavaParser.IDENT:
            buffer.append(ast.getText());
            break;
        case JavaParser.DOT:
            buffer.append(_dottedName(ast.getChild(0)));
            buffer.append(".");
            buffer.append(_dottedName(ast.getChild(1)));
            break;
        default:
            break;
        }
        return buffer.toString();
    }

    /**
     * Extract the "visibility" information from a MODIFIER_LIST node.
     */
    private static Visibility _javaVisibility(IterableTree ast) {
        if (ast != null) {
            for (IterableTree child : ast) {
                switch (child.getType()) {
                case JavaParser.PUBLIC:
                    return Visibility.PUBLIC;
                case JavaParser.PRIVATE:
                    return Visibility.PRIVATE;
                case JavaParser.PROTECTED:
                    return Visibility.PROTECTED;
                default:
                    continue;
                }
            }
        }
        return Visibility.SCOPE;
    }

    /**
     * Extract the modifiers from a MODIFIER_LIST node (without the "visibility"
     * information)
     */
    private static Set<String> _javaModifiers(IterableTree ast) {
        Set<String> modifiers = new HashSet<String>();
        if (ast != null) {
            for (IterableTree child : ast) {
                switch (child.getType()) {
                case JavaParser.PUBLIC:
                case JavaParser.PRIVATE:
                case JavaParser.PROTECTED:
                    break;
                case JavaParser.AT:
                    modifiers.add("@" + _dottedName(child.getChild(0)));
                    break;
                default:
                    modifiers.add(child.getText());
                }
            }
        }
        return modifiers;
    }

    /**
     * Extract the Type information from a TYPE node.
     */
    private static String _typeName(IterableTree ast) {
        if (ast == null) {
            return null;
        }
        StringBuilder typeName = new StringBuilder();

        if (ast.getType() == JavaParser.TYPE) {

            IterableTree qualifiedType = ast.firstChildOfType(JavaParser.QUALIFIED_TYPE_IDENT);

            if (qualifiedType != null) {
                StringBuilder qualifiedTypeName = new StringBuilder();
                for (int i = 0; i < qualifiedType.getChildCount(); i++) {
                    qualifiedTypeName.append("." + qualifiedType.getChild(i).getText());

                    IterableTree generics = qualifiedType.getChild(i).firstChildOfType(
                            JavaParser.GENERIC_TYPE_ARG_LIST);
                    if (generics != null) {
                        qualifiedTypeName.append('<');
                        qualifiedTypeName.append(_genericsTypeList(generics));
                        qualifiedTypeName.append('>');
                    }
                }
                /* to remove the leading dot */
                typeName.append(qualifiedTypeName.substring(1));
            } else {
                typeName.append(ast.getChild(0).getText());
            }

            Tree arrayDecl = ast.firstChildOfType(JavaParser.ARRAY_DECLARATOR_LIST);
            if (arrayDecl != null) {
                for (int i = 0; i < arrayDecl.getChildCount(); i++) {
                    typeName.append("[]");
                }
            }

        } else if (ast.getType() == JavaParser.QUESTION) {
            typeName.append("?");

            if (ast.getChildCount() > 0) {
                /* ^(QUESTION ^(EXTENDS|SUPER type)) */
                IterableTree extendsAst = ast.getChild(0);
                typeName.append(" ");
                typeName.append(extendsAst.getText());
                typeName.append(" ");
                typeName.append(_typeName(extendsAst.getChild(0)));
            }
        }

        return typeName.toString();
    }

    /**
     * Extract the generic type list from a type.
     *
     * Such as Blah<GenericType1, GenericType2>
     */
    private static String _genericsTypeList(IterableTree ast) {

        StringBuilder generics = new StringBuilder();

        for (IterableTree child : ast) {
            generics.append(", ");
            switch (child.getType()) {
            case JavaParser.TYPE:
                generics.append(_typeName(child));
                break;
            case JavaParser.IDENT:
                generics.append(child.getText());
                IterableTree bounds = child.firstChildOfType(JavaParser.EXTENDS_BOUND_LIST);
                if (bounds != null) {
                    generics.append(" extends ");
                    for (IterableTree bound : bounds) {
                        generics.append(_typeName(bound));
                        generics.append(" & ");
                    }
                    /* we remove the trailing " & " */
                    generics.delete(generics.length() - " & ".length(), generics.length());
                }
                break;
            default:
                break;
            }
        }

        return generics.substring(2); /* remove the leading ", " */
    }

    private static final String SOURCE_FILE_FORMAT = "%s:%d";
    private String _source(Tree ast) {
        return String.format(SOURCE_FILE_FORMAT, sourceFile, ast.getLine());
    }
}


text:
package org.finra.datagenerator.distributor.spark;

import org.apache.spark.api.java.JavaRDD;
import org.finra.datagenerator.engine.scxml.SCXMLEngine;
import org.junit.Assert;
import org.junit.Test;

import java.io.InputStream;
import java.util.Map;

/**
 * Integration test for SparkDistributor
 *
 * Needs proper unit tests some day
 */
public class SparkDistributorTest {

    /**
     * Simple integration test to smoke test the SparkDistributor
     */
    @Test
    public void testSparkDistributor() {
        InputStream is = SparkDistributorTest.class.getResourceAsStream("/spark/samplemachine.xml");

        SCXMLEngine scxmlEngine = new SCXMLEngine();

        scxmlEngine.setModelByInputFileStream(is);
        scxmlEngine.setBootstrapMin(1);

        SparkDistributor sparkDistributor = new SparkDistributor("local[5]");
        scxmlEngine.process(sparkDistributor);

        JavaRDD<Map<String, String>> results = sparkDistributor.getGeneratedMaps();
        Assert.assertEquals(243, results.collect().size());
    }
}


text:
MERCHANTS

Merchant Management

Merchants

                    ID
                    NAME
                    WALLET BALANCE
                    STATUS
                    CREATED ON

                    1
                    South India Shopping Mall
                    Rs. 534.00
                    In Active
                    23/04/2016

                    2
                    Avantika Collections
                    Rs. 3537.00
                    In Active
                    20/04/2016


text:
namespace Online_Radio_Database.Exceptions
{
    public class InvalidSongLengthException : InvalidSongException
    {
        public override string Message
        {
            get { return "Invalid song length."; }
        }
    }
}


text:
<?php
namespace Hal\Metric\Helper;

use PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Return_;

/**
 * @package Hal\Metric\Helper
 */
class RoleOfMethodDetector
{
    /**
     * @var array
     */
    private $fingerprints = [
        'getter' => [
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Stmt\\Return_',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
            ],
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Stmt\\Return_',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Name',
            ],
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Stmt\\Return_',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
            ],
        ],
        'setter' => [
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Expr\\Assign',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Param',
            ],
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Expr\\Assign',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Param',
                'PhpParser\\Node\\Name',
            ],
            // nicik/php-parser:^4
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Stmt\\Expression',
                'PhpParser\\Node\\Expr\\Assign',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Param',
                'PhpParser\\Node\\Expr\\Variable',
            ],
            [
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Stmt\\Expression',
                'PhpParser\\Node\\Expr\\Assign',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Param',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Name',
            ],[
                // function setOk(?bool $ok): self { $this->isOk = $ok; return $this; }
                'PhpParser\\Node\\Stmt\\ClassMethod',
                'PhpParser\\Node\\Stmt\\Expression',
                'PhpParser\\Node\\Expr\\Assign',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Expr\\PropertyFetch',
                'PhpParser\\Node\\Expr\\Variable',
                'PhpParser\\Node\\Param',
                'PhpParser\\Node\\Expr\\Variable',
            ],
        ]
    ];

    /**
     * @param $node
     * @return string|null
     */
    public function detects($node)
    {
        if (! $node instanceof ClassMethod) {
            return null;
        }

        // build a fingerprint of the given method
        $fingerprintOfMethod = [];
        iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) {
            // avoid identifier (php-parser:^4)
            if ($node instanceof Identifier) {
                return;
            }

            // avoid cast
            if ($node instanceof Cast) {
                return;
            }

            // avoid fluent interface
            if ($node instanceof Return_ && $node->expr instanceof Variable && $node->expr->name === 'this') {
                unset($fingerprintOfMethod[count($fingerprintOfMethod) - 1]);
                return;
            }

            // avoid type hint
            if ($node instanceof Name) {
                return;
            }

            // avoid nullable type
            if ($node instanceof NullableType) {
                return;
            }

            $fingerprintOfMethod[] = get_class($node);
        });
        $fingerprintOfMethod = array_reverse($fingerprintOfMethod);

        // compare with database of fingerprints
        foreach ($this->fingerprints as $type => $fingerprints) {
            if (in_array($fingerprintOfMethod, $fingerprints, true)) {
                return $type;
            }
        }

        return null;
    }
}


text:
using System.Collections.Generic;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;

namespace Articulate.Models
{
    public class AuthorListModel : MasterModel
    {
        public AuthorListModel(IPublishedContent content)
            : base(content)
        {
        }

        public IEnumerable<AuthorModel> Authors { get; set; }
    }
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>CSS Inline Layout: getComputedStyle().lineHeight</title>
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#line-height-property">
<meta name="assert" content="line-height computed value is normal or a length.">


text:
package azkaban.metric;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import azkaban.metric.inmemoryemitter.InMemoryHistoryNode;
import azkaban.metric.inmemoryemitter.InMemoryMetricEmitter;
import azkaban.utils.Props;
import java.util.Date;
import java.util.List;
import org.junit.Before;
import org.junit.Test;

/**
 * Azkaban Metric Manager Tests
 */
public class MetricManagerTest {

  MetricReportManager manager;
  FakeMetric metric;
  InMemoryMetricEmitter emitter;

  @Before
  public void setUp() throws Exception {
    this.manager = MetricReportManager.getInstance();
    this.metric = new FakeMetric(this.manager);
    this.manager.addMetric(this.metric);
    this.emitter = new InMemoryMetricEmitter(new Props());
    this.manager.addMetricEmitter(this.emitter);
  }

  /**
   * Test enable disable and status methods
   */
  @Test
  public void managerStatusTest() {
    assertNotNull("Singleton Failed to instantiate", this.manager);
    assertTrue("Failed to enable metric manager", MetricReportManager.isAvailable());
    this.manager.disableManager();
    assertFalse("Failed to disable metric manager", MetricReportManager.isAvailable());
    this.manager.enableManager();
    assertTrue("Failed to enable metric manager", MetricReportManager.isAvailable());
  }

  /**
   * Test adding and accessing metric methods
   */
  @Test
  public void managerMetricMaintenanceTest() {
    assertEquals("Failed to add metric", this.manager.getAllMetrics().size(), 1);
    assertTrue("Failed to add metric", this.manager.getAllMetrics().contains(this.metric));
    assertEquals("Failed to get metric by Name", this.manager.getMetricFromName("FakeMetric"),
        this.metric);
  }

  /**
   * Test adding, removing and accessing metric emitter.
   */
  @Test
  public void managerEmitterMaintenanceTest() {
    assertTrue("Failed to add Emitter", this.manager.getMetricEmitters().contains(this.emitter));

    final int originalSize = this.manager.getMetricEmitters().size();
    this.manager.removeMetricEmitter(this.emitter);
    assertEquals("Failed to remove emitter", this.manager.getMetricEmitters().size(),
        originalSize - 1);
    this.manager.addMetricEmitter(this.emitter);
  }

  /**
   * Test metric reporting methods, including InMemoryMetricEmitter methods
   */
  @Test
  public void managerEmitterHandlingTest() throws Exception {
    this.emitter.purgeAllData();
    final Date from = new Date();
    this.metric.notifyManager();

    Thread.sleep(2000);

    final List<InMemoryHistoryNode> nodes = this.emitter
        .getMetrics("FakeMetric", from, new Date(), false);

    assertEquals("Failed to report metric", 1, nodes.size());
    assertEquals("Failed to report metric", nodes.get(0).getValue(), 4);
  }
}


text:
using namespace boost;

template <typename Graph, typename CapacityMap, typename ReverseEdgeMap>
std::pair< typename graph_traits<Graph>::vertex_descriptor,typename graph_traits<Graph>::vertex_descriptor>
fill_random_max_flow_graph(Graph& g, CapacityMap cap, ReverseEdgeMap rev, typename graph_traits<Graph>::vertices_size_type n_verts,
                           typename graph_traits<Graph>::edges_size_type n_edges, std::size_t seed)
{
  typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor;
  typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
  const int cap_low = 1;
  const int cap_high = 1000;

  //init random numer generator
  minstd_rand gen(seed);
  //generate graph
  generate_random_graph(g, n_verts, n_edges, gen);

  //init an uniform distribution int generator
  typedef variate_generator<minstd_rand, uniform_int<int> > tIntGen;
  tIntGen int_gen(gen, uniform_int<int>(cap_low, cap_high));
  //randomize edge-capacities
  //randomize_property<edge_capacity, Graph, tIntGen> (g,int_gen); //we cannot use this, as we have no idea how properties are stored, right?
  typename graph_traits<Graph>::edge_iterator ei, e_end;
  for(boost::tie(ei,e_end) = edges(g); ei != e_end; ++ei)
    cap[*ei] = int_gen();

  //get source and sink node
  vertex_descriptor s = random_vertex(g, gen);
  vertex_descriptor t = graph_traits<Graph>::null_vertex();
  while(t == graph_traits<Graph>::null_vertex() || t == s)
    t = random_vertex(g, gen);

  //add reverse edges (ugly... how to do better?!)
  std::list<edge_descriptor> edges_copy;
  boost::tie(ei, e_end) = edges(g);
  std::copy(ei, e_end, std::back_insert_iterator< std::list<edge_descriptor> >(edges_copy));
  while(!edges_copy.empty()){
    edge_descriptor old_edge = edges_copy.front();
    edges_copy.pop_front();
    vertex_descriptor source_vertex = target(old_edge, g);
    vertex_descriptor target_vertex = source(old_edge, g);
    bool inserted;
    edge_descriptor  new_edge;
    boost::tie(new_edge,inserted) = add_edge(source_vertex, target_vertex, g);
    assert(inserted);
    rev[old_edge] = new_edge;
    rev[new_edge] = old_edge ;
    cap[new_edge] = 0;
  }
  return std::make_pair(s,t);
}

long test_adjacency_list_vecS(int n_verts, int n_edges, std::size_t seed){
  typedef adjacency_list_traits<vecS, vecS, directedS> tVectorTraits;
  typedef adjacency_list<vecS, vecS, directedS,
  property<vertex_index_t, long,
  property<vertex_predecessor_t, tVectorTraits::edge_descriptor,
  property<vertex_color_t, boost::default_color_type,
  property<vertex_distance_t, long> > > >,
  property<edge_capacity_t, long,
  property<edge_residual_capacity_t, long,
  property<edge_reverse_t, tVectorTraits::edge_descriptor > > > > tVectorGraph;

  tVectorGraph g;

  graph_traits<tVectorGraph>::vertex_descriptor src,sink;
  boost::tie(src,sink) = fill_random_max_flow_graph(g, get(edge_capacity,g), get(edge_reverse, g), n_verts, n_edges, seed);

  return boykov_kolmogorov_max_flow(g, get(edge_capacity, g),
                                    get(edge_residual_capacity, g),
                                    get(edge_reverse, g),
                                    get(vertex_predecessor, g),
                                    get(vertex_color, g),
                                    get(vertex_distance, g),
                                    get(vertex_index, g),
                                    src, sink);
}

long test_adjacency_list_listS(int n_verts, int n_edges, std::size_t seed){
  typedef adjacency_list_traits<listS, listS, directedS> tListTraits;
  typedef adjacency_list<listS, listS, directedS,
  property<vertex_index_t, long,
  property<vertex_predecessor_t, tListTraits::edge_descriptor,
  property<vertex_color_t, boost::default_color_type,
  property<vertex_distance_t, long> > > >,
  property<edge_capacity_t, long,
  property<edge_residual_capacity_t, long,
  property<edge_reverse_t, tListTraits::edge_descriptor > > > > tListGraph;

  tListGraph g;

  graph_traits<tListGraph>::vertex_descriptor src,sink;
  boost::tie(src,sink) = fill_random_max_flow_graph(g, get(edge_capacity,g), get(edge_reverse, g), n_verts, n_edges, seed);

  //initialize vertex indices
  graph_traits<tListGraph>::vertex_iterator vi,v_end;
  graph_traits<tListGraph>::vertices_size_type index = 0;
  for(boost::tie(vi, v_end) = vertices(g); vi != v_end; ++vi){
    put(vertex_index, g, *vi, index++);
  }
  return boykov_kolmogorov_max_flow(g, get(edge_capacity, g),
                                    get(edge_residual_capacity, g),
                                    get(edge_reverse, g),
                                    get(vertex_predecessor, g),
                                    get(vertex_color, g),
                                    get(vertex_distance, g),
                                    get(vertex_index, g),
                                    src, sink);
}

template<typename EdgeDescriptor>
    struct Node{
  boost::default_color_type vertex_color;
  long vertex_distance;
  EdgeDescriptor vertex_predecessor;
};

template<typename EdgeDescriptor>
    struct Link{
  long edge_capacity;
  long edge_residual_capacity;
  EdgeDescriptor edge_reverse;
};

long test_bundled_properties(int n_verts, int n_edges, std::size_t seed){
  typedef adjacency_list_traits<vecS, vecS, directedS> tTraits;
  typedef Node<tTraits::edge_descriptor> tVertex;
  typedef Link<tTraits::edge_descriptor> tEdge;
  typedef adjacency_list<vecS, vecS, directedS, tVertex, tEdge> tBundleGraph;

  tBundleGraph g;

  graph_traits<tBundleGraph>::vertex_descriptor src,sink;
  boost::tie(src,sink) = fill_random_max_flow_graph(g, get(&tEdge::edge_capacity,g), get(&tEdge::edge_reverse, g), n_verts, n_edges, seed);
  return boykov_kolmogorov_max_flow(g, get(&tEdge::edge_capacity, g),
                                    get(&tEdge::edge_residual_capacity, g),
                                    get(&tEdge::edge_reverse, g),
                                    get(&tVertex::vertex_predecessor, g),
                                    get(&tVertex::vertex_color, g),
                                    get(&tVertex::vertex_distance, g),
                                    get(vertex_index, g),
                                    src, sink);
}

long test_overloads(int n_verts, int n_edges, std::size_t seed){
  typedef adjacency_list_traits<vecS, vecS, directedS> tTraits;
  typedef property <edge_capacity_t, long,
     property<edge_residual_capacity_t, long,
     property<edge_reverse_t, tTraits::edge_descriptor> > >tEdgeProperty;
  typedef adjacency_list<vecS, vecS, directedS, no_property, tEdgeProperty> tGraph;

  tGraph g;

  graph_traits<tGraph>::vertex_descriptor src,sink;
  boost::tie(src,sink) = fill_random_max_flow_graph(g, get(edge_capacity,g), get(edge_reverse, g), n_verts, n_edges, seed);

  std::vector<graph_traits<tGraph>::edge_descriptor> predecessor_vec(n_verts);
  std::vector<default_color_type> color_vec(n_verts);
  std::vector<graph_traits<tGraph>::vertices_size_type> distance_vec(n_verts);

  long flow_overload_1 =
    boykov_kolmogorov_max_flow(g,
                               get(edge_capacity,g),
                               get(edge_residual_capacity,g),
                               get(edge_reverse,g),
                               get(vertex_index,g),
                               src, sink);

  long flow_overload_2 =
    boykov_kolmogorov_max_flow(g,
                               get(edge_capacity,g),
                               get(edge_residual_capacity,g),
                               get(edge_reverse,g),
                               &(color_vec[0]),
                               get(vertex_index,g),
                               src, sink);

  BOOST_CHECK(flow_overload_1 == flow_overload_2);
  return flow_overload_1;
}

template<class Graph,
         class EdgeCapacityMap,
         class ResidualCapacityEdgeMap,
         class ReverseEdgeMap,
         class PredecessorMap,
         class ColorMap,
         class DistanceMap,
         class IndexMap>
class boykov_kolmogorov_test
  : public detail::bk_max_flow<
      Graph, EdgeCapacityMap, ResidualCapacityEdgeMap, ReverseEdgeMap,
      PredecessorMap, ColorMap, DistanceMap, IndexMap
    >
{

  typedef typename graph_traits<Graph>::edge_descriptor tEdge;
  typedef typename graph_traits<Graph>::vertex_descriptor tVertex;
  typedef typename property_traits< typename property_map<Graph, edge_capacity_t>::const_type>::value_type tEdgeVal;
  typedef typename graph_traits<Graph>::vertex_iterator tVertexIterator;
  typedef typename graph_traits<Graph>::out_edge_iterator tOutEdgeIterator;
  typedef typename property_traits<ColorMap>::value_type tColorValue;
  typedef color_traits<tColorValue> tColorTraits;
  typedef typename property_traits<DistanceMap>::value_type tDistanceVal;
  typedef typename detail::bk_max_flow<
    Graph, EdgeCapacityMap, ResidualCapacityEdgeMap, ReverseEdgeMap,
    PredecessorMap, ColorMap, DistanceMap, IndexMap
  > tSuper;
  public:
        boykov_kolmogorov_test(Graph& g,
                               typename graph_traits<Graph>::vertex_descriptor src,
                               typename graph_traits<Graph>::vertex_descriptor sink)
          : tSuper(g, get(edge_capacity,g), get(edge_residual_capacity,g),
                   get(edge_reverse, g), get(vertex_predecessor, g),
                   get(vertex_color, g), get(vertex_distance, g),
                   get(vertex_index, g), src, sink)
          { }

        void invariant_four(tVertex v) const{
          //passive nodes in S or T
          if(v == tSuper::m_source || v == tSuper::m_sink)
            return;
          typename std::list<tVertex>::const_iterator it = find(tSuper::m_orphans.begin(), tSuper::m_orphans.end(), v);
          // a node is active, if its in the active_list AND (is has_a_parent, or its already in the orphans_list or its the sink, or its the source)
          bool is_active = (tSuper::m_in_active_list_map[v] && (tSuper::has_parent(v) || it != tSuper::m_orphans.end() ));
          if(this->get_tree(v) != tColorTraits::gray() && !is_active){
            typename graph_traits<Graph>::out_edge_iterator ei,e_end;
            for(boost::tie(ei, e_end) = out_edges(v, tSuper::m_g); ei != e_end; ++ei){
              const tVertex& other_node = target(*ei, tSuper::m_g);
              if(this->get_tree(other_node) != this->get_tree(v)){
                if(this->get_tree(v) == tColorTraits::black())
                  BOOST_CHECK(tSuper::m_res_cap_map[*ei] == 0);
                else
                  BOOST_CHECK(tSuper::m_res_cap_map[tSuper::m_rev_edge_map[*ei]] == 0);
              }
             }
          }
        }

        void invariant_five(const tVertex& v) const{
          BOOST_CHECK(this->get_tree(v) != tColorTraits::gray() || tSuper::m_time_map[v] <= tSuper::m_time);
        }

        void invariant_six(const tVertex& v) const{
          if(this->get_tree(v) == tColorTraits::gray() || tSuper::m_time_map[v] != tSuper::m_time)
            return;
          else{
            tVertex current_node = v;
            tDistanceVal distance = 0;
            tColorValue color = this->get_tree(v);
            tVertex terminal = (color == tColorTraits::black()) ? tSuper::m_source : tSuper::m_sink;
            while(current_node != terminal){
              BOOST_CHECK(tSuper::has_parent(current_node));
              tEdge e = this->get_edge_to_parent(current_node);
              ++distance;
              current_node = (color == tColorTraits::black())? source(e, tSuper::m_g) : target(e, tSuper::m_g);
              if(distance > tSuper::m_dist_map[v])
                break;
            }
            BOOST_CHECK(distance == tSuper::m_dist_map[v]);
          }
        }

        void invariant_seven(const tVertex& v) const{
          if(this->get_tree(v) == tColorTraits::gray())
            return;
          else{
            tColorValue color = this->get_tree(v);
            long time = tSuper::m_time_map[v];
            tVertex current_node = v;
            while(tSuper::has_parent(current_node)){
              tEdge e = this->get_edge_to_parent(current_node);
              current_node = (color == tColorTraits::black()) ? source(e, tSuper::m_g) : target(e, tSuper::m_g);
              BOOST_CHECK(tSuper::m_time_map[current_node] >= time);
            }
          }
        }//invariant_seven

        void invariant_eight(const tVertex& v) const{
          if(this->get_tree(v) == tColorTraits::gray())
             return;
          else{
            tColorValue color = this->get_tree(v);
            long time = tSuper::m_time_map[v];
            tDistanceVal distance = tSuper::m_dist_map[v];
            tVertex current_node = v;
            while(tSuper::has_parent(current_node)){
              tEdge e = this->get_edge_to_parent(current_node);
              current_node = (color == tColorTraits::black()) ? source(e, tSuper::m_g) : target(e, tSuper::m_g);
              if(tSuper::m_time_map[current_node] == time)
                BOOST_CHECK(tSuper::m_dist_map[current_node] < distance);
            }
          }
        }//invariant_eight

        void check_invariants(){
          tVertexIterator vi, v_end;
          for(boost::tie(vi, v_end) = vertices(tSuper::m_g); vi != v_end; ++vi){
            invariant_four(*vi);
            invariant_five(*vi);
            invariant_six(*vi);
            invariant_seven(*vi);
            invariant_eight(*vi);
          }
        }

        tEdgeVal test(){
          this->add_active_node(this->m_sink);
          this->augment_direct_paths();
          check_invariants();
          //start the main-loop
          while(true){
            bool path_found;
            tEdge connecting_edge;
            boost::tie(connecting_edge, path_found) = this->grow(); //find a path from source to sink
            if(!path_found){
                //we're finished, no more paths were found
              break;
            }
            check_invariants();
            this->m_time++;
            this->augment(connecting_edge); //augment that path
            check_invariants();
            this->adopt(); //rebuild search tree structure
            check_invariants();
          }

          //check if flow is the sum of outgoing edges of src
          tOutEdgeIterator ei, e_end;
          tEdgeVal src_sum = 0;
          for(boost::tie(ei, e_end) = out_edges(this->m_source, this->m_g); ei != e_end; ++ei){
            src_sum += this->m_cap_map[*ei] - this->m_res_cap_map[*ei];
          }
          BOOST_CHECK(this->m_flow == src_sum);
          //check if flow is the sum of ingoing edges of sink
          tEdgeVal sink_sum = 0;
          for(boost::tie(ei, e_end) = out_edges(this->m_sink, this->m_g); ei != e_end; ++ei){
            tEdge in_edge = this->m_rev_edge_map[*ei];
            sink_sum += this->m_cap_map[in_edge] - this->m_res_cap_map[in_edge];
          }
          BOOST_CHECK(this->m_flow == sink_sum);
          return this->m_flow;
        }
};

long test_algorithms_invariant(int n_verts, int n_edges, std::size_t seed)
{
  typedef adjacency_list_traits<vecS, vecS, directedS> tVectorTraits;
  typedef adjacency_list<vecS, vecS, directedS,
  property<vertex_index_t, long,
  property<vertex_predecessor_t, tVectorTraits::edge_descriptor,
  property<vertex_color_t, default_color_type,
  property<vertex_distance_t, long> > > >,
  property<edge_capacity_t, long,
  property<edge_residual_capacity_t, long,
  property<edge_reverse_t, tVectorTraits::edge_descriptor > > > > tVectorGraph;

  tVectorGraph g;

  graph_traits<tVectorGraph>::vertex_descriptor src, sink;
  boost::tie(src,sink) = fill_random_max_flow_graph(g, get(edge_capacity,g), get(edge_reverse, g), n_verts, n_edges, seed);

  typedef property_map<tVectorGraph, edge_capacity_t>::type tEdgeCapMap;
  typedef property_map<tVectorGraph, edge_residual_capacity_t>::type tEdgeResCapMap;
  typedef property_map<tVectorGraph, edge_reverse_t>::type tRevEdgeMap;
  typedef property_map<tVectorGraph, vertex_predecessor_t>::type tVertexPredMap;
  typedef property_map<tVectorGraph, vertex_color_t>::type tVertexColorMap;
  typedef property_map<tVectorGraph, vertex_distance_t>::type tDistanceMap;
  typedef property_map<tVectorGraph, vertex_index_t>::type tIndexMap;
  typedef boykov_kolmogorov_test<
    tVectorGraph, tEdgeCapMap, tEdgeResCapMap, tRevEdgeMap, tVertexPredMap,
    tVertexColorMap, tDistanceMap, tIndexMap
  > tKolmo;
  tKolmo instance(g, src, sink);
  return instance.test();
}

int test_main(int argc, char* argv[])
{
  int n_verts = 10;
  int n_edges = 500;
  std::size_t seed = 1;

  if (argc > 1) n_verts = lexical_cast<int>(argv[1]);
  if (argc > 2) n_edges = lexical_cast<int>(argv[2]);
  if (argc > 3) seed = lexical_cast<std::size_t>(argv[3]);

  //we need at least 2 vertices to create src and sink in random graphs
  //this case is also caught in boykov_kolmogorov_max_flow
  if (n_verts<2)
    n_verts = 2;

  // below are checks for different calls to boykov_kolmogorov_max_flow and different graph-types

  //checks support of vecS storage
  long flow_vecS = test_adjacency_list_vecS(n_verts, n_edges, seed);
  std::cout << "vecS flow: " << flow_vecS << std::endl;
  //checks support of listS storage (especially problems with vertex indices)
  long flow_listS = test_adjacency_list_listS(n_verts, n_edges, seed);
  std::cout << "listS flow: " << flow_listS << std::endl;
  BOOST_CHECK(flow_vecS == flow_listS);
  //checks bundled properties
  long flow_bundles = test_bundled_properties(n_verts, n_edges, seed);
  std::cout << "bundles flow: " << flow_bundles << std::endl;
  BOOST_CHECK(flow_listS == flow_bundles);
  //checks overloads
  long flow_overloads = test_overloads(n_verts, n_edges, seed);
  std::cout << "overloads flow: " << flow_overloads << std::endl;
  BOOST_CHECK(flow_bundles == flow_overloads);

  // excessive test version where Boykov-Kolmogorov's algorithm invariants are
  // checked
  long flow_invariants = test_algorithms_invariant(n_verts, n_edges, seed);
  std::cout << "invariants flow: " << flow_invariants << std::endl;
  BOOST_CHECK(flow_overloads == flow_invariants);
  return 0;
}


text:
package cz.pfreiberg.knparser.exporter.oracledatabase;

import java.sql.SQLException;
import java.util.List;

import cz.pfreiberg.knparser.ConnectionParameters;
import cz.pfreiberg.knparser.domain.prvkykatastralnimapy.SpojeniBMapy;
import cz.pfreiberg.knparser.util.VfkUtil;

public class SpojeniBMapyOracleDatabaseJdbcExporter extends
		Stav2OracleDatabaseJdbcExporter {

	private final static String name = "SPOJENI_B_MAPY";
	private static final String insert = "INSERT INTO " + name + " VALUES"
			+ "(?,?,?,?,?,?,?,?,?,?)";
	private static final String hisInsert = "INSERT INTO " + name + "_MIN" + " VALUES"
			+ "(SEQ_SPOJENI_B_MAPY_MIN.nextval,?,?,?,?,?,?,?,?,?,?)";

	public SpojeniBMapyOracleDatabaseJdbcExporter(
			List<SpojeniBMapy> spojeniBMapy,
			ConnectionParameters connectionParameters) {
		super(connectionParameters, name, insert, hisInsert);
		prepareStatement(spojeniBMapy, name);
	}

	@Override
	protected void insertRecord(Object rawRecord) throws SQLException {
		SpojeniBMapy record = (SpojeniBMapy) rawRecord;
		psInsert.setObject(1,
				VfkUtil.convertToDatabaseDate(record.getDatumVzniku()));
		psInsert.setObject(2,
				VfkUtil.convertToDatabaseDate(record.getDatumZaniku()));
		psInsert.setObject(3, record.getPoradoveCisloBodu());
		psInsert.setObject(4, record.getSouradniceY());
		psInsert.setObject(5, record.getSouradniceX());
		psInsert.setObject(6, record.getOpId());
		psInsert.setObject(7, record.getDpmId());
		psInsert.setObject(8, record.getHbpejId());
		psInsert.setObject(9, record.getParametrySpojeni());
		psInsert.setObject(10, 0);
	}

	@Override
	protected void insertHistoricalRecord(Object rawRecord) throws SQLException {
		SpojeniBMapy record = (SpojeniBMapy) rawRecord;
		psHisInsert.setObject(1,
				VfkUtil.convertToDatabaseDate(record.getDatumVzniku()));
		psHisInsert.setObject(2,
				VfkUtil.convertToDatabaseDate(record.getDatumZaniku()));
		psHisInsert.setObject(3, record.getPoradoveCisloBodu());
		psHisInsert.setObject(4, record.getSouradniceY());
		psHisInsert.setObject(5, record.getSouradniceX());
		psHisInsert.setObject(6, record.getOpId());
		psHisInsert.setObject(7, record.getDpmId());
		psHisInsert.setObject(8, record.getHbpejId());
		psHisInsert.setObject(9, record.getParametrySpojeni());
		psHisInsert.setObject(10, 0);
	}

}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.LanguageServices.Implementation.Options;

namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
{
    [Guid(Guids.CSharpOptionPageFormattingIndentationIdString)]
    internal class FormattingIndentationOptionPage : AbstractOptionPage
    {
        protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
        {
            return new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new IndentationViewModel(o, s));
        }
    }
}


text:
/// <reference path="point.ts" />

module MakerJs.path {

    /**
     * Create a clone of a path, mirrored on either or both x and y axes.
     *
     * @param pathToMirror The path to mirror.
     * @param mirrorX Boolean to mirror on the x axis.
     * @param mirrorY Boolean to mirror on the y axis.
     * @param newId Optional id to assign to the new path.
     * @returns Mirrored path.
     */
    export function mirror(pathToMirror: IPath, mirrorX: boolean, mirrorY: boolean, newId?: string): IPath {

        var newPath: IPath = null;
        var origin = point.mirror(pathToMirror.origin, mirrorX, mirrorY);

        var map: IPathFunctionMap = {};

        map[pathType.Line] = function (line: IPathLine) {

            newPath = new paths.Line(
                origin,
                point.mirror(line.end, mirrorX, mirrorY)
                );
        };

        map[pathType.Circle] = function (circle: IPathCircle) {

            newPath = new paths.Circle(
                origin,
                circle.radius
                );
        };

        map[pathType.Arc] = function (arc: IPathArc) {

            var startAngle = angle.mirror(arc.startAngle, mirrorX, mirrorY);
            var endAngle = angle.mirror(angle.ofArcEnd(arc), mirrorX, mirrorY);
            var xor = mirrorX != mirrorY;

            newPath = new paths.Arc(
                origin,
                arc.radius,
                xor ? endAngle : startAngle,
                xor ? startAngle : endAngle
                );
        };

        var fn = map[pathToMirror.type];
        if (fn) {
            fn(pathToMirror);
        }

        return newPath;
    }

    /**
     * Move a path to an absolute point.
     *
     * @param pathToMove The path to move.
     * @param origin The new origin for the path.
     * @returns The original path (for chaining).
     */
    export function move(pathToMove: IPath, origin: IPoint): IPath {

        if (pathToMove) {
            var map: IPathFunctionMap = {};

            map[pathType.Line] = function (line: IPathLine) {
                var delta = point.subtract(line.end, line.origin);
                line.end = point.add(origin, delta);
            };

            var fn = map[pathToMove.type];
            if (fn) {
                fn(pathToMove);
            }

            pathToMove.origin = origin;
        }

        return pathToMove;
    }

    /**
     * Move a path's origin by a relative amount.
     *
     * @param pathToMove The path to move.
     * @param delta The x & y adjustments as a point object.
     * @returns The original path (for chaining).
     */
    export function moveRelative(pathToMove: IPath, delta: IPoint): IPath {

        if (pathToMove) {
            var map: IPathFunctionMap = {};

            map[pathType.Line] = function (line: IPathLine) {
                line.end = point.add(line.end, delta);
            };

            pathToMove.origin = point.add(pathToMove.origin, delta);

            var fn = map[pathToMove.type];
            if (fn) {
                fn(pathToMove);
            }
        }

        return pathToMove;
    }

    /**
     * Rotate a path.
     *
     * @param pathToRotate The path to rotate.
     * @param angleInDegrees The amount of rotation, in degrees.
     * @param rotationOrigin The center point of rotation.
     * @returns The original path (for chaining).
     */
    export function rotate(pathToRotate: IPath, angleInDegrees: number, rotationOrigin: IPoint): IPath {
        if (angleInDegrees == 0) return pathToRotate;

        var map: IPathFunctionMap = {};

        map[pathType.Line] = function (line: IPathLine) {
            line.end = point.rotate(line.end, angleInDegrees, rotationOrigin);
        }

        map[pathType.Arc] = function (arc: IPathArc) {
            arc.startAngle += angleInDegrees;
            arc.endAngle += angleInDegrees;
        }

        pathToRotate.origin = point.rotate(pathToRotate.origin, angleInDegrees, rotationOrigin);

        var fn = map[pathToRotate.type];
        if (fn) {
            fn(pathToRotate);
        }

        return pathToRotate;
    }

    /**
     * Scale a path.
     *
     * @param pathToScale The path to scale.
     * @param scaleValue The amount of scaling.
     * @returns The original path (for chaining).
     */
    export function scale(pathToScale: IPath, scaleValue: number): IPath {
        if (scaleValue == 1) return pathToScale;

        var map: IPathFunctionMap = {};

        map[pathType.Line] = function (line: IPathLine) {
            line.end = point.scale(line.end, scaleValue);
        }

        map[pathType.Circle] = function (circle: IPathCircle) {
            circle.radius *= scaleValue;
        }

        map[pathType.Arc] = map[pathType.Circle];

        pathToScale.origin = point.scale(pathToScale.origin, scaleValue);

        var fn = map[pathToScale.type];
        if (fn) {
            fn(pathToScale);
        }

        return pathToScale;
    }

}


text:
require "test_helper"

class IncomeTest < ActiveSupport::TestCase

  def income
    @income ||= Income.new
  end

  def test_valid
    assert income.valid?
  end

end


text:
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class RevengeOfThePancakes {

    public static void main(String[] args) throws FileNotFoundException {
        try (Scanner in = new Scanner(new File("input.txt"))) {
            int numCases = in.nextInt();
            in.nextLine();
            for (int i = 0; i < numCases; i++) {
                final long answer = processCase(in.nextLine());
                System.out.println("Case #" + (i+1) + ": " + (answer == -1 ? "INSOMNIA" : answer));
            }
        }

    }

    private static long processCase(String str) {
        int count = 0;
        char[] vals = str.toCharArray();
//        System.out.println(vals);
        for (int i = vals.length-1 ; i >=0; i--) {
            if (vals[i] =='-') {
                flip(vals, i);
                count++;
            }
        }
        return count;
    }

    private static void flip(char[] vals, int i) {
        for (int j = 0; j <= i; j++) {
            if (vals[j] == '-') {
                vals[j] = '+';
            } else if (vals[j] == '+') {
                vals[j] = '-';
            } else {
                throw new IllegalStateException();
            }
        }

    }

}


text:
package com.oba7;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.sun.org.apache.xpath.internal.operations.String;

public class Amballah extends ApplicationAdapter {
    public static int WIDTH = 800, HEIGHT = 600;
    private SpriteBatch batch;
    private Texture wara;
        private Music music;

    @Override
    public void create() {
        batch = new SpriteBatch();

        wara = (Math.random()*10<5)?Textures.WARA:Textures.WARA2;
        Screens.setScreen(new El7ara());
        music=Textures.MUSIC;

    }

    @Override
    public void dispose() {
        if (Screens.getCurrentScreen() != null)
            Screens.getCurrentScreen().dispose();
        batch.dispose();
    }

    @Override
    public void render() {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        music.setLooping(true);
        music.play();
        batch.begin();

        batch.draw(wara, 0, 0, 800, 600, 0, 0, 800, 600, false, false);

        batch.end();
        if (Screens.getCurrentScreen() != null)
            Screens.getCurrentScreen().update();

        if (Screens.getCurrentScreen() != null)
            Screens.getCurrentScreen().render(batch);
    }

    @Override
    public void resize(int width, int height) {
        if (Screens.getCurrentScreen() != null)
            Screens.getCurrentScreen().resize(width, height);
    }

    @Override

    public void pause() {
        if (Screens.getCurrentScreen() != null)
            Screens.getCurrentScreen().pause();
    }

    @Override
    public void resume() {
        if (Screens.getCurrentScreen() != null)
            Screens.getCurrentScreen().resume();
    }

    public static int getWIDTH() {
        return WIDTH;
    }

    public static void setWIDTH(int WIDTH) {
        Amballah.WIDTH = WIDTH;
    }

    public static int getHEIGHT() {
        return HEIGHT;
    }

    public static void setHEIGHT(int HEIGHT) {
        Amballah.HEIGHT = HEIGHT;
    }

    public SpriteBatch getBatch() {
        return batch;
    }

    public void setBatch(SpriteBatch batch) {
        this.batch = batch;
    }

    public Texture getWara() {
        return wara;
    }

    public void setWara(Texture wara) {
        this.wara = wara;
    }

    public Music getMusic() {
        return music;
    }

    public void setMusic(Music music) {
        this.music = music;
    }

}


text:
from swgpy.object import *

def create(kernel):
	result = Building()

	result.template = "object/building/yavin/shared_temple_exar_kun.iff"
	result.attribute_template_id = -1
	result.stfName("building_name","temple_exar_kun")

	#### BEGIN MODIFICATIONS ####
	####  END MODIFICATIONS  ####

	return result


text:
<?php

class DynamicDataRemoval
{

	const CONSTANT_ONE = 1;

	public $propertyOne;

	public function methodOne($method_param1) {}

}


text:
@import RazeUIKit;

#import <RazeScene/RazeScene.h>

@interface RZXViewNode : RZXModelNode

+ (instancetype)nodeWithView:(UIView *)view;

@end


text:
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new Genemu\Bundle\FormBundle\GenemuFormBundle(),
            new PunkAve\FileUploaderBundle\PunkAveFileUploaderBundle(),
            //new Beryllium\CacheBundle\BerylliumCacheBundle(),
            //new Aequasi\Bundle\MemcachedBundle\AequasiMemcachedBundle(),
            //new winzou\CacheBundle\winzouCacheBundle(),
            new Maxmind\Bundle\GeoipBundle\MaxmindGeoipBundle(),
            //new WhiteOctober\TCPDFBundle\WhiteOctoberTCPDFBundle(),
            new Slik\DompdfBundle\SlikDompdfBundle()
            //new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new Acme\IndexBundle\AcmeIndexBundle();
            $bundles[] = new Acme\AuthBundle\AcmeAuthBundle();
            $bundles[] = new Acme\SecureBundle\AcmeSecureBundle();
            $bundles[] = new Acme\AdminBundle\AcmeAdminBundle();
            //$bundles[] = new DMS\Bundle\FilterBundle\DMSFilterBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }

    public function init()
    {
        date_default_timezone_set( 'Europe/Moscow' );
        parent::init();
    }
}


text:
/**
 *     This code was auto-generated by a Codezu.
 *
 *     Changes to this file may cause incorrect behavior and will be lost if
 *     the code is regenerated.
 */
package com.mozu.api.clients.commerce.catalog.storefront;

import java.util.List;
import java.util.ArrayList;
import com.mozu.api.MozuClient;
import com.mozu.api.MozuClientFactory;
import com.mozu.api.MozuUrl;
import com.mozu.api.Headers;
import org.joda.time.DateTime;
import com.mozu.api.AsyncCallback;
import java.util.concurrent.CountDownLatch;
import com.mozu.api.security.AuthTicket;
import org.apache.commons.lang.StringUtils;

/**
 * Use the Storefront Shipping resource to retrieve shipping rate information from the website.
 *
 */
public class ShippingClient {

	/**
	 * Retrieves the shipping rates applicable for the site.
	 *

	 * MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> mozuClient=GetRatesClient( rateRequest);
	 * client.setBaseAddress(url);
	 * client.executeRequest();
	 * RatesResponse ratesResponse = client.Result();
	 *

	 * @param rateRequest Properties required to request a shipping rate calculation.
	 * @return Mozu.Api.MozuClient <com.mozu.api.contracts.shippingruntime.RatesResponse>
	 * @see com.mozu.api.contracts.shippingruntime.RatesResponse
	 * @see com.mozu.api.contracts.shippingruntime.RateRequest
	 */
	public static MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> getRatesClient(com.mozu.api.contracts.shippingruntime.RateRequest rateRequest) throws Exception
	{
		return getRatesClient( rateRequest,  null);
	}

	/**
	 * Retrieves the shipping rates applicable for the site.
	 *

	 * MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> mozuClient=GetRatesClient( rateRequest,  responseFields);
	 * client.setBaseAddress(url);
	 * client.executeRequest();
	 * RatesResponse ratesResponse = client.Result();
	 *

	 * @param responseFields Use this field to include those fields which are not included by default.
	 * @param rateRequest Properties required to request a shipping rate calculation.
	 * @return Mozu.Api.MozuClient <com.mozu.api.contracts.shippingruntime.RatesResponse>
	 * @see com.mozu.api.contracts.shippingruntime.RatesResponse
	 * @see com.mozu.api.contracts.shippingruntime.RateRequest
	 */
	public static MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> getRatesClient(com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, String responseFields) throws Exception
	{
		MozuUrl url = com.mozu.api.urls.commerce.catalog.storefront.ShippingUrl.getRatesUrl(responseFields);
		String verb = "POST";
		Class<?> clz = com.mozu.api.contracts.shippingruntime.RatesResponse.class;
		MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> mozuClient = (MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse>) MozuClientFactory.getInstance(clz);
		mozuClient.setVerb(verb);
		mozuClient.setResourceUrl(url);
		mozuClient.setBody(rateRequest);
		return mozuClient;

	}

}


text:
title: Server-side Selecting Multiple Rows
page_title: Server-side Selecting Multiple Rows | RadGrid for ASP.NET AJAX Documentation
description: Server-side Selecting Multiple Rows
slug: grid/functionality/selecting/selecting-rows/server-side-selecting-multiple-rows
tags: server-side,selecting,multiple,rows
published: True
position: 4
---

# Server-side Selecting Multiple Rows

##

**RadGrid** allows multiple rows to be selected at the same time when the **AllowMultiRowSelection**property is set to **true**When multi-row selection is enabled, you can still use the approaches described in [Selecting a row with a checkbox (server-side)]({%slug grid/functionality/selecting/selecting-rows/server-side-selecting-with-a-checkbox%}) and [ Selecting a row with a select button (server-side)]({%slug grid/functionality/selecting/selecting-rows/server-side-selecting-with-a-select-button%}) topics.

![](images/SelectRowServerSide.PNG)

The selected rows can be accessed using the grid's **SelectedItems** collection. In addition, you can handle the grid's **SelectedIndexChanged** server event to detect when an item's selection changes and perform additional operations if needed.

For a live example of multi-row selection that is handled server-side, see [Server-side row selection](http://demos.telerik.com/aspnet-ajax/Grid/Examples/Programming/SelectRowWithCheckBox/DefaultCS.aspx).


text:
'use strict';
// Automatically inject Bower components into the HTML file
module.exports = {
	app : {
		html       : '<%= paths.app %>/index.html',
		ignorePath : '<%= paths.app %>/'
	}
};


text:
module ApiVersions
  module Generators
    class BumpGenerator < Rails::Generators::Base
      desc "Bump API version to next major version, initializing controllers"
      source_root File.expand_path('../templates', __FILE__)

      def get_controllers
        Dir.chdir File.join(Rails.root, 'app', 'controllers') do
          @controllers = Dir.glob('api/v**/**/*.rb')
        end

        @highest_version = @controllers.map do |controller|
          Gem::Version.new ApiVersions::DSL.to_version_string(controller.match(/api\/v(\d+?(?:dot)?\d*[a-z]?\d*)\//)[1])
        end.max
        @highest_version_string = ApiVersions::DSL.to_version_dsl(@highest_version)

        @controllers.keep_if { |element| element =~ /api\/v#{@highest_version_string}\// }
      end

      def generate_new_controllers
        new_version_string = ApiVersions::DSL.to_version_dsl(@highest_version.bump)
        @controllers.each do |controller|
          new_controller = controller.gsub(/api\/v#{@highest_version_string}\//, "api/v#{new_version_string}/")
          @current_new_controller = new_controller.chomp(File.extname(controller)).camelize
          @current_old_controller = controller.chomp(File.extname(controller)).camelize
          template 'controller.rb', File.join('app', 'controllers', new_controller)
        end
      end
    end
  end
end


text:
'use strict';
var CRLF = '\r\n';
var date = require('./date');
var codes = require('./http-codes');

function statusLine(code) {
  if (code === 200) {
    return 'HTTP/1.1 200 OK';
  }

  var phrase = codes[code] || 'Unknown';
  return 'HTTP/1.1 ' + String(code) + ' ' + String(phrase);
}

function makeHeader(code, headers, bodyLength, isChunked, isKeepAlive) {
  var header = String(statusLine(code)) + CRLF;

  if (isKeepAlive) {
    header += 'connection: keep-alive' + CRLF;
  } else {
    header += 'connection: close' + CRLF;
  }

  // append date header
  header += 'date: ' + String(date.getDateHeaderString()) + CRLF;

  if (isChunked) {
    header += 'transfer-encoding: chunked' + CRLF;
  } else {
    header += 'content-length: ' + String(bodyLength) + CRLF;
  }

  for (var i = 0, l = headers._names.length; i < l; ++i) {
    header += String(headers._names[i]) + ': ' + String(headers._values[i]) + CRLF;
  }

  return header;
}

module.exports = makeHeader;


text:
package odeint

//import "fmt"

// Rk4 implements the rk4 stepper method. rk4 is part of the Stepper
// interface.
type Rk4 struct {
	stepSize complex128
	system   System
}

// NewRk4 returns a reference to a new rk4 stepper method.
func NewRk4(stepSize complex128, system System) (r *Rk4) {
	//if stepSize <= 0 {
	if real(stepSize) <= 0 && imag(stepSize) <= 0.0 {
		panic("NewRk4 called with negative or null stepSize.")
	}
	if system.Function() == nil {
		panic("NewRk4 called with nil system.Function.")
	}
	r = &Rk4{stepSize: stepSize, system: system}
	return
}

// These methods are required by the interface Stepper

// Setter methods

// SetStep sets the state for the Rk4 stepper.
func (rk4 *Rk4) SetStep(step complex128) error {
	rk4.stepSize = step
	return nil
}

// SetState sets the state for the Rk4 stepper.
func (rk4 *Rk4) SetState(state []complex128) error {
	rk4.system.stateVector = state
	return nil
}

// Set sets the step size and System for the Rk4 stepper.
func (rk4 *Rk4) Set(stepSize complex128, system System) error {
	//if stepSize <= 0 {
	if real(stepSize) <= 0 && imag(stepSize) <= 0.0 {
		return &Error{"Can't use negative or null step size for Rk4 stepper."}
	} else {
		rk4.stepSize = stepSize
		rk4.system = system
		return nil
	}
}

// Getter methods

// StepSize returns the step size of the method
func (rk4 *Rk4) StepSize() complex128 {
	return rk4.stepSize
}

// State returns the state of the Rk4 stepper.
func (rk4 *Rk4) State() []complex128 {
	return rk4.system.stateVector
}

// Step performs one step iteration call of the Rk4 stepper.
// It also updates the state of the Rk4 object.
//
// The Runge-Kutta4 method for the system,
// 		y = f(t,y)
// Consists of building the sequence of numbers t_n, y_n,
// following the recurrence,
//    t_n+1 = t_n + dt
//    k1 = dt*f(t_n, y_n)
//    k2 = dt*f(t_n + 0.5*dt, y_n + 0.5*k1)
//    k3 = dt*f(t_n + 0.5*dt, y_n + 0.5*k2)
//    k4 = dt*f(t_n + dt, y_n + k3)
//    y_n+1 = y_n + (1/6)*(k1 + 2*k2 + 2*k3 + k4) // First step
func (rk4 *Rk4) Step() ([]complex128, error) {

	newstate := rk4.system.stateVector
	stateK1 := make([]complex128, len(rk4.system.stateVector))
	stateK2 := make([]complex128, len(rk4.system.stateVector))
	stateK3 := make([]complex128, len(rk4.system.stateVector))
	stateK4 := make([]complex128, len(rk4.system.stateVector))

	BufferK1 := make([]complex128, len(rk4.system.stateVector))
	BufferK2 := make([]complex128, len(rk4.system.stateVector))
	BufferK3 := make([]complex128, len(rk4.system.stateVector))

	// First Step
	stateK1 = rk4.system.Evaluate(newstate)

	// Second Step
	for i := 0; i < len(rk4.system.stateVector); i++ {
		BufferK1[i] = newstate[i] + 0.5*rk4.stepSize*stateK1[i]
	}

	stateK2 = rk4.system.Evaluate(BufferK1)

	// Third Step
	for i := 0; i < len(rk4.system.stateVector); i++ {
		BufferK2[i] = newstate[i] + 0.5*rk4.stepSize*stateK2[i]
	}

	stateK3 = rk4.system.Evaluate(BufferK2)

	// Fourth Step
	for i := 0; i < len(rk4.system.stateVector); i++ {
		BufferK3[i] = newstate[i] + rk4.stepSize*stateK3[i]
	}

	stateK4 = rk4.system.Evaluate(BufferK3)

	// Result
	for i := 0; i < len(rk4.system.stateVector); i++ {
		newstate[i] = newstate[i] + (rk4.stepSize/6.0)*(stateK1[i]+2*stateK2[i]+2*stateK3[i]+stateK4[i])
	}

	rk4.system.stateVector = newstate

	return newstate, nil
}


text:
A simple Piano widget for wxWidgets. Tested on wxWidgets 2.9.*

## Overview
Widget which displays a piano with notes in any useful range, supports clicking keys as well as using the keyboard to play it, and sends appropriate events accordingly.

Supports showing note names on the keys according to 4 notations: Classic (Do, Re, ...), Byzantine (Ni, Pa, ...), Greek Byzantine (Νη, Πα,...) and Western (C, D, ...).

Includes `score.cpp`, which implements the `Note` and `MultipleNotes` (chord) classes in the `Music` namespace, that the widget uses to pass and receive note information.

This repository contains a **working example** of the widget. Compile and run `appmain.cpp` to see it run right away.

## Screenshots
![wxPianoControl](https://raw.githubusercontent.com/petru-dimitriu/wxPianoControl/master/screen1.png)

## Tips
* To select multiple notes and build chords: press and hold `Shift`, click the keys on the piano one by one, releasing the `Shift` key before the last one.
* To view an options menu, right click anywhere within the control.

## Getting started & API
After you include `pianoctl.cpp` and `pianoctl.h` in your project, the following line of code will create a piano with notes ranging from C2 to B6:

`wxPianoControl* Piano = new wxPianoControl(this,1234,5,5,1000,250,Note(DO,2),Note(DO,7));`

Note that DO, RE, ... SI are `#define`s which resolve to 0, 1, ... 6.

### Events
The Piano widget sends the following wxCommandEvents:

* `EVT_PIANO_KEY_DOWN`, when the user presses a key, either by clicking it or by pressing its corresponding key on the computer keyboard
* `EVT_PIANO_KEY_UP`, when the user releases a key, either by releasing the left mouse button or by releasing the corresponding key on the computer keyboard
* `EVT_PIANO_NOTE_RECEIVED`, when the user finishes either pressing a key or building a chord.
* `EVT_PIANO_KEY_HOVERON`, when the user hovers the mouse pointer over a key
* `EVT_PIANO_KEY_HOVEROFF`, when the user no longer hovers the mouse pointer over a key

Note that `EVT_PIANO_KEY_UP` and `EVT_PIANO_NOTE_RECEIVED` are both sent when a user presses and releases a single key.

The events' ClientData contains a `Music::Note` object - for `KEY_DOWN` and `KEY_UP` - and a `Music::MultipleNotes` (chord) object - for `NOTE_RECEIVED`

### Methods

#### Getters
* `char GetNoteNames()` gets the notation used to draw notes
* `bool HasOctave()` is true if piano shows the octave besides note names
* `bool HasPlayFromKeyboard()` is true if piano allows being played using the computer keyboard
* `bool GetShowNoteNames()` is true if piano has note names drawn on the keys
* `wxColour GetWhiteKeyColour()`
* `wxColour GetBlackKeyColour()`
* `wxColour GetWhiteKeyColourPressed()`
* `wxColour GetBlackKeyColourPressed()`
* `wxColour GetWhiteKeyColourHovered()`
* `wxColour GetBlackKeyColourHovered()`

#### Setters
* `void SetNoteNames(char Names)` sets which notation to use for note names
* `void SetOctave(bool octave)` sets whether or not to show the octave besides note names
* `void SetPlayFromKeyboard(bool play)` sets whether or not the piano allows being played using the computer keyboard
* `void SetShowNoteNames(bool)` sets whether or not note names should be drawn on the keys
* `void SetWhiteKeyColour(wxColour)`
* `void SetBlackKeyColour(wxColour)`
* `void SetWhiteKeyColourPressed(wxColour)`
* `void SetBlackKeyColourPressed(wxColour)`
* `void SetWhiteKeyColourHovered(wxColour)`
* `void SetBlackKeyColourHovered(wxColour)`

#### Togglers
* `void ToggleNoteNames()`
* `void ToggleNoteOctave()`
* `void TogglePlayFromKeyboard()`

### Score.cpp
`Score.cpp` is my own implementation of an abstract musical score, which holds chords (`MultipleNotes`) containing one or more `Note` objects. All functions are wrapped in the `Music` namespace.

* `Note(RE,5)` produces D5
* `Note::Tell()` returns a string with the note's name in a certain notation, optionally including the octave, accidentals (#, b, n) according to a certain `Signature`.
* `Signature` objects contain signatures in the form of an array of 7 floating points, where `0.5` means the respective note has a sharp, `-0.5` means the note has a flat, and `0` means the note is natural.

## License
I hereby release this to the public domain. I don't mind if you credit me, though.


text:
<?php

/*
* <auto-generated>
*     This code was generated by a Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Contracts\ProductAdmin;

/**
*	Properties of the conditions that must be met for a discount to apply to an order.
*/
class DiscountCondition
{
	/**
	*Code of a discount coupon. This code can be used by a shopper when a coupon code is required to earn the associated discount on a purchase.
	*/
	public $couponCode;

	/**
	*Date and time in UTC format when a discount, credit, wish list, or cart expires. An expired discount no longer can be redeemed. An expired wish list is no longer available. An expired credit can no longer be redeemed for a purchase. Acart becomes inactive and expired based on a system-calculated interval. For example, if an anonymous shopper has 14 days of inactivity, the cart is considered abandoned after that period of inactivity. System-supplied and read-only.
	*/
	public $expirationDate;

	/**
	*List of payment types that trigger this discount to be valid.
	*/
	public $includedPaymentWorkflows;

	/**
	*The maximum number of times the discount can be redeemed.
	*/
	public $maxRedemptionCount;

	/**
	*This pecifies the minimum amount that must be purchased in the combined categories defined in IncludedCategories. This amount is calculated before discounting and it is not used if IncludedCategories is empty.
	*/
	public $minimumCategorySubtotalBeforeDiscounts;

	/**
	*The minimum customer lifetime value amount required to redeem this discount.
	*/
	public $minimumLifetimeValueAmount;

	/**
	*The minimum order amount required to redeem this discount.
	*/
	public $minimumOrderAmount;

	/**
	*This specifies the minimum quantity of products in the categories specified in IncludedCategories, which must be purchased to qualify for the associated discount. This defaults to 1 if  null, and IncludedCategories has values.
	*/
	public $minimumQuantityProductsRequiredInCategories;

	/**
	*This specifies the minimum quantity of products in the specified IncludedProducts that must be purchased to qualify for the associated discount. This defaults to 1 if  null, and IncludedProducts has values.
	*/
	public $minimumQuantityRequiredProducts;

	/**
	*If true, only authenticated users can redeem the discount. If false, anonymous users can redeem the discount.
	*/
	public $requiresAuthenticatedUser;

	/**
	*If true, redemption of this discount requires entry of a coupon code.
	*/
	public $requiresCoupon;

	/**
	*The earliest date and time this discount can be redeemed.
	*/
	public $startDate;

	/**
	*List of customer segments associated with the discount. Shoppers who are members of an associated customer segment can redeem this discount.
	*/
	public $customerSegments;

	/**
	*List of the product categories that are not eligible for the discount.
	*/
	public $excludedCategories;

	/**
	*List of products that are not eligible for the discount.
	*/
	public $excludedProducts;

	/**
	*List of product categories that are eligible for the discount.
	*/
	public $includedCategories;

	/**
	*List of products that are eligible for the discount.
	*/
	public $includedProducts;

}

?>


text:
import { Container, ComponentArguments, ButtonsRow } from './utils'
import Text from '../text'

import { useDispatch } from '../../hooks/store'

import { acceptGroupInvitation, declineGroupInvitation } from '../../actions/groupsActions'

import { GroupInvitationNotification } from '../../types/chat'

const numberFormater = Intl && Intl.NumberFormat
  ? Intl.NumberFormat()
  : {
      format: (number: Number) => number.toString()
    }

export default function GroupInvitation (
  { data, onClose }: ComponentArguments<GroupInvitationNotification>
) {
  const dispatch = useDispatch()

  const fee = numberFormater.format(data.fee)

  return (
    <Container title='Invitation to join a group'>

        <Text text={data.text} multiline />

        {'Fee: '}

          {fee}
          L$

      <ButtonsRow>
        <button
          className='btn btn--ok'
          onClick={() => {
            dispatch(acceptGroupInvitation(data.transactionId, data.groupId))
            onClose()
          }}
        >
          Accept
        </button>

        <button
          className='btn btn--danger'
          onClick={() => {
            dispatch(declineGroupInvitation(data.transactionId, data.groupId))
            onClose()
          }}
        >
          Decline
        </button>
      </ButtonsRow>
    </Container>
  )
}