text:
package forms;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Timer;
import java.util.TimerTask;

/**
 * GameBoard - An on-screen keyboard for gamepads.
 * This is my very first full-blown Java project.
 * User: Shedo Surashu
 *       http://coffeecone.com/gameboard
 * Date: November 17, 2013
 * Time: 7:54 PM
 */

public class MainForm extends JFrame {
    private JPanel panel1;
    private JButton btnA1;
    private JButton btnA2;
    private JButton btnA3;
    private JButton btnA4;
    private JButton btnA5;
    private JButton btnA6;
    private JButton btnA7;
    private JButton btnA8;
    private JLabel status;
    private JButton btnA9;
    private JButton btnA10;
    private JButton btnA11;
    private JButton btnA12;
    private JButton btnB1;
    private JButton btnB2;
    private JButton btnB3;
    private JButton btnB4;
    private JButton btnB5;
    private JButton btnB6;
    private JButton btnB7;
    private JButton btnB8;
    private JButton btnB9;
    private JButton btnB10;
    private JButton btnB11;
    private JButton btnB12;
    private JButton btnC1;
    private JButton btnC2;
    private JButton btnC3;
    private JButton btnC4;
    private JButton btnC5;
    private JButton btnC6;
    private JButton btnC7;
    private JButton btnC8;
    private JButton btnC9;
    private JButton btnC10;
    private JButton btnC11;
    private JButton btnC12;
    private JButton btnD1;
    private JButton btnD2;
    private JButton btnD3;
    private JButton btnD4;
    private JButton btnD5;
    private JButton btnD6;
    private JButton btnD7;
    private JButton btnD8;
    private JButton btnD9;
    private JButton btnD10;
    private JButton btnD11;
    private JButton btnD12;
    private JButton btnShift;
    private JButton btnEnter;
    public JComboBox controllerList;
    public JButton configure;
    public JButton about;

    private int curLayout = -1;
    private String[][] keyMap = new String[][] {
            { // Default layout
            "a","b","c","d","e","f","g","h","i","j","k","l",
            "m","n","o","p","q","r","s","t","u","v","w","x",
            "y","z","0","1","2","3","4","5","6","7","8","9",
            ",",".",":",";","?","!","@","^","_","-","/","\\"
            }
            ,{ // Caps layout
            "A","B","C","D","E","F","G","H","I","J","K","L",
            "M","N","O","P","Q","R","S","T","U","V","W","X",
            "Y","Z","0","1","2","3","4","5","6","7","8","9",
            "~","#","+","'","\"","*","<",">","(",")","[","]"
            }
//            ,{ // Extra layout
//            "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12",
//            "`","0","1","2","3","4","5","6","7","8","9","0",
//            "","","","","","","","","","","","",
//            "","","","","","","","","","","",""
//            }
    };
    private JButton[] btn = {
            btnA1, btnA2, btnA3, btnA4, btnA5, btnA6, btnA7, btnA8, btnA9, btnA10, btnA11, btnA12,
            btnB1, btnB2, btnB3, btnB4, btnB5, btnB6, btnB7, btnB8, btnB9, btnB10, btnB11, btnB12,
            btnC1, btnC2, btnC3, btnC4, btnC5, btnC6, btnC7, btnC8, btnC9, btnC10, btnC11, btnC12,
            btnD1, btnD2, btnD3, btnD4, btnD5, btnD6, btnD7, btnD8, btnD9, btnD10, btnD11, btnD12,
            btnShift, btnEnter
    };
    private int curBtn = 0;
    private int oldBtn = 0;
    private Robot typeBot;
    private boolean continueBackspace = false;
    private Timer backspaceTimer;
    private Timer arrowKeysTimer;
    public int mouseIncX = 0;
    public int mouseIncY = 0;

    public MainForm() {
        setContentPane(panel1);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setResizable(false);
        setFocusableWindowState(false);
        setLocationByPlatform(true);
        setFocusable(false);
        setAlwaysOnTop(true);
        pack();
        setVisible(true);

        changeCase();

        try {
            typeBot = new Robot();
        } catch (AWTException e) {
            e.printStackTrace();
        }

    }

    public void changeCase() {
        curLayout++;

        if (curLayout > (keyMap.length-1)) {
            curLayout = 0;
        }

        for (int i = 0; i < 48; i++) {
            btn[i].setText(keyMap[curLayout][i]);
        }
    }

    public void mouseSet() {
        int mouseX = MouseInfo.getPointerInfo().getLocation().x + mouseIncX;
        int mouseY = MouseInfo.getPointerInfo().getLocation().y + mouseIncY;

        typeBot.mouseMove(mouseX, mouseY);
    }

    public void restore(boolean center) {
        Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension windowDim = getSize();
        Point windowLoc = new Point();
        Double x;
        Double y;

        if (center) {
            x = (screenDim.getWidth()-windowDim.getWidth())/2;
            y = (screenDim.getHeight()-windowDim.getHeight())/2;
            windowLoc.setLocation(x, y);
        } else {
            Point mouseLoc = MouseInfo.getPointerInfo().getLocation();
            x = mouseLoc.getX();
            y = mouseLoc.getY();

            if ((mouseLoc.getX()+windowDim.getWidth()) >= screenDim.getWidth()) {
                x = (screenDim.getWidth()-windowDim.getWidth());
            }
            if ((mouseLoc.getY()+windowDim.getHeight()) >= screenDim.getHeight()) {
                y = (screenDim.getHeight()-windowDim.getHeight());
            }
            windowLoc.setLocation(x, y);
        }
        setLocation(windowLoc);
        setState(Frame.NORMAL);

    }

    public void minimize() {
        setState(Frame.ICONIFIED);
    }

    public void pressLeftMouseBtn() {
        typeBot.mousePress(KeyEvent.BUTTON1_MASK);
    }

    public void releaseLeftMouseBtn() {
        typeBot.mouseRelease(KeyEvent.BUTTON1_MASK);
    }

    public void pressRightMouseBtn() {
        typeBot.mousePress(KeyEvent.BUTTON3_MASK);
    }

    public void releaseRightMouseBtn() {
        typeBot.mouseRelease(KeyEvent.BUTTON3_MASK);
    }

    public void pressMiddleMouseBtn() {
        typeBot.mousePress(KeyEvent.BUTTON2_MASK);
    }

    public void releaseMiddleMouseBtn() {
        typeBot.mouseRelease(KeyEvent.BUTTON2_MASK);
    }

    public void pressEnter() {
        btnEnter.doClick(100);

        typeBot.keyPress(KeyEvent.VK_ENTER);
    }

    public void pressShift() {
        btnShift.doClick(100);

        changeCase();
    }

    public void selectButton(String direction) {
        toFront();

        if (direction == "up" && curBtn >= 12 && curBtn < 48) {
            btn[curBtn].setBorderPainted(false);
            curBtn = curBtn-12;
            btn[curBtn].setBorderPainted(true);
        } else if (direction == "up" && curBtn > 47) {
            btn[curBtn].setBorderPainted(false);
            curBtn = oldBtn;
            btn[curBtn].setBorderPainted(true);
        } else if (direction == "down" && curBtn < 36) {
            btn[curBtn].setBorderPainted(false);
            curBtn = curBtn+12;
            btn[curBtn].setBorderPainted(true);
        } else if (direction == "down" && curBtn >= 36 && curBtn <= 38) { // Shift button
            btn[curBtn].setBorderPainted(false);
            oldBtn = curBtn;
            curBtn = 48;
            btn[curBtn].setBorderPainted(true);
        } else if (direction == "down" && curBtn > 38 && curBtn < 48) { // Done button
            btn[curBtn].setBorderPainted(false);
            oldBtn = curBtn;
            curBtn = 49;
            btn[curBtn].setBorderPainted(true);
        } else if (direction == "left" && curBtn != 0 && curBtn != 12 && curBtn != 24 && curBtn != 36 && curBtn != 48) {
            btn[curBtn].setBorderPainted(false);
            curBtn = curBtn-1;
            btn[curBtn].setBorderPainted(true);
        } else if (direction == "right" && curBtn != 11 && curBtn != 23 && curBtn != 35 && curBtn != 47 && curBtn != 49) {
            btn[curBtn].setBorderPainted(false);
            curBtn = curBtn+1;
            btn[curBtn].setBorderPainted(true);
        }
    }

    public void pressBackspace(boolean cont) {
        if (cont) {
            continueBackspace = true;
            pressBackspaceContinuously();
        } else {
            continueBackspace = false;
            try {
                backspaceTimer.cancel();
                backspaceTimer.purge();
            } catch (Exception ignored) {}
            typeBot.keyPress(KeyEvent.VK_BACK_SPACE);
        }
    }

