text:
#include <EchoPhotonBridge.h>
#include <math.h>
//public:

EchoPhotonBridge::EchoPhotonBridge()
{
    Particle.variable("echoDeviceV2", EchoPhotonBridge::echoDeviceConfigsV2);
    Particle.function("echoCmdV2",  &EchoPhotonBridge::callEchoFunctionV2, this);
    Particle.variable("echoDeviceV3", EchoPhotonBridge::echoDeviceConfigsV3);
    Particle.function("echoCmdV3",  &EchoPhotonBridge::callEchoFunctionV3, this);
}

int EchoPhotonBridge::callEchoFunctionV2(String value)
{

    int device = _stoi(_getValue(value, ':', 0));
    int function = _stoi(_getValue(value, ':', 1));
    String params = _getValue(value, ':', 2);

    int delta = 0;
    bool on = false;
    bool requestStatus = false;
    bool requestStatus2 = false;

    //Check if the device number is within range..
    if (device < 0 or device > _echoDeviceCountV2) {
        return -2;
    }

    switch (function)
    {
        case DEVICETYPEV2_ONOFF:
            if (_v2devices[device].fOnOff == NULL) return -1;
            on = (_stoi(params) > 0);
            delta = _v2devices[device].fOnOff (device, on, params);
            return 1000 + delta;

        case DEVICETYPEV2_PERCENT:
            if (_v2devices[device].fPercent == NULL) return -1;
            delta = _getDelta(params, _v2devices[device].percent);
            _v2devices[device].percent += delta;

            if (_v2devices[device].percent > 100) _v2devices[device].percent = 100;
            if (_v2devices[device].percent < 0) _v2devices[device].percent = 0;

            return _v2devices[device].fPercent (device, _v2devices[device].percent, delta, params);

        case DEVICETYPEV2_COLOR:
            if (_v2devices[device].fColor == NULL) return -1;
            _v2devices[device].rgb.red = _stoi(_getValue(params, ',', 0));
            _v2devices[device].rgb.green = _stoi(_getValue(params, ',', 1));
            _v2devices[device].rgb.blue = _stoi(_getValue(params, ',', 2));
            return _v2devices[device].fColor (device, _stoi(_getValue(params, ',', 0)), _stoi(_getValue(params, ',', 1)), _stoi(_getValue(params, ',', 2)), params);

        case DEVICETYPEV2_LOCK:
            if (_v2devices[device].fLock == NULL) return -1;
            requestStatus = (_stoi(_getValue(params, ',', 0)) > 0);
            on = _stoi(_getValue(params, ',', 1)) > 0;
            return _v2devices[device].fLock (device, requestStatus, on, params);

        case DEVICETYPEV2_TEMP:
            if (_v2devices[device].fTemp == NULL) return -1;
            requestStatus = (_stoi(_getValue(params, ',', 0)) == 1);
            requestStatus2 = (_stoi(_getValue(params, ',', 0)) == 2);
            delta = _getDelta(_getValue(params, ',', 1), _v2devices[device].temp);
            _v2devices[device].temp += delta;
            return _v2devices[device].fTemp (device, requestStatus, requestStatus2, _v2devices[device].temp, delta, params);

        case DEVICETYPEV2_LIGHTTEMP:
            if (_v2devices[device].fLightTemp == NULL) return -1;
            delta = _getDelta(_getValue(params, ',', 1), _v2devices[device].lightTemp);
            _v2devices[device].lightTemp += delta;
            return _v2devices[device].fLightTemp (device, _stoi(params), params);

        default:
            return 0;
    }
}

int EchoPhotonBridge::callEchoFunctionV3(String value)
{
    int device = _stoi(_getValue(value, ':', 0));
    int function = _stoi(_getValue(value, ':', 1));
    String params = _getValue(value, ':', 2);

    int delta = 0;
    bool on = false;
    bool muted = false;
    String data = "";
    int iValue = 0;

    //Check if the device number is within range..
    if (device < 0 or device > _echoDeviceCountV3) {
        return -2;
    }

    switch (function)
    {
        case DEVICETYPEV3_ONOFF:
            if (_v3devices[device].fOnOff == NULL) return -1;
            on = (_stoi(params) > 0);
            return _v3devices[device].fOnOff (device, on, params);

        case DEVICETYPEV3_VOLUMEPERCENT:
            if (_v3devices[device].fVolumePercent == NULL) return -1;
            muted = (_stoi(_getValue(params,',', 0))) == 1;
            delta = _getDelta(_getValue(params,',',1), _v3devices[device].volumePercent);
            _v3devices[device].volumePercent += delta;
            if (_v3devices[device].volumePercent > 100) _v3devices[device].volumePercent = 100;
            if (_v3devices[device].volumePercent < 0) _v3devices[device].volumePercent = 0;
            _v3devices[device].isMuted = muted;
            return _v3devices[device].fVolumePercent (device, muted, _v3devices[device].volumePercent, delta, params);

        case DEVICETYPEV3_VOLUMESTEP:
            if (_v3devices[device].fVolumeStep == NULL) return -1;
            muted = (_stoi(_getValue(params,',', 0))) == 1;
            delta = _getDelta(_getValue(params,',',1), _v3devices[device].volumeStep);
            _v3devices[device].volumeStep += delta;
            _v3devices[device].isMuted = muted;
            return _v3devices[device].fVolumeStep (device, muted, _v3devices[device].volumeStep, delta, params);

        case DEVICETYPEV3_CHANNEL:
            if (_v3devices[device].fChannel == NULL) return -1;
            delta = _getDelta(_getValue(params,',', 0), _v3devices[device].currentChannel);
            data = _getValue(params,',', 1);
            if (data.length() > 0) iValue = _getIndex(data, _v3devices[device].channels, ',');
            if (iValue > 0)
            {
                _v3devices[device].currentChannel = iValue;
                delta = 0;
            }
            return _v3devices[device].fChannel (device, _v3devices[device].currentChannel, delta, data, params);

        case DEVICETYPEV3_MEDIACONTROL:
            if (_v3devices[device].fMediaControl == NULL) return -1;
            return _v3devices[device].fMediaControl (device, params);

        case DEVICETYPEV3_INPUTCONTROL:
            if (_v3devices[device].fInputControl == NULL) return -1;
            delta = _getDelta(_getValue(params,',', 0), _v3devices[device].currentInput);
            data = _getValue(params,',', 1);
            if (data.length() > 0) iValue = _getIndex(data, _v3devices[device].inputs, ',');
            if (iValue > 0)
            {
                _v3devices[device].currentInput = iValue;
                delta = 0;
            }
            return _v3devices[device].fInputControl (device, _v3devices[device].currentInput, delta, data, params);

        default:
            return 0;
    }
}

