text:
package ev3dev.utils;

import ev3dev.actuators.lego.motors.Motor;
import lejos.robotics.RegulatedMotor;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Configuration class for Differential Pilot.
 *
 * @author Lawrie Griffiths, Juan Antonio Breña Moral
 */
public class PilotProps extends Properties {

    public static final String PERSISTENT_FILENAME = "pilot.props";

    public static final String KEY_WHEELDIAMETER = "wheelDiameter";
    public static final String KEY_TRACKWIDTH = "trackWidth";
    public static final String KEY_LEFTMOTOR = "leftMotor";
    public static final String KEY_RIGHTMOTOR = "rightMotor";
    public static final String KEY_REVERSE = "reverse";

    /**
     * Method to load values from file
     *
     * @throws IOException Not found
     */
    public void loadPersistentValues() throws IOException {

        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        try (InputStream resourceStream = loader.getResourceAsStream(PERSISTENT_FILENAME)) {
            this.load(resourceStream);
        }
    }

    /**
     * Store values in the file
     *
     * @throws IOException Not found
     */
    public void storePersistentValues() throws IOException {

        try (FileOutputStream fos = new FileOutputStream(new File(PERSISTENT_FILENAME))) {
            this.store(fos, null);
        }
    }

    /**
     * Utility method to get Motor instance from string (A, B or C)
     */
    public static RegulatedMotor getMotor(String motor) {

        if (motor.equals("A")) {
            return Motor.A;
        } else if (motor.equals("B")) {
            return Motor.B;
        } else if (motor.equals("C")) {
            return Motor.C;
        } else if (motor.equals("D")) {
            return Motor.D;
        } else {
            //TODO Review this case.
            return null;
        }
    }

}


text:
package org.dashbuilder.displayer;

import java.util.ArrayList;
import java.util.List;

import static org.dashbuilder.displayer.DisplayerSubType.*;

/**
 * An enumeration for the different types of displayers.
 */
public enum DisplayerType {

    /**
     * Bar Chart
     */
    BARCHART(BAR, BAR_STACKED, COLUMN, COLUMN_STACKED),

    /**
     * Pie Chart
     */
    PIECHART(PIE, PIE_3D, DONUT),

    /**
     * Area Chart
     */
    AREACHART(AREA, AREA_STACKED/*, STEPPED*/),

    /**
     * Line Chart
     */
    LINECHART(LINE, SMOOTH),

    /**
     * Bubble Chart
     */
    BUBBLECHART(),

    /**
     * Meter Chart
     */
    METERCHART(),

    /**
     * Table reports
     */
    TABLE(),

    /**
     * Map
     */
    MAP(MAP_REGIONS, MAP_MARKERS),

    /**
     * Selector
     */
    SELECTOR(),

    /**
     * Metric
     */
    METRIC();

    private DisplayerType(DisplayerSubType ... subtypes) {
        for (DisplayerSubType displayerSubType : subtypes) this.subtypes.add(displayerSubType);
    }

    private List<DisplayerSubType> subtypes = new ArrayList<DisplayerSubType>(5);

    public static DisplayerType getByName(String str) {
        try {
            return valueOf(str.toUpperCase());
        } catch (Exception e) {
            return null;
        }
    }