    private void pressBackspaceContinuously() {
        backspaceTimer = new Timer();
        backspaceTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                if (continueBackspace) {
                    typeBot.keyPress(KeyEvent.VK_BACK_SPACE);
                }
            }
        }, 75, 75);
    }

    public void pressSpace() {
        typeBot.keyPress(KeyEvent.VK_SPACE);
    }

    public void pressEscape() {
        typeBot.keyPress(KeyEvent.VK_ESCAPE);
    }

    public void pressAltTab() {
        typeBot.keyPress(KeyEvent.VK_ALT);
        typeBot.keyPress(KeyEvent.VK_TAB);
    }

    public void releaseAltTab() {
        typeBot.keyRelease(KeyEvent.VK_ALT);
        typeBot.keyRelease(KeyEvent.VK_TAB);
    }

    public void pressCtrlTab() {
        doType(KeyEvent.VK_CONTROL, KeyEvent.VK_TAB);
    }

    public void pressCtrlShiftTab() {
        doType(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
    }

    public void pressAltF4() {
        doType(KeyEvent.VK_ALT, KeyEvent.VK_F4);
    }

    public void releaseArrowKey() {
        try {
            arrowKeysTimer.cancel();
            arrowKeysTimer.purge();
        } catch (Exception ignored) {
        }
    }

    public void pressUp() {
        arrowKeysTimer = new Timer();
        arrowKeysTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                typeBot.keyPress(KeyEvent.VK_UP);
            }
        }, 75, 75);
    }

    public void pressDown() {
        arrowKeysTimer = new Timer();
        arrowKeysTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                typeBot.keyPress(KeyEvent.VK_DOWN);
            }
        }, 75, 75);
    }

    public void pressLeft() {
        arrowKeysTimer = new Timer();
        arrowKeysTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                typeBot.keyPress(KeyEvent.VK_LEFT);
            }
        }, 75, 75);
    }

    public void pressRight() {
        arrowKeysTimer = new Timer();
        arrowKeysTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                typeBot.keyPress(KeyEvent.VK_RIGHT);
            }
        }, 75, 75);
    }

    public void pressWinKey() {
        typeBot.keyPress(KeyEvent.VK_WINDOWS);
    }

    public void releaseWinKey() {
        typeBot.keyRelease(KeyEvent.VK_WINDOWS);
    }

    public void pressButton() {
        if (curBtn < 48) {
            btn[curBtn].doClick(50);

            switch (keyMap[curLayout][curBtn].charAt(0)) {

                // Default layout
                case 'a': doType(KeyEvent.VK_A); break;
                case 'b': doType(KeyEvent.VK_B); break;
                case 'c': doType(KeyEvent.VK_C); break;
                case 'd': doType(KeyEvent.VK_D); break;
                case 'e': doType(KeyEvent.VK_E); break;
                case 'f': doType(KeyEvent.VK_F); break;
                case 'g': doType(KeyEvent.VK_G); break;
                case 'h': doType(KeyEvent.VK_H); break;
                case 'i': doType(KeyEvent.VK_I); break;
                case 'j': doType(KeyEvent.VK_J); break;
                case 'k': doType(KeyEvent.VK_K); break;
                case 'l': doType(KeyEvent.VK_L); break;
                case 'm': doType(KeyEvent.VK_M); break;
                case 'n': doType(KeyEvent.VK_N); break;
                case 'o': doType(KeyEvent.VK_O); break;
                case 'p': doType(KeyEvent.VK_P); break;
                case 'q': doType(KeyEvent.VK_Q); break;
                case 'r': doType(KeyEvent.VK_R); break;
                case 's': doType(KeyEvent.VK_S); break;
                case 't': doType(KeyEvent.VK_T); break;
                case 'u': doType(KeyEvent.VK_U); break;
                case 'v': doType(KeyEvent.VK_V); break;
                case 'w': doType(KeyEvent.VK_W); break;
                case 'x': doType(KeyEvent.VK_X); break;
                case 'y': doType(KeyEvent.VK_Y); break;
                case 'z': doType(KeyEvent.VK_Z); break;

                // Caps layout
                case 'A': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_A); break;
                case 'B': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_B); break;
                case 'C': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_C); break;
                case 'D': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_D); break;
                case 'E': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_E); break;
                case 'F': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_F); break;
                case 'G': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_G); break;
                case 'H': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_H); break;
                case 'I': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_I); break;
                case 'J': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_J); break;
                case 'K': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_K); break;
                case 'L': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_L); break;
                case 'M': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_M); break;
                case 'N': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_N); break;
                case 'O': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_O); break;
                case 'P': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_P); break;
                case 'Q': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_Q); break;
                case 'R': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_R); break;
                case 'S': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_S); break;
                case 'T': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_T); break;
                case 'U': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_U); break;
                case 'V': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_V); break;
                case 'W': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_W); break;
                case 'X': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_X); break;
                case 'Y': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_Y); break;
                case 'Z': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_Z); break;

                case '0': doType(KeyEvent.VK_0); break;
                case '1': doType(KeyEvent.VK_1); break;
                case '2': doType(KeyEvent.VK_2); break;
                case '3': doType(KeyEvent.VK_3); break;
                case '4': doType(KeyEvent.VK_4); break;
                case '5': doType(KeyEvent.VK_5); break;
                case '6': doType(KeyEvent.VK_6); break;
                case '7': doType(KeyEvent.VK_7); break;
                case '8': doType(KeyEvent.VK_8); break;
                case '9': doType(KeyEvent.VK_9); break;

                case ',': doType(KeyEvent.VK_COMMA); break;
                case '.': doType(KeyEvent.VK_PERIOD); break;
                case ':': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_SEMICOLON); break;
                case ';': doType(KeyEvent.VK_SEMICOLON); break;
                case '?': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_SLASH); break;
                case '!': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_1); break;
                case '@': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_2); break;
                case '^': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_6); break;
                case '_': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_MINUS); break;
                case '-': doType(KeyEvent.VK_MINUS); break;
                case '/': doType(KeyEvent.VK_SLASH); break;
                case '\\': doType(KeyEvent.VK_BACK_SLASH); break;

                case '~': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_BACK_QUOTE); break;
                case '#': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_3); break;
                case '+': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_EQUALS); break;
                case '\'': doType(KeyEvent.VK_QUOTE); break;
                case '"': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_QUOTE); break;
                case '*': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_8); break;
                case '<': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_COMMA); break;
                case '>': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_PERIOD); break;
                case '(': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_9); break;
                case ')': doType(KeyEvent.VK_SHIFT, KeyEvent.VK_0); break;
                case '[': doType(KeyEvent.VK_OPEN_BRACKET); break;
                case ']': doType(KeyEvent.VK_CLOSE_BRACKET); break;

                default:
                    // Do nothing when key is unsupported.
                    break;
            }
        } else {
            switch (curBtn) {
                case 48:
                    pressShift();
                    break;
                case 49:
                    pressEnter();
                    break;
                default:
                    // None
                    break;
            }
        }
    }

    public void doType(int... keyCodes) {
        doType(keyCodes, 0, keyCodes.length);
    }

    private void doType(int[] keyCodes, int offset, int length) {
        if (length == 0) {
            return;
        }

        try {
            typeBot.keyPress(keyCodes[offset]);
            doType(keyCodes, offset + 1, length - 1);
            typeBot.keyRelease(keyCodes[offset]);
        } catch (Exception ignore) {}

    }

    public void status(String message) {
        status.setText(message);
    }

    public void clearControllers() {
        controllerList.removeAllItems();
    }

    public void addController(String controller) {
        controllerList.addItem(controller);
    }

    public int getConID() {
        return controllerList.getSelectedIndex();
    }

    public String getCon() {
        return controllerList.getSelectedItem().toString();
    }

    public void enableList(boolean bool) {
        controllerList.setEnabled(bool);
    }

    public void enableConf(boolean bool) {
        configure.setEnabled(bool);
    }

    public void confIsCancel(boolean bool) {
        if (bool) {
            configure.setText("Cancel");
        } else {
            configure.setText("Configure");
        }
    }

    public boolean isConfCancel() {
        if (configure.getText().equals("Configure")) {
            return false;
        } else {
            return true;
        }
    }

}


text:
rem
rem Header: oe_p_pd.sql 09-jan-01
rem
rem Copyright (c) 2001, 2015, Oracle Corporation.  All rights reserved.
rem
rem Permission is hereby granted, free of charge, to any person obtaining
rem a copy of this software and associated documentation files (the
rem "Software"), to deal in the Software without restriction, including
rem without limitation the rights to use, copy, modify, merge, publish,
rem distribute, sublicense, and/or sell copies of the Software, and to
rem permit persons to whom the Software is furnished to do so, subject to
rem the following conditions:
rem
rem The above copyright notice and this permission notice shall be
rem included in all copies or substantial portions of the Software.
rem
rem THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
rem EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
rem MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
rem NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
rem LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
rem OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
rem WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
rem
rem Owner  : ahunold
rem
rem NAME
rem   oe_p_pd.sql - populate OE Common Schema
rem
rem DESCRIPTON
rem   Table product_descriptions
rem
rem MODIFIED   (MM/DD/YY)
rem   hyeh      08/29/02 - hyeh_mv_comschema_to_rdbms
rem   ahunold   05/03/01 - Catalan language.
rem   ahunold   02/08/01 - Globalization
rem   ttanaka   02/07/01 - call one SQL script per language
rem   ahunold   01/09/01 - checkin ADE

REM =======================================================
REM insert translated contents into product_descriptions
REM =======================================================

REM
REM American English
REM
@@oe_p_us
REM
REM Other languages
REM
@@oe_p_ar
@@oe_p_ca
@@oe_p_cs
@@oe_p_d
@@oe_p_dk
@@oe_p_e
@@oe_p_el
@@oe_p_esa
@@oe_p_f
@@oe_p_frc
@@oe_p_hu
@@oe_p_i
@@oe_p_iw
@@oe_p_ja
@@oe_p_ko
@@oe_p_n
@@oe_p_nl
@@oe_p_pl
@@oe_p_pt
@@oe_p_ptb
@@oe_p_ro
@@oe_p_ru
@@oe_p_s
@@oe_p_sf
@@oe_p_sk
@@oe_p_th
@@oe_p_tr
@@oe_p_zhs
@@oe_p_zht

commit;
set define on

redpajama_set_name: RedPajamaGithub


text:
/**
* @file
* @brief  Implementation of CPACS wing profile algorithm factory
*/

#include "CTiglError.h"
#include "CTiglLogging.h"
#include "CCPACSWingProfile.h"
#include "CCPACSWingProfileFactory.h"
#include "CCPACSWingProfilePointList.h"
#include "CCPACSWingProfileCST.h"

namespace tigl
{

CCPACSWingProfileFactory& CCPACSWingProfileFactory::Instance()
{
    static CCPACSWingProfileFactory instance;
    return instance;
}

CCPACSWingProfileFactory::CCPACSWingProfileFactory()
{
}

bool CCPACSWingProfileFactory::RegisterAlgo(std::string cpacsID, CreateProfileAlgoCallback callback)
{
    profileMap[cpacsID] = callback;
    return true;
}

// Create profile algo
PTiglWingProfileAlgo CCPACSWingProfileFactory::CreateProfileAlgo(TixiDocumentHandle tixiHandle, CCPACSWingProfile& profile, std::string & ProfileXPath)
{
    ProfileMap::iterator it = profileMap.begin();
    for (; it != profileMap.end(); ++it) {
        std::string cpacsID = it->first;
        if (tixiCheckElement(tixiHandle, std::string(ProfileXPath + "/" + cpacsID).c_str()) == SUCCESS) {
            CreateProfileAlgoCallback createProfileAlgo = it->second;
            return createProfileAlgo(profile, ProfileXPath);
        }
    }

    // no profile created
    throw CTiglError("Error: CCPACSWingProfileFactory::CreateProfileAlgo: Unable to find valid profile data", TIGL_XML_ERROR);
}

} // namespace tigl


text:
using System.Collections.Generic;
using System.Data.SqlClient;

namespace IG.Extensions
{
    public static class SqlCommandExt
    {
        /// <summary>
        /// This will add an array of parameters to a SqlCommand. This is used for an IN statement.
        /// Use the returned value for the IN part of your SQL call. (i.e. SELECT * FROM table WHERE field IN ({paramNameRoot}))
        /// </summary>
        /// <param name="cmd">The SqlCommand object to add parameters to.</param>
        /// <param name="values">The array of strings that need to be added as parameters.</param>
        /// <param name="paramNameRoot">What the parameter should be named followed by a unique value for each value. This value surrounded by {} in the CommandText will be replaced.</param>
        /// <param name="start">The beginning number to append to the end of paramNameRoot for each value.</param>
        /// <param name="separator">The string that separates the parameter names in the sql command.</param>
        public static SqlParameter[] AddArrayParameters<T>(this SqlCommand cmd, IEnumerable<T> values, string paramNameRoot, int start = 1, string separator = ", ")
        {
            /* An array cannot be simply added as a parameter to a SqlCommand so we need to loop through things and add it manually.
             * Each item in the array will end up being it's own SqlParameter so the return value for this must be used as part of the
             * IN statement in the CommandText.
             */
            var parameters = new List<SqlParameter>();
            var parameterNames = new List<string>();
            var paramNbr = start;

            foreach (var value in values)
            {
                var paramName = $"@{paramNameRoot}{paramNbr++}";
                parameterNames.Add(paramName);
                parameters.Add(cmd.Parameters.AddWithValue(paramName, $"{value}"));
            }
            cmd.CommandText = cmd.CommandText.Replace("{" + paramNameRoot + "}", string.Join(separator, parameterNames));
            return parameters.ToArray();
        }
    }
}


text:
/**
 * \file	Contact.h
 *
 * \brief	Declares the contact class.
 */

#pragma once

#include <cmath>
#include "RigidBodyObject.h"

namespace Physics
{
	/**
	 * \struct	Contact
	 *
	 * \brief	Contact.
	 */

	struct Contact
	{
		/**
		 * \fn	Contact()
		 *
		 * \brief	Default constructor.
		 */

		Contact() { }

		/**
		 * \fn	Contact(Objects::RigidBodyObject* a, Objects::RigidBodyObject* b, Ogre::Vector3 pos,
		 *  Ogre::Vector3 norm)
		 *
		 * \brief	Constructor.
		 *
		 * \param [in,out]	a	If non-null, the Objects::RigidBodyObject* to process.
		 * \param [in,out]	b	If non-null, the Objects::RigidBodyObject* to process.
		 * \param	pos		 	The position.
		 * \param	norm	 	The normalise.
		 */

		Contact(Objects::RigidBodyObject* a, Objects::RigidBodyObject* b,
			Ogre::Vector3 pos, Ogre::Vector3 norm)
		{
			A = a;
			B = b;

			position = pos;
			normal = norm;

			Initialise();
			ApplyVelocityChange();
		}

		/**
		 * \fn	void Initialise();
		 *
		 * \brief	Initialises this object.
		 */

		void Initialise();

		/**
		 * \fn	void CalculateBasis();
		 *
		 * \brief	Calculates the basis.
		 */

		void CalculateBasis();

		/**
		 * \fn	Ogre::Vector3 CalculateImpulse(Ogre::Matrix3* inverseInertiaTensor);
		 *
		 * \brief	Calculates the impulse.
		 *
		 * \param [in,out]	inverseInertiaTensor	If non-null, the inverse inertia tensor.
		 *
		 * \return	The calculated impulse.
		 */