void EchoPhotonBridge::addEchoDeviceV2(String deviceName,
                    functionOnOff fOnOff,
                    functionPercent fPercent,
                    functionColor fColor,
                    functionLock fLock,
                    functionTemp fTemp,
                    functionLightTemp fLightTemp)
{
    //Check if we have enough devices available to use.
    if (_echoDeviceCountV2 > MAX_ECHO_DEVICESV2) return;
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;

    //Now store functions and device identifier
    if (fOnOff != NULL) _addEchoDeviceV2OnOff(deviceIndex, fOnOff);
    if (fPercent != NULL) _addEchoDeviceV2Percent(deviceIndex, fPercent);
    if (fColor != NULL) _addEchoDeviceV2Color(deviceIndex, fColor);
    if (fLock != NULL) _addEchoDeviceV2Lock(deviceIndex, fLock);
    if (fTemp != NULL) _addEchoDeviceV2Temp(deviceIndex, fTemp);
    if (fLightTemp != NULL) _addEchoDeviceV2LightTemp(deviceIndex, fLightTemp);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV2OnOff(String deviceName, functionOnOff fOnOff)
{
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV2OnOff(deviceIndex, fOnOff);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV2Percent(String deviceName, functionPercent fPercent)
{
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV2Percent(deviceIndex, fPercent);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV2Color(String deviceName, functionColor fColor)
{
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV2Color(deviceIndex, fColor);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV2Lock(String deviceName, functionLock fLock)
{
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV2Lock(deviceIndex, fLock);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV2Temp(String deviceName, functionTemp fTemp)
{
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV2Temp(deviceIndex, fTemp);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV2LightTemp(String deviceName, functionLightTemp fLightTemp)
{
    int deviceIndex = _getDeviceIndexV2(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV2LightTemp(deviceIndex, fLightTemp);
    _updateDeviceConfigs();
}

EchoPhotonBridge::colorInRGB EchoPhotonBridge::getLightColor(int deviceIndex) {
    return _v2devices[deviceIndex].rgb;
}

void EchoPhotonBridge::addEchoDeviceV3(String deviceName,
                    functionOnOff fOnOff,
                    functionVolumePercent fVolumePercent,
                    functionVolumeStep fVolumeStep,
                    functionChannel fChannel,
                    String commaSeperatedChannelList,
                    functionMediaControl fMediaControl,
                    functionInputControl fInputControl,
                    String commaSeperatedInputList)
{
     //Check if we have enough devices available to use.
    if (_echoDeviceCountV3 > MAX_ECHO_DEVICESV3) return;
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;

    //Now store functions and device identifier
    if (fOnOff != NULL) _addEchoDeviceV3OnOff(deviceIndex, fOnOff);
    if (fVolumePercent != NULL) _addEchoDeviceV3VolumePercent(deviceIndex, fVolumePercent);
    if (fVolumeStep != NULL) _addEchoDeviceV3VolumeStep(deviceIndex, fVolumeStep);
    if (fChannel != NULL) _addEchoDeviceV3Channel(deviceIndex, commaSeperatedChannelList, fChannel);
    if (fMediaControl != NULL) _addEchoDeviceV3MediaControl(deviceIndex, fMediaControl);
    if (fInputControl != NULL) _addEchoDeviceV3InputControl(deviceIndex, commaSeperatedInputList, fInputControl);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV3OnOff(String deviceName, functionOnOff fOnOff)
{
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV3OnOff(deviceIndex, fOnOff);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV3VolumePercent(String deviceName, functionVolumePercent fVolumePercent)
{
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV3VolumePercent(deviceIndex, fVolumePercent);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV3VolumeStep(String deviceName, functionVolumeStep fVolumeStep)
{
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV3VolumeStep(deviceIndex, fVolumeStep);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV3Channel(String deviceName, String commaSeperatedChannelList, functionChannel fChannel)
{
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV3Channel(deviceIndex, commaSeperatedChannelList, fChannel);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV3MediaControl(String deviceName, functionMediaControl fMediaControl)
{
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV3MediaControl(deviceIndex, fMediaControl);
    _updateDeviceConfigs();
}

void EchoPhotonBridge::addEchoDeviceV3InputControl(String deviceName, String commaSeperatedInputList, functionInputControl fInputControl)
{
    int deviceIndex = _getDeviceIndexV3(deviceName);
    if (deviceIndex == -1) return;
    _addEchoDeviceV3InputControl(deviceIndex, commaSeperatedInputList, fInputControl);
    _updateDeviceConfigs();
}

EchoPhotonBridge::colorInRGB EchoPhotonBridge::kelvinToRGB(int tempInKelvin) {
    EchoPhotonBridge::colorInRGB answer;

    //Algorithm from http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/

    int temp = tempInKelvin / 100;

    if (temp <= 66) {
        answer.red = 255;
        answer.blue = 255;
        answer.green = 99.4708025861 * log(answer.green) - 161.1195681661;
    }
    else
    {
        answer.red = 329.698727446 * pow((temp - 60),-0.1332047592);
        answer.blue = 138.5177312231 * log(temp - 60) - 305.0447927307;
        answer.green = 288.1221695283 * pow((temp - 60),-0.0755148492);
    }

    answer.red = (answer.red < 0) ? 0 : answer.red;
    answer.red = (answer.red > 255) ? 255 : answer.red;

    answer.blue = (answer.blue < 0) ? 0 : answer.blue;
    answer.blue = (answer.blue > 255) ? 255 : answer.blue;

    answer.green = (answer.green < 0) ? 0 : answer.green;
    answer.green = (answer.green > 255) ? 255 : answer.green;

    return answer;
}

//private:

void EchoPhotonBridge::_addEchoDeviceV2OnOff(int deviceIndex, functionOnOff fOnOff)
{
    _v2devices[deviceIndex].fOnOff = fOnOff;
    _v2devices[deviceIndex].type = _setBit(_v2devices[deviceIndex].type,DEVICETYPEV2_ONOFF);
}

void EchoPhotonBridge::_addEchoDeviceV2Percent(int deviceIndex, functionPercent fPercent)
{
    _v2devices[deviceIndex].fPercent = fPercent;
    _v2devices[deviceIndex].type = _setBit(_v2devices[deviceIndex].type,DEVICETYPEV2_PERCENT);
}

void EchoPhotonBridge::_addEchoDeviceV2Color(int deviceIndex, functionColor fColor)
{
    _v2devices[deviceIndex].fColor = fColor;
    _v2devices[deviceIndex].type = _setBit(_v2devices[deviceIndex].type,DEVICETYPEV2_COLOR);
}

void EchoPhotonBridge::_addEchoDeviceV2Lock(int deviceIndex, functionLock fLock)
{
    _v2devices[deviceIndex].fLock = fLock;
    _v2devices[deviceIndex].type = _setBit(_v2devices[deviceIndex].type,DEVICETYPEV2_LOCK);
}

void EchoPhotonBridge::_addEchoDeviceV2Temp(int deviceIndex, functionTemp fTemp)
{
    _v2devices[deviceIndex].fTemp = fTemp;
    _v2devices[deviceIndex].type = _setBit(_v2devices[deviceIndex].type,DEVICETYPEV2_TEMP);
}

void EchoPhotonBridge::_addEchoDeviceV2LightTemp(int deviceIndex, functionLightTemp fLightTemp)
{
    _v2devices[deviceIndex].fLightTemp = fLightTemp;
    _v2devices[deviceIndex].type = _setBit(_v2devices[deviceIndex].type,DEVICETYPEV2_LIGHTTEMP);
}

void EchoPhotonBridge::_addEchoDeviceV3OnOff(int deviceIndex, functionOnOff fOnOff)
{
    _v3devices[deviceIndex].fOnOff = fOnOff;
    _v3devices[deviceIndex].type = _setBit(_v3devices[deviceIndex].type,DEVICETYPEV3_ONOFF);
}

void EchoPhotonBridge::_addEchoDeviceV3VolumePercent(int deviceIndex, functionVolumePercent fVolumePercent)
{
    _v3devices[deviceIndex].fVolumePercent = fVolumePercent;
   _v3devices[deviceIndex].type = _setBit(_v3devices[deviceIndex].type,DEVICETYPEV3_VOLUMEPERCENT);
}

void EchoPhotonBridge::_addEchoDeviceV3VolumeStep(int deviceIndex, functionVolumeStep fVolumeStep)
{
    _v3devices[deviceIndex].fVolumeStep = fVolumeStep;
    _v3devices[deviceIndex].type = _setBit(_v3devices[deviceIndex].type,DEVICETYPEV3_VOLUMESTEP);
}

void EchoPhotonBridge::_addEchoDeviceV3Channel(int deviceIndex, String commaSeperatedChannelList, functionChannel fChannel)
{
    _v3devices[deviceIndex].fChannel = fChannel;
    _v3devices[deviceIndex].type = _setBit(_v3devices[deviceIndex].type,DEVICETYPEV3_CHANNEL);
    //Turn the channel list into a json list.
    _v3devices[deviceIndex].channels = "\"" + commaSeperatedChannelList.replace(",","\",\"") + "\"";
}

void EchoPhotonBridge::_addEchoDeviceV3MediaControl(int deviceIndex, functionMediaControl fMediaControl)
{
    _v3devices[deviceIndex].fMediaControl = fMediaControl;
    _v3devices[deviceIndex].type = _setBit(_v3devices[deviceIndex].type,DEVICETYPEV3_MEDIACONTROL);
}

void EchoPhotonBridge::_addEchoDeviceV3InputControl(int deviceIndex, String commaSeperatedInputList, functionInputControl fInputControl)
{
    _v3devices[deviceIndex].fInputControl = fInputControl;
    _v3devices[deviceIndex].type = _setBit(_v3devices[deviceIndex].type,DEVICETYPEV3_INPUTCONTROL);
    //Turn the Input list into a json list.
    _v3devices[deviceIndex].inputs = "\"" + commaSeperatedInputList.replace(",","\",\"") + "\"";
}

/***************************************************************************************
 *
 *   Helper Functions
 *
 * *************************************************************************************/

int EchoPhotonBridge::_getDeviceIndexV2(String deviceName)
{
    int i = 0;
    for(; i < _echoDeviceCountV2; i++)
    {
        if (deviceName.toUpperCase() == _v2devices[i].name.toUpperCase())
        {
            return i;
        }
    }
    i = _echoDeviceCountV2;
    _echoDeviceCountV2++;
    _v2devices[i].name = deviceName;
    if (i > MAX_ECHO_DEVICESV2) {
        return -1;
    }
    return i;
}

int EchoPhotonBridge::_getDeviceIndexV3(String deviceName)
{
     int i = 0;
    for(; i < _echoDeviceCountV3; i++)
    {
        if (deviceName.toUpperCase() == _v3devices[i].name.toUpperCase())
        {
            return i;
        }
    }
    i = _echoDeviceCountV3;
    _echoDeviceCountV3++;
    _v3devices[i].name = deviceName;
    if (i > MAX_ECHO_DEVICESV3) {
        return -1;
    }
    return i;
}

int EchoPhotonBridge::_stoi(String number)
{
    char inputStr[64];
    number.toCharArray(inputStr,64);
    return atoi(inputStr);
}

int EchoPhotonBridge::_getDelta(String params, int currentValue)
{
    int delta = 0;
    if (params.substring(0,1).toUpperCase() == "U") {
        params = params.substring(1,params.length());
        delta = _stoi(params);
    } else if (params.substring(0,1).toUpperCase() == "D") {
        params = params.substring(1,params.length());
        delta = -1 * _stoi(params);
    } else {
        delta = _stoi(params) - currentValue;
    }
    return delta;
}

String EchoPhotonBridge::_getValue(String data, char separator, int index)
{
    int found = 0;
    int strIndex[] = { 0, -1 };
    int maxIndex = data.length() - 1;

    for (int i = 0; i <= maxIndex && found <= index; i++) {
        if (data.charAt(i) == separator || i == maxIndex) {
            found++;
            strIndex[0] = strIndex[1] + 1;
            strIndex[1] = (i == maxIndex) ? i+1 : i;
        }
    }
    return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}

int EchoPhotonBridge::_getIndex(String data, String csvData, char separator)
{
    int index = 0;
    int strIndex[] = { 0, -1 };
    int maxIndex = csvData.length() - 1;

    for (int i = 0; i <= maxIndex; i++) {
        if (csvData.charAt(i) == separator || i == maxIndex) {
            strIndex[0] = strIndex[1] + 1;
            strIndex[1] = (i == maxIndex) ? i+1 : i;
            if (csvData.substring(strIndex[0], strIndex[1]).toUpperCase() == data.toUpperCase()) return index;
            index++;
        }
    }
    return -1;
}

int EchoPhotonBridge::_setBit(int input, int bitIndex)
{
    input ^= (-1 ^ input) & (1 << bitIndex);
    return input;
}

int EchoPhotonBridge::_clearBit(int input, int bitIndex)
{
    input ^= (0 ^ input) & (1 << bitIndex);
    return input;
}

void EchoPhotonBridge::_updateDeviceConfigs()
{
    echoDeviceConfigsV2 = "{\"Version\":2,\"Devices\":["; //denotes configuration type 01
    for(int i = 0; i < _echoDeviceCountV2; i++)
    {
        echoDeviceConfigsV2 += "{\"name\":\"" + _v2devices[i].name + "\",\"type\":" + _v2devices[i].type + "}";
        if ( i + 1 < _echoDeviceCountV2) echoDeviceConfigsV2 += ",";
    }
    echoDeviceConfigsV2 += "]}";

    echoDeviceConfigsV3 = "{\"Version\":3,\"Devices\":["; //denotes configuration type 01
    for(int i = 0; i < _echoDeviceCountV3; i++)
    {
        echoDeviceConfigsV3 += "{\"name\":\"" + _v3devices[i].name + "\",\"type\":" + _v3devices[i].name + "}";
        if (i + 1 < _echoDeviceCountV3) echoDeviceConfigsV3 += ",";
    }
    echoDeviceConfigsV3 += "]}";
}


text:
package com.android.test.hwui;

import android.app.Activity;
import android.os.Bundle;

@SuppressWarnings({"UnusedDeclaration"})
public class LabelsActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.labels);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

$lang['login.label_button'] = "Se connecter";
$lang['login.bad_credentials'] = 'Votre identifiant ou votre mot de passe est incorrect.';

$lang['utils.there_was_an_error'] = "Il y a eu une erreur :'(";
$lang['utils.all_is_good'] = "C'est fait :)";


text:
.gba
.create "output.bin",0

.relativeinclude off

.include "a.asm"
.include "sub/a.asm"

.relativeinclude on
.include "a.asm"
.include "sub/a.asm"

.include "sub/sub.asm"

.include "█.asm"

.close


text:
<?php
	class Admin extends CoreApp\ViewController {
		public function __construct() {
			CoreApp\Session::init();
			parent::__construct(__CLASS__);
			$_GET["main"] = true;
			include_once("App/_controllers/RequestControllers/Auth.php");
			$auth_obj = new Auth();
			if(!isset($_SESSION["logged"]) || !$auth_obj->cULI())
			 	header("Location: /Login");
      $model = $this->loadModel(__CLASS__);
			$contents = $model->getData();
			$this->v->projects = isset($contents["project"]) ? $contents["project"] : [];
			$this->v->courses = isset($contents["course"]) ? $contents["course"] : [];
		}
	}


text:
package edu.utah.ece.async.ibiosim.synthesis.SBMLTechMap;

import java.net.URI;

/**
 *
 *
 * @author Nicholas Roehner
 * @author Chris Myers
 * @author  iBioSim Contributors
 * @version %I%
 */
public class ChEBI {

	private ChEBI() {

	}

	/**
	 * Creates a new URI from the Chemical Entities of Biological Interest (CheBI)
	 * namespace with the given local name. For example, the function call
	 * <value>term("CHEBI_16991")</value> will return the
	 * URI <value>http://purl.obolibrary.org/obo/CHEBI_16991</value>
	 */
	public static final URI type(String localName) {
		return NAMESPACE.resolve(localName);
	}

	/**
	 * Namespace of ChEBI
	 * (http://purl.obolibrary.org/obo/).
	 */
	public static final URI NAMESPACE = URI.create("http://purl.obolibrary.org/obo/");

	/**
	 * 	High molecular weight, linear polymers, composed of nucleotides containing
	 *  deoxyribose and linked by phosphodiester bonds; DNA contain the genetic
	 *  information of organisms.
	 * (CHEBI_16991).
	 */
	public static final URI DNA = type("CHEBI_16991");

	/**
	 * A biological macromolecule minimally consisting of one polypeptide chain
	 * synthesized at the ribosome.
	 * (CHEBI_36080).
	 */
	public static final URI PROTEIN = type("CHEBI_36080");

	/**
	 * Systems consisting of two or more molecular entities held together by
	 * non-covalent interactions.
	 * (CHEBI_50967).
	 */
	public static final URI NON_COVALENTLY_BOUND_MOLECULAR_ENTITY = type("CHEBI_50967");

	/**
	 * A small molecule which increases (activator) or decreases (inhibitor) the
	 * activity of an (allosteric) enzyme by binding to the enzyme at the regulatory
	 * site (which is different from the substrate-binding catalytic site).
	 * (CHEBI_35224).
	 */
	public static final URI EFFECTOR = type("CHEBI_35224");

}


text:
package org.kohsuke.stapler.bind;

import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

/**
 * Indicates that the method is exposed to client-side JavaScript proxies
 * and is callable as a method from them.
 *
 *

 * This annotation is assumed to be implicit on every public methods
 * that start with 'js', like 'jsFoo' or 'jsBar', but you can use this annotation
 * on those methods to assign different names.
 *
 * @author Kohsuke Kawaguchi
 */
@Retention(RUNTIME)
@Target(METHOD)
@Documented
public @interface JavaScriptMethod {
    /**
     * JavaScript method name assigned to this method.
     *
     *

     * If unspecified, defaults to the method name.
     */
    String[] name() default {};
}


text:
module("Manipulation");

var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); };

test("Dom.prototype.getText", function() {

	var expected = "This link has class=\"blog\": Simon Willison's Weblog";
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, "").replace("hasclass", "has class"), expected, "Check for merged text of more then one element." );

	// Check serialization of text values
	equal( new Dom(document.createTextNode("foo")).getText(), "foo", "Text node was retreived from .getText()." );

	var val = "
Hello cruel world!
";
	equal( Dom.get("foo").setText(val).node.innerHTML.replace(/>/g, ">"), "<div><b>Hello</b> cruel world!</div>", "Check escaped text" );

	document.getElementById("text1").value = "bla";
	equal( Dom.get("text1").getText(), "bla", "Check for modified value of input element" );

	QUnit.reset();

	equal( Dom.get("text1").getText(), "Test", "Check for value of input element" );
	// ticket #1714 this caused a JS error in IE
	equal( Dom.get("first").getText(), "Try them out:", "Check a paragraph element to see if it has a value" );

	equal( Dom.get("select2").getText(), "3", "Call getText() on a single=\"single\" select" );

	//deepEqual( Dom.get("select3").getText(), "1,2", "Call getText() on a multiple=\"multiple\" select" );

	equal( Dom.get("option3c").getText(), "2", "Call getText() on a option element with value" );

	//equal( Dom.get("option3a").getText(), "Nothing", "Call getText() on a option element with empty value" );

	equal( Dom.get("option3e").getText(), "no value", "Call getText() on a option element with no value attribute" );

	//equal( Dom.get("option3a").getText(), "Nothing", "Call getText() on a option element with no value attribute" );

	// IE6 fails in this case. Just ignore it.
	if(!navigator.isIE6){
		Dom.get("select3").setText("");
		deepEqual( Dom.get("select3").getText(), "", "Call getText() on a multiple=\"multiple\" select" );
	}
	//deepEqual( Dom.get("select4").getText(), "1,2,3", "Call getText() on multiple=\"multiple\" select with all disabled options" );

	Dom.get("select4").setAttr("disabled", true);
	//deepEqual( Dom.get("select4").getText(), "1,2,3", "Call getText() on disabled multiple=\"multiple\" select" );

	equal( Dom.get("select5").getText(), "3", "Check value on ambiguous select." );

	Dom.get("select5").setText(1);
	equal( Dom.get("select5").getText(), "1", "Check value on ambiguous select." );

	Dom.get("select5").setText(3);
	equal( Dom.get("select5").getText(), "3", "Check value on ambiguous select." );

	// var checks = Dom.parse("<input type='checkbox' name='test' value='1'/><input type='checkbox' name='test' value='2'/><input type='checkbox' name='test' value=''/><input type='checkbox' name='test'/>").appendTo("#form");
//
	// deepEqual( checks.getText(), "", "Get unchecked values." );
//
	// equal( checks.eq(3).getText(), "on", "Make sure a value of 'on' is provided if none is specified." );
//
	// checks.setText("2");
	// deepEqual( checks.serialize(), "test=2", "Get a single checked value." );
//
	// checks.setText(",1");
	// deepEqual( checks.serialize(), "test=1&test=", "Get multiple checked values." );
//
	// checks.setText(",2");
	// deepEqual( checks.serialize(), "test=2&test=", "Get multiple checked values." );
//
	// checks.setText("1,on");
	// deepEqual( checks.serialize(), "test=1&test=on", "Get multiple checked values." );

	//   checks.remove();

	var button = Dom.get("button").after("<button value='foobar'>text</button>");
	equal( button.getText(), "text", "Value retrieval on a button does not return innerHTML" );
	equal( button.setText("baz").getHtml(), "baz", "Setting the value does not change innerHTML" );

	//   equal( Dom.parse("<option/>").setText("test").getAttr("value"), "test", "Setting value sets the value attribute" );
});

/*

test("Dom.prototype.wrap", function() {
	var defaultText = "Try them out:"
	var result = Dom.get("first").wrap( "

").getText();
	equal( defaultText, result, "Check for wrapping of on-the-fly html" );
	ok( Dom.get("first").get('parent').get('parent').hasClass("red"), "Check if wrapper has class 'red'" );

	QUnit.reset();
	var defaultText = "Try them out:";
	Dom.get("first").wrap(document.getElementById("empty"));
	var result = Dom.get("first").get('parent');
	equal( result.tagName, "OL", "Check for element wrapping" );
	equal( result.getText(), defaultText, "Check for element wrapping" );

	QUnit.reset();
	Dom.get("check1").on('click', function() {
		var checkbox = this;
		ok( checkbox.checked, "Checkbox's state is erased after wrap() action" );
		Dom.get(checkbox).wrap( "

");
		ok( checkbox.checked, "Checkbox's state is erased after wrap() action" );
	}).trigger('click')     ;

	var j = Dom.parse("");
	j.wrap( "
");
	equal( j.nodeName.toUpperCase(), "LABEL", "Element is a label" );
	equal( j.parentNode.nodeName.toUpperCase(), "LI", "Element has been wrapped" );

	// wrap an element containing a text node
	j = Dom.parse("");
	j.wrap("
test
");
	equal( j.previousSibling.nodeType, 3, "Make sure the previous node is a text element" );
	equal( j.parentNode.nodeName.toUpperCase(), "DIV", "And that we're in the div element." );

	// Try to wrap an element with multiple elements (should fail)
	//j = Dom.parse("

").children();
	//j.wrap("

");
	//equal( j[0].parentNode.parentNode.childNodes.length, 1, "There should only be one element wrapping." );
	//equal( j[0].parentNode.nodeName.toUpperCase(), "P", "The span should be in the paragraph." );

	j = Dom.parse("");
	j.wrap("

");

	equal( j.parentNode.nodeName.toLowerCase(), "div", "Wrapping works." );

	// wrap an element with a Dom.parse set and event
	result = Dom.parse("

").on('click', function(){
		ok(true, "Event triggered.");

		// Remove handlers on detached elements
		this.un();
	});

	j = Dom.parse("");
	j.wrap(result);
	equal( j.parentNode.nodeName.toLowerCase(), "div", "Wrapping works." );

	j.get('parent').trigger("click");

	// clean up attached elements
	QUnit.reset();
});

test("wrapAll(String|Element)", function() {
	expect(8);
	var prev = Dom.get("firstp")[0].previousSibling;
	var p = Dom.get("firstp,#first")[0].parentNode;

	var result = Dom.get("firstp,#first").wrapAll( "

" );
	equal( result.get('parent').length, 1, "Check for wrapping of on-the-fly html" );
	ok( Dom.get("first").get('parent').get('parent').is(".red"), "Check if wrapper has class 'red'" );
	ok( Dom.get("firstp").get('parent').get('parent').is(".red"), "Check if wrapper has class 'red'" );
	equal( Dom.get("first").get('parent').get('parent')[0].previousSibling, prev, "Correct Previous Sibling" );
	equal( Dom.get("first").get('parent').get('parent')[0].parentNode, p, "Correct Parent" );

	QUnit.reset();
	var prev = Dom.get("firstp")[0].previousSibling;
	var p = Dom.get("first")[0].parentNode;
	var result = Dom.get("firstp,#first").wrapAll( document.getElementById("empty") );
	equal( Dom.get("first").get('parent')[0], Dom.get("firstp").get('parent')[0], "Same Parent" );
	equal( Dom.get("first").get('parent')[0].previousSibling, prev, "Correct Previous Sibling" );
	equal( Dom.get("first").get('parent')[0].parentNode, p, "Correct Parent" );
});

test("wrapInner(String|Element)", function() {
	expect(11);
	var num = Dom.get("first").children().length;
	var result = Dom.get("first").wrapInner(val("

"));
	equal( Dom.get("first").children().length, 1, "Only one child" );
	ok( Dom.get("first").children().is(".red"), "Verify Right Element" );
	equal( Dom.get("first").children().children().children().length, num, "Verify Elements Intact" );

	QUnit.reset();
	var num = Dom.get("first").setHtml("foo
test

test2
").children().length;
	var result = Dom.get("first").wrapInner(val("

"));
	equal( Dom.get("first").children().length, 1, "Only one child" );
	ok( Dom.get("first").children().is(".red"), "Verify Right Element" );
	equal( Dom.get("first").children().children().children().length, num, "Verify Elements Intact" );

	QUnit.reset();
	var num = Dom.get("first").children().length;
	var result = Dom.get("first").wrapInner(val(document.getElementById("empty")));
	equal( Dom.get("first").children().length, 1, "Only one child" );
	ok( Dom.get("first").children().is("#empty"), "Verify Right Element" );
	equal( Dom.get("first").children().children().length, num, "Verify Elements Intact" );

	var div = Dom.parse("
");
	div.wrapInner(val(""));
	equal(div.children().length, 1, "The contents were wrapped.");
	equal(div.children()[0].nodeName.toLowerCase(), "span", "A span was inserted.");
});

test("unwrap()", function() {
	expect(9);

	Dom.parse("body").append("

 a b

 c d

 e f

");

	var abcd = Dom.get("unwrap1 > span, #unwrap2 > span").get(),
		abcdef = Dom.get("unwrap span").get();

	equal( Dom.get("unwrap1 span").add("#unwrap2 span:first").unwrap().length, 3, "make #unwrap1 and #unwrap2 go away" );
	deepEqual( Dom.get("unwrap > span").get(), abcd, "all four spans should still exist" );

	deepEqual( Dom.get("unwrap3 span").unwrap().get(), Dom.get("unwrap3 > span").get(), "make all b in #unwrap3 go away" );

	deepEqual( Dom.get("unwrap3 span").unwrap().get(), Dom.get("unwrap > span.unwrap3").get(), "make #unwrap3 go away" );

	deepEqual( Dom.get("unwrap").children().get(), abcdef, "#unwrap only contains 6 child spans" );

	deepEqual( Dom.get("unwrap > span").unwrap().get(), Dom.parse("body > span.unwrap").get(), "make the 6 spans become children of body" );

	deepEqual( Dom.parse("body > span.unwrap").unwrap().get(), Dom.parse("body > span.unwrap").get(), "can't unwrap children of body" );
	deepEqual( Dom.parse("body > span.unwrap").unwrap().get(), abcdef, "can't unwrap children of body" );

	deepEqual( Dom.parse("body > span.unwrap").get(), abcdef, "body contains 6 .unwrap child spans" );

	Dom.parse("body > span.unwrap").remove();
});

*/

test("Dom.prototype.append", function() {
	var defaultText = "Try them out:"
	equal( Dom.get("first").getText(), defaultText, "Check defaultText" );
	var result = Dom.get("first");
	result.append("buga");
	equal( result.getText(), defaultText + "buga", "Check if text appending works" );
	equal( Dom.get("select3").append("<option value='appendTest'>Append Test</option>").getAttr("value"), "appendTest", "Appending html options to select element");

	QUnit.reset();
	var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
	Dom.get("sap").append(document.getElementById("first"));
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, '').replace("hasclass", "has class"), expected, "Check for appending of element" );

	// QUnit.reset();
	// Dom.get("sap").append( 5 );
	// ok( Dom.get("sap").node.innerHTML.match( /5$/ ), "Check for appending a number" );

	QUnit.reset();
	Dom.get("sap").append(  " text with spaces " );
	ok( Dom.get("sap").node.innerHTML.match(/ text with spaces $/), "Check for appending text with spaces" );

	QUnit.reset();
	ok( Dom.get("sap").append("" ), "Check for appending an empty string." );
	//  ok( Dom.get("sap").append( document.getElementsByTagName("foo") ), "Check for appending an empty nodelist." );

	QUnit.reset();
	var form =  document.query("form");
	form.append("<input name='radiotest' type='radio' checked='checked' />");

	form.query("input[name=radiotest]").each(function(node){
		ok( node.checked, "Append checked radio");
	});
	form.remove();

	QUnit.reset();
	var form =  document.query("form");
	form.append("<input name='radiotest' type='radio' checked    =   'checked' />");
	form.query("input[name=radiotest]").each(function(node){
		ok( node.checked, "Append alternately formated checked radio");
	});

	form.remove();

	QUnit.reset();
	var form =  document.query("form");
	form.append("<input name='radiotest' type='radio' checked />");
	form.query("input[name=radiotest]").each(function(node){
		ok( node.checked, "Append HTML5-formated checked radio");
	});

	form.remove();

	QUnit.reset();
	Dom.get("sap").append( document.getElementById("form") );
	equal( !Dom.get("sap").find('form'), false, "Check for appending a form" ); // Bug #910

	QUnit.reset();
	var pass = true;
	try {
		var body = Dom.get("iframe").node.contentWindow.document.body;

		if(body !== null) {
			pass = false;
			new Dom( body ).append( "
test
"   );
		}

		pass = true;
	} catch(e) {}

	ok( pass, "Test for appending a DOM node to the contents of an IFrame" );

	QUnit.reset();
	Dom.get("select1").append( "<OPTION>Test</OPTION>" );
	equal( Dom.get("select1").last('option').getText(), "Test", "Appending <OPTION> (all caps)" );

	var colgroup = Dom.get("table").append( "<colgroup></colgroup>" );
	//     colgroup = new Dom(colgroup.childNodes[0] || colgroup);
	// equal( Dom.get("table").get("last").tagName.toLowerCase(), "colgroup", "Append colgroup" );

	colgroup.append ( "<col/>" );
	equal( colgroup.last().node.tagName, "COL", "Append col" );

	// QUnit.reset();
	// Dom.get("table").append( "

" );
	// equal( Dom.get("table").get("first").tagName.toLowerCase(), "caption", "Append caption" );

	//  QUnit.reset();
	// var Dom.getinput = Dom.parse("<input />").set({ "type": "checkbox", "checked": true }).appendTo('testForm');
	//  equal( Dom.getinput.checked, true, "A checked checkbox that is appended stays checked" );

	QUnit.reset();
	var radio = document.find("input[type='radio'][name='R1']"),
		radioNot = Dom.parse("<input type='radio' name='R1' checked='checked'/>").appendTo(radio.parent()).after(radio);
	radio.trigger('click');
	radioNot.checked = false;

	radio.parent().replaceWith("

").append(radio);
	//   equal( Dom.getradio.checked, true, "Reappending radios uphold which radio is checked" );
	equal( radioNot.checked, false, "Reappending radios uphold not being checked" );

	radioNot.remove();
	QUnit.reset();

	var prev = Dom.get("sap").children().length;

	Dom.get("sap").append(
		"" +
		"" +
		""
	);

	equal( Dom.get("sap").children().length, prev + 3, "Make sure that multiple arguments works." );
	QUnit.reset();
});

/*

test("append the same fragment with events (Bug #6997, 5566)", function () {
	var doExtra = !Dom.parse.support.noCloneEvent && document.fireEvent;
	expect(2 + (doExtra ? 1 : 0));
	stop(1000);

	var element;

	// This patch modified the way that cloning occurs in IE; we need to make sure that
	// native event handlers on the original object don't get disturbed when they are
	// modified on the clone
	if ( doExtra ) {
		element = Dom.parse("div:first").on('click' ,function () {
			ok(true, "Event exists on original after being unbound on clone");
			Dom.parse(this).unbind("click");
		});
		var clone = element.clone(true).unbind("click");
		clone[0].fireEvent("onclick");
		element[0].fireEvent("onclick");

		// manually clean up detached elements
		clone.remove();
	}

	element = Dom.parse("").on('click' ,function () {
		ok(true, "Append second element events work");
	});

	Dom.get("listWithTabIndex li").append(element)
		.find("a.test6997").eq(1).trigger('click');

	element = Dom.parse("

").on('click' ,function () {
		ok(true, "Before second element events work");
		start();
	});

	Dom.get("listWithTabIndex li").before(element);
	Dom.get("listWithTabIndex li.test6997").eq(1).trigger('click');
});

*/

/*

test("Dom.prototype.append(xml)", function() {
	expect( 1 );

	function createXMLDoc() {
		// Initialize DOM based upon latest installed MSXML or Netscape
		var elem,
			aActiveX =
				[ "MSXML6.nodeDocument",
				"MSXML3.nodeDocument",
				"MSXML2.nodeDocument",
				"MSXML.nodeDocument",
				"Microsoft.XmlDom" ];

		if ( document.implementation && "createDocument" in document.implementation ) {
			return document.implementation.createDocument( "", "", null );
		} else {
			// IE
			for ( var n = 0, len = aActiveX.length; n < len; n++ ) {
				try {
					elem = new ActiveXObject( aActiveX[ n ] );
					return elem;
				} catch(_){};
			}
		}
	}

	var xmlDoc = createXMLDoc(),
		xml1 = xmlDoc.createElement("head"),
		xml2 = xmlDoc.createElement("test");

	ok( new Dom( xml1 ).append( xml2 ), "Append an xml element to another without raising an exception." );

});

*/

test("Dom.prototype.appendTo", function() {

	var defaultText = "Try them out:";
	Dom.parse("buga").appendTo("first");
	equal( Dom.get("first").getText(), defaultText + "buga", "Check if text appending works" );
	equal( Dom.parse("<option value='appendTest'>Append Test</option>").appendTo("select3").parent().last("option").getAttr("value"), "appendTest", "Appending html options to select element");

	QUnit.reset();
	var l = Dom.get("first").children().length + 2;
	new DomList([ Dom.parse("test"), Dom.parse("test") ])
		.appendTo("first");
	equal( Dom.get("first").children().length, 2, "Make sure the elements were inserted." );
	equal( Dom.get("first").children()[Dom.get("first").children().length - 1].nodeName.toLowerCase(), "strong", "Verify the last element." );

	QUnit.reset();
	var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
	Dom.get("first").appendTo("sap");
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, "").replace("hasclass", "has class"), expected, "Check for appending of element" );

	QUnit.reset();
	expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
	new DomList([document.getElementById("first"), document.getElementById("yahoo")]).appendTo("sap");
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, "").replace(/[\r\n]/g, "").replace("hasclass", "has class"), expected, "Check for appending of array of elements" );

	QUnit.reset();
	ok( Dom.create("script").appendTo(), "Make sure a disconnected script can be appended." );

	QUnit.reset();
	expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:";
	Dom.get("yahoo").appendTo("sap");
	Dom.get("first").appendTo("sap");
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, "").replace("hasclass", "has class"), expected, "Check for appending of Dom.parse object" );

	QUnit.reset();
	Dom.get("select1").appendTo("foo");

	QUnit.reset();
	var div = Dom.parse("
").on('click', function(){
		ok(true, "Running a cloned click.");
	});
	div.appendTo("moretests");

	Dom.get("qunit-fixture").query("div").item(-1).trigger('click');
	Dom.get("moretests").query("div").item(-1).trigger('click');

	QUnit.reset();
	var div = Dom.parse("
").appendTo("moretests");

	div.addClass("test");

	ok( Dom.get("moretests").last('div').hasClass("test"), "appendTo element was modified after the insertion" );

	QUnit.reset();

	div = Dom.parse("
");
	div.append(Dom.parse("ab"));

	equal( div.children().length, 2, "Make sure the right number of children were inserted." );

	div = Dom.get("moretests").query('div');

	var num = Dom.get("qunit-fixture").query('div').length;
	div.remove().appendTo("qunit-fixture");

	equal( Dom.get("qunit-fixture").query('div').length, num, "Make sure all the removed divs were inserted." );

	QUnit.reset();
});

test("Dom.prototype.prepend(html)", function() {
	var defaultText = "Try them out:"
	var result = Dom.get("first");
	result.prepend("buga");
	equal( result.getText(), "buga" + defaultText, "Check if text prepending works" );
	equal( Dom.get("select3").prepend("<option value='prependTest'>Prepend Test</option>" ).getAttr("value"), "prependTest", "Prepending html options to select element");

	QUnit.reset();
	var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
	Dom.get("sap").prepend(document.getElementById("first"));
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, "").replace("hasclass", "has class"), expected, "Check for prepending of element" );

	QUnit.reset();
	expected = "YahooThis link has class=\"blog\": Simon Willison's Weblog";
	Dom.get("sap").prepend(Dom.get("yahoo") );
	equal( Dom.get("sap").getText().replace(/[\r\n]/g, "").replace("hasclass", "has class"), expected, "Check for prepending of Dom.parse object" );
});