    public List<DisplayerSubType> getSubTypes() {
        return subtypes;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="undo">UNDO</string>

</resources>


text:
"""Example of using a custom model with batch norm."""

import argparse
import os

import ray
from ray import tune
from ray.rllib.examples.models.batch_norm_model import BatchNormModel, \
    KerasBatchNormModel, TorchBatchNormModel
from ray.rllib.models import ModelCatalog
from ray.rllib.utils.framework import try_import_tf
from ray.rllib.utils.test_utils import check_learning_achieved

tf1, tf, tfv = try_import_tf()

parser = argparse.ArgumentParser()
parser.add_argument(
    "--run",
    type=str,
    default="PPO",
    help="The RLlib-registered algorithm to use.")
parser.add_argument(
    "--framework",
    choices=["tf", "tf2", "tfe", "torch"],
    default="tf",
    help="The DL framework specifier.")
parser.add_argument(
    "--as-test",
    action="store_true",
    help="Whether this script should be run as a test: --stop-reward must "
    "be achieved within --stop-timesteps AND --stop-iters.")
parser.add_argument(
    "--stop-iters",
    type=int,
    default=200,
    help="Number of iterations to train.")
parser.add_argument(
    "--stop-timesteps",
    type=int,
    default=100000,
    help="Number of timesteps to train.")
parser.add_argument(
    "--stop-reward",
    type=float,
    default=150.0,
    help="Reward at which we stop training.")

if __name__ == "__main__":
    args = parser.parse_args()
    ray.init()

    ModelCatalog.register_custom_model(
        "bn_model", TorchBatchNormModel
        if args.framework == "torch" else KerasBatchNormModel
        if args.run != "PPO" else BatchNormModel)

    config = {
        "env": "Pendulum-v0" if args.run in ["DDPG", "SAC"] else "CartPole-v0",
        "model": {
            "custom_model": "bn_model",
        },
        "lr": 0.0003,
        # Use GPUs iff `RLLIB_NUM_GPUS` env var set to > 0.
        "num_gpus": int(os.environ.get("RLLIB_NUM_GPUS", "0")),
        "num_workers": 0,
        "framework": args.framework,
    }

    stop = {
        "training_iteration": args.stop_iters,
        "timesteps_total": args.stop_timesteps,
        "episode_reward_mean": args.stop_reward,
    }

    results = tune.run(args.run, stop=stop, config=config, verbose=2)

    if args.as_test:
        check_learning_achieved(results, args.stop_reward)

    ray.shutdown()


text:
package org.cthul.monad.switches;

import java.util.function.Function;
import org.cthul.monad.Status;

public class BasicStatusSwitch<T, U, R>
        extends SwitchExtension<Status, T, U, R,
                        BasicSwitch.Status<T, U, R>,
                        Switch.Case<T, U, BasicSwitch.Status<T, U, R>>,
                        Switch.Case<T, U, R>>
        implements BasicSwitch.Status<T, U, R> {

    public static <T, U, R> Function<Switch<Status, T, U, R, ?, ?, ?>, BasicSwitch.Status<T, U, R>> wrapper() {
        return (Function) WRAPPER;
    }

    public static <T, U, R> BasicSwitch.Status<T, U, R> asBasicStatusSwitch(Switch<Status, T, U, R, ?, ?, ?> delegate) {
        return delegate.asStatusSwitch(wrapper());
    }

    public static <T, R> Function<Switch<Status, T, T, R, ?, ?, ?>, BasicSwitch.StatusIdentity<T, R>> identityWrapper() {
        return (Function) IDENTITY_WRAPPER;
    }

    public static <T, R> BasicSwitch.StatusIdentity<T, R> asBasicStatusIdentitySwitch(Switch<Status, T, T, R, ?, ?, ?> delegate) {
        return delegate.asStatusIdentitySwitch(identityWrapper());
    }

    public BasicStatusSwitch(Switch<Status, T, U, R, ?, ?, ?> delegate) {
        super(delegate);
    }

    @Override
    protected <R0, R1> Case<T, U, R1> newCaseImplementation(Case<T, U, R0> caseDelegate, Function<? super R0, ? extends R1> resultMapping) {
        return new IdentityDelegator<>(caseDelegate, resultMapping);
    }

    @Override
    protected BasicSwitch.Status<T, U, R> wrapNextStep(Switch<Status, T, U, R, ?, ?, ?> newDelegate) {
        return newDelegate.asStatusSwitch(wrapper());
    }

    public static class Identity<T, R>
            extends SwitchExtension<Status, T, T, R,
                            BasicSwitch.StatusIdentity<T, R>,
                            Switch.IdentityCase<T, BasicSwitch.StatusIdentity<T, R>>,
                            Switch.IdentityCase<T, R>>
            implements BasicSwitch.StatusIdentity<T, R>,
                    StatusSwitch.Identity<T, R,
                            BasicSwitch.StatusIdentity<T, R>,
                            Switch.IdentityCase<T, BasicSwitch.StatusIdentity<T, R>>,
                            Switch.IdentityCase<T, R>> {

        public Identity(Switch<Status, T, T, R, ?, ?, ?> delegate) {
            super(delegate);
        }

        @Override
        protected <R0, R1> Case<T, T, R1> newCaseImplementation(Case<T, T, R0> caseDelegate, Function<? super R0, ? extends R1> resultMapping) {
            return new BasicIdentitySwitch.IdentityCaseDelegator<>(caseDelegate, resultMapping);
        }

        @Override
        protected BasicSwitch.StatusIdentity<T, R> wrapNextStep(Switch<Status, T, T, R, ?, ?, ?> newDelegate) {
            return new BasicStatusSwitch.Identity<>(newDelegate);
        }
    }

    public static class Direct<T, U>
            extends SwitchExtension.Direct<Status, T, U, U,
                            BasicSwitch.Status<T, U, U>,
                            Switch.Case<T, U, BasicSwitch.Status<T, U, U>>,
                            Switch.Case<T, U, U>>
            implements StatusSwitch.Direct<T, U,
                            BasicSwitch.Status<T, U, U>,
                            Switch.Case<T, U, BasicSwitch.Status<T, U, U>>,
                            Switch.Case<T, U, U>> {

        public Direct(Switch<Status, T, U, U, ?, ?, ?> delegate) {
            super(delegate);
        }

        @Override
        protected <R0, R1> Case<T, U, R1> newCaseImplementation(Case<T, U, R0> caseDelegate, Function<? super R0, ? extends R1> resultMapping) {
            return new IdentityDelegator<>(caseDelegate, resultMapping);
        }

        @Override
        protected BasicSwitch.Status<T, U, U> wrapNextStep(Switch<Status, T, U, U, ?, ?, ?> newDelegate) {
            return newDelegate.asStatusSwitch(wrapper());
        }
    }

    public static class DirectIdentity<T, U>
            extends SwitchExtension.Direct<Status, T, T, T,
                            BasicSwitch.StatusIdentity<T, T>,
                            Switch.IdentityCase<T, BasicSwitch.StatusIdentity<T, T>>,
                            Switch.IdentityCase<T, T>>
            implements StatusSwitch.DirectIdentity<T,
                            BasicSwitch.StatusIdentity<T, T>,
                            Switch.IdentityCase<T, BasicSwitch.StatusIdentity<T, T>>,
                            Switch.IdentityCase<T, T>> {

        public DirectIdentity(Switch<Status, T, T, T, ?, ?, ?> delegate) {
            super(delegate);
        }

        @Override
        protected <R0, R1> Switch.IdentityCase<T, R1> newCaseImplementation(Switch.Case<T, T, R0> caseDelegate, Function<? super R0, ? extends R1> resultMapping) {
            return new BasicIdentitySwitch.IdentityCaseDelegator<>(caseDelegate, resultMapping);
        }

        @Override
        protected BasicSwitch.StatusIdentity<T, T> wrapNextStep(Switch<Status, T, T, T, ?, ?, ?> newDelegate) {
            return newDelegate.asStatusIdentitySwitch(identityWrapper());
        }
    }

    private static final Function<Switch<Status,?,?,?,?,?,?>, ?> WRAPPER = BasicStatusSwitch::new;
    private static final Function<Switch<Status,Object,Object,?,?,?,?>, ?> IDENTITY_WRAPPER = BasicStatusSwitch.Identity::new;
}


text:
enum ToknType { TOKN = 0x30, LBCT, RBCT, SGQT, DBQT, SMCL, EOF_, };

class Tokn : public Text {
public:
    Tokn(ToknType t, string n, Baseplate *plate);
    unsigned char t();
    string tree();
    string to_s();
};

#endif


text:
/**
 * ViosMaps - Visual Interactive OpenSource Maps
 * @author  Gustavo Adrián Salvini
 * @date 20160408
 */

/* Required modules */

var $ 			= require('jQuery'),
	jqBrowser  	= require('jquery.browser'),
	Snap 		= require('snapsvg'),
	vios		= require('./vios-functions.js');

// console.log("vios:", vios);
// console.log("vios.openURLwithTarget:", vios.openURLwithTarget);
// console.log('$.browser', $.browser);

window.onload = function () {

	var s           = Snap("#svgMap");
	// s.attr({ width: "100%", height: "100%" });

	var map_x_offset = 106, map_y_offset = 50;
	var isFullyCompatibleBrowser =  ! ( $.browser.msie || $.browser.msedge || $.browser["windows phone"] );

	var shadow      = s.filter(Snap.filter.shadow(0, 2, 3));
	var noShadow    = s.filter(Snap.filter.shadow(0,0,0));
	var invert      = s.filter(Snap.filter.invert(1.0));
	// var invertFilterChild = invert.node.firstChild;
	var noInvert    = s.filter(Snap.filter.invert(0));
	var saturate    = s.filter(Snap.filter.saturate(1.5));
	var saturateFilterChild = saturate.node.firstChild;

	var activeBounds = {};

	var defaultRegionURL = '#';
	var regionsMetadata =
		{
			'antartida': { 'text': "Antártida (Arg.)", 'url': 'https://es.wikipedia.org/wiki/Ant%C3%A1rtida_Argentina', 'target': '_blank', 'label_offset_x': 50, 'label_offset_y': 0, 'label_hover_offset_x': 30, 'label_hover_offset_y': -10 },
			'malvinas': { 'text': "Islas Malvinas", 'label_offset_x': 0, 'label_offset_y': -20, 'label_hover_offset_x': 10, 'label_hover_offset_y': -10 },
			'buenos-aires': { 'text': "Buenos Aires", 'url': 'https://es.wikipedia.org/wiki/Provincia_de_Buenos_Aires', 'target': '_blank', 'label_offset_x': -2, 'label_offset_y': 0, 'label_hover_offset_x': -5, 'label_hover_offset_y': -20 },
			'caba': { 'text': "", 'url': 'https://es.wikipedia.org/wiki/Buenos_Aires', 'label_offset_x': 60, 'label_offset_y': 10 },
			'caba-big': { 'text': "Capital Federal", 'url': 'https://es.wikipedia.org/wiki/Buenos_Aires', 'target': '_blank', 'label_offset_x': 0, 'label_offset_y': 70, 'label_hover_offset_y': 55 },
			'catamarca': { 'text': "Catamarca", 'label_offset_x': 2, 'label_offset_y': 10, 'rotation': 45 },
			'chaco': { 'text': "Chaco", 'label_offset_x': 12, 'label_offset_y': 28, 'label_hover_offset_x': 7, 'label_hover_offset_y': 10 },
			'chubut': { 'text': "Chubut", 'label_offset_x': -10, 'label_offset_y': 10, 'rotation': -5 },
			'cordoba': { 'text': "Córdoba", 'label_offset_x': -2, 'label_offset_y': 0, 'rotation': 0 },
			'corrientes': { 'text': "Corrientes", 'url': 'https://es.wikipedia.org/wiki/Provincia_de_Corrientes', 'label_offset_x': 10, 'label_offset_y': 10, 'label_hover_offset_x': 95, 'label_hover_offset_y': 20 },
			'entre-rios': { 'text': "Entre Ríos", 'label_offset_x': 20, 'label_offset_y': 10, 'rotation': 0, 'label_hover_offset_x': 100, 'label_hover_offset_y': -20 },
			'formosa': { 'text': "Formosa", 'label_offset_x': 0, 'label_offset_y': 17, 'rotation': 28 },
			'jujuy': { 'text': "Jujuy", 'label_offset_x': 0, 'label_offset_y': 14, 'rotation': 40 },
			'la-pampa': { 'text': "La Pampa", 'label_offset_x': 0, 'label_offset_y': 15, 'rotation': 0 },
			'la-rioja': { 'text': "La Rioja", 'label_offset_x': 0, 'label_offset_y': 0, 'rotation': 45 },
			'mendoza': { 'text': "Mendoza", 'label_offset_x': -5, 'label_offset_y': 10, 'rotation': -50 },
			'misiones': { 'text': "Misiones", 'label_offset_x': 5, 'label_offset_y': 17, 'rotation': -45 },
			'tucuman': { 'text': "Tucumán", 'label_offset_x': 0, 'label_offset_y': 0, 'label_hover_offset_x': 10 , 'label_hover_offset_y': -40 },
			'neuquen': { 'text': "Neuquén", 'label_offset_x': 0, 'label_offset_y': 15, 'rotation': -50 },
			'rio-negro': { 'text': "Río Negro", 'label_offset_x': 0, 'label_offset_y': 25, 'rotation': -3, 'label_hover_offset_x': 20 },
			'salta': { 'text': "Salta", 'label_offset_x': 10, 'label_offset_y': 35, 'label_hover_offset_x': 0, 'label_hover_offset_y': 20 },
			'san-juan': { 'text': "San Juan", 'label_offset_x': -10, 'label_offset_y': 20, 'rotation': 0 },
			'san-luis': { 'text': "San Luis", 'label_offset_x': 8, 'label_offset_y': 10, 'rotation': -90, 'label_hover_offset_x': 0, 'label_hover_offset_y': 5 },
			'santa-cruz': { 'text': "Santa Cruz", 'label_offset_x': 5, 'label_offset_y': -20, 'rotation': -5, 'label_hover_offset_x': 5, 'label_hover_offset_y': -34 },
			'santa-fe': { 'text': "Santa Fe", 'label_offset_x': -4, 'label_offset_y': 10, 'rotation': -75 },
			'santiago-del-estero': { 'text': "Stgo. del Estero", 'label_offset_x': 0, 'label_offset_y': 5, 'rotation': -50 },
			'tierra-del-fuego': { 'text': "Tierra del Fuego", 'label_offset_x': 45, 'label_offset_y': 0, 'rotation': -7, 'label_hover_offset_x': 40, 'label_hover_offset_y': 0 },
	};

	Snap.plugin( function( Snap, Element, Paper, global ) {
		Element.prototype.addTransform = function( t ) {
			return this.transform( this.transform().localMatrix.toTransformString() + t );
		};
	});

	Snap.load("assets/argentina_map.svg", function (f) {

		/**
		 * [drawBounds description]
		 * @param  {[type]} targetObject [description]
		 * @return {[type]}              [description]
		 */
		function drawBounds(targetObject) {

			targetId = targetObject.attr('id');

			if ( typeof activeBounds[ targetId ] == 'undefined')
				activeBounds[ targetId ] = [];

			var tmp_polyline, tmp_outer_disc, tmp_inner_disc, tmp_innermost_disc;

			var bbox = targetObject.getBBox();

			// calculate middle point
			var x_center = ( bbox.x2 + bbox.x ) / 2 + map_x_offset;
			var y_center = ( bbox.y2 + bbox.y ) / 2 + map_y_offset;

			if (false) {

				tmp_polyline = s.polyline( bbox.x + map_x_offset, bbox.y + map_y_offset,
											bbox.x2 + map_x_offset, bbox.y + map_y_offset,
											bbox.x2 + map_x_offset, bbox.y2 + map_y_offset,
											bbox.x + map_x_offset, bbox.y2 + map_y_offset,
											bbox.x + map_x_offset, bbox.y + map_y_offset
											 )
					.attr({
						stroke: "rgb(206,43,55)",
						strokeWidth: "2",
						opacity: "0.3",
						fill: "none"
					});

				activeBounds[ targetId ].push( tmp_polyline );

				tmp_outer_disc = s.circle(x_center, y_center, bbox.r0 ).attr({
					fill: "none",
					stroke: "rgb(0, 146, 70)",
					strokeWidth: "3",
					opacity: "0.3",
				});

				activeBounds[ targetId ].push( tmp_outer_disc );

				tmp_inner_disc = s.circle(x_center, y_center, bbox.r1 ).attr({
					fill: "none",
					stroke: "rgb(206,43,55)",
					strokeWidth: "3",
					opacity: "0.3",
				});

				activeBounds[ targetId ].push( tmp_inner_disc );
				// console.log('activeBounds:', activeBounds);
			}

		}

		/**
		 * [mouseOutSVG description]
		 * @param  {[type]} event [description]
		 * @return {[type]}       [description]
		 */
		function mouseOutSVG(event) {
			// console.log('Out of SVG!!!!!');
			// console.log(event.target);
		}

		/**
		 * [hoverRegion description]
		 * @param  {[type]} event [description]
		 * @return {[type]}       [description]
		 */
		function hoverRegion(event) {

			if ( isFullyCompatibleBrowser ) {

				if (weakOverlays != null) weakOverlays.animate( { 'opacity': '0' }, 200, mina.easeout );

				// var lastChild = document.querySelectorAll('g#italia_regioni')[0].lastElementChild;
				// var $lastChild = $('#regions > path:last-child');
				var $lastChild = $('#regions').children().last();
				// var lastSnapObject = s.select( '#'+lastChild.id );
				var lastSnapObject = s.select( '#'+$lastChild.attr('id') );
				lastSnapObject.after(this);

				/* regions labels */
				var label_hover_x = 0,
					label_hover_y = 0;

				if ( typeof regionsMetadata[ this.attr('id') ] != 'undefined')
				{

					if ( typeof regionsMetadata[ this.attr('id') ]['label_hover_offset_x'] != 'undefined')
						label_hover_x = regionsMetadata[ this.attr('id') ]['label_hover_offset_x'];

					if ( typeof regionsMetadata[ this.attr('id') ]['label_hover_offset_y'] != 'undefined')
						label_hover_y = regionsMetadata[ this.attr('id') ]['label_hover_offset_y'];

				}

				console.log( 'Original BBox for:', this );
				console.log( regions[ this.attr('id') ].originalBBox);

				var originalBBox        = regions[ this.attr('id') ].originalBBox;
				var originalTransform   = regions[ this.attr('id') ].originalTransform;
				// this.transform( regions[ this.attr('id') ].originalTransform['string'] );

				var that = this;

				// that.attr({ transform:  });
				that.attr({ filter: shadow }).animate( { transform: "s1.6,1.6,"+originalBBox.cx+","+originalBBox.cy }, 600, mina.elastic );

				regions[ this.attr('id') ].snapLabel.animate( { 'opacity': '1' }, 300, mina.easeout );
				regions[ this.attr('id') ].snapLabel.addTransform('t'+label_hover_x+','+label_hover_y).addTransform('s1.6,1.6');

				console.log( 'On Hover BBox:', that.getBBox() );

			}
			else // not fully compatible browser
			{
				this.attr({ filter: invert });
			}
		}

		/**
		 * [removeBounds description]
		 * @return {[type]} [description]
		 */
		function removeBounds() {

			// cleans the activeBounds Queue
			var nActiveBounds = Object.keys(activeBounds).length;
			// console.log('#Regions with Active Bounds:', nActiveBounds );
			if ( nActiveBounds > 0 )
			{
				// console.log('There are things to be cleaned!');
				for (var region in activeBounds) {
					// console.log('#-# region: ', region);
					for ( var i = 0; i < activeBounds[region].length; i++ ) {
						activeBounds[region][i].remove();
					}
					activeBounds[region] = [];
				}
			}
		}

		/**
		 * [noHoverRegion description]
		 * @param  {[type]} event [description]
		 * @return {[type]}       [description]
		 */
		function noHoverRegion(event) {
			// console.log('mouseOut:', this.attr('id'));
			// setTimeout( function() { removeBounds() }, 2000 );
			if (weakOverlays != null) weakOverlays.animate( { 'opacity': '1' }, 200, mina.easeout );

			if ( isFullyCompatibleBrowser ) {

				/* regions labels */
				var label_hover_x = 0;
				var label_hover_y = 0;

				if ( typeof regionsMetadata[ this.attr('id') ] != 'undefined')
				{
					if ( typeof regionsMetadata[ this.attr('id') ]['label_hover_offset_x'] != 'undefined')
						label_hover_x = -1 * regionsMetadata[ this.attr('id') ]['label_hover_offset_x'];

					if ( typeof regionsMetadata[ this.attr('id') ]['label_hover_offset_y'] != 'undefined')
						label_hover_y = -1 * regionsMetadata[ this.attr('id') ]['label_hover_offset_y'];

					// if ( typeof regionsMetadata[ this.attr('id') ]['label_hover_rotation'] != 'undefined')
					//  label_hover_rotation = -1 * regionsMetadata[ this.attr('id') ]['label_hover_rotation'];

				}

				var originalBBox        = regions[ this.attr('id') ].originalBBox;
				var originalTransform   = regions[ this.attr('id') ].originalTransform;

				this.animate({ transform: "s1,1,"+originalBBox.cx+","+originalBBox.cy }, 700, mina.elastic).attr({ filter: noShadow });

				// console.log( 'Original Transform for:', this );
				// console.log( regions[ this.attr('id') ].originalTransform );
				// this.addTransform( regions[ this.attr('id') ].originalTransform['string'] );

				regions[ this.attr('id') ].snapLabel.animate( { 'opacity': '0.2' }, 300, mina.easeout );
				regions[ this.attr('id') ].snapLabel.addTransform('s0.625,0.625').addTransform('t'+label_hover_x+','+label_hover_y);
			}
			else
			{
				this.animate({ transform: "s1,1" }, 700, mina.elastic).attr({ filter: noInvert });
			}

		}

		/**
		 * [clickRegion description]
		 * @param  {[type]} event [description]
		 * @return {[type]}       [description]
		 */
		function clickRegion(event) {

			var regionURL = defaultRegionURL,
				target = '_self';

			if ( typeof regionsMetadata[ this.attr('id') ] != 'undefined')
			{
				if ( typeof regionsMetadata[ this.attr('id') ]['url'] != 'undefined')
					regionURL = regionsMetadata[ this.attr('id') ]['url'];

				if ( typeof regionsMetadata[ this.attr('id') ]['target'] != 'undefined')
					target = regionsMetadata[ this.attr('id') ]['target'];
			}

			// top.location.href = regionURL;
			vios.openURLwithTarget( regionURL, target );
		}

		/* Main callback code for Snap.load ************************************************************************/

		var regionsContainer = f.select("#regions");
		s.append(regionsContainer);

		var weakOverlays = f.select("#weak-overlays");
		if ( weakOverlays != null)
		{
			s.append(weakOverlays);
			weakOverlays.attr({ 'pointer-events': 'none' });
		}

		// var  elemRegions     = document.querySelectorAll('#regions > path'),
		var elemRegions     = $('#regions').children(),
			regions         = {};

		// console.log( 'Regiones:', elemRegions.length );

		s.mouseout( function(event) {
			mouseOutSVG(event);
		} );

		var regionBBox;

		for ( var i = 0; i < elemRegions.length; i++ ) {
			regions[ elemRegions[i].id ] = {};
			regions[ elemRegions[i].id ].id = elemRegions[i].id;
			var regionId = regions[ elemRegions[i].id ].id;
			// regions[ elemRegions[i].id ].name = elemRegions[i].getAttribute('data-name');
			regions[ elemRegions[i].id ].snapObject = s.select( '#'+elemRegions[i].id );
			regions[ elemRegions[i].id ].pathLength = Snap.path.getTotalLength( regions[ elemRegions[i].id ].snapObject );
			regions[ elemRegions[i].id ].originalBBox = regions[ elemRegions[i].id ].snapObject.getBBox();
			regions[ elemRegions[i].id ].originalTransform = regions[ elemRegions[i].id ].snapObject.transform();

			// console.log ( elemRegions[i].id,':', regions[ elemRegions[i].id ].originalTransform );

			/* region bounding box */
			var regionBBox = regions[ elemRegions[i].id ].snapObject.getBBox();

			var x_center = ( regionBBox.x2 + regionBBox.x ) / 2 + map_x_offset;
			var y_center = ( regionBBox.y2 + regionBBox.y ) / 2 + map_y_offset;

			/* event handlers */
			regions[ elemRegions[i].id ].snapObject.hover( hoverRegion, noHoverRegion );
			regions[ elemRegions[i].id ].snapObject.click( clickRegion );

			/* regions labels */
			var label_x = x_center;
			var label_y = y_center;
			var label_text = regionId;
			var label_rotation = 0;

			if ( typeof regionsMetadata[ elemRegions[i].id ] != 'undefined')
			{
				if ( typeof regionsMetadata[ elemRegions[i].id ]['label_offset_x'] != 'undefined')
					label_x += regionsMetadata[ elemRegions[i].id ]['label_offset_x'];

				if ( typeof regionsMetadata[ elemRegions[i].id ]['label_offset_y'] != 'undefined')
					label_y += regionsMetadata[ elemRegions[i].id ]['label_offset_y'];

				if ( typeof regionsMetadata[ elemRegions[i].id ]['text'] != 'undefined')
					label_text = regionsMetadata[ elemRegions[i].id ]['text'];

				if ( typeof regionsMetadata[ elemRegions[i].id ]['rotation'] != 'undefined')
					label_rotation = regionsMetadata[ elemRegions[i].id ]['rotation'];

			}

			var label       = s.text(label_x, label_y, label_text);

			// var label1       = s.multitext(label_x, label_y, label_text, 200, { "font-size": "10px" });

			var labelBBox   = label.getBBox();
			label.transform('t-'+labelBBox.width/2+',-'+ labelBBox.height/2 +' r' + label_rotation );
			label.attr({ 'pointer-events': 'none' });
			regions[ elemRegions[i].id ].snapLabel = label;
			// regions[ elemRegions[i].id ].snapLabel.remove();
			regions[ elemRegions[i].id ].snapLabel.attr({'font-size': '16px', 'opacity': '0.2'});

			regions[ elemRegions[i].id ].snapLabelTransform = regions[ elemRegions[i].id ].snapLabel.transform();
			// console.log( 'current label transform:', regions[ elemRegions[i].id ].snapLabelTransform );

			// s.append(regions[ elemRegions[i].id ].snapLabel );

		}
		/* /End Main callback code for Snap.load ************************************************************************/

	});
};


text:
package org.wso2.msf4j.formparam.util.mime;

/**
 * Exception that will be thrown if any issues occur
 * when parsing the multipart/form-data request.
 *
 */
final class ParseException extends Exception {

    /**
     * The UID to use when serializing this instance.
     */
    private static final long serialVersionUID = 5355281266579392077L;

    /**
     * Constructs a new exception with the specified detail message.
     *
     * @param message the detail message.
     */
    public ParseException(String message) {
        super(message);
    }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.casoftworks.jdroidlib.exception;

/**
 * An exception notifying that the current platform is not supported.
 * @author Simon Cahill
 */
public class PlatformNotSupportedException extends Exception {

    public PlatformNotSupportedException() {
        super();
    }

    public PlatformNotSupportedException(String msg) {
        super(msg);
    }

}


text:
package com.brownfield.pss.client;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.web.client.RestTemplate;

@EnableGlobalMethodSecurity
@SpringBootApplication
@EnableDiscoveryClient
public class WebsiteApplication{

	@Bean
	@LoadBalanced
    RestTemplate restTemplate(){
	    return new RestTemplate();
    }

   	public static void main(String[] args) {
		SpringApplication.run(WebsiteApplication.class, args);
	}
}


text:
using System;
using System.Net;

namespace Sandboxable.Hyak.Common.TransientFaultHandling
{
    public class DefaultHttpErrorDetectionStrategy : ITransientErrorDetectionStrategy
    {
        public bool IsTransient(Exception ex)
        {
            var httpRequestExceptionWithStatus = ex as HttpRequestExceptionWithStatus;
            if (httpRequestExceptionWithStatus != null && (httpRequestExceptionWithStatus.StatusCode == HttpStatusCode.RequestTimeout
                                                           || httpRequestExceptionWithStatus.StatusCode >= HttpStatusCode.InternalServerError
                                                           && httpRequestExceptionWithStatus.StatusCode != HttpStatusCode.NotImplemented
                                                           && httpRequestExceptionWithStatus.StatusCode != HttpStatusCode.HttpVersionNotSupported))
            {
                return true;
            }

            return false;
        }
    }
}


text:
package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.product.business.ProductService;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.product.business.domain.ProductItem;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.ShoppingListService;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.domain.ListItem;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts.listeners.DeleteProductOnClickListener;
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.main.MainActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 * Author: Grebiel Jose Ifill Brito
 * Created: 21.07.16 creation date
 */
public class DeleteProductsActivity extends AppCompatActivity
{
    private ProductService productService;
    private ShoppingListService shoppingListService;
    private DeleteProductsCache cache;
    private String listId;
    private ListItem item;

    @Override
    protected final void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.delete_products_activity);

        AbstractInstanceFactory instanceFactory = new InstanceFactory(getApplicationContext());
        this.productService = (ProductService) instanceFactory.createInstance(ProductService.class);
        this.shoppingListService = (ShoppingListService) instanceFactory.createInstance(ShoppingListService.class);

        listId = getIntent().getStringExtra(MainActivity.LIST_ID_KEY);
        shoppingListService.getById(listId)
                .doOnNext(result -> item = result)
                .doOnCompleted(() ->
                {
                    cache = new DeleteProductsCache(this, listId, item.getListName());
                    cache.getDeleteFab().setOnClickListener(new DeleteProductOnClickListener(cache));
                    updateListView();
                })
                .doOnError(Throwable::printStackTrace)
                .subscribe();

        overridePendingTransition(0, 0);
    }

    public void updateListView()
    {
        List<ProductItem> allProducts = new ArrayList<>();

        productService.getAllProducts(cache.getListId())
                .doOnNext(item -> allProducts.add(item))
                .doOnCompleted(() ->
                {
                    // sort according to last sort selection
                    final ListItem[] listItem = new ListItem[ 1 ];
                    shoppingListService.getById(listId)
                            .doOnNext(result -> listItem[ 0 ] = result)
                            .doOnCompleted(() ->
                                    {
                                        String sortBy = listItem[ 0 ].getSortCriteria();
                                        boolean sortAscending = listItem[ 0 ].isSortAscending();
                                        productService.sortProducts(allProducts, sortBy, sortAscending);

                                        cache.getDeleteProductsAdapter().setList(allProducts);
                                        cache.getDeleteProductsAdapter().notifyDataSetChanged();
                                    }
                            )
                            .doOnError(Throwable::printStackTrace)
                            .subscribe();
                })
                .doOnError(Throwable::printStackTrace)
                .subscribe();
    }
}


text:
import { calculateTreeQuantity } from '../src/calculateTreeQuantity'
import { RecipeTree, RecipeTreeWithCraftFlags } from '../src/types'

const RECIPE_PARTIAL = {
  id: 1,
  type: 'Recipe' as const,
  output: 1,
  min_rating: 400,
  recipe_id: 123,
  disciplines: ['Armorsmith'],
}

const ITEM_PARTIAL = {
  id: 1,
  type: 'Item' as const,
  output: 1,
  min_rating: null,
  disciplines: [],
}

const RECIPE_PARTIAL_WITH_CRAFT_FLAGS = {
  ...RECIPE_PARTIAL,
  craft: true,
  totalQuantity: 1,
  usedQuantity: 1,
  buyPriceEach: 1,
  buyPrice: 1,
  decisionPrice: 1,
}

const ITEM_PARTIAL_WITH_CRAFT_FLAGS = {
  ...ITEM_PARTIAL,
  craft: false,
  totalQuantity: 1,
  usedQuantity: 1,
  buyPriceEach: 1,
  buyPrice: 1,
  decisionPrice: 1,
}

describe('calculateTreeQuantity (total quantity)', () => {
  it('calculates the correct quantity for recipes without components', () => {
    const recipeTree: RecipeTree = { ...RECIPE_PARTIAL, quantity: 1 }

    const adjustedTree = calculateTreeQuantity(1, recipeTree)
    expect(adjustedTree).toMatchSnapshot()
  })

  it('calculates the correct quantity for recipes with components', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      components: [
        { ...ITEM_PARTIAL, quantity: 1 },
        { ...ITEM_PARTIAL, quantity: 5 },
      ],
    }

    const adjustedTree = calculateTreeQuantity(1, recipeTree)
    expect(adjustedTree).toMatchSnapshot()
  })