		Ogre::Vector3 CalculateImpulse(Ogre::Matrix3* inverseInertiaTensor);

		/**
		 * \fn	Ogre::Vector3 CalculateLocalVelocity(bool isA);
		 *
		 * \brief	Calculates the local velocity.
		 *
		 * \param	isA	true if this object is a.
		 *
		 * \return	The calculated local velocity.
		 */

		Ogre::Vector3 CalculateLocalVelocity(bool isA);

		/**
		 * \fn	void CalculateDeltaVelocity();
		 *
		 * \brief	Calculates the delta velocity.
		 */

		void CalculateDeltaVelocity();

		/**
		 * \fn	void ApplyVelocityChange();
		 *
		 * \brief	Applies the velocity change.
		 */

		void ApplyVelocityChange();

		/**
		 * \brief	The contact to world.
		 */

		Ogre::Matrix3 contactToWorld;

		/**
		 * \brief	The world to contact.
		 */

		Ogre::Matrix3 worldToContact;

		/**
		 * \brief	The relative contact position[ 2].
		 */

		Ogre::Vector3 relativeContactPosition[2];

		/**
		 * \brief	The local velocity.
		 */

		Ogre::Vector3 localVelocity;

		/**
		 * \brief	The desired delta velocity.
		 */

		float desiredDeltaVelocity;

		/**
		 * \brief	The contact velocity.
		 */

		Ogre::Vector3 contactVelocity;

		/**
		 * \brief	The restitution.
		 */

		float restitution;

		/**
		 * \brief	The Objects::RigidBodyObject* to process.
		 */

		Objects::RigidBodyObject* A;

		/**
		 * \brief	to process.
		 */

		Objects::RigidBodyObject* B;

		/**
		 * \brief	The position.
		 */

		Ogre::Vector3 position;

		/**
		 * \brief	The normal.
		 */

		Ogre::Vector3 normal;
	};
}


text:
#ifndef CONCAVE_DEMO_H
#define CONCAVE_DEMO_H

#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif

#include "LinearMath/btAlignedObjectArray.h"

class btBroadphaseInterface;
class btCollisionShape;
class btOverlappingPairCache;
class btCollisionDispatcher;
class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration;
class btTriangleIndexVertexArray;

///ConcaveDemo shows usage of static concave triangle meshes
///It also shows per-triangle material (friction/restitution) through CustomMaterialCombinerCallback
class ConcaveDemo : public PlatformDemoApplication
{

	//keep the collision shapes, for deletion/cleanup
	btAlignedObjectArray<btCollisionShape*>	m_collisionShapes;

	btTriangleIndexVertexArray* m_indexVertexArrays;

	btBroadphaseInterface*	m_broadphase;

	btCollisionDispatcher*	m_dispatcher;

	btConstraintSolver*	m_solver;

	btDefaultCollisionConfiguration* m_collisionConfiguration;

	bool	m_animatedMesh;

	public:

	ConcaveDemo() : m_animatedMesh(true)
	{

	}
	void	initPhysics();

	void	exitPhysics();

	virtual ~ConcaveDemo()
	{
		exitPhysics();
	}

	virtual void clientMoveAndDisplay();

	virtual void displayCallback();

	//to show refit works
	void	setVertexPositions(float waveheight, float offset);

	virtual void keyboardCallback(unsigned char key, int x, int y);

	static DemoApplication* Create()
	{
		ConcaveDemo* demo = new ConcaveDemo();
		demo->myinit();
		demo->initPhysics();
		return demo;
	};
};

#endif //CONCAVE_DEMO_H


text:
import ComparisonBinary from './ComparisonBinary';

export default class LessThan extends ComparisonBinary {
    constructor(propertyName: string, expression: number);
}


text:
FOUNDATION_EXPORT double ATHKitVersionNumber;
FOUNDATION_EXPORT const unsigned char ATHKitVersionString[];


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

<title>UPDATE-LOCATION-DELAYED</title>

I schedule the

	UPDATE-LOCATION micro-behaviour to happen after other micro-behaviours.

	Begin micro-behaviour

UPDATE-LOCATION-DELAYED

	Begin NetLogo code:

do-after .004
   [add-behaviour UPDATE-LOCATION]

	End NetLogo code

Variants

You can delay by any amount of time. Here we delay by .004 time units.

Related Micro-behaviours

	UPDATE-LOCATION does the real work.

How this works

It schedules

	UPDATE-LOCATION to start .004 time units from now. This ensures that all other

	processes will have updated my-heading before doing this.

History

This was implemented by Ken Kahn.


text:
class CreateFiasEstateStatuses < ActiveRecord::Migration
  def change
    create_table :fias_estate_statuses do |t|
      t.integer :eststatid
      t.string :name

      t.timestamps
    end
  end
end


text:
package fm.common

class StacklessThrowable(msg: String) extends Throwable(msg) {
  def this() = this(null)

  override def fillInStackTrace: Throwable = this
}


text:
module Grape
  module Kaminari
    base = if post_0_9_0_grape?
             Grape::Validations::Base
           else
             Grape::Validations::SingleOptionValidator
           end

    class MaxValueValidator < base
      def validate_param!(attr_name, params)
        return unless params[attr_name]

        attr = params[attr_name]
        if attr && @option && attr > @option
          if Gem::Version.new(Grape::VERSION) >= Gem::Version.new('0.9.0')
            raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: "must be less than #{@option}"
          else
            raise Grape::Exceptions::Validation, param: @scope.full_name(attr_name), message: "must be less than #{@option}"
          end
        end
      end
    end
  end
end


text:
<?php

namespace ScaliantretienBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Candidat
 *
 * @ORM\Table(name="candidat")
 * @ORM\Entity(repositoryClass="ScaliantretienBundle\Repository\CandidatRepository")
 */
class Candidat
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="nom", type="string", length=60)
     */
    private $nom;

    /**
     * @var string
     *
     * @ORM\Column(name="prenom", type="string", length=60)
     */
    private $prenom;

    /**
     * @var string
     *
     * @ORM\Column(name="email", type="string", length=60, nullable=true)
     * @Assert\Email(
     *     message = "L'Email '{{ value }}' n'est pas une adresse email valide.",
     *     checkMX = false
     * )
     */
    private $email;

    /**
     * @var string
     *
     * @ORM\Column(name="tel", type="string", length=15, nullable=true)
     * @Assert\Regex("/^0[1-9]([-. ]?\d{2}){4}$/" ,
     *      message="Le numéro '{{ value }}' n'est pas valide")
     */
    private $tel;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_rdv_rh", type="datetime", nullable=true)
     */
    private $dateRdvRh;

    /**
     * Candidat CV
     *
     * @ORM\OneToOne(targetEntity="ScaliantretienBundle\Entity\FileCV", cascade={"persist", "remove"})
     * @ORM\JoinColumn(name="cv_id", referencedColumnName="id")
     * @Assert\Valid()
     *
     */
    private $cv;

    /**
     * @var string
     *
     * @ORM\Column(name="note_rh", type="text", nullable=true)
     */
    private $noteRh;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_rdv_tech", type="datetime", nullable=true)
     */
    private $dateRdvTech;

    /**
     * @var string
     *
     * @ORM\Column(name="note_tech", type="text", nullable=true)
     */
    private $noteTech;

    /**
     * @var string
     *
     * @ORM\Column(name="note_test", type="smallint", nullable=true)
     */
    private $noteTest;

    /**
     * @var string
     *
     * @ORM\Column(name="etat", type="string", length=25, nullable=false)
     */
    private $etat;

    /**
     * @var integer
     *
     *@ORM\Column(name="dispo", type="integer", nullable=true)
     */
    private $dispo;

    /**
     * @var integer
     *
     * @ORM\Column(name="experience", type="integer")
     */
    private $experience;

    /**
     * @var integer
     *
     * @ORM\Column(name="pretention", type="integer")
     */
    private $pretention;

    /**
     * @var integer
     *
     * @ORM\Column(name="salaire", type="integer")
     */
    private $salaire;

    /**
     * Entite du candidat
     * @ORM\ManyToOne(targetEntity="ScaliantretienBundle\Entity\Entite")
     * @ORM\JoinColumn(name="entite_id", referencedColumnName="id")
     */
    private $entite;

    /**
     * Technos choisies pour les questions du candidat
     *@ORM\ManyToMany(targetEntity="ScaliantretienBundle\Entity\Techno")
     * @ORM\JoinTable(name="techno_candidat",
     *     joinColumns={@ORM\JoinColumn(name="candidat_id", referencedColumnName="id")},
     *     inverseJoinColumns={@ORM\JoinColumn(name="techno_id", referencedColumnName="id")})
     */
    private $technos;

    /**
     * type de poste du candidat
     *
     * @ORM\ManyToOne(targetEntity="ScaliantretienBundle\Entity\Poste")
     * @ORM\JoinColumn(name="poste_id", referencedColumnName="id")
     */
    private $typePoste;

    /**
     *  Un candidat à plusieurs évaluations
     *
     *@ORM\OneToMany(targetEntity="ScaliantretienBundle\Entity\Evalu",mappedBy="candidat")
     */
    private $evalus;

//    /**
//     * Un candidat à plusieurs évaluations
//     *
//     * @ORM\ManyToMany(targetEntity="ScaliantretienBundle\Entity\Evalu")
//     * @ORM\JoinTable(name="candidat_evalus",
//     *     joinColumns={@ORM\JoinColumn(name="candidat_id", referencedColumnName="id")},
//     *     inverseJoinColumns={@ORM\JoinColumn(name="evalu_id", referencedColumnName="id", unique=true)})
//     */
//    private $evalus;

    /**
     * Candidat constructor.
     */
    public function __construct()
    {
        $this->etat= 'start';
        $this->technos = new ArrayCollection();
        $this->evalus= new ArrayCollection();
        $this->experience = 0;
        $this->pretention = 0;
        $this->salaire = 0;
    }

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nom
     *
     * @param string $nom
     *
     * @return Candidat
     */
    public function setNom($nom)
    {
        $this->nom = $nom;

        return $this;
    }

    /**
     * Get nom
     *
     * @return string
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set prenom
     *
     * @param string $prenom
     *
     * @return Candidat
     */
    public function setPrenom($prenom)
    {
        $this->prenom = $prenom;

        return $this;
    }

    /**
     * Get prenom
     *
     * @return string
     */
    public function getPrenom()
    {
        return $this->prenom;
    }

    /**
     * Set email
     *
     * @param string $email
     *
     * @return Candidat
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set tel
     *
     * @param string $tel
     *
     * @return Candidat
     */
    public function setTel($tel)
    {
        $this->tel = $tel;

        return $this;
    }

    /**
     * Get tel
     *
     * @return string
     */
    public function getTel()
    {
        return $this->tel;
    }

    /**
     * @return mixed
     */
    public function getCv()
    {
        return $this->cv;
    }

    /**
     * @param mixed $cv
     */
    public function setCv(FileCV $cv)
    {
        $this->cv = $cv;
    }

    /**
     * Set dateRdvRh
     *
     * @param \DateTime $dateRdvRh
     *
     * @return Candidat
     */
    public function setDateRdvRh($dateRdvRh)
    {
        $this->dateRdvRh = $dateRdvRh;

        return $this;
    }

    /**
     * Get dateRdvRh
     *
     * @return \DateTime
     */
    public function getDateRdvRh()
    {
        return $this->dateRdvRh;
    }

    /**
     * Set noteRh
     *
     * @param string $noteRh
     *
     * @return Candidat
     */
    public function setNoteRh($noteRh)
    {
        $this->noteRh = $noteRh;

        return $this;
    }

    /**
     * Get noteRh
     *
     * @return string
     */
    public function getNoteRh()
    {
        return $this->noteRh;
    }

    /**
     * Set dateRdvTech
     *
     * @param \DateTime $dateRdvTech
     *
     * @return Candidat
     */
    public function setDateRdvTech($dateRdvTech)
    {
        $this->dateRdvTech = $dateRdvTech;

        return $this;
    }

    /**
     * Get dateRdvTech
     *
     * @return \DateTime
     */
    public function getDateRdvTech()
    {
        return $this->dateRdvTech;
    }

    /**
     * Set noteTech
     *
     * @param string $noteTech
     *
     * @return Candidat
     */
    public function setNoteTech($noteTech)
    {
        $this->noteTech = $noteTech;

        return $this;
    }

    /**
     * Get noteTech
     *
     * @return string
     */
    public function getNoteTech()
    {
        return $this->noteTech;
    }

    /**
     * Set noteTest
     *
     * @param string $noteTest
     *
     * @return Candidat
     */
    public function setNoteTest($noteTest)
    {
        $this->noteTest = $noteTest;

        return $this;
    }

    /**
     * Get noteTest
     *
     * @return string
     */
    public function getNoteTest()
    {
        return $this->noteTest;
    }

    /**
     * @return mixed
     */
    public function getEntite()
    {
        return $this->entite;
    }

    /**
     * @param mixed $entite
     */
    public function setEntite($entite)
    {
        $this->entite = $entite;
    }

    /**
     * @return mixed
     */
    public function getTechnos()
    {
        return $this->technos;
    }

    /**
     * @param mixed $technos
     */
    public function setTechnos($technos)
    {
        $this->technos = $technos;
    }

    /**
     * @return string
     */
    public function getEtat()
    {
        return $this->etat;
    }

    /**
     * @param string $etat
     */
    public function setEtat($etat)
    {
        $this->etat = $etat;
    }

    /**
     * @return mixed
     */
    public function getTypePoste()
    {
        return $this->typePoste;
    }

    /**
     * @param mixed $typePoste
     */
    public function setTypePoste($typePoste)
    {
        $this->typePoste = $typePoste;
    }

    /**
     * @return mixed
     */
    public function getDispo()
    {
        return $this->dispo;
    }

    /**
     * @param mixed $dispo
     */
    public function setDispo($dispo)
    {
        $this->dispo = $dispo;
    }

    /**
     * @return mixed
     */
    public function getExperience()
    {
        return $this->experience;
    }

    /**
     * @param mixed $experience
     */
    public function setExperience($experience)
    {
        $this->experience = $experience;
    }

    /**
     * @return int
     */
    public function getPretention()
    {
        return $this->pretention;
    }

    /**
     * @param int $pretention
     */
    public function setPretention($pretention)
    {
        $this->pretention = $pretention;
    }

    /**
     * @return int
     */
    public function getSalaire()
    {
        return $this->salaire;
    }

    /**
     * @param int $salaire
     */
    public function setSalaire($salaire)
    {
        $this->salaire = $salaire;
    }

    /**
     * @return mixed
     */
    public function getEvalus()
    {
        return $this->evalus;
    }

    /**
     * @param mixed $evalus
     */
    public function setEvalus($evalus)
    {
        $this->evalus = $evalus;
    }
}