test("Dom.prototype.before(html)", function() {
	var expected = "This is a normal link: bugaYahoo";
	Dom.get("yahoo").before("buga");
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert String before" );

	QUnit.reset();
	expected = "This is a normal link: Try them out:Yahoo";
	Dom.get("yahoo").before(document.getElementById("first"));

	// !Safari
	equal( Dom.get("en").getText().replace(/[\r\n]/g, "").replace("link:T", "link: T"), expected, "Insert element before" );

	QUnit.reset();
	expected = "This is a normal link: diveintomarkYahoo";
	Dom.get("yahoo").before(Dom.get("mark"));
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert Dom.parse before" );

	// var set = Dom.parse("
").before("test");
	// equal( set.nodeName.toLowerCase(), "span", "Insert the element before the disconnected node." );
});

test("Dom.prototype.after(html)", function() {
	var expected = "This is a normal link: Yahoobuga";
	Dom.get("yahoo").after("buga" );
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert String after" );

	QUnit.reset();
	expected = "This is a normal link: YahooTry them out:";
	Dom.get("yahoo").after(document.getElementById("first")  );
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert element after" );

	QUnit.reset();
	expected = "This is a normal link: Yahoodiveintomark";
	Dom.get("yahoo").after(Dom.get("mark"));
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert Dom.parse after" );

	// var set = Dom.parse("
").after("test");
	// equal( set.nodeName.toLowerCase(), "span", "Insert the element after the disconnected node." );
});