  it('does not modify the initial recipe tree', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      components: [
        { ...ITEM_PARTIAL, quantity: 1 },
        { ...ITEM_PARTIAL, quantity: 5 },
      ],
    }

    const adjustedTree = calculateTreeQuantity(1, recipeTree)
    expect(recipeTree).toMatchSnapshot()
    expect(adjustedTree).toMatchSnapshot()
  })

  it('calculates the correct quantity if an amount is set', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      components: [
        { ...ITEM_PARTIAL, quantity: 1 },
        { ...ITEM_PARTIAL, quantity: 5 },
        { ...ITEM_PARTIAL, type: 'Currency', quantity: 10 },
      ],
    }

    const adjustedTree = calculateTreeQuantity(2, recipeTree)
    expect(adjustedTree).toMatchSnapshot()
  })

  it('calculates the correct quantity if an recipe has a output > 0', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      output: 5,
      components: [
        { ...ITEM_PARTIAL, quantity: 1 },
        { ...ITEM_PARTIAL, quantity: 5 },
      ],
    }
    const adjustedTreeOne = calculateTreeQuantity(1, recipeTree)
    expect(adjustedTreeOne).toMatchSnapshot()

    const adjustedTreeTwo = calculateTreeQuantity(4, recipeTree)
    expect(adjustedTreeTwo).toMatchSnapshot()

    const adjustedTreeThree = calculateTreeQuantity(25, recipeTree)
    expect(adjustedTreeThree).toMatchSnapshot()
  })

  it('calculates the correct quantity if an sub-recipe has a output > 0', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      output: 2,
      components: [
        { ...ITEM_PARTIAL, quantity: 1, output: 10 },
        { ...ITEM_PARTIAL, quantity: 7, output: 5 },
      ],
    }

    const adjustedTreeOne = calculateTreeQuantity(1, recipeTree)
    expect(adjustedTreeOne).toMatchSnapshot()

    const adjustedTreeTwo = calculateTreeQuantity(3, recipeTree)
    expect(adjustedTreeTwo).toMatchSnapshot()
  })

  it('works with a simple real recipe', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      output: 5,
      quantity: 1,
      components: [
        { ...ITEM_PARTIAL, quantity: 25 },
        {
          ...RECIPE_PARTIAL,
          quantity: 10,
          output: 1,
          components: [{ ...ITEM_PARTIAL, quantity: 3 }],
        },
        {
          ...RECIPE_PARTIAL,
          quantity: 4,
          output: 1,
          components: [{ ...ITEM_PARTIAL, quantity: 2 }],
        },
      ],
    }

    const adjustedTree = calculateTreeQuantity(7, recipeTree)
    expect(adjustedTree).toMatchSnapshot()
  })

  it('works with a complex real recipe', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      output: 1,
      components: [
        { ...ITEM_PARTIAL, quantity: 5 },
        { ...ITEM_PARTIAL, quantity: 5 },
        {
          ...RECIPE_PARTIAL,
          output: 5,
          quantity: 5,
          components: [
            { ...ITEM_PARTIAL, quantity: 25 },
            {
              ...RECIPE_PARTIAL,
              quantity: 10,
              output: 1,
              components: [{ ...ITEM_PARTIAL, quantity: 3 }],
            },
            {
              ...RECIPE_PARTIAL,
              quantity: 4,
              output: 1,
              components: [{ ...ITEM_PARTIAL, quantity: 2 }],
            },
          ],
        },
      ],
    }

    const adjustedTree = calculateTreeQuantity(2, recipeTree)
    expect(adjustedTree).toMatchSnapshot()
  })

  it('rounds correctly if the output is percentage based', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      quantity: 1,
      components: [{ ...ITEM_PARTIAL, quantity: 77, output: 0.31 }],
    }

    const adjustedTree = calculateTreeQuantity(1, recipeTree)
    expect(adjustedTree).toMatchSnapshot()
  })
})