text:
/*
 * Handling functions for command line options.
 *
 * Most options are handled by the generic code in option.c.
 * But all string options, and a few non-string options, require
 * special handling specific to the particular option.
 * This special processing is done by the "handling functions" in this file.
 *
 * Each handling function is passed a "type" and, if it is a string
 * option, the string which should be "assigned" to the option.
 * The type may be one of:
 *	INIT	The option is being initialized from the command line.
 *	TOGGLE	The option is being changed from within the program.
 *	QUERY	The setting of the option is merely being queried.
 */

#include "less.h"
#include "option.h"

extern int bufspace;
extern int pr_type;
extern int plusoption;
extern int swindow;
extern int sc_width;
extern int sc_height;
extern int secure;
extern int dohelp;
extern int any_display;
extern char openquote;
extern char closequote;
extern char *prproto[];
extern char *eqproto;
extern char *hproto;
extern char *wproto;
extern IFILE curr_ifile;
extern char version[];
extern int jump_sline;
extern int jump_sline_fraction;
extern int less_is_more;
extern char *namelogfile;
extern int force_logfile;
extern int logfile;
char *tagoption = NULL;
extern char *tags;

int shift_count;	/* Number of positions to shift horizontally */
static int shift_count_fraction = -1;

/*
 * Handler for -o option.
 */
void
opt_o(int type, char *s)
{
	PARG parg;

	if (secure) {
		error("log file support is not available", NULL_PARG);
		return;
	}
	switch (type) {
	case INIT:
		namelogfile = s;
		break;
	case TOGGLE:
		if (ch_getflags() & CH_CANSEEK) {
			error("Input is not a pipe", NULL_PARG);
			return;
		}
		if (logfile >= 0) {
			error("Log file is already in use", NULL_PARG);
			return;
		}
		s = skipsp(s);
		namelogfile = lglob(s);
		use_logfile(namelogfile);
		sync_logfile();
		break;
	case QUERY:
		if (logfile < 0) {
			error("No log file", NULL_PARG);
		} else {
			parg.p_string = namelogfile;
			error("Log file \"%s\"", &parg);
		}
		break;
	}
}

/*
 * Handler for -O option.
 */
void
opt__O(int type, char *s)
{
	force_logfile = TRUE;
	opt_o(type, s);
}

/*
 * Handlers for -j option.
 */
void
opt_j(int type, char *s)
{
	PARG parg;
	char buf[16];
	int len;
	int err;

	switch (type) {
	case INIT:
	case TOGGLE:
		if (*s == '.') {
			s++;
			jump_sline_fraction = getfraction(&s, "j", &err);
			if (err)
				error("Invalid line fraction", NULL_PARG);
			else
				calc_jump_sline();
		} else {
			int sline = getnum(&s, "j", &err);
			if (err) {
				error("Invalid line number", NULL_PARG);
			} else {
				jump_sline = sline;
				jump_sline_fraction = -1;
			}
		}
		break;
	case QUERY:
		if (jump_sline_fraction < 0) {
			parg.p_int =  jump_sline;
			error("Position target at screen line %d", &parg);
		} else {
			(void) snprintf(buf, sizeof (buf), ".%06d",
			    jump_sline_fraction);
			len = strlen(buf);
			while (len > 2 && buf[len-1] == '0')
				len--;
			buf[len] = '\0';
			parg.p_string = buf;
			error("Position target at screen position %s", &parg);
		}
		break;
	}
}

void
calc_jump_sline(void)
{
	if (jump_sline_fraction < 0)
		return;
	jump_sline = sc_height * jump_sline_fraction / NUM_FRAC_DENOM;
}

/*
 * Handlers for -# option.
 */
void
opt_shift(int type, char *s)
{
	PARG parg;
	char buf[16];
	int len;
	int err;

	switch (type) {
	case INIT:
	case TOGGLE:
		if (*s == '.') {
			s++;
			shift_count_fraction = getfraction(&s, "#", &err);
			if (err)
				error("Invalid column fraction", NULL_PARG);
			else
				calc_shift_count();
		} else {
			int hs = getnum(&s, "#", &err);
			if (err) {
				error("Invalid column number", NULL_PARG);
			} else {
				shift_count = hs;
				shift_count_fraction = -1;
			}
		}
		break;
	case QUERY:
		if (shift_count_fraction < 0) {
			parg.p_int = shift_count;
			error("Horizontal shift %d columns", &parg);
		} else {

			(void) snprintf(buf, sizeof (buf), ".%06d",
			    shift_count_fraction);
			len = strlen(buf);
			while (len > 2 && buf[len-1] == '0')
				len--;
			buf[len] = '\0';
			parg.p_string = buf;
			error("Horizontal shift %s of screen width", &parg);
		}
		break;
	}
}

void
calc_shift_count(void)
{
	if (shift_count_fraction < 0)
		return;
	shift_count = sc_width * shift_count_fraction / NUM_FRAC_DENOM;
}

void
opt_k(int type, char *s)
{
	PARG parg;

	switch (type) {
	case INIT:
		if (lesskey(s, 0)) {
			parg.p_string = s;
			error("Cannot use lesskey file \"%s\"", &parg);
		}
		break;
	}
}

/*
 * Handler for -t option.
 */
void
opt_t(int type, char *s)
{
	IFILE save_ifile;
	off_t pos;

	switch (type) {
	case INIT:
		tagoption = s;
		/* Do the rest in main() */
		break;
	case TOGGLE:
		if (secure) {
			error("tags support is not available", NULL_PARG);
			break;
		}
		findtag(skipsp(s));
		save_ifile = save_curr_ifile();
		/*
		 * Try to open the file containing the tag
		 * and search for the tag in that file.
		 */
		if (edit_tagfile() || (pos = tagsearch()) == -1) {
			/* Failed: reopen the old file. */
			reedit_ifile(save_ifile);
			break;
		}
		unsave_ifile(save_ifile);
		jump_loc(pos, jump_sline);
		break;
	}
}

/*
 * Handler for -T option.
 */
void
opt__T(int type, char *s)
{
	PARG parg;

	switch (type) {
	case INIT:
		tags = s;
		break;
	case TOGGLE:
		s = skipsp(s);
		tags = lglob(s);
		break;
	case QUERY:
		parg.p_string = tags;
		error("Tags file \"%s\"", &parg);
		break;
	}
}

/*
 * Handler for -p option.
 */
void
opt_p(int type, char *s)
{
	switch (type) {
	case INIT:
		/*
		 * Unget a search command for the specified string.
		 * {{ This won't work if the "/" command is
		 *    changed or invalidated by a .lesskey file. }}
		 */
		plusoption = TRUE;
		ungetsc(s);
		/*
		 * In "more" mode, the -p argument is a command,
		 * not a search string, so we don't need a slash.
		 */
		if (!less_is_more)
			ungetsc("/");
		break;
	}
}

/*
 * Handler for -P option.
 */
void
opt__P(int type, char *s)
{
	char **proto;
	PARG parg;

	switch (type) {
	case INIT:
	case TOGGLE:
		/*
		 * Figure out which prototype string should be changed.
		 */
		switch (*s) {
		case 's':  proto = &prproto[PR_SHORT];	s++;	break;
		case 'm':  proto = &prproto[PR_MEDIUM];	s++;	break;
		case 'M':  proto = &prproto[PR_LONG];	s++;	break;
		case '=':  proto = &eqproto;		s++;	break;
		case 'h':  proto = &hproto;		s++;	break;
		case 'w':  proto = &wproto;		s++;	break;
		default:   proto = &prproto[PR_SHORT];		break;
		}
		free(*proto);
		*proto = save(s);
		break;
	case QUERY:
		parg.p_string = prproto[pr_type];
		error("%s", &parg);
		break;
	}
}

/*
 * Handler for the -b option.
 */
/*ARGSUSED*/
void
opt_b(int type, char *s)
{
	switch (type) {
	case INIT:
	case TOGGLE:
		/*
		 * Set the new number of buffers.
		 */
		ch_setbufspace(bufspace);
		break;
	case QUERY:
		break;
	}
}

/*
 * Handler for the -i option.
 */
/*ARGSUSED*/
void
opt_i(int type, char *s)
{
	switch (type) {
	case TOGGLE:
		chg_caseless();
		break;
	case QUERY:
	case INIT:
		break;
	}
}

/*
 * Handler for the -V option.
 */
/*ARGSUSED*/
void
opt__V(int type, char *s)
{
	switch (type) {
	case TOGGLE:
	case QUERY:
		dispversion();
		break;
	case INIT:
		/*
		 * Force output to stdout per GNU standard for --version output.
		 */
		any_display = 1;
		putstr("less ");
		putstr(version);
		putstr(" (");
		putstr("POSIX ");
		putstr("regular expressions)\n");
		putstr("Copyright (C) 1984-2012 Mark Nudelman\n");
		putstr("Modified for POSIX compliance by Garrett D'Amore.\n");
		putstr("Copyright 2017 Garrett D'Amore\n\n");
		putstr("less comes with NO WARRANTY, ");
		putstr("to the extent permitted by law.\n");
		putstr("For information about the terms of redistribution,\n");
		putstr("see the file named README in the less distribution.\n");
		putstr("Homepage: http://www.greenwoodsoftware.com/less\n");
		putstr("\n");
		quit(QUIT_OK);
		break;
	}
}

/*
 * Handler for the -x option.
 */