test("Dom.prototype.append(html)", function() {
	var expected = "This is a normal link: Yahoobuga";
	Dom.get("yahoo").append("buga" );
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert String after" );

	QUnit.reset();
	expected = "This is a normal link: YahooTry them out:";
	Dom.get("yahoo").append(document.getElementById("first")  );
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert element after" );

	QUnit.reset();
	expected = "This is a normal link: Yahoodiveintomark";
	Dom.get("yahoo").append(Dom.get("mark"));
	equal( Dom.get("en").getText().replace(/[\r\n]/g, ""), expected, "Insert Dom.parse after" );

	var set = Dom.parse("
").append(   "test");
	equal( set.node.nodeName.toLowerCase(), "span", "Insert the element after the disconnected node." );
});

test("Dom.prototype.replaceWith", function() {

	Dom.get("yahoo").replaceWith( "buga" );
	ok( Dom.get("replace"), "Replace element with string" );
	ok( !Dom.get("yahoo"), "Verify that original element is gone, after string" );

	QUnit.reset();
	Dom.get("yahoo").replaceWith( document.getElementById("first") );
	ok( Dom.get("first"), "Replace element with element" );
	ok( !Dom.get("yahoo"), "Verify that original element is gone, after element" );

	QUnit.reset();
	Dom.get("qunit-fixture").append("

");
	Dom.get("baz").replaceWith("Baz");
	equal( Dom.get("bar").getText().replace(/[\r\n]/g, ""),"Baz", "Replace element with text" );
	ok( !Dom.get("baz"), "Verify that original element is gone, after element" );

	QUnit.reset();
	Dom.get("yahoo").replaceWith( Dom.get("mark") );
	ok( Dom.get("first"), "Replace element with set of elements" );
	ok( Dom.get("mark"), "Replace element with set of elements" );
	ok( !Dom.get("yahoo"), "Verify that original element is gone, after set of elements" );

	QUnit.reset();
	var tmp = Dom.parse("
").appendTo().on('click', function(){ ok(true, "Newly bound click run." ); });
	var y = Dom.parse("
").appendTo().on('click',function(){ ok(true, "Previously bound click run." ); });
	var child = y.append("test").on('click',function(){ ok(true, "Child bound click run." ); return false; });

	y.replaceWith( tmp );

	tmp.trigger('click');
	y.trigger('click'); // Shouldn't be run
	//  child.trigger('click'); // Shouldn't be run

	tmp.remove();
	y.remove();
	//child.remove();

	QUnit.reset();

	y = Dom.parse("
").appendTo().on('click' ,function(){ ok(true, "Previously bound click run." ); });

	var child2 = y.append("test").on('click' ,function(){ ok(true, "Child 2 bound click run." ); return false; });

	y.replaceWith( child2 );

	child2.trigger('click');

	y.remove();
	child2.remove();

	QUnit.reset();

	var set = Dom.parse("
").replaceWith( "test" );
	equal( set.node.nodeName.toLowerCase(), "span", "Replace the disconnected node." );

	var div = Dom.parse("

").appendTo();
	// TODO: Work on Dom.parse(...) inline script execution
	//div.replaceWith("

");
	equal(document.query(".replacewith").length, 1, "Check number of elements in page.");
	document.query(".replacewith").remove();

	QUnit.reset();

	Dom.get("qunit-fixture").append("

");
	equal( Dom.get("qunit-fixture").query("div[id=replaceWith]").length, 1, "Make sure only one div exists." );

	Dom.get("replaceWith").replaceWith( "

" );
	equal( Dom.get("qunit-fixture").query("div[id=replaceWith]").length, 1, "Make sure only one div exists." );

	Dom.get("replaceWith").replaceWith(  "

" );
	equal( Dom.get("qunit-fixture").query("div[id=replaceWith]").length, 1, "Make sure only one div exists." );
});

test("Dom.prototype.replaceWith(string) for more than one element", function(){
	expect(3);

	equal(document.query("#foo p").length, 3, "ensuring that test data has not changed");

	document.query("#foo p").replaceWith("bar");
	equal(document.query("#foo span").length, 3, "verify that all the three original element have been replaced");
	equal(document.query("#foo p").length, 0, "verify that all the three original element have been replaced");
});

test("Dom.parse.clone() (#8017)", function() {

	var main = Dom.get("qunit-fixture"),
			clone = main.clone();

	equal( main.node.childNodes.length, clone.node.childNodes.length, "Simple child length to ensure a large dom tree copies correctly" );

	Dom.get("qunit-fixture").append("<select class='test8070'></select><select class='test8070'></select>");
	var selects = document.query(".test8070");

	selects.append("<OPTION>1</OPTION><OPTION>2</OPTION>");

	equal( selects[0].childNodes.length, 2, "First select got two nodes" );
	equal( selects[1].childNodes.length, 2, "Second select got two nodes" );

	selects.dispose();

});

test("Dom.prototype.clone", function() {
	equal( "This is a normal link: Yahoo", Dom.get("en").getText(), "Assert text for #en" );
	var clone = Dom.get("yahoo").clone();
	Dom.get("first").append(clone);
	equal( "Try them out:Yahoo", Dom.get("first").getText(), "Check for clone" );
	equal( "This is a normal link: Yahoo", Dom.get("en").getText(), "Reassert text for #en" );

	var cloneTags = [
		"
", "
", "", "
",
		"<button/>", "
", "
", "
",
		"<input type='checkbox' />", "<select/>", "<option/>", "<textarea/>",
		"
", "
", "
", ""
	];
	for (var i = 0; i < cloneTags.length; i++) {
		var j = Dom.parse(cloneTags[i]);
		equal( j.node.tagName, j.clone().node.tagName, "Clone a " + cloneTags[i]);
	}

	var div = Dom.parse("

test

").on('click' ,function(){
		ok( true, "Bound event still exists." );
	});

	clone = div.clone(true);

	// manually clean up detached elements
	div.remove();

	div = clone.clone(true);

	// manually clean up detached elements
	clone.remove();

	equal( div.node.nodeName.toUpperCase(), "DIV", "DIV element cloned" );
	div.trigger("click");

	// manually clean up detached elements
	div.remove();

	div = Dom.parse("
");
	 div.append(document.createElement("table"));
	div.find("table").on('click' ,function(){
		ok( true, "Bound event still exists." );
	});

	clone = div.clone(true);
	equal( clone.node.nodeName.toUpperCase(), "DIV", "DIV element cloned" );
	clone.find("table").trigger("click");

	// manually clean up detached elements
	div.remove();
	clone.remove();

	var divEvt = Dom.parse("

test

").on('click' ,function(){
		ok( false, "Bound event still exists after .clone()." );
	}),
		cloneEvt = divEvt.clone(true, false);

	// Make sure that doing .clone() doesn't clone events
	cloneEvt.trigger("click");

	cloneEvt.remove();
	divEvt.remove();

	// this is technically an invalid object, but because of the special
	// classid instantiation it is the only kind that IE has trouble with,
	// so let's test with it too.
	div = Dom.parse("
").setHtml("<object height='355' width='425' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'>  <param name='movie' value='http://www.youtube.com/v/3KANI2dpXLw&hl=en'>  <param name='wmode' value='transparent'> </object>");

	// !IE9
	//clone = div.clone(true);
	//equal( clone.getHtml(), div.getHtml(), "Element contents cloned" );
	//equal( clone.nodeName.toUpperCase(), "DIV", "DIV element cloned" );

	// and here's a valid one.
	div = Dom.parse("
").setHtml("<object height='355' width='425' type='application/x-shockwave-flash' data='http://www.youtube.com/v/3KANI2dpXLw&hl=en'>  <param name='movie' value='http://www.youtube.com/v/3KANI2dpXLw&hl=en'>  <param name='wmode' value='transparent'> </object>");

	clone = div.clone(true);
	equal( clone.getHtml(), div.getHtml(), "Element contents cloned" );
	equal( clone.node.nodeName.toUpperCase(), "DIV", "DIV element cloned" );

	// manually clean up detached elements
	div.remove();
	clone.remove();

	var form = document.createElement("form");
	form.action = "/test/";
	var div = document.createElement("div");
	div.appendChild( document.createTextNode("test") );
	form.appendChild( div );

	equal( Dom.get(form).clone().children().length, 1, "Make sure we just get the form back." );

	//equal( document.find("body").clone().tagName, "BODY", "Make sure cloning body works" );
});

test("clone(form element) (Bug #3879, #6655)", function() {
	var element = Dom.parse("<select><option>Foo</option><option selected>Bar</option></select>");

	equal( element.clone().find(":selected").getText(), element.find(":selected").getText(), "Selected option cloned correctly" );

	element = Dom.parse("<input type='checkbox' value='foo'>").setAttr("checked", "checked");
	clone = element.clone();

	equal( clone.node.defaultValue, "foo", "Checked input defaultValue cloned correctly" );

	// defaultChecked also gets set now due to setAttribute in attr, is this check still valid?
	// equal( clone[0].defaultChecked, !Dom.parse.support.noCloneChecked, "Checked input defaultChecked cloned correctly" );

	// element = Dom.parse("<input type='text' value='foo'>");
	// clone = element.clone();
	// equal( clone.defaultValue, "foo", "Text input defaultValue cloned correctly" );

	// element = Dom.parse("<textarea>foo</textarea>");
	// clone = element.clone();
	// equal( clone.defaultValue, "foo", "Textarea defaultValue cloned correctly" );
});

test("clone(multiple selected options)", function() {
	expect(1);
	var element = Dom.parse("<select><option>Foo</option><option selected>Bar</option><option selected>Baz</option></select>");

	equal( element.clone().query(":selected").length, element.query(":selected").length, "Multiple selected options cloned correctly" );

});

test("Dom.prototype.setHtml", function() {

	Dom.parse.scriptorder = 0;

	var div = document.query("#qunit-fixture > div");
	div.setHtml( "test");
	var pass = true;
	for ( var i = 0; i < div.length; i++ ) {
		if ( div[i].childNodes.length != 1 ) pass = false;
	}
	ok( pass, "Set HTML" );

	div = Dom.parse("
").setHtml( "

"  );

	equal( div.children().length, 2, "Make sure two child nodes exist." );
	equal( div.children().children().length, 1, "Make sure that a grandchild exists." );

	var space = Dom.parse("
").setHtml( " " ).node.innerHTML;
	ok( /^\xA0$|^ $/.test( space ), "Make sure entities are passed through correctly." );
	equal( Dom.parse("
").setHtml( "&" ).node.innerHTML, "&", "Make sure entities are passed through correctly." );

	Dom.get("qunit-fixture").setHtml( "" );

	  equal( Dom.get("qunit-fixture").children().length, 1, "Make sure there is a child element." );
	    equal( Dom.get("qunit-fixture").children()[0].nodeName.toUpperCase(), "STYLE", "And that a style element was inserted." );

	//QUnit.reset();
	//Dom.get("qunit-fixture").setHtml( "<select/>" );
	//document.find("#qunit-fixture select").setHtml( "<option>O1</option><option selected='selected'>O2</option><option>O3</option>" );
	//equal( document.find("#qunit-fixture select").getText(), "O2", "Selected option correct" );

	var div = Dom.parse("
");
	equal( div.setHtml( 5 ).getHtml(), "5", "Setting a number as html" );
	equal( div.setHtml( 0 ).getHtml(), "0", "Setting a zero as html" );

	var div2 = Dom.parse("
"), insert = "<div>hello1</div>";
	equal( div2.setHtml(insert).getHtml().replace(/>/g, ">"), insert, "Verify escaped insertion." );
	equal( div2.setHtml("x" + insert).getHtml().replace(/>/g, ">"), "x" + insert, "Verify escaped insertion." );
	// equal( div2.setHtml(" " + insert).getHtml().replace(/>/g, ">"), " " + insert, "Verify escaped insertion." );

	var map = Dom.parse("<map/>").setHtml("<area id='map01' shape='rect' coords='50,50,150,150' href='http://www.jquery.com/' alt='Dom.parse'>");

	equal( map.node.childNodes.length, 1, "The area was inserted." );
	equal( map.node.firstChild.nodeName.toLowerCase(), "area", "The area was inserted." );

	QUnit.reset();

	Dom.get("qunit-fixture").setHtml("

");

	var child = Dom.get("qunit-fixture").query("script");

	equal( child.length, 6, "Make sure that two non-JavaScript script tags are left." );
	equal( child.item(0).node.type, "something/else", "Verify type of script tag." );
	equal( child.item(-1).node.type, "something/else", "Verify type of script tag." );

	Dom.get("qunit-fixture").setHtml("");
	Dom.get("qunit-fixture").setHtml("");
	Dom.get("qunit-fixture").setHtml("");

	Dom.get("qunit-fixture").setHtml("");

	Dom.get("qunit-fixture").setHtml("foo <form></form>");

	Dom.get("qunit-fixture").setHtml("'
//	     ].join ( "\n" ) ).appendTo( "qunit-fixture" );
//	// Dom.parse( [
//	 //        ''
//	  //    ].join ( "\n" ) ).appendTo( "qunit-fixture" );
//	Dom.parse( [
//	         ''
//	     ].join ( "\n" ) ).appendTo( "qunit-fixture" );
//});

test("clone - no exceptions for object elements #9587", function() {
	expect(1);

	try {
		Dom.get("no-clone-exception").clone();
		ok( true, "cloned with no exceptions" );
	} catch( e ) {
		ok( false, e.message );
	}
});


text:
@protocol GDMetadataCache;
@class GDURLMetadata;
@protocol GDURLMetadata;

@class GDFileService;
@class GDFileSessionUploadOperation;
@class GDFileManagerUploadState;

@interface GDFileServiceSession : NSObject

// Implementation
- (id)initWithBaseURL:(NSURL *)baseURL fileService:(GDFileService *)fileService;

- (void)unlink;

@property (nonatomic, readonly, strong) NSURL *baseURL;
@property (nonatomic, readonly, weak)   GDFileService *fileService;
@property (nonatomic, getter = isReadOnly) BOOL readOnly;
@property (nonatomic, readonly) BOOL shouldCacheResults;
@property (nonatomic, getter = isUserVisible) BOOL userVisible;

- (NSOperation *)downloadURL:(NSURL *)url intoFileURL:(NSURL *)localURL
                    progress:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))progress
                     success:(void (^)(NSURL *localURL, GDURLMetadata *metadata))success
                     failure:(void (^)(NSError *error))failure;

// Subclasses to provide

@property (nonatomic, readonly, getter = isAvailable) BOOL available;

- (BOOL)automaticallyAvoidsUploadOverwrites;
- (void)validateAccessWithSuccess:(void (^)())success failure:(void (^)(NSError *error))failure;

- (void)getMetadataForURL:(NSURL *)url metadataCache:(id <GDMetadataCache>)metadataCache cachedMetadata:(id <GDURLMetadata>)cachedMetadataOrNil
                  success:(void (^)(GDURLMetadata *metadata))success failure:(void (^)(NSError *error))failure;

- (void)getLatestVersionIdentifierForURL:(NSURL *)url metadataCache:(id <GDMetadataCache>)metadataCache cachedMetadata:(id <GDURLMetadata>)cachedMetadataOrNil
                                 success:(void (^)(NSString *fileVersionIdentifier))success failure:(void (^)(NSError *error))failure;

- (void)getContentsOfDirectoryAtURL:(NSURL *)url metadataCache:(id <GDMetadataCache>)metadataCache
                     cachedMetadata:(id <GDURLMetadata>)cachedMetadataOrNil cachedContents:(NSArray *)contentsOrNil
                         success:(void (^)(NSArray *contents))success failure:(void (^)(NSError *error))failure;

- (void)deleteURL:(NSURL *)url success:(void (^)())success failure:(void (^)(NSError *error))failure;
- (void)copyFileAtURL:(NSURL *)sourceURL toParentURL:(NSURL *)destinationParentURL name:(NSString *)name success:(void (^)(GDURLMetadata *metadata))success failure:(void (^)(NSError *))failure;
- (void)moveFileAtURL:(NSURL *)sourceURL toParentURL:(NSURL *)destinationParentURL name:(NSString *)name success:(void (^)(GDURLMetadata *metadata))success failure:(void (^)(NSError *))failure;

- (NSOperation *)downloadURL:(NSURL *)url intoFileURL:(NSURL *)localURL fileVersion:(NSString *)fileVersionIdentifier
                    progress:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))progress
                     success:(void (^)(NSURL *localURL, GDURLMetadata *metadata))success
                     failure:(void (^)(NSError *error))failure;

- (NSOperation *)uploadFileURL:(NSURL *)localURL mimeType:(NSString *)mimeType toDestinationURL:(NSURL *)destinationURL parentVersionID:(NSString *)parentVersionID
           internalUploadState:(id <NSCoding>)internalUploadState uploadStateHandler:(void (^)(GDFileManagerUploadState * uploadState))uploadStateHandler
                      progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress
                       success:(void (^)(GDURLMetadata *metadata, NSArray *conflicts))success
                       failure:(void (^)(NSError *error))failure;

- (NSOperation *)resumeUploadWithUploadState:(GDFileManagerUploadState *)uploadState fromFileURL:(NSURL *)localURL
                          uploadStateHandler:(void (^)(GDFileManagerUploadState * uploadState))uploadStateHandler
                                    progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress
                                     success:(void (^)(GDURLMetadata *metadata, NSArray *conflicts))success
                                     failure:(void (^)(NSError *error))failure;

- (NSOperation *)uploadFileURL:(NSURL *)localURL filename:(NSString *)filename mimeType:(NSString *)mimeType toParentFolderURL:(NSURL *)parentFolderURL
            uploadStateHandler:(void (^)(GDFileManagerUploadState * uploadState))uploadStateHandler
                      progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress
                       success:(void (^)(GDURLMetadata *metadata, NSArray *conflicts))success
                       failure:(void (^)(NSError *error))failure;

- (GDURLMetadata *)clientMetadataWithCachedMetadata:(id <GDURLMetadata>)urlMetadata parentURL:(NSURL *)url;
- (NSArray *)clientMetadataArrayWithCachedMetadataArray:(NSArray *)metadataArray parentURL:(NSURL *)url cache:(id <GDMetadataCache>)cacheOrNil;

- (NSString *)filenameAvoidingConflictsWithExistingContents:(NSArray *)contents preferredFilename:(NSString *)preferredFilename;

- (NSURL *)cacheURLForURL:(NSURL *)canonicalURL versionIdentifier:(NSString *)versionIdentifier cachedMetadata:(GDURLMetadata *__autoreleasing *)cachedMetadata;

// Subclasses may override
- (NSString *)normalisedPathForPath:(NSString *)path;
- (NSURL *)canonicalURLForURL:(NSURL *)url;
- (NSURL *)_canonicalURLForURL:(NSURL *)url;
- (NSString *)userDescription;
- (NSString *)detailDescription;

- (void)addMetadata:(id)metadata parentURL:(NSURL *)parentURL toCache:(id <GDMetadataCache>)cache
       continuation:(void (^)(GDURLMetadata *metadata, NSArray *metadataContents))continuation;

@end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>New LiquidCrystal library: LiquidCrystal_I2C_ByVac Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

New LiquidCrystal library
    1.3.2

Generic LCD control library

Main Page

Related Pages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Public Member Functions |
List of all members

LiquidCrystal_I2C_ByVac Class Reference

Inheritance diagram for LiquidCrystal_I2C_ByVac:

  <map id="LiquidCrystal_I2C_ByVac_map" name="LiquidCrystal_I2C_ByVac_map">
<area href="class_l_c_d.html" alt="LCD" shape="rect" coords="0,56,156,80"/>
</map>

Public Member Functions

 	LiquidCrystal_I2C_ByVac (uint8_t lcd_Addr)

virtual void 	begin (uint8_t cols, uint8_t rows, uint8_t charsize=LCD_5x8DOTS)

virtual void 	send (uint8_t value, uint8_t mode)

void 	setBacklight (uint8_t value)

void 	setContrast (uint8_t value)

 Public Member Functions inherited from LCD

 	LCD ()

void 	clear ()

void 	home ()

void 	noDisplay ()

void 	display ()

void 	noBlink ()

void 	blink ()

void 	noCursor ()

void 	cursor ()

void 	scrollDisplayLeft ()

void 	scrollDisplayRight ()

void 	leftToRight ()

void 	rightToLeft ()

void 	moveCursorLeft ()

void 	moveCursorRight ()

void 	autoscroll ()

void 	noAutoscroll ()

void 	createChar (uint8_t location, uint8_t charmap[])

void 	setCursor (uint8_t col, uint8_t row)

void 	backlight (void)

void 	noBacklight (void)

void 	on (void)

void 	off (void)

virtual void 	setBacklightPin (uint8_t value, t_backlighPol pol)

virtual void 	write (uint8_t value)

Additional Inherited Members

 Protected Attributes inherited from LCD

uint8_t 	_displayfunction

uint8_t 	_displaycontrol

uint8_t 	_displaymode

uint8_t 	_numlines

uint8_t 	_cols

t_backlighPol 	_polarity

Constructor & Destructor Documentation

          LiquidCrystal_I2C_ByVac::LiquidCrystal_I2C_ByVac
          (
          uint8_t
          lcd_Addr	)

Class constructor.  Initializes class variables and defines the I2C address of the LCD. The constructor does not initialize the LCD.

Parameters

lcd_Addr[in]	I2C address of the IO expansion module. For BV4218, the address can be configured using the address commands (to be implemented).

Member Function Documentation

          void LiquidCrystal_I2C_ByVac::begin
          (
          uint8_t
          cols,

          uint8_t
          rows,

          uint8_t
          charsize = LCD_5x8DOTS

          )

virtual

LCD initialization and associated HW.  Initializes the LCD to a given size (col, row). This methods initializes the LCD, therefore, it MUST be called prior to using any other method from this class or parent class.

The begin method can be overloaded if necessary to initialize any HW that is implemented by a library and can't be done during construction, here we use the Wire class.

Parameters

cols[in]	the number of columns that the display has

rows[in]	the number of rows that the display has

charsize[in]	size of the characters of the LCD: LCD_5x8DOTS or LCD_5x10DOTS.

Reimplemented from LCD.

          void LiquidCrystal_I2C_ByVac::send
          (
          uint8_t
          value,

          uint8_t
          mode

          )

virtual

Send a particular value to the LCD.  Sends a particular value to the LCD for writing to the LCD or as an LCD command.

Users should never call this method.

Parameters

value[in]	Value to send to the LCD.

mode[in]	DATA - write to the LCD CGRAM, COMMAND - write a command to the LCD.

Reimplemented from LCD.

          void LiquidCrystal_I2C_ByVac::setBacklight
          (
          uint8_t
          value	)

virtual

Switch-on/off the LCD backlight.  Switch-on/off the LCD backlight.

Parameters

value	backlight mode (HIGH|LOW)

Reimplemented from LCD.

          void LiquidCrystal_I2C_ByVac::setContrast
          (
          uint8_t
          value	)

Switch-on/off the LCD contrast.  Switch-on/off the LCD contrast.

Parameters

value	contrast mode (HIGH|LOW)

The documentation for this class was generated from the following files:

/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/LiquidCrystal_I2C_ByVac.h

/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/LiquidCrystal_I2C_ByVac.cpp

<address class="footer">
Generated by

 1.8.10
</address>


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <LinearLayout
        android:id="@+id/top"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/pluginDirTxt"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.69"
            android:hint="@string/pl_dir" />

        <Button
            android:id="@+id/pluginLoader"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/pl_load" />
    </LinearLayout>

    <ListView
        android:id="@+id/pluglist"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/top"
        android:fadingEdge="none"
        android:scrollbars="vertical"
        android:scrollingCache="true" />

</RelativeLayout>


text:
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

import React, { Component, PropTypes } from 'react';
import { List as VirtualScroll } from 'react-virtualized';
import classNames from 'classnames';
import { keyCodes } from '../utils';
import moment from 'moment';
var style = {
    'root': 'Cal__Years__root',
    'list': 'Cal__Years__list',
    'center': 'Cal__Years__center',
    'year': 'Cal__Years__year',
    'active': 'Cal__Years__active',
    'currentYear': 'Cal__Years__currentYear'
};

var Years = function (_Component) {
    _inherits(Years, _Component);

    function Years(props) {
        _classCallCheck(this, Years);

        var _this = _possibleConstructorReturn(this, (Years.__proto__ || Object.getPrototypeOf(Years)).call(this, props));

        _this.state = {
            selectedYear: props.selectedDate ? props.selectedDate.year() : moment().year()
        };
        return _this;
    }

    _createClass(Years, [{
        key: 'componentDidMount',
        value: function componentDidMount() {
            var vs = this.refs.VirtualScroll;
            var grid = vs && vs.refs.Grid;

            this.scrollEl = grid && grid.refs.scrollingContainer;
        }
    }, {
        key: 'handleClick',
        value: function handleClick(year, e) {
            var _props = this.props,
                hideYearsOnSelect = _props.hideYearsOnSelect,
                scrollToDate = _props.scrollToDate,
                selectedDate = _props.selectedDate,
                setDisplay = _props.setDisplay;

            var date = selectedDate || moment();
            var newDate = date.clone().year(year);

            this.selectDate(newDate, e, !hideYearsOnSelect);
            scrollToDate(newDate, -40);

            if (hideYearsOnSelect) {
                setDisplay('days');
            }
        }
    }, {
        key: 'selectDate',
        value: function selectDate(date, e) {
            var updateState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
            var shouldHeaderAnimate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
            var _props2 = this.props,
                minDate = _props2.minDate,
                maxDate = _props2.maxDate,
                onDaySelect = _props2.onDaySelect;

            if (!date.isBefore(minDate, 'day') && !date.isAfter(maxDate, 'day')) {
                if (updateState) {
                    this.setState({
                        selectedYear: date.year()
                    });
                }

                onDaySelect(date, e, shouldHeaderAnimate);
            }
        }
    }, {
        key: 'handleKeyDown',
        value: function handleKeyDown(e) {
            var _props3 = this.props,
                scrollToDate = _props3.scrollToDate,
                setDisplay = _props3.setDisplay,
                selectedDate = _props3.selectedDate;
            var selectedYear = this.state.selectedYear;

            var delta = 0;

            switch (e.keyCode) {
                case keyCodes.enter:
                case keyCodes.escape:
                    setDisplay('days');
                    scrollToDate(selectedDate || moment(selectedYear, 'YYYY'), -40);
                    return;
                case keyCodes.down:
                    delta = +1;
                    break;
                case keyCodes.up:
                    delta = -1;
                    break;
            }

            if (delta) {
                if (!selectedDate) selectedDate = moment().year(selectedYear);

                var newSelectedDate = selectedDate.clone().add(delta, 'year');
                this.selectDate(newSelectedDate, e);
            }
        }
    }, {
        key: 'render',
        value: function render() {
            var _this2 = this;

            var _props4 = this.props,
                height = _props4.height,
                selectedDate = _props4.selectedDate,
                theme = _props4.theme,
                width = _props4.width;
            var selectedYear = this.state.selectedYear;

            var currentYear = moment().year();
            var years = this.props.years.slice(0, this.props.years.length);
            // Add spacer rows at the top and bottom
            years.unshift(null);
            years.push(null);

            var selectedYearIndex = years.indexOf(selectedYear);
            var rowHeight = 50;
            var containerHeight = years.length * rowHeight < height + 50 ? years.length * rowHeight : height + 50;

            if (typeof width == 'string' && width.indexOf('%') !== -1) {
                width = window.innerWidth * parseInt(width.replace('%', ''), 10) / 100; // See https://github.com/bvaughn/react-virtualized/issues/229
            }

            return React.createElement(
                'div',
                {
                    className: style.root,
                    style: { color: theme.selectionColor, height: height + 50 }
                },
                React.createElement(VirtualScroll, {
                    ref: 'VirtualScroll',
                    className: style.list,
                    width: width,
                    height: containerHeight,
                    rowCount: years.length,
                    rowHeight: rowHeight,
                    scrollToIndex: selectedYearIndex + 1,
                    scrollToAlignment: 'center',
                    rowRenderer: function rowRenderer(_ref) {
                        var index = _ref.index,
                            rowStyle = _ref.style;

                        var year = years[index];

                        if (year !== null) {
                            var _classNames;

                            var isActive = index == selectedYearIndex;

                            return React.createElement(
                                'div',
                                {
                                    className: classNames(style.year, (_classNames = {}, _defineProperty(_classNames, style.active, isActive), _defineProperty(_classNames, style.currentYear, year == currentYear), _classNames)),
                                    onClick: function onClick() {
                                        return _this2.handleClick(year);
                                    },
                                    title: 'Set year to ' + year,
                                    'data-year': year,
                                    style: Object.assign({}, rowStyle, { color: typeof theme.selectionColor == 'function' ? theme.selectionColor(selectedDate.clone().year(year)) : theme.selectionColor })
                                },
                                React.createElement(
                                    'span',
                                    { style: year == currentYear ? { borderColor: theme.todayColor } : null },
                                    year
                                )
                            );
                        } else {
                            return React.createElement('div', { className: style.spacer });
                        }
                    }
                })
            );
        }
    }]);

    return Years;
}(Component);

Years.propTypes = {
    height: PropTypes.number,
    width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    hideYearsOnSelect: PropTypes.bool,
    maxDate: PropTypes.object,
    minDate: PropTypes.object,
    onDaySelect: PropTypes.func,
    scrollToDate: PropTypes.func,
    selectedDate: PropTypes.object,
    setDisplay: PropTypes.func,
    theme: PropTypes.object,
    years: PropTypes.array
};
export default Years;


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Elmah;

namespace ElmahMagic.Repository.Tests.Helpers
{
    public class GivenData
    {
        public IDictionary Dictionary { get; set; }
        public string Key { get; set; }
        public object Value { get; set; }
        public TypeCode TypeCode { get; set; }
        public NameValueCollection NameValueCollection { get; set; }
        public Error Error { get; set; }
        public string ErrorId { get; set; }
        public IErrorRepository ErrorRepository { get; set; }
        public RepositoryErrorLog ErrorLog { get; set; }
        public int TotalErrorCount { get; set; }
        public int PageIndex { get; set; }
        public int PageSize { get; set; }
        public List<ErrorLogEntry> ErrorEntryList { get; set; }
        public int ExpectedErrorCount { get; set; }
    }
}


text:
<?php

declare(strict_types=1);

namespace Blackprism\Serializer\Json;

use Blackprism\Serializer\Configuration;
use Blackprism\Serializer\Configuration\Blackhole;
use Blackprism\Serializer\Configuration\Type;
use Blackprism\Serializer\DeserializerInterface;
use Blackprism\Serializer\Exception\InvalidJson;
use Blackprism\Serializer\Exception\MissingIdentifierAttribute;
use Blackprism\Serializer\Exception\UndefinedIdentifierAttribute;
use Blackprism\Serializer\Value\ClassName;

/**
 * Deserialize
 *
 * @property Configuration $configuration
 */
class Deserialize implements DeserializerInterface
{
    /**
     * @var Configuration
     */
    private $configuration;

    /**
     * @param Configuration $configuration
     */
    public function __construct(Configuration $configuration)
    {
        $this->configuration = $configuration;
    }

    /**
     * @param string $serialized
     *
     * @return mixed
     * @throws InvalidJson
     */
    private function decodeJson(string $serialized)
    {
        $objectsAsArray = json_decode($serialized, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidJson(json_last_error_msg());
        }

        return $objectsAsArray;
    }

    /**
     * Deserialize string with class as the root object
     *
     * @param string $serialized
     * @param ClassName $className
     *
     * @return object|object[]
     * @throws InvalidJson
     * @throws UndefinedIdentifierAttribute
     * @throws MissingIdentifierAttribute
     */
    public function deserialize(string $serialized, ClassName $className = null)
    {
        $objectsAsArray = $this->decodeJson($serialized);

        if ($className !== null) {
            return $this->setObjectForClass($className, $objectsAsArray);
        }

        return $this->setObject($objectsAsArray);
    }

    /**
     * Deserialize string with class as the root object
     *
     * @param string $serialized
     * @param ClassName $className
     *
     * @return object[]
     * @throws InvalidJson
     * @throws UndefinedIdentifierAttribute
     * @throws MissingIdentifierAttribute
     */
    public function deserializeCollection(string $serialized, ClassName $className)
    {
        $objectsAsArray = $this->decodeJson($serialized);

        $objects = [];
        foreach ($objectsAsArray as $attribute => $object) {
            $objects[$attribute] = $this->setObjectForClass($className, $object);
        }

        return $objects;
    }

    /**
     * Create class object with data
     *
     * @param mixed[] $data
     *
     * @return object|object[]
     * @throws UndefinedIdentifierAttribute
     * @throws MissingIdentifierAttribute
     */
    private function setObject(array $data)
    {
        $identifierAttribute = $this->configuration->getIdentifierAttribute();

        if ($identifierAttribute === null) {
            throw new UndefinedIdentifierAttribute();
        }

        // We found an identifier attribute, $data is a json object
        if (isset($data[$identifierAttribute]) === true) {
            return $this->setObjectForObjectData($identifierAttribute, $data);
        }

        // We don't found an identifier attribute, $data is a collection
        return $this->setObjectForCollectionData($data);
    }

    /**
     * @param string $identifierAttribute
     * @param array $data
     *
     * @return mixed
     */
    private function setObjectForObjectData(string $identifierAttribute, array $data)
    {
        $configurationObject = $this->configuration
            ->getConfigurationObjectForIdentifier($data[$identifierAttribute]);
        $className = $configurationObject->getClassName();
        $fqdnClass = $className->getValue();
        $object = new $fqdnClass();

        foreach ($data as $attribute => $value) {
            if ($attribute === $identifierAttribute) {
                continue;
            }

            $type = $configurationObject->getTypeForAttribute($attribute);
            $this->processDeserializeForType($type, $object, $value);
        }

        return $object;
    }

    /**
     * @param mixed[] $data
     *
     * @return object[]
     * @throws MissingIdentifierAttribute
     * @throws UndefinedIdentifierAttribute
     */
    private function setObjectForCollectionData(array $data)
    {
        $objects = [];
        foreach ($data as $attribute => $object) {
            if (is_array($object) === false) {
                throw new MissingIdentifierAttribute();
            }

            $objects[$attribute] = $this->setObject($object);
        }

        return $objects;
    }

    /**
     * Create $className object with data
     *
     * @param ClassName $className
     * @param mixed[] $data
     *
     * @return object|object[]
     */
    private function setObjectForClass(ClassName $className, array $data)
    {
        $fqdnClass = $className->getValue();
        $object = new $fqdnClass();

        foreach ($data as $attribute => $value) {
            $configurationObject = $this->configuration->getConfigurationObjectForClass($className);
            $type = $configurationObject->getTypeForAttribute($attribute);

            $this->processDeserializeForType($type, $object, $value);
        }

        return $object;
    }

    /**
     * @param Configuration\TypeInterface $type
     * @param object $object
     * @param mixed $value
     */
    private function processDeserializeForType(Configuration\TypeInterface $type, $object, $value)
    {
        if ($type instanceof Type\Method) {
            $this->processDeserializeTypeMethod($type, $object, $value);
        } elseif ($type instanceof Type\Object) {
            $this->processDeserializeTypeObject($type, $object, $value);
        } elseif ($type instanceof Type\Collection\Object) {
            $this->processDeserializeTypeCollectionObject($type, $object, $value);
        } elseif ($type instanceof Type\IdentifiedObject) {
            $this->processDeserializeTypeIdentifiedObject($type, $object, $value);
        } elseif ($type instanceof Type\Collection\IdentifiedObject) {
            $this->processDeserializeTypeCollectionIdentifiedObject($type, $object, $value);
        } elseif ($type instanceof Type\Handler) {
            $this->processDeserializeTypeHandler($type, $object, $value);
        }
    }

    /**
     * @param Type\Method $method
     * @param object $object
     * @param mixed $value
     *
     * @return Deserialize
     */
    private function processDeserializeTypeMethod(Type\Method $method, $object, $value): self
    {
        $object->{$method->setter()}($value);

        return $this;
    }

    /**
     * @param Type\Object $objectType
     * @param object $object
     * @param mixed $value
     *
     * @return Deserialize
     */
    private function processDeserializeTypeObject(Type\Object $objectType, $object, $value): self
    {
        $object->{$objectType->setter()}($this->setObjectForClass($objectType->className(), $value));

        return $this;
    }

    /**
     * @param Type\Collection\Object $objectType
     * @param object $object
     * @param array $values
     *
     * @return Deserialize
     */
    private function processDeserializeTypeCollectionObject(Type\Collection\Object $objectType, $object, array $values)
    {
        $objects = [];
        foreach ($values as $key => $objectFromValue) {
            $objects[$key] = $this->setObjectForClass($objectType->className(), $objectFromValue);
        }

        $object->{$objectType->setter()}($objects);

        return $this;
    }

    /**
     * @param Type\IdentifiedObject $objectType
     * @param object $object
     * @param mixed $value
     *
     * @return Deserialize
     */
    private function processDeserializeTypeIdentifiedObject(Type\IdentifiedObject $objectType, $object, $value): self
    {
        $identifierAttribute = $this->configuration->getIdentifierAttribute();

        if (isset($value[$identifierAttribute]) === false) {
            return $this;
        }

        $configurationObject = $this->configuration->getConfigurationObjectForIdentifier($value[$identifierAttribute]);

        if ($configurationObject instanceof Blackhole) {
            return $this;
        }

        $object->{$objectType->setter()}($this->setObjectForClass($configurationObject->getClassName(), $value));

        return $this;
    }

    /**
     * @param Type\Collection\IdentifiedObject $objectType
     * @param object $object
     * @param array $values
     *
     * @return Deserialize
     */
    private function processDeserializeTypeCollectionIdentifiedObject(
        Type\Collection\IdentifiedObject $objectType,
        $object,
        array $values
    ): self {
        $identifierAttribute = $this->configuration->getIdentifierAttribute();

        $objects = [];
        foreach ($values as $key => $objectFromValue) {
            if (isset($objectFromValue[$identifierAttribute]) === false) {
                continue;
            }

            $configurationObject =
                $this->configuration->getConfigurationObjectForIdentifier($objectFromValue[$identifierAttribute]);

            if ($configurationObject instanceof Blackhole) {
                continue;
            }

            $objects[$key] = $this->setObjectForClass($configurationObject->getClassName(), $objectFromValue);
        }

        $object->{$objectType->setter()}($objects);

        return $this;
    }

    /**
     * @param Type\Handler $handler
     * @param object $object
     * @param mixed $value
     *
     * @return Deserialize
     */
    private function processDeserializeTypeHandler(Type\Handler $handler, $object, $value): self
    {
        $handler->deserializer()->deserialize($object, $value);

        return $this;
    }
}


text:
@implementation KSGlobals

////////////////////////////////////////////////////////////////////////////////

#pragma mark - Main

+ (NSString *)host
{
    return @"localhost:3000";
}

+ (NSString *)scheme
{
    return @"http";
}

+ (NSString *)format
{
    return @"json";
}

@end


text:
package com.conlect.oatos.mail;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;

import com.conlect.oatos.utils.StringUtils;

public class MailConfigure {

	public static Properties props = new Properties();
	public static Map<String, Properties> defaultConfigs = new HashMap<String, Properties>();

	static {
		try {
			props.load(MailConfigure.class.getClassLoader()
					.getResourceAsStream(
							"com/conlect/oatos/mail/mail.properties"));
			initMailConfigs();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private static void initMailConfigs() {
		String[] mailAccepts = StringUtils.split(
				props.getProperty("mail.accept"), ",");
		for (String mailType : mailAccepts) {
			Properties pop3Config = readMailConfig(mailType, false);
			Properties imapConfig = readMailConfig(mailType, true);
			defaultConfigs.put(mailType + ".pop3", pop3Config);
			defaultConfigs.put(mailType + ".imap", imapConfig);
		}
	}

	private static Properties readMailConfig(String mailType, boolean isIMAP) {
		Properties mailConfig = new Properties();
		for (Entry<Object, Object> entry : props.entrySet()) {
			String key = entry.getKey().toString();
			boolean notContain = isIMAP ? key.indexOf("pop3") == -1 : key
					.indexOf("imap") == -1;
			if (key.startsWith(mailType) && notContain) {
				mailConfig.put(key.substring(mailType.length() + 1),
						entry.getValue());
			}
		}
		if (mailConfig.size() > 0)
			mailConfig.put("mail.store.protocol", isIMAP ? "imaps" : "pop3");
		return mailConfig;
	}

	public static final Properties getDefaultConfig(String mailType,
			boolean isIMAP) {
		String sendPropocal = isIMAP ? ".imap" : ".pop3";
		return defaultConfigs.get(mailType + sendPropocal);
	}
}


text:
export * from './dataTypes';
export * from './themeTypes';


text:
package com.orbital3dstudios.composite.koopa.implementation;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import com.orbital3dstudios.composite.koopa.MapComponent;
import com.orbital3dstudios.composite.koopa.component.CompositeComponent;

public abstract class AbstractMapComponent<V extends CompositeComponent> extends AbstractKeyValueComponent<V> implements MapComponent<V>
{
	@Override
	protected Map<Class<? extends V>, V> createMap()
	{
		return new HashMap<Class<? extends V>, V>();
	}

	public void put(Class<? extends V> key, V value)
	{
		getMap().put(key, value);
	}

	public V get(Class<? extends V> key)
	{
		return getMap().get(key);
	}

	public Collection<V> values()
	{
		return getMap().values();
	}

}


text:
set -e

# Run tests on CI. Assumes working directory is hive-bigquery.
./prerequisites/prerequisites.sh

virtualenv env

# Shellcheck cannot lint env/bin/activate because it's created by virtualenv.
# shellcheck disable=SC1091
source env/bin/activate

pip3 install -e .
pip3 install pytest
pytest .