describe('calculateTreeQuantity (used quantity)', () => {
  it('sets correct used quantity without available items', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      id: 1,
      quantity: 1,
      output: 1,
      components: [
        { ...ITEM_PARTIAL, id: 2, quantity: 1, output: 1 },
        { ...ITEM_PARTIAL, id: 3, quantity: 5, output: 1 },
      ],
    }
    const availableItems = {}

    expect(calculateTreeQuantity(1, recipeTree, availableItems)).toMatchSnapshot()
  })

  it('sets correct used quantity with available items', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      id: 1,
      quantity: 1,
      output: 1,
      components: [
        { ...ITEM_PARTIAL, id: 2, type: 'Currency', quantity: 100, output: 1 },
        { ...ITEM_PARTIAL, id: 2, quantity: 1, output: 1 },
        { ...ITEM_PARTIAL, id: 3, quantity: 5, output: 1 },
        { ...ITEM_PARTIAL, id: 3, quantity: 5, output: 1 },
        { ...ITEM_PARTIAL, id: 2, quantity: 1, output: 1 },
      ],
    }
    const availableItems = { 2: 2, 3: 2 }

    expect(calculateTreeQuantity(1, recipeTree, availableItems)).toMatchSnapshot()
    expect(availableItems).toEqual({ 2: 2, 3: 2 })
  })

  it("doesn't use tree components if the tree result is available or not crafted", () => {
    const recipeTree: RecipeTreeWithCraftFlags = {
      ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
      id: 1,
      quantity: 1,
      output: 1,
      components: [
        { ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 2, quantity: 1, output: 1 },
        {
          ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
          id: 3,
          quantity: 1,
          output: 1,
          components: [{ ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 4, quantity: 5, output: 1 }],
        },
        {
          ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
          id: 6,
          quantity: 1,
          output: 1,
          craft: false,
          components: [{ ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 4, quantity: 5, output: 1 }],
        },
        {
          ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
          id: 5,
          quantity: 1,
          output: 1,
          components: [{ ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 4, quantity: 5, output: 1 }],
        },
      ],
    }
    const availableItems = { 2: 3, 3: 1, 4: 5 }

    expect(calculateTreeQuantity(1, recipeTree, availableItems)).toMatchSnapshot()
  })

  it("doesn't use tree sub-components if the tree result is not crafted or available", () => {
    const recipeTree: RecipeTreeWithCraftFlags = {
      ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
      id: 1,
      quantity: 1,
      output: 1,
      components: [
        {
          ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
          id: 2,
          quantity: 1,
          output: 1,
          craft: false,
          components: [
            {
              ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
              id: 3,
              quantity: 5,
              output: 1,
              craft: true,
              components: [{ ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 4, quantity: 5, output: 1 }],
            },
          ],
        },
        {
          ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
          id: 99,
          quantity: 1,
          output: 1,
          components: [
            {
              ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
              id: 3,
              quantity: 5,
              output: 1,
              components: [{ ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 4, quantity: 5, output: 1 }],
            },
          ],
        },
        {
          ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
          id: 5,
          quantity: 1,
          output: 1,
          craft: true,
          components: [
            {
              ...RECIPE_PARTIAL_WITH_CRAFT_FLAGS,
              id: 6,
              quantity: 5,
              output: 1,
              craft: true,
              components: [{ ...ITEM_PARTIAL_WITH_CRAFT_FLAGS, id: 4, quantity: 5, output: 1 }],
            },
          ],
        },
      ],
    }
    const availableItems = { 99: 1000, 4: 20 }

    expect(calculateTreeQuantity(1, recipeTree, availableItems)).toMatchSnapshot()
  })

  it('does only craft part of the items if the tree result if partially available', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      id: 0,
      quantity: 1,
      output: 1,
      components: [
        {
          ...RECIPE_PARTIAL,
          id: 1,
          quantity: 1,
          output: 1,
          components: [{ ...ITEM_PARTIAL, id: 2, quantity: 1, output: 1 }],
        },
      ],
    }
    const availableItems = { 1: 5, 2: 3 }

    expect(calculateTreeQuantity(10, recipeTree, availableItems)).toMatchSnapshot()
  })

  it('always crafts the root node even if it is available', () => {
    const recipeTree: RecipeTree = {
      ...RECIPE_PARTIAL,
      id: 1,
      quantity: 1,
      output: 1,
    }
    const availableItems = { 1: 500 }

    expect(calculateTreeQuantity(1, recipeTree, availableItems)).toMatchSnapshot()
  })
})