void
opt_x(int type, char *s)
{
	extern int tabstops[];
	extern int ntabstops;
	extern int tabdefault;
	char msg[60+(4*TABSTOP_MAX)];
	int i;
	PARG p;

	switch (type) {
	case INIT:
	case TOGGLE:
		/* Start at 1 because tabstops[0] is always zero. */
		for (i = 1; i < TABSTOP_MAX; ) {
			int n = 0;
			s = skipsp(s);
			while (*s >= '0' && *s <= '9')
				n = (10 * n) + (*s++ - '0');
			if (n > tabstops[i-1])
				tabstops[i++] = n;
			s = skipsp(s);
			if (*s++ != ',')
				break;
		}
		if (i < 2)
			return;
		ntabstops = i;
		tabdefault = tabstops[ntabstops-1] - tabstops[ntabstops-2];
		break;
	case QUERY:
		(void) strlcpy(msg, "Tab stops ", sizeof(msg));
		if (ntabstops > 2) {
			for (i = 1;  i < ntabstops;  i++) {
				if (i > 1)
					strlcat(msg, ",", sizeof(msg));
				(void) snprintf(msg+strlen(msg),
				    sizeof(msg)-strlen(msg), "%d", tabstops[i]);
			}
			(void) snprintf(msg+strlen(msg), sizeof(msg)-strlen(msg),
			    " and then ");
		}
		(void) snprintf(msg+strlen(msg), sizeof(msg)-strlen(msg),
		    "every %d spaces", tabdefault);
		p.p_string = msg;
		error("%s", &p);
		break;
	}
}

/*
 * Handler for the -" option.
 */
void
opt_quote(int type, char *s)
{
	char buf[3];
	PARG parg;

	switch (type) {
	case INIT:
	case TOGGLE:
		if (s[0] == '\0') {
			openquote = closequote = '\0';
			break;
		}
		if (s[1] != '\0' && s[2] != '\0') {
			error("-\" must be followed by 1 or 2 chars",
			    NULL_PARG);
			return;
		}
		openquote = s[0];
		if (s[1] == '\0')
			closequote = openquote;
		else
			closequote = s[1];
		break;
	case QUERY:
		buf[0] = openquote;
		buf[1] = closequote;
		buf[2] = '\0';
		parg.p_string = buf;
		error("quotes %s", &parg);
		break;
	}
}

/*
 * "-?" means display a help message.
 * If from the command line, exit immediately.
 */
/*ARGSUSED*/
void
opt_query(int type, char *s)
{
	switch (type) {
	case QUERY:
	case TOGGLE:
		error("Use \"h\" for help", NULL_PARG);
		break;
	case INIT:
		dohelp = 1;
	}
}

/*
 * Get the "screen window" size.
 */
int
get_swindow(void)
{
	if (swindow > 0)
		return (swindow);
	return (sc_height + swindow);
}


text:
// (C) Copyright 2015 Martin Dougiamas
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

angular.module('mm.core.user')

/**
 * Controller to handle a user profile page.
 *
 * @module mm.core.user
 * @ngdoc controller
 * @name mmaParticipantsProfileCtrl
 */
.controller('mmUserProfileCtrl', function($scope, $stateParams, $mmUtil, $mmUser, $mmUserDelegate, $mmSite, $q, $translate,
            $mmEvents, $mmCourses, mmUserEventProfileRefreshed) {

    var courseid = $stateParams.courseid,
        userid   = $stateParams.userid;

    $scope.isAndroid = ionic.Platform.isAndroid();
    $scope.plugins = [];

    function fetchUserData() {
        return $mmUser.getProfile(userid, courseid).then(function(user) {

            user.address = $mmUser.formatAddress(user.address, user.city, user.country);
            if (user.address) {
                user.encodedAddress = encodeURIComponent(user.address);
            }

            $mmUser.formatRoleList(user.roles).then(function(roles) {
                user.roles = roles;
            });

            $scope.user = user;
            $scope.title = user.fullname;
            $scope.hasContact = user.email || user.phone1 || user.phone2 || user.city || user.country || user.address;
            $scope.hasCourseDetails = user.roles;
            $scope.hasDetails = user.url || user.interests || (user.customfields && user.customfields.length > 0);

            $scope.isLoadingHandlers = true;
            $mmUserDelegate.getProfileHandlersFor(user, courseid).then(function(handlers) {
                $scope.profileHandlers = handlers;
            }).finally(function() {
                $scope.isLoadingHandlers = false;
            });
        }, function(message) {
            $scope.user = false;
            if (message) {
                $mmUtil.showErrorMessage(message);
            }
            return $q.reject();
        });
    }

    fetchUserData().then(function() {
        // Add log in Moodle.
        return $mmSite.write('core_user_view_user_profile', {
            userid: userid,
            courseid: courseid
        }).catch(function(error) {
            $scope.isDeleted = error === $translate.instant('mm.core.userdeleted');
        });
    }).finally(function() {
        $scope.userLoaded = true;
    });

    $scope.refreshUser = function() {
        var promises = [];
        $mmEvents.trigger(mmUserEventProfileRefreshed, {courseid: courseid, userid: userid});

        promises.push($mmUser.invalidateUserCache(userid));
        promises.push($mmCourses.invalidateUserNavigationOptions());
        promises.push($mmCourses.invalidateUserAdministrationOptions());

        $q.all(promises).finally(function() {
            fetchUserData().finally(function() {
                $scope.$broadcast('scroll.refreshComplete');
            });
        });
    };

});


text:
import logging
from copy import deepcopy

from channels.generic import BaseConsumer

LOG = logging.getLogger(__name__)

class SignalConsumer(BaseConsumer):

    method_mapping = {
        "http.request": "signal_reciever",
    }

    def signal_reciever(self, message, **kwargs):
        """Collect related models to instance and for widgets
        call widget_update

        in message expect:

            singal_name: string
            instance: instance
            created: bool
        """

        sender = message.content['sender']
        instance = message.content['instance']
        update_fields = message.content['update_fields']


text:
module Sorcery
  module TestHelpers
    module Rails
      module Request
        # Accepts arguments for user to login, the password, route to use and HTTP method
        # Defaults - @user, 'secret', 'user_sessions_url' and http_method: POST
        def login_user(user = nil, password = 'secret', route = nil, http_method = :post)
          user ||= @user
          route ||= user_sessions_url

          username_attr = user.sorcery_config.username_attribute_names.first
          username = user.send(username_attr)
          password_attr = user.sorcery_config.password_attribute_name

          send(http_method, route, params: { "#{username_attr}": username, "#{password_attr}": password })
        end
      end
    end
  end
end


text:
'''
    xam.xam
    ----------

    This module is the entry point for the console script xam.

    :copyright: (c) 2012 Jonathan Beluch
    :license: BSD, see LICENSE for more details.
'''

USAGE = \
'''
    %(prog)s [options] {all, depends, get, info, search} [arg [arg ...]]

synopsis:
    %(prog)s all
    %(prog)s depends <plugin_id>
    %(prog)s get <plugin_id> [<plugin_id> ...]
    %(prog)s info <plugin_id>
    %(prog)s search <search_text>

commands:
    all
        Prints addon ids and current version numbers for every addon in the
        repo.

    depends
        Prints addon ids and current version for every addon which lists
        the specified addon id as a dependency.

    get
        Downloads the addon zip file and any assets to a folder in the
        current working directory. The folder name will be the addon id.

        NOTE: At this time, the download functionality will only work
        properly for repositories which zip their addons. Using this
        command for a repository which doesn't zip addons will definitely
        not download all of the necessary addon files.

    info
        Prints the specified addon's xml file to STDOUT.

    search
        Prints addon ids and matching lines for the provided text. A case
        insensitive seach of addon xml files is performed.

optional arguments:
    -r URL, --repo URL
        Either an official repo name [eden, eden_pre, dharma, dharma_pre]
        or a URL to a zipped repository file. Defaults to "eden". A list
        of 3rd party repos can be found here:
        http://wiki.xbmc.org/index.php?title=3rd_party_add-on_repositories

examples:
    %(prog)s --repo dharma all
        List addon id and version for every addon in the Dharma repo.

    %(prog)s --repo http://bluecop-xbmc-repo.googlecode.com/files/repository.bluecop.xbmc-plugins.zip all
        List addon id and version for every addon in bluecop's repo.

    %(prog)s depends script.module.xbmcswift
        List addon ids and version for every addon which lists
        script.module.xbmcswift as a dependency.

    %(prog)s get plugin.video.academicearth plugin.video.khanacademy
        Download the current versions of Acacdemic Earth and Khan Academy.

    %(prog)s info plugin.video.classiccinema
        Print addon.xml for the current Classic Cinema plugin.

    %(prog)s search lecture
        Print addon ids and matching lines for any addon containing the
        word lecture.
'''


text:
/* bbiRead - Big Binary Indexed file.  Stuff that's common between bigWig and bigBed on the
 * read side. */

/* Copyright (C) 2014 The Regents of the University of California
 * See README in this or parent directory for licensing information. */

#include "common.h"
#include "linefile.h"
#include "hash.h"
#include "obscure.h"
#include "zlibFace.h"
#include "bPlusTree.h"
#include "hmmstats.h"
#include "cirTree.h"
#include "udc.h"
#include "bbiFile.h"

struct bbiZoomLevel *bbiBestZoom(struct bbiZoomLevel *levelList, int desiredReduction)
/* Return zoom level that is the closest one that is less than or equal to
 * desiredReduction. */
{
if (desiredReduction < 0)
   errAbort("bad value %d for desiredReduction in bbiBestZoom", desiredReduction);
if (desiredReduction <= 1)
    return NULL;
int closestDiff = BIGNUM;
struct bbiZoomLevel *closestLevel = NULL;
struct bbiZoomLevel *level;

for (level = levelList; level != NULL; level = level->next)
    {
    int diff = desiredReduction - level->reductionLevel;
    if (diff >= 0 && diff < closestDiff)
        {
	closestDiff = diff;
	closestLevel = level;
	}
    }
return closestLevel;
}

boolean bbiFileCheckSigs(char *fileName, bits32 sig, char *typeName)
/* check file signatures at beginning and end of file */
{
int fd = mustOpenFd(fileName, O_RDONLY);
bits32 magic;
boolean isSwapped = FALSE;

// look for signature at the beginning of the file
mustReadFd(fd, &magic, sizeof(magic));

if (magic != sig)
    {
    magic = byteSwap32(magic);
    isSwapped = TRUE;
    if (magic != sig)
        return FALSE;
    }

// look for signature at the end of the file
mustLseek(fd, -sizeof(magic), SEEK_END);
mustReadFd(fd, &magic, sizeof(magic));
mustCloseFd(&fd);

if (isSwapped)
    {
    magic = byteSwap32(magic);
    if (magic != sig)
        return FALSE;
    }
else
    {
    if (magic != sig)
        return FALSE;
    }

return TRUE;
}

struct bbiFile *bbiFileOpen(char *fileName, bits32 sig, char *typeName)
/* Open up big wig or big bed file. */
{
/* This code needs to agree with code in two other places currently - bigBedFileCreate,
 * and bigWigFileCreate.  I'm thinking of refactoring to share at least between
 * bigBedFileCreate and bigWigFileCreate.  It'd be great so it could be structured
 * so that it could send the input in one chromosome at a time, and send in the zoom
 * stuff only after all the chromosomes are done.  This'd potentially reduce the memory
 * footprint by a factor of 2 or 4.  Still, for now it works. -JK */
struct bbiFile *bbi;
AllocVar(bbi);
bbi->fileName = cloneString(fileName);
struct udcFile *udc = bbi->udc = udcFileOpen(fileName, udcDefaultDir());

/* Read magic number at head of file and use it to see if we are proper file type, and
 * see if we are byte-swapped. */
bits32 magic;
boolean isSwapped = FALSE;
udcMustRead(udc, &magic, sizeof(magic));
if (magic != sig)
    {
    magic = byteSwap32(magic);
    isSwapped = TRUE;
    if (magic != sig)
       errAbort("%s is not a %s file", fileName, typeName);
    }
bbi->typeSig = sig;
bbi->isSwapped = isSwapped;

/* Read rest of defined bits of header, byte swapping as needed. */
bbi->version = udcReadBits16(udc, isSwapped);
bbi->zoomLevels = udcReadBits16(udc, isSwapped);
bbi->chromTreeOffset = udcReadBits64(udc, isSwapped);
bbi->unzoomedDataOffset = udcReadBits64(udc, isSwapped);
bbi->unzoomedIndexOffset = udcReadBits64(udc, isSwapped);
bbi->fieldCount = udcReadBits16(udc, isSwapped);
bbi->definedFieldCount = udcReadBits16(udc, isSwapped);
bbi->asOffset = udcReadBits64(udc, isSwapped);
bbi->totalSummaryOffset = udcReadBits64(udc, isSwapped);
bbi->uncompressBufSize = udcReadBits32(udc, isSwapped);
bbi->extensionOffset = udcReadBits64(udc, isSwapped);

/* Read zoom headers. */
int i;
struct bbiZoomLevel *level, *levelList = NULL;
for (i=0; i<bbi->zoomLevels; ++i)
    {
    AllocVar(level);
    level->reductionLevel = udcReadBits32(udc, isSwapped);
    level->reserved = udcReadBits32(udc, isSwapped);
    level->dataOffset = udcReadBits64(udc, isSwapped);
    level->indexOffset = udcReadBits64(udc, isSwapped);
    slAddHead(&levelList, level);
    }
slReverse(&levelList);
bbi->levelList = levelList;

/* Deal with header extension if any. */
if (bbi->extensionOffset != 0)
    {
    udcSeek(udc, bbi->extensionOffset);
    bbi->extensionSize = udcReadBits16(udc, isSwapped);
    bbi->extraIndexCount = udcReadBits16(udc, isSwapped);
    bbi->extraIndexListOffset = udcReadBits64(udc, isSwapped);
    }

/* Attach B+ tree of chromosome names and ids. */
udcSeek(udc, bbi->chromTreeOffset);
bbi->chromBpt =  bptFileAttach(fileName, udc);

return bbi;
}

void bbiFileClose(struct bbiFile **pBwf)
/* Close down a big wig/big bed file. */
{
struct bbiFile *bwf = *pBwf;
if (bwf != NULL)
    {
    cirTreeFileDetach(&bwf->unzoomedCir);
    slFreeList(&bwf->levelList);
    slFreeList(&bwf->levelList);
    bptFileDetach(&bwf->chromBpt);
    udcFileClose(&bwf->udc);
    freeMem(bwf->fileName);
    freez(pBwf);
    }
}

static void chromIdSizeHandleSwapped(boolean isSwapped, struct bbiChromIdSize *idSize)
/* Swap bytes in chromosome Id and Size as needed. */
{
if (isSwapped)
    {
    idSize->chromId = byteSwap32(idSize->chromId);
    idSize->chromSize = byteSwap32(idSize->chromSize);
    }
}

struct fileOffsetSize *bbiOverlappingBlocks(struct bbiFile *bbi, struct cirTreeFile *ctf,
	char *chrom, bits32 start, bits32 end, bits32 *retChromId)
/* Fetch list of file blocks that contain items overlapping chromosome range. */
{
struct bbiChromIdSize idSize;
if (!bptFileFind(bbi->chromBpt, chrom, strlen(chrom), &idSize, sizeof(idSize)))
    {
    // if chrom is not found and the chrom starts with "chr", try without "chr"
    if (!startsWith("chr", chrom) || !bptFileFind(bbi->chromBpt, &chrom[3], strlen(chrom) - 3, &idSize, sizeof(idSize)))
        return NULL;
    }
chromIdSizeHandleSwapped(bbi->isSwapped, &idSize);
if (retChromId != NULL)
    *retChromId = idSize.chromId;
return cirTreeFindOverlappingBlocks(ctf, idSize.chromId, start, end);
}

struct chromNameCallbackContext
/* Some stuff that the bPlusTree traverser needs for context. */
    {
    struct bbiChromInfo *list;		/* The list we are building. */
    boolean isSwapped;			/* Need to byte-swap things? */
    };

static void chromNameCallback(void *context, void *key, int keySize, void *val, int valSize)
/* Callback that captures chromInfo from bPlusTree. */
{
struct chromNameCallbackContext *c = context;
struct bbiChromInfo *info;
struct bbiChromIdSize *idSize = val;
assert(valSize == sizeof(*idSize));
chromIdSizeHandleSwapped(c->isSwapped, idSize);
AllocVar(info);
info->name = cloneStringZ(key, keySize);
info->id = idSize->chromId;
info->size = idSize->chromSize;
slAddHead(&c->list, info);
}

struct bbiChromInfo *bbiChromList(struct bbiFile *bbi)
/* Return list of chromosomes. */
{
struct chromNameCallbackContext context;
context.list = NULL;
context.isSwapped = bbi->isSwapped;
bptFileTraverse(bbi->chromBpt, &context, chromNameCallback);
slReverse(&context.list);
return context.list;
}

bits32 bbiChromSize(struct bbiFile *bbi, char *chrom)
/* Return chromosome size, or 0 if no such chromosome in file. */
{
struct bbiChromIdSize idSize;
if (!bptFileFind(bbi->chromBpt, chrom, strlen(chrom), &idSize, sizeof(idSize)))
    return 0;
chromIdSizeHandleSwapped(bbi->isSwapped, &idSize);
return idSize.chromSize;
}

void bbiChromInfoFree(struct bbiChromInfo **pInfo)
/* Free up one chromInfo */
{
struct bbiChromInfo *info = *pInfo;
if (info != NULL)
    {
    freeMem(info->name);
    freez(pInfo);
    }
}

void bbiChromInfoFreeList(struct bbiChromInfo **pList)
/* Free a list of dynamically allocated bbiChromInfo's */
{
struct bbiChromInfo *el, *next;

for (el = *pList; el != NULL; el = next)
    {
    next = el->next;
    bbiChromInfoFree(&el);
    }
*pList = NULL;
}

void bbiAttachUnzoomedCir(struct bbiFile *bbi)
/* Make sure unzoomed cir is attached. */
{
if (bbi->unzoomedCir == NULL)
    {
    udcSeek(bbi->udc, bbi->unzoomedIndexOffset);
    bbi->unzoomedCir = cirTreeFileAttach(bbi->fileName, bbi->udc);
    }
}

enum bbiSummaryType bbiSummaryTypeFromString(char *string)
/* Return summary type given a descriptive string. */
{
if (sameWord(string, "mean") || sameWord(string, "average"))
    return bbiSumMean;
else if (sameWord(string, "max") || sameWord(string, "maximum"))
    return bbiSumMax;
else if (sameWord(string, "min") || sameWord(string, "minimum"))
    return bbiSumMin;
else if (sameWord(string, "coverage") || sameWord(string, "dataCoverage"))
    return bbiSumCoverage;
else if (sameWord(string, "std"))
    return bbiSumStandardDeviation;
else
    {
    errAbort("Unknown bbiSummaryType %s", string);
    return bbiSumMean;	/* Keep compiler quiet. */
    }
}

char *bbiSummaryTypeToString(enum bbiSummaryType type)
/* Convert summary type from enum to string representation. */
{
switch (type)
    {
    case bbiSumMean:
        return "mean";
    case bbiSumMax:
        return "max";
    case bbiSumMin:
        return "min";
    case bbiSumCoverage:
        return "coverage";
    case bbiSumStandardDeviation:
        return "std";
    default:
	errAbort("Unknown bbiSummaryType %d", (int)type);
	return NULL;
    }
}

#ifdef UNUSED
static void bbiSummaryOnDiskRead(struct bbiFile *bbi, struct bbiSummaryOnDisk *sum)
/* Read in summary from file. */
{
struct udcFile *udc = bbi->udc;
boolean isSwapped = bbi->isSwapped;
sum->chromId = udcReadBits32(udc, isSwapped);
sum->start = udcReadBits32(udc, isSwapped);
sum->end = udcReadBits32(udc, isSwapped);
sum->validCount = udcReadBits32(udc, isSwapped);
// looks like a bug to me, these should call udcReadFloat()
udcMustReadOne(udc, sum->minVal);
udcMustReadOne(udc, sum->maxVal);
udcMustReadOne(udc, sum->sumData);
udcMustReadOne(udc, sum->sumSquares);
}
#endif /* UNUSED */

static void bbiSummaryHandleSwapped(struct bbiFile *bbi, struct bbiSummaryOnDisk *in)
/* Swap integer fields in summary as needed. */
{
if (bbi->isSwapped)
    {
    in->chromId = byteSwap32(in->chromId);
    in->start = byteSwap32(in->start);
    in->end = byteSwap32(in->end);
    in->validCount = byteSwap32(in->validCount);
    in->minVal = byteSwapFloat(in->minVal);
    in->maxVal = byteSwapFloat(in->maxVal);
    in->sumData = byteSwapFloat(in->sumData);
    in->sumSquares = byteSwapFloat(in->sumSquares);
    }
}

static struct bbiSummary *bbiSummaryFromOnDisk(struct bbiSummaryOnDisk *in)
/* Create a bbiSummary unlinked to anything from input in onDisk format. */
{
struct bbiSummary *out;
AllocVar(out);
out->chromId = in->chromId;
out->start = in->start;
out->end = in->end;
out->validCount = in->validCount;
out->minVal = in->minVal;
out->maxVal = in->maxVal;
out->sumData = in->sumData;
out->sumSquares = in->sumSquares;
return out;
}

struct bbiSummary *bbiSummariesInRegion(struct bbiZoomLevel *zoom, struct bbiFile *bbi,
	int chromId, bits32 start, bits32 end)
/* Return list of all summaries in region at given zoom level of bbiFile. */
{
struct bbiSummary *sumList = NULL, *sum;
struct udcFile *udc = bbi->udc;
udcSeek(udc, zoom->indexOffset);
struct cirTreeFile *ctf = cirTreeFileAttach(bbi->fileName, bbi->udc);
struct fileOffsetSize *blockList = cirTreeFindOverlappingBlocks(ctf, chromId, start, end);
struct fileOffsetSize *block, *beforeGap, *afterGap;

/* Set up for uncompression optionally. */
char *uncompressBuf = NULL;
if (bbi->uncompressBufSize > 0)
    uncompressBuf = needLargeMem(bbi->uncompressBufSize);

/* This loop is a little complicated because we merge the read requests for efficiency, but we
 * have to then go back through the data one unmerged block at a time. */
for (block = blockList; block != NULL; )
    {
    /* Find contigious blocks and read them into mergedBuf. */
    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
    bits64 mergedOffset = block->offset;
    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
    udcSeek(udc, mergedOffset);
    char *mergedBuf = needLargeMem(mergedSize);
    udcMustRead(udc, mergedBuf, mergedSize);
    char *blockBuf = mergedBuf;

    /* Loop through individual blocks within merged section. */
    for (;block != afterGap; block = block->next)
        {
	/* Uncompress if necessary. */
	char *blockPt, *blockEnd;
	if (uncompressBuf)
	    {
	    blockPt = uncompressBuf;
	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bbi->uncompressBufSize);
	    blockEnd = blockPt + uncSize;
	    }
	else
	    {
	    blockPt = blockBuf;
	    blockEnd = blockPt + block->size;
	    }

	/* Figure out bounds and number of items in block. */
	int blockSize = blockEnd - blockPt;
	struct bbiSummaryOnDisk *dSum;
	int itemSize = sizeof(*dSum);
	assert(blockSize % itemSize == 0);
	int itemCount = blockSize / itemSize;

	/* Read in items and convert to memory list format. */
	int i;
	for (i=0; i<itemCount; ++i)
	    {
	    dSum = (void *)blockPt;
	    blockPt += sizeof(*dSum);
	    bbiSummaryHandleSwapped(bbi, dSum);
	    if (dSum->chromId == chromId)
		{
		int s = max(dSum->start, start);
		int e = min(dSum->end, end);
		if (s < e)
		    {
		    sum = bbiSummaryFromOnDisk(dSum);
		    slAddHead(&sumList, sum);
		    }
		}
	    }
	assert(blockPt == blockEnd);
	blockBuf += block->size;
        }
    freeMem(mergedBuf);
    }