text:
var HashDo = require('hashdo'),
  Utils = require('../lib/utils');

  isProduction = process.env.NODE_ENV === 'production',
  cardsDirectory = process.env.CARDS_DIRECTORY;

exports.post = function (req, res) {
  HashDo.card.secureInputs(req.params.pack, req.params.card, req.body, function (err, token) {
    if (!err) {
      Utils.respond(req, res, 200, token);
    }
    else {
      Utils.respond(req, res, 500, err);
    }
  });
};

exports.get = function (req, res) {
  var inputValues = req.query;

  if (inputValues) {
    inputValues.ipAddress = Utils.getIPAddress(req);
  }

  // input params
  var params = {
    url: req.url,
    directory: cardsDirectory,
    packName: req.params.pack,
    cardName: req.params.card,
    inputValues: inputValues
  };

  // callback
  var cb = function (err, html) {
    if (err) {
      Utils.respond(req, res, 200, '');
    }
    else {
      Utils.respond(req, res, 200, html);
    }
  };

  HashDo.card.generateCard(params, cb);
};


text:
@implementation UIView (LayoutMethods)

// coordinator getters
- (CGFloat)height
{
    return self.frame.size.height;
}

- (CGFloat)width
{
    return self.frame.size.width;
}

- (CGFloat)x
{
    return self.frame.origin.x;
}

- (void)setX:(CGFloat)x
{
    self.frame = CGRectMake(x, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
}

- (void)setY:(CGFloat)y
{
    self.frame = CGRectMake(self.frame.origin.x, y, self.frame.size.width, self.frame.size.height);
}

- (CGFloat)y
{
    return self.frame.origin.y;
}

- (CGSize)size
{
    return self.frame.size;
}

- (CGPoint)origin
{
    return self.frame.origin;
}

- (CGFloat)centerX
{
    return self.center.x;
}

- (CGFloat)centerY
{
    return self.center.y;
}

- (CGFloat)bottom
{
    return self.frame.size.height + self.frame.origin.y;
}

- (CGFloat)right
{
    return self.frame.size.width + self.frame.origin.x;
}

- (CGFloat)left
{
    return self.frame.origin.x;
}

- (void)setLeft:(CGFloat)left
{
    self.x = left;
}

- (void)setTop:(CGFloat)top
{
    self.y = top;
}

- (CGFloat)top
{
    return self.frame.origin.y;
}

// height
- (void)setHeight:(CGFloat)height
{
    CGRect newFrame = CGRectMake(self.x, self.y, self.width, height);
    self.frame = newFrame;
}

- (void)heightEqualToView:(UIView *)view
{
    self.height = view.height;
}

// width
- (void)setWidth:(CGFloat)width
{
    CGRect newFrame = CGRectMake(self.x, self.y, width, self.height);
    self.frame = newFrame;
}

- (void)widthEqualToView:(UIView *)view
{
    self.width = view.width;
}

// center
- (void)setCenterX:(CGFloat)centerX
{
    CGPoint center = CGPointMake(self.centerX, self.centerY);
    center.x = centerX;
    self.center = center;
}

- (void)setCenterY:(CGFloat)centerY
{
    CGPoint center = CGPointMake(self.centerX, self.centerY);
    center.y = centerY;
    self.center = center;
}

- (void)centerXEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
    CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
    self.centerX = centerPoint.x;
}