freeMem(uncompressBuf);
slFreeList(&blockList);
cirTreeFileDetach(&ctf);
slReverse(&sumList);
return sumList;
}

static int normalizeCount(struct bbiSummaryElement *el, double countFactor,
    double minVal, double maxVal, double sumData, double sumSquares)
/* normalize statistics to be based on an integer number of valid bases
 * Integer value is the smallest integer not less than countFactor */
{
bits32 validCount = ceil(countFactor);
double normFactor = (double)validCount/countFactor;

el->validCount = validCount;
el->minVal = minVal;
el->maxVal = maxVal;
el->sumData = sumData * normFactor;
el->sumSquares = sumSquares * normFactor;

return validCount;
}

static bits32 bbiSummarySlice(struct bbiFile *bbi, bits32 baseStart, bits32 baseEnd,
	struct bbiSummary *sumList, struct bbiSummaryElement *el)
/* Update retVal with the average value if there is any data in interval.  Return number
 * of valid data bases in interval. */
{
bits32 validCount = 0;

if (sumList != NULL)
    {
    double minVal = sumList->minVal;
    double maxVal = sumList->maxVal;
    double sumData = 0, sumSquares = 0;
    double countFactor = 0.0;

    struct bbiSummary *sum;
    for (sum = sumList; sum != NULL && sum->start < baseEnd; sum = sum->next)
	{
	int overlap = rangeIntersection(baseStart, baseEnd, sum->start, sum->end);
	if (overlap > 0)
	    {
	    double overlapFactor = (double)overlap / (sum->end - sum->start);
	    countFactor += sum->validCount * overlapFactor;
	    sumData += sum->sumData * overlapFactor;
	    sumSquares += sum->sumSquares * overlapFactor;
	    if (maxVal < sum->maxVal)
		maxVal = sum->maxVal;
	    if (minVal > sum->minVal)
		minVal = sum->minVal;
	    }
	}

    if (countFactor > 0)
	validCount = normalizeCount(el, countFactor, minVal, maxVal, sumData, sumSquares);
    }
return validCount;
}

static int bbiChromId(struct bbiFile *bbi, char *chrom)
/* Return chromosome Id */
{
struct bbiChromIdSize idSize;
if (!bptFileFind(bbi->chromBpt, chrom, strlen(chrom), &idSize, sizeof(idSize)))
    return -1;
chromIdSizeHandleSwapped(bbi->isSwapped, &idSize);
return idSize.chromId;
}

static boolean bbiSummaryArrayFromZoom(struct bbiZoomLevel *zoom, struct bbiFile *bbi,
	char *chrom, bits32 start, bits32 end,
	int summarySize, struct bbiSummaryElement *summary)
/* Look up region in index and get data at given zoom level.  Summarize this data
 * in the summary array. */
{
boolean result = FALSE;
int chromId = bbiChromId(bbi, chrom);
if (chromId < 0)
    return FALSE;
struct bbiSummary *sum, *sumList = bbiSummariesInRegion(zoom, bbi, chromId, start, end);
if (sumList != NULL)
    {
    int i;
    bits32 baseStart = start, baseEnd;
    bits32 baseCount = end - start;
    sum = sumList;
    for (i=0; i<summarySize; ++i)
        {
	/* Calculate end of this part of summary */
	baseEnd = start + (bits64)baseCount*(i+1)/summarySize;

        /* Advance sum to skip over parts we are no longer interested in. */
	while (sum != NULL && sum->end <= baseStart)
	    sum = sum->next;

	if (bbiSummarySlice(bbi, baseStart, baseEnd, sum, &summary[i]))
	    result = TRUE;

	/* Next time round start where we left off. */
	baseStart = baseEnd;
	}
    slFreeList(&sumList);
    }
return result;
}

static bits32 bbiIntervalSlice(struct bbiFile *bbi, bits32 baseStart, bits32 baseEnd,
	struct bbiInterval *intervalList, struct bbiSummaryElement *el)
/* Update retVal with the average value if there is any data in interval.  Return number
 * of valid data bases in interval. */
{
bits32 validCount = 0;

if (intervalList != NULL)
    {
    double countFactor = 0;
    struct bbiInterval *interval;
    double sumData = 0, sumSquares = 0;
    double minVal = intervalList->val;
    double maxVal = intervalList->val;

    for (interval = intervalList; interval != NULL && interval->start < baseEnd;
	    interval = interval->next)
	{
	int overlap = rangeIntersection(baseStart, baseEnd, interval->start, interval->end);
	if (overlap > 0)
	    {
	    int intervalSize = interval->end - interval->start;
	    double overlapFactor = (double)overlap / intervalSize;
	    double intervalWeight = intervalSize * overlapFactor;
	    countFactor += intervalWeight;
	    sumData += interval->val * intervalWeight;
	    sumSquares += interval->val * interval->val * intervalWeight;
	    if (maxVal < interval->val)
		maxVal = interval->val;
	    if (minVal > interval->val)
		minVal = interval->val;
	    }
	}

    validCount = normalizeCount(el, countFactor, minVal, maxVal, sumData, sumSquares);
    }
return validCount;
}

static boolean bbiSummaryArrayFromFull(struct bbiFile *bbi,
	char *chrom, bits32 start, bits32 end, BbiFetchIntervals fetchIntervals,
	int summarySize, struct bbiSummaryElement *summary)
/* Summarize data, not using zoom. */
{
struct bbiInterval *intervalList = NULL, *interval;
struct lm *lm = lmInit(0);
intervalList = (*fetchIntervals)(bbi, chrom, start, end, lm);
boolean result = FALSE;
if (intervalList != NULL)
    {
    int i;
    bits32 baseStart = start, baseEnd;
    bits32 baseCount = end - start;
    interval = intervalList;
    for (i=0; i<summarySize; ++i)
        {
	/* Calculate end of this part of summary */
	baseEnd = start + (bits64)baseCount*(i+1)/summarySize;
	int end1 = baseEnd;
	if (end1 == baseStart)
	    end1 = baseStart+1;

        /* Advance interval to skip over parts we are no longer interested in. */
	while (interval != NULL && interval->end <= baseStart)
	    interval = interval->next;

	if (bbiIntervalSlice(bbi, baseStart, end1, interval, &summary[i]))
	    result = TRUE;

	/* Next time round start where we left off. */
	baseStart = baseEnd;
	}
    }
lmCleanup(&lm);
return result;
}

boolean bbiSummaryArrayExtended(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
	BbiFetchIntervals fetchIntervals,
	int summarySize, struct bbiSummaryElement *summary)
/* Fill in summary with  data from indicated chromosome range in bigWig file.
 * Returns FALSE if no data at that position. */
{
boolean result = FALSE;

/* Protect from bad input. */
if (start >= end)
    return result;
bzero(summary, summarySize * sizeof(summary[0]));

/* Figure out what size of data we want.  We actually want to get 2 data points per summary
 * value if possible to minimize the effect of a data point being split between summary pixels. */
bits32 baseSize = end - start;
int fullReduction = (baseSize/summarySize);
int zoomLevel = fullReduction/2;
if (zoomLevel < 0)
    zoomLevel = 0;

/* Get the closest zoom level less than what we're looking for. */
struct bbiZoomLevel *zoom = bbiBestZoom(bbi->levelList, zoomLevel);
if (zoom != NULL)
    result = bbiSummaryArrayFromZoom(zoom, bbi, chrom, start, end, summarySize, summary);
else
    result = bbiSummaryArrayFromFull(bbi, chrom, start, end, fetchIntervals, summarySize, summary);
return result;
}

boolean bbiSummaryArray(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
	BbiFetchIntervals fetchIntervals,
	enum bbiSummaryType summaryType, int summarySize, double *summaryValues)
/* Fill in summaryValues with  data from indicated chromosome range in bigWig file.
 * Be sure to initialize summaryValues to a default value, which will not be touched
 * for regions without data in file.  (Generally you want the default value to either
 * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
 * at that position. */
{
struct bbiSummaryElement *elements;
AllocArray(elements, summarySize);
boolean ret = bbiSummaryArrayExtended(bbi, chrom, start, end,
	fetchIntervals, summarySize, elements);
if (ret)
    {
    int i;
    double covFactor = (double)summarySize/(end - start);
    for (i=0; i<summarySize; ++i)
        {
	struct bbiSummaryElement *el = &elements[i];
	if (el->validCount > 0)
	    {
	    double val;
	    switch (summaryType)
		{
		case bbiSumMean:
		    val = el->sumData/el->validCount;
		    break;
		case bbiSumMax:
		    val = el->maxVal;
		    break;
		case bbiSumMin:
		    val = el->minVal;
		    break;
		case bbiSumCoverage:
		    val = covFactor*el->validCount;
		    break;
		case bbiSumStandardDeviation:
		    val = calcStdFromSums(el->sumData, el->sumSquares, el->validCount);
		    break;
		default:
		    internalErr();
		    val = 0.0;
		    break;
		}
	    summaryValues[i] = val;
	    }
	}
    }
freeMem(elements);
return ret;
}

struct bbiSummaryElement bbiTotalSummary(struct bbiFile *bbi)
/* Return summary of entire file! */
{
struct udcFile *udc = bbi->udc;
boolean isSwapped = bbi->isSwapped;
struct bbiSummaryElement res;
ZeroVar(&res);

if (bbi->totalSummaryOffset != 0)
    {
    udcSeek(udc, bbi->totalSummaryOffset);
    res.validCount = udcReadBits64(udc, isSwapped);
    res.minVal = udcReadDouble(udc, isSwapped);
    res.maxVal = udcReadDouble(udc, isSwapped);
    res.sumData = udcReadDouble(udc, isSwapped);
    res.sumSquares = udcReadDouble(udc, isSwapped);
    }
else if (bbi->version == 1)
    /* Require version 1 so as not to have to deal with compression.  Should not happen
     * to have NULL totalSummaryOffset for non-empty version 2+ file anyway. */
    {
    /* Find most extreme zoom. */
    struct bbiZoomLevel *bestZoom = NULL, *zoom;
    bits32 bestReduction = 0;
    for (zoom = bbi->levelList; zoom != NULL; zoom = zoom->next)
	{
	if (zoom->reductionLevel > bestReduction)
	    {
	    bestReduction = zoom->reductionLevel;
	    bestZoom = zoom;
	    }
	}

    if (bestZoom != NULL)
	{
	udcSeek(udc, bestZoom->dataOffset);
	bits32 zoomSectionCount = udcReadBits32(udc, isSwapped);
	bits32 i;
	for (i=0; i<zoomSectionCount; ++i)
	    {
	    /* Read, but ignore, position. */
	    udcReadBits32(udc, isSwapped);  // chromId
	    udcReadBits32(udc, isSwapped);  // chromStart
	    udcReadBits32(udc, isSwapped);  // chromEnd

	    /* First time through set values, rest of time add to them. */
	    if (i == 0)
		{
		res.validCount = udcReadBits32(udc, isSwapped);
		res.minVal = udcReadFloat(udc, isSwapped);
		res.maxVal = udcReadFloat(udc, isSwapped);
		res.sumData = udcReadFloat(udc, isSwapped);
		res.sumSquares = udcReadFloat(udc, isSwapped);
		}
	    else
		{
		res.validCount += udcReadBits32(udc, isSwapped);
		float minVal = udcReadFloat(udc, isSwapped);
		if (minVal < res.minVal) res.minVal = minVal;
		float maxVal = udcReadFloat(udc, isSwapped);
		if (maxVal > res.maxVal) res.maxVal = maxVal;
		res.sumData += udcReadFloat(udc, isSwapped);
		res.sumSquares += udcReadFloat(udc, isSwapped);
		}
	    }
	}
    }
return res;
}

time_t bbiUpdateTime(struct bbiFile *bbi)
/* return bbi->udc->updateTime */
{
struct udcFile *udc = bbi->udc;
return udcUpdateTime(udc);
}

char *bbiCachedChromLookup(struct bbiFile *bbi, int chromId, int lastChromId,
    char *chromBuf, int chromBufSize)