- (void)centerYEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
    CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
    self.centerY = centerPoint.y;
}

- (void)centerEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
    CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
    self.centerX = centerPoint.x;
    self.centerY = centerPoint.y;
}

// top, bottom, left, right -- Version 1.1.0
- (void)fromTheTop:(CGFloat)distance ofView:(UIView *)view
{
    [self bottom:distance FromView:view];
}

- (void)fromTheBottom:(CGFloat)distance ofView:(UIView *)view
{
    [self top:distance FromView:view];
}

- (void)fromTheLeft:(CGFloat)distance ofView:(UIView *)view
{
    [self left:distance FromView:view];
}

- (void)fromTheRight:(CGFloat)distance ofView:(UIView *)view
{
    [self right:distance FromView:view];
}

- (void)fromTheRelativeTop:(CGFloat)distance ofView:(UIView *)view screenType:(UIScreenType)screenType
{
    [self bottomRatio:distance FromView:view screenType:screenType];
}

- (void)fromTheRelativeBottom:(CGFloat)distance ofView:(UIView *)view screenType:(UIScreenType)screenType
{
    [self topRatio:distance FromView:view screenType:screenType];
}

- (void)fromTheRelativeLeft:(CGFloat)distance ofView:(UIView *)view screenType:(UIScreenType)screenType
{
    [self leftRatio:distance FromView:view screenType:screenType];
}

- (void)fromTheRelativeRight:(CGFloat)distance ofView:(UIView *)view screenType:(UIScreenType)screenType
{
    [self rightRatio:distance FromView:view screenType:screenType];
}

- (void)relativeTopInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    [self topRatioInContainer:top shouldResize:shouldResize screenType:screenType];
}

- (void)relativeBottomInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    [self bottomRatioInContainer:bottom shouldResize:shouldResize screenType:screenType];
}

- (void)relativeLeftInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    [self leftRatioInContainer:left shouldResize:shouldResize screenType:screenType];
}

- (void)relativeRightInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    [self rightRatioInContainer:right shouldResize:shouldResize screenType:screenType];
}

// top, bottom, left, right -- Old Version
- (void)top:(CGFloat)top FromView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.y = floorf(newOrigin.y + top + view.height);
}

- (void)bottom:(CGFloat)bottom FromView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.y = newOrigin.y - bottom - self.height;
}

- (void)left:(CGFloat)left FromView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.x = newOrigin.x - left - self.width;
}

- (void)right:(CGFloat)right FromView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.x = newOrigin.x + right + view.width;
}

- (void)topRatio:(CGFloat)top FromView:(UIView *)view screenType:(UIScreenType)screenType
{
    CGFloat topRatio = top / screenType;
    CGFloat topValue = topRatio * self.superview.width;
    [self top:topValue FromView:view];
}

- (void)bottomRatio:(CGFloat)bottom FromView:(UIView *)view screenType:(UIScreenType)screenType
{
    CGFloat bottomRatio = bottom / screenType;
    CGFloat bottomValue = bottomRatio * self.superview.width;
    [self bottom:bottomValue FromView:view];
}

- (void)leftRatio:(CGFloat)left FromView:(UIView *)view screenType:(UIScreenType)screenType
{
    CGFloat leftRatio = left / screenType;
    CGFloat leftValue = leftRatio * self.superview.width;
    [self left:leftValue FromView:view];
}

- (void)rightRatio:(CGFloat)right FromView:(UIView *)view screenType:(UIScreenType)screenType
{
    CGFloat rightRatio = right / screenType;
    CGFloat rightValue = rightRatio * self.superview.width;
    [self right:rightValue FromView:view];
}

- (void)topInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize
{
    if (shouldResize) {
        self.height = self.y - top + self.height;
    }
    self.y = top;
}

- (void)bottomInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize
{
    if (shouldResize) {
        self.height = self.superview.height - bottom - self.y;
    } else {
        self.y = self.superview.height - self.height - bottom;
    }
}

- (void)leftInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize
{
    if (shouldResize) {
        self.width = self.x - left + self.superview.width;
    }
    self.x = left;
}

- (void)rightInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize
{
    if (shouldResize) {
        self.width = self.superview.width - right - self.x;
    } else {
        self.x = self.superview.width - self.width - right;
    }
}

- (void)topRatioInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    CGFloat topRatio = top / screenType;
    CGFloat topValue = topRatio * self.superview.width;
    [self topInContainer:topValue shouldResize:shouldResize];
}

- (void)bottomRatioInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    CGFloat bottomRatio = bottom / screenType;
    CGFloat bottomValue = bottomRatio * self.superview.width;
    [self bottomInContainer:bottomValue shouldResize:shouldResize];
}

- (void)leftRatioInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    CGFloat leftRatio = left / screenType;
    CGFloat leftValue = leftRatio * self.superview.width;
    [self leftInContainer:leftValue shouldResize:shouldResize];
}

- (void)rightRatioInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize screenType:(UIScreenType)screenType
{
    CGFloat rightRatio = right / screenType;
    CGFloat rightValue = rightRatio * self.superview.width;
    [self rightInContainer:rightValue shouldResize:shouldResize];
}