/* Return chromosome name corresponding to chromId.  Because this is a bit expensive,
 * if you are doing this repeatedly pass in the chromId used in the previous call to
 * this in lastChromId,  which will save it from doing the lookup again on the same
 * chromosome.  Pass in -1 to lastChromId if this is the first time or if you can't be
 * bothered.  The chromBufSize should be at greater or equal to bbi->keySize+1.  */
{
if (chromId != lastChromId)
    bptStringKeyAtPos(bbi->chromBpt, chromId, chromBuf, chromBufSize);
return chromBuf;
}


text:
onadata.apps.viewer.models package
==================================

Submodules
----------

onadata.apps.viewer.models.data_dictionary module
-------------------------------------------------

.. automodule:: onadata.apps.viewer.models.data_dictionary
    :members:
    :undoc-members:
    :show-inheritance:

onadata.apps.viewer.models.export module
----------------------------------------

.. automodule:: onadata.apps.viewer.models.export
    :members:
    :undoc-members:
    :show-inheritance:

onadata.apps.viewer.models.parsed_instance module
-------------------------------------------------

.. automodule:: onadata.apps.viewer.models.parsed_instance
    :members:
    :undoc-members:
    :show-inheritance:

Module contents
---------------

.. automodule:: onadata.apps.viewer.models
    :members:
    :undoc-members:
    :show-inheritance:


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>match_flag_type</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="Boost.Regex">
<link rel="up" href="../ref.html" title="Reference">
<link rel="prev" href="syntax_option_type/syntax_option_type_literal.html" title="Options for Literal Strings">
<link rel="next" href="error_type.html" title="error_type">

Home
Libraries
People
FAQ
More

match_flag_type

        The type match_flag_type
        is an implementation specific bitmask type (see C++ std 17.3.2.1.2) that
        controls how a regular expression is matched against a character sequence.
        The behavior of the format flags is described in more detail in the format syntax guide.

namespace boost{ namespace regex_constants{

typedef implemenation-specific-bitmask-type match_flag_type;

static const match_flag_type match_default = 0;
static const match_flag_type match_not_bob;
static const match_flag_type match_not_eob;
static const match_flag_type match_not_bol;
static const match_flag_type match_not_eol;
static const match_flag_type match_not_bow;
static const match_flag_type match_not_eow;
static const match_flag_type match_any;
static const match_flag_type match_not_null;
static const match_flag_type match_continuous;
static const match_flag_type match_partial;
static const match_flag_type match_single_line;
static const match_flag_type match_prev_avail;
static const match_flag_type match_not_dot_newline;
static const match_flag_type match_not_dot_null;
static const match_flag_type match_posix;
static const match_flag_type match_perl;
static const match_flag_type match_nosubs;
static const match_flag_type match_extra;

static const match_flag_type format_default = 0;
static const match_flag_type format_sed;
static const match_flag_type format_perl;
static const match_flag_type format_literal;

static const match_flag_type format_no_copy;
static const match_flag_type format_first_only;
static const match_flag_type format_all;

} // namespace regex_constants
} // namespace boost

        Description

        The type match_flag_type
        is an implementation specific bitmask type (see C++ std 17.3.2.1.2). When
        matching a regular expression against a sequence of characters [first, last)
        then setting its elements has the effects listed in the table below:

<colgroup>
<col>
<col>
</colgroup>

                  Element

                  Effect if set

                  match_default

                  Specifies that matching of regular expressions proceeds without
                  any modification of the normal rules used in ECMA-262, ECMAScript
                  Language Specification, Chapter 15 part 10, RegExp (Regular Expression)
                  Objects (FWD.1)

                  match_not_bob

                  Specifies that the expressions "\A" and "\`"
                  should not match against the sub-sequence [first,first).

                  match_not_eob

                  Specifies that the expressions "\'", "\z" and
                  "\Z" should not match against the sub-sequence [last,last).

                  match_not_bol

                  Specifies that the expression "^" should not be matched
                  against the sub-sequence [first,first).

                  match_not_eol

                  Specifies that the expression "$" should not be matched
                  against the sub-sequence [last,last).

                  match_not_bow

                  Specifies that the expressions "\<" and "\b"
                  should not be matched against the sub-sequence [first,first).

                  match_not_eow

                  Specifies that the expressions "\>" and "\b"
                  should not be matched against the sub-sequence [last,last).

                  match_any

                  Specifies that if more than one match is possible then any match
                  is an acceptable result: this will still find the leftmost match,
                  but may not find the "best" match at that position. Use
                  this flag if you care about the speed of matching, but don't care
                  what was matched (only whether there is one or not).

                  match_not_null

                  Specifies that the expression can not be matched against an empty
                  sequence.

                  match_continuous

                  Specifies that the expression must match a sub-sequence that begins
                  at first.

                  match_partial

                  Specifies that if no match can be found, then it is acceptable
                  to return a match [from, last) such that from!= last, if there
                  could exist some longer sequence of characters [from,to) of which
                  [from,last) is a prefix, and which would result in a full match.
                  This flag is used when matching incomplete or very long texts,
                  see the partial matches documentation for more information.

                  match_extra

                  Instructs the matching engine to retain all available capture information;
                  if a capturing group is repeated then information about every repeat
                  is available via match_results::captures() or sub_match_captures().

                  match_single_line

                  Equivalent to the inverse of Perl's m/ modifier; prevents ^ from
                  matching after an embedded newline character (so that it only matches
                  at the start of the text being matched), and $ from matching before
                  an embedded newline (so that it only matches at the end of the
                  text being matched).

                  match_prev_avail

                  Specifies that --first is a valid iterator position, when this
                  flag is set then the flags match_not_bol and match_not_bow are
                  ignored by the regular expression algorithms (RE.7) and iterators
                  (RE.8).

                  match_not_dot_newline

                  Specifies that the expression "." does not match a newline
                  character. This is the inverse of Perl's s/ modifier.

                  match_not_dot_null

                  Specifies that the expression "." does not match a character
                  null '\0'.

                  match_posix

                  Specifies that the expression should be matched according to the
                  POSIX leftmost-longest
                  rule, regardless of what kind of expression was compiled.
                  Be warned that these rules do not work well with many Perl-specific
                  features such as non-greedy repeats.

                  match_perl

                  Specifies that the expression should be matched according to the
                  Perl
                  matching rules, irrespective of what kind of expression
                  was compiled.

                  match_nosubs

                  Makes the expression behave as if it had no marked subexpressions,
                  no matter how many capturing groups are actually present. The
                  match_results
                  class will only contain information about the overall match, and
                  not any sub-expressions.

                  format_default

                  Specifies that when a regular expression match is to be replaced
                  by a new string, that the new string is constructed using the rules
                  used by the ECMAScript replace function in ECMA-262, ECMAScript
                  Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
                  (FWD.1).

                  This is functionally identical to the Perl
                  format string rules.

                  In addition during search and replace operations then all non-overlapping
                  occurrences of the regular expression are located and replaced,
                  and sections of the input that did not match the expression, are
                  copied unchanged to the output string.

                  format_sed

                  Specifies that when a regular expression match is to be replaced
                  by a new string, that the new string is constructed using the rules
                  used by the Unix sed utility in IEEE Std 1003.1-2001, Portable
                  Operating SystemInterface (POSIX ), Shells and Utilities. See also
                  the Sed Format string
                  reference.

                  format_perl

                  Specifies that when a regular expression match is to be replaced
                  by a new string, that the new string is constructed using the same rules as Perl
                  5.

                  format_literal

                  Specifies that when a regular expression match is to be replaced
                  by a new string, that the new string is a literal copy of the replacement
                  text.

                  format_all

                  Specifies that all syntax extensions are enabled, including conditional
                  (?ddexpression1:expression2) replacements: see the format
                  string guide for more details.

                  format_no_copy

                  When specified during a search and replace operation, then sections
                  of the character container sequence being searched that do match
                  the regular expression, are not copied to the output string.

                  format_first_only

                  When specified during a search and replace operation, then only
                  the first occurrence of the regular expression is replaced.

Copyright © 1998-2010 John Maddock

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
package com.bbn.kbp.events2014.transformers;

import com.bbn.bue.common.symbols.Symbol;
import com.bbn.kbp.events2014.KBPEATestUtils;
import com.bbn.kbp.events2014.Response;
import com.bbn.kbp.events2014.ResponseLinking;
import com.bbn.kbp.events2014.ResponseSet;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;

import org.junit.Test;

import static com.bbn.kbp.events2014.KBPEATestUtils.dummyTRFR;
import static org.junit.Assert.assertEquals;

/**
 * Created by rgabbard on 6/25/15.
 */
public class TestResponseMapping {
  @Test
  public void testLinkingMapping() {
    final Symbol docID = Symbol.from("foo");

    final KBPEATestUtils.DummyResponseGenerator rGen = new KBPEATestUtils.DummyResponseGenerator();
    final Response a = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("a")));
    final Response b = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("b")));
    final Response c = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("c")));
    final Response d = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("d")));
    final Response e = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("e")));
    final Response f = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("f")));
    final Response g = rGen.responseFor(dummyTRFR(docID, KBPEATestUtils.kbpString("g")));

    final ResponseLinking sourceLinking = ResponseLinking.builder().docID(docID)
        .responseSets(ImmutableSet.of(ResponseSet.from(a, b), ResponseSet.from(a, c),
            ResponseSet.from(a, c, d), ResponseSet.from(d)))
        .incompleteResponses(ImmutableList.of(e, f)).build();
    final ResponseLinking expectedResult = ResponseLinking.builder().docID(docID)
        .responseSets(ImmutableSet.of(ResponseSet.from(a,c)))
        .incompleteResponses(ImmutableList.of(g)).build();
    final ResponseMapping mapping = ResponseMapping.create(
        ImmutableMap.of(b,c, f, g), ImmutableSet.of(d,e));

    assertEquals(expectedResult, mapping.apply(sourceLinking));
  }
}


text:
namespace Conreign.LoadTest.Core.Behaviours
{
    public interface IBotBehaviour
    {
    }
}


text:
A front end framework and pattern library

**Atomic**
- atoms – high level elements such as inputs, headings
- molecules – something containing multiple atoms or a very reusable flexible
pattern
- organism – something very specific to it's use that contains multiple
molecules

## Getting Started

1. Clone the project / Download the zip.
```
git clone git@github.com:getchopchop/chopchop.git chopchop
```
2. Navigation to the working directory
```
cd chopchop
```
3. Install npm modules
```
npm i
```
4. Update variables, paths, folders, extensions etc at top of the gulpfile.js
file to suite your project.
5. Build assets
```
npm run build
```

### NPM Scripts
* `$ npm run watch` - Builds assets and watches directories for changes.
* `$ npm run build` - Builds all assets.
* `$ npm run build:production` - Builds all assets for production (Minified CSS
  and JavaScript, compressed images etc).

### Example Project Structure
*This can be easily changed to suit your project.*
```
+-- build/
|   +-- css
|   +-- img
|   |   +-- icons
|   +-- js
+-- node_modules/
+-- inc/
+-- pattern/
+-- src/
|   +-- img
|   |   +-- vectors
|   +-- js
|   +-- scss
+-- .editorconfig
+-- .gitignore
+-- .htaccess
+-- gulpfile.js
+-- index.php
+-- LICENCE.md
+-- package.json
+-- README.md
```

## Bugs and feature requests

Have a bug or a feature request? Please first read the [contributing guidelines](https://github.com/getchopchop/chopchop/blob/next/.github/CONTRIBUTING.md)
document and search for existing and closed issues. If your problem or idea is
not addressed yet, please open a [new issue](https://github.com/getchopchop/chopchop/issues).

## Contributing

Please read through our [contributing guidelines](https://github.com/getchopchop/chopchop/blob/next/.github/CONTRIBUTING.md).
Included are directions for opening issues, coding standards, and notes on
development.

Editor preferences are available in the editor config for easy use in common
text editors. Read more and download plugins at http://editorconfig.org.

## Versioning

This project is maintained under the [Semantic Versioning guidelines](http://semver.org/).
Sometimes we screw up, but we'll adhere to those rules whenever possible.

See the [Releases](https://github.com/getchopchop/chopchop/releases) section
of our GitHub project for changelogs for each release.