- (void)topEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.y = newOrigin.y;
}

- (void)bottomEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.y = newOrigin.y + view.height - self.height;
}

- (void)leftEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.x = newOrigin.x;
}

- (void)rightEqualToView:(UIView *)view
{
    UIView *superView = view.superview ? view.superview : view;
    CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
    CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];

    self.x = newOrigin.x + view.width - self.width;
}

// size
- (void)setSize:(CGSize)size
{
    self.frame = CGRectMake(self.x, self.y, size.width, size.height);
}

- (void)setSize:(CGSize)size screenType:(UIScreenType)screenType
{
    CGFloat ratio = SCREEN_WIDTH / screenType;
    self.frame = CGRectMake(self.x, self.y, size.width * ratio, size.height * ratio);
}

- (void)sizeEqualToView:(UIView *)view
{
    self.frame = CGRectMake(self.x, self.y, view.width, view.height);
}

// imbueset
- (void)fillWidth
{
    self.width = self.superview.width;
    [self centerXEqualToView:self.superview];
}

- (void)fillHeight
{
    self.height = self.superview.height;
    [self centerYEqualToView:self.superview];
}

- (void)fill
{
    self.frame = CGRectMake(0, 0, self.superview.width, self.superview.height);
}

- (UIView *)topSuperView
{
    UIView *topSuperView = self.superview;

    if (topSuperView == nil) {
        topSuperView = self;
    } else {
        while (topSuperView.superview) {
            topSuperView = topSuperView.superview;
        }
    }

    return topSuperView;
}

@end


text:
#if !defined(XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680)
#define XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680

#include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp>

#include <map>

#if XERCES_VERSION_MAJOR >= 2
#include <xercesc/dom/deprecated/DOM_Node.hpp>
#else
#include <xercesc/dom/DOM_Node.hpp>
#endif

#include <xalanc/XercesParserLiaison/Deprecated/XercesDOM_NodeHack.hpp>

namespace XERCES_CPP_NAMESPACE
{
    class NodeImpl;
}

namespace XALAN_CPP_NAMESPACE {

class XalanNode;

/**
 * This class is deprecated.
 *
 * @deprecated This class works with the deprecated Xerces DOM bridge.
 */
class XALAN_XERCESPARSERLIAISON_EXPORT XercesToXalanNodeMap
{
public:

    typedef xercesc::DOM_Node     DOM_NodeType;
    typedef xercesc::NodeImpl     NodeImplType;

    typedef std::map<XalanNode*, NodeImplType*>     XalanNodeMapType;

    typedef std::map<NodeImplType*, XalanNode*>     XercesNodeMapType;

    XercesToXalanNodeMap();

    ~XercesToXalanNodeMap();

    void
    addAssociation(
            const DOM_NodeType&     theXercesNode,
            XalanNode*              theXalanNode);

    void
    clear();

    XalanNode*
    getNode(const DOM_NodeType&     theXercesNode) const
    {
        return getNode(XercesDOM_NodeHack::getImpl(theXercesNode));
    }

    XalanNode*
    getNode(NodeImplType*   theXercesNodeImpl) const
    {
        const XercesNodeMapType::const_iterator     i =
                m_xercesMap.find(theXercesNodeImpl);

        if (i == m_xercesMap.end())
        {
            return 0;
        }
        else
        {
            return (*i).second;
        }
    }

    DOM_NodeType
    getNode(const XalanNode*    theXalanNode) const
    {
        return XercesDOM_NodeHack(getNodeImpl(theXalanNode));
    }

    NodeImplType*
    getNodeImpl(const XalanNode*    theXalanNode) const;

    class NameMapEqualsFunctor
    {
    public:

        NameMapEqualsFunctor(const XalanNode*   theXalanNode) :
            m_value(theXalanNode)
        {
        }

        bool
        operator()(const XercesNodeMapType::value_type&     thePair) const
        {
            return m_value == thePair.second;
        }

    private:

        const XalanNode*    m_value;
    };

    NodeImplType*
    getNodeImpl(const DOM_NodeType&     theXercesNode) const
    {
        return XercesDOM_NodeHack::getImpl(theXercesNode);
    }

private:

    XalanNodeMapType    m_xalanMap;

    XercesNodeMapType   m_xercesMap;
};

}

#endif  // !defined(XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680)


text: Pin Reset


text:
package cfclient

import (
	"testing"

	. "github.com/smartystreets/goconvey/convey"
)

func TestListSpaceQuotas(t *testing.T) {
	Convey("List Space Quotas", t, func() {
		mocks := []MockRoute{
			{"GET", "/v2/space_quota_definitions", listSpaceQuotasPayloadPage1, "", 200, ""},
			{"GET", "/v2/space_quota_definitions_page_2", listSpaceQuotasPayloadPage2, "", 200, ""},
		}
		setupMultiple(mocks, t)
		defer teardown()
		c := &Config{
			ApiAddress: server.URL,
			Token:      "foobar",
		}
		client, err := NewClient(c)
		So(err, ShouldBeNil)

		spaceQuotas, err := client.ListSpaceQuotas()
		So(err, ShouldBeNil)

		So(len(spaceQuotas), ShouldEqual, 2)
		So(spaceQuotas[0].Guid, ShouldEqual, "889aa2ed-a883-4cc0-abe5-804b2503f15d")
		So(spaceQuotas[0].Name, ShouldEqual, "test-1")
		So(spaceQuotas[0].NonBasicServicesAllowed, ShouldEqual, true)
		So(spaceQuotas[0].TotalServices, ShouldEqual, -1)
		So(spaceQuotas[0].TotalRoutes, ShouldEqual, 100)
		So(spaceQuotas[0].MemoryLimit, ShouldEqual, 102400)
		So(spaceQuotas[0].InstanceMemoryLimit, ShouldEqual, -1)
		So(spaceQuotas[0].AppInstanceLimit, ShouldEqual, -1)
		So(spaceQuotas[0].AppTaskLimit, ShouldEqual, -1)
		So(spaceQuotas[0].TotalServiceKeys, ShouldEqual, -1)
		So(spaceQuotas[0].TotalReservedRoutePorts, ShouldEqual, -1)
	})
}

func TestGetSpaceQuotaByName(t *testing.T) {
	Convey("Get Space Quota By Name", t, func() {
		setup(MockRoute{"GET", "/v2/space_quota_definitions", listSpaceQuotasPayloadPage2, "", 200, "q=name:test-2"}, t)
		defer teardown()
		c := &Config{
			ApiAddress: server.URL,
			Token:      "foobar",
		}
		client, err := NewClient(c)
		So(err, ShouldBeNil)

		spaceQuota, err := client.GetSpaceQuotaByName("test-2")
		So(err, ShouldBeNil)

		So(spaceQuota.Guid, ShouldEqual, "9ffd7c5c-d83c-4786-b399-b7bd54883977")
		So(spaceQuota.Name, ShouldEqual, "test-2")
		So(spaceQuota.NonBasicServicesAllowed, ShouldEqual, false)
		So(spaceQuota.TotalServices, ShouldEqual, 10)
		So(spaceQuota.TotalRoutes, ShouldEqual, 20)
		So(spaceQuota.MemoryLimit, ShouldEqual, 30)
		So(spaceQuota.InstanceMemoryLimit, ShouldEqual, 40)
		So(spaceQuota.AppInstanceLimit, ShouldEqual, 50)
		So(spaceQuota.AppTaskLimit, ShouldEqual, 60)
		So(spaceQuota.TotalServiceKeys, ShouldEqual, 70)
		So(spaceQuota.TotalReservedRoutePorts, ShouldEqual, 80)
	})
}