text:
package com.guangtai.model.domain;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "reservation", schema = "guangtai", catalog = "")
public class Reservation {
    private int id;
    private Integer visitorid;
    private Integer intervieweeid;
    private String reason;
    private String retinue;
    private String belongings;
    private String transport;
    private String replacement;
    private String visitornumber;
    private String ordertime;
    private String interviewtime;
    private String cometime;
    private String leavetime;
    private Integer operatorid;
    private String operatetime;
    private Integer state;
    private String remark;

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "visitorid", nullable = true)
    public Integer getVisitorid() {
        return visitorid;
    }

    public void setVisitorid(Integer visitorid) {
        this.visitorid = visitorid;
    }

    @Basic
    @Column(name = "intervieweeid", nullable = true)
    public Integer getIntervieweeid() {
        return intervieweeid;
    }

    public void setIntervieweeid(Integer intervieweeid) {
        this.intervieweeid = intervieweeid;
    }

    @Basic
    @Column(name = "reason", nullable = true, length = 2000)
    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @Basic
    @Column(name = "retinue", nullable = true, length = 200)
    public String getRetinue() {
        return retinue;
    }

    public void setRetinue(String retinue) {
        this.retinue = retinue;
    }

    @Basic
    @Column(name = "belongings", nullable = true, length = 200)
    public String getBelongings() {
        return belongings;
    }

    public void setBelongings(String belongings) {
        this.belongings = belongings;
    }

    @Basic
    @Column(name = "transport", nullable = true, length = 50)
    public String getTransport() {
        return transport;
    }

    public void setTransport(String transport) {
        this.transport = transport;
    }

    @Basic
    @Column(name = "replacement", nullable = true, length = 50)
    public String getReplacement() {
        return replacement;
    }

    public void setReplacement(String replacement) {
        this.replacement = replacement;
    }

    @Basic
    @Column(name = "visitornumber", nullable = true, length = 50)
    public String getVisitornumber() {
        return visitornumber;
    }

    public void setVisitornumber(String visitornumber) {
        this.visitornumber = visitornumber;
    }

    @Basic
    @Column(name = "ordertime", nullable = true)
    public String getOrdertime() {
        return ordertime;
    }

    public void setOrdertime(String ordertime) {
        this.ordertime = ordertime;
    }

    @Basic
    @Column(name = "interviewtime", nullable = true)
    public String getInterviewtime() {
        return interviewtime;
    }

    public void setInterviewtime(String interviewtime) {
        this.interviewtime = interviewtime;
    }

    @Basic
    @Column(name = "cometime", nullable = true)
    public String getCometime() {
        return cometime;
    }

    public void setCometime(String cometime) {
        this.cometime = cometime;
    }

    @Basic
    @Column(name = "leavetime", nullable = true)
    public String getLeavetime() {
        return leavetime;
    }

    public void setLeavetime(String leavetime) {
        this.leavetime = leavetime;
    }

    @Basic
    @Column(name = "operatorid", nullable = true)
    public Integer getOperatorid() {
        return operatorid;
    }

    public void setOperatorid(Integer operatorid) {
        this.operatorid = operatorid;
    }

    @Basic
    @Column(name = "operatetime", nullable = true)
    public String getOperatetime() {
        return operatetime;
    }

    public void setOperatetime(String operatetime) {
        this.operatetime = operatetime;
    }

    @Basic
    @Column(name = "state", nullable = true)
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    @Basic
    @Column(name = "remark", nullable = true, length = 2000)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Reservation that = (Reservation) o;

        if (id != that.id) return false;
        if (visitorid != null ? !visitorid.equals(that.visitorid) : that.visitorid != null) return false;
        if (intervieweeid != null ? !intervieweeid.equals(that.intervieweeid) : that.intervieweeid != null)
            return false;
        if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
        if (retinue != null ? !retinue.equals(that.retinue) : that.retinue != null) return false;
        if (belongings != null ? !belongings.equals(that.belongings) : that.belongings != null) return false;
        if (transport != null ? !transport.equals(that.transport) : that.transport != null) return false;
        if (replacement != null ? !replacement.equals(that.replacement) : that.replacement != null) return false;
        if (visitornumber != null ? !visitornumber.equals(that.visitornumber) : that.visitornumber != null)
            return false;
        if (ordertime != null ? !ordertime.equals(that.ordertime) : that.ordertime != null) return false;
        if (interviewtime != null ? !interviewtime.equals(that.interviewtime) : that.interviewtime != null)
            return false;
        if (cometime != null ? !cometime.equals(that.cometime) : that.cometime != null) return false;
        if (leavetime != null ? !leavetime.equals(that.leavetime) : that.leavetime != null) return false;
        if (operatorid != null ? !operatorid.equals(that.operatorid) : that.operatorid != null) return false;
        if (operatetime != null ? !operatetime.equals(that.operatetime) : that.operatetime != null) return false;
        if (state != null ? !state.equals(that.state) : that.state != null) return false;
        if (remark != null ? !remark.equals(that.remark) : that.remark != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (visitorid != null ? visitorid.hashCode() : 0);
        result = 31 * result + (intervieweeid != null ? intervieweeid.hashCode() : 0);
        result = 31 * result + (reason != null ? reason.hashCode() : 0);
        result = 31 * result + (retinue != null ? retinue.hashCode() : 0);
        result = 31 * result + (belongings != null ? belongings.hashCode() : 0);
        result = 31 * result + (transport != null ? transport.hashCode() : 0);
        result = 31 * result + (replacement != null ? replacement.hashCode() : 0);
        result = 31 * result + (visitornumber != null ? visitornumber.hashCode() : 0);
        result = 31 * result + (ordertime != null ? ordertime.hashCode() : 0);
        result = 31 * result + (interviewtime != null ? interviewtime.hashCode() : 0);
        result = 31 * result + (cometime != null ? cometime.hashCode() : 0);
        result = 31 * result + (leavetime != null ? leavetime.hashCode() : 0);
        result = 31 * result + (operatorid != null ? operatorid.hashCode() : 0);
        result = 31 * result + (operatetime != null ? operatetime.hashCode() : 0);
        result = 31 * result + (state != null ? state.hashCode() : 0);
        result = 31 * result + (remark != null ? remark.hashCode() : 0);
        return result;
    }
}


text:
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using System;
using Perspex.Styling;

namespace Perspex.Controls
{
    public class UserControl : ContentControl, IStyleable
    {
        Type IStyleable.StyleKey => typeof(ContentControl);
    }
}

redpajama_set_name: RedPajamaGithub


text:
import fs from "fs";
import LocalReleaseUploader from "./local/release";
import AmazonReleaseUploader from "./amazon/release";
import AzureReleaseUploader from "./azure/release";
import OpenstackReleaseUploader from "./openstack/release";

export default class ReleaseUploader {
    constructor(config) {
        switch (config.storage) {
            case "local":
                this.uploader = new LocalReleaseUploader(config.local.directory);
                break;

            case "amazon":
                this.uploader = new AmazonReleaseUploader(config.amazon.key, config.amazon.secret, config.amazon.region);
                break;

            case "azure":
                this.uploader = new AzureReleaseUploader(config.azure.account, config.azure.key);
                break;

            case "openstack":
                this.uploader = new OpenstackReleaseUploader(config.openstack.username, config.openstack.password, config.openstack.auth_url, config.openstack.region);
                break;
        }
    }

    async upload(app, release, file) {
        if (file.readable === false) {
            file = fs.createReadStream(file.path);
        }

        return this.uploader.upload(app, release, file);
    }

    async remove(app, release) {
        return this.uploader.remove(app, release);
    }
}


text:
package com.example.gsyvideoplayer.utils;

import android.view.View;
import android.view.ViewGroup;

/**
 * Created by shuyu on 2016/11/11.
 */

public class CommonUtil {

    public static void setViewHeight(View view, int width, int height) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (null == layoutParams)
            return;
        layoutParams.width = width;
        layoutParams.height = height;
        view.setLayoutParams(layoutParams);
    }

}


text:
#region License

#endregion License

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;

namespace JsonFx.Json
{
	/// <summary>
	/// Utility for forcing conversion between types
	/// </summary>
	internal class TypeCoercionUtility
	{
		#region Constants

		private const string ErrorNullValueType = "{0} does not accept null as a value";
		private const string ErrorDefaultCtor = "Only objects with default constructors can be deserialized. ({0})";
		private const string ErrorCannotInstantiate = "Interfaces, Abstract classes, and unsupported ValueTypes cannot be deserialized. ({0})";

		#endregion Constants

		#region Fields

		private Dictionary<Type, Dictionary<string, MemberInfo>> memberMapCache;
		private bool allowNullValueTypes = true;

		#endregion Fields

		#region Properties

		private Dictionary<Type, Dictionary<string, MemberInfo>> MemberMapCache
		{
			get
			{
				if (this.memberMapCache == null)
				{
					// instantiate space for cache
					this.memberMapCache = new Dictionary<Type, Dictionary<string, MemberInfo>>();
				}
				return this.memberMapCache;
			}
		}

		/// <summary>
		/// Gets and sets if ValueTypes can accept values of null
		/// </summary>
		/// <remarks>
		/// Only affects deserialization: if a ValueType is assigned the
		/// value of null, it will receive the value default(TheType).
		/// Setting this to false, throws an exception if null is
		/// specified for a ValueType member.
		/// </remarks>
		public bool AllowNullValueTypes
		{
			get { return this.allowNullValueTypes; }
			set { this.allowNullValueTypes = value; }
		}

		#endregion Properties

		#region Object Methods

		/// <summary>
		/// If a Type Hint is present then this method attempts to
		/// use it and move any previously parsed data over.
		/// </summary>
		/// <param name="result">the previous result</param>
		/// <param name="typeInfo">the type info string to use</param>
		/// <param name="objectType">reference to the objectType</param>
		/// <param name="memberMap">reference to the memberMap</param>
		/// <returns></returns>
		internal object ProcessTypeHint(
			IDictionary result,
			string typeInfo,
			out Type objectType,
			out Dictionary<string, MemberInfo> memberMap)
		{
			if (String.IsNullOrEmpty(typeInfo))
			{
				objectType = null;
				memberMap = null;
				return result;
			}

			Type hintedType = Type.GetType(typeInfo, false);
			if (hintedType == null)
			{
				objectType = null;
				memberMap = null;
				return result;
			}

			objectType = hintedType;
			return this.CoerceType(hintedType, result, out memberMap);
		}

		internal Object InstantiateObject(Type objectType, out Dictionary<string, MemberInfo> memberMap)
		{
			if (objectType.IsInterface || objectType.IsAbstract || objectType.IsValueType)
			{
				throw new JsonTypeCoercionException(
					String.Format(TypeCoercionUtility.ErrorCannotInstantiate, objectType.FullName));
			}

			ConstructorInfo ctor = objectType.GetConstructor(Type.EmptyTypes);
			if (ctor == null)
			{
				throw new JsonTypeCoercionException(
					String.Format(TypeCoercionUtility.ErrorDefaultCtor, objectType.FullName));
			}
			Object result;
			try
			{
				// always try-catch Invoke() to expose real exception
				result = ctor.Invoke(null);
			}
			catch (TargetInvocationException ex)
			{
				if (ex.InnerException != null)
				{
					throw new JsonTypeCoercionException(ex.InnerException.Message, ex.InnerException);
				}
				throw new JsonTypeCoercionException("Error instantiating " + objectType.FullName, ex);
			}

			// don't incurr the cost of member map for dictionaries
			if (typeof(IDictionary).IsAssignableFrom(objectType))
			{
				memberMap = null;
			}
			else
			{
				memberMap = this.CreateMemberMap(objectType);
			}
			return result;
		}

		private Dictionary<string, MemberInfo> CreateMemberMap(Type objectType)
		{
			if (this.MemberMapCache.ContainsKey(objectType))
			{
				// map was stored in cache
				return this.MemberMapCache[objectType];
			}

			// create a new map
			Dictionary<string, MemberInfo> memberMap = new Dictionary<string, MemberInfo>();

			// load properties into property map
			PropertyInfo[] properties = objectType.GetProperties();
			foreach (PropertyInfo info in properties)
			{
				if (!info.CanRead || !info.CanWrite)
				{
					continue;
				}

				if (JsonIgnoreAttribute.IsJsonIgnore(info))
				{
					continue;
				}

				string jsonName = JsonNameAttribute.GetJsonName(info);
				if (String.IsNullOrEmpty(jsonName))
				{
					memberMap[info.Name] = info;
				}
				else
				{
					memberMap[jsonName] = info;
				}
			}

			// load public fields into property map
			FieldInfo[] fields = objectType.GetFields();
			foreach (FieldInfo info in fields)
			{
				if (!info.IsPublic)
				{
					continue;
				}

				if (JsonIgnoreAttribute.IsJsonIgnore(info))
				{
					continue;
				}

				string jsonName = JsonNameAttribute.GetJsonName(info);
				if (String.IsNullOrEmpty(jsonName))
				{
					memberMap[info.Name] = info;
				}
				else
				{
					memberMap[jsonName] = info;
				}
			}

			// store in cache for repeated usage
			this.MemberMapCache[objectType] = memberMap;

			return memberMap;
		}

		internal static Type GetMemberInfo(
			Dictionary<string, MemberInfo> memberMap,
			string memberName,
			out MemberInfo memberInfo)
		{
			if (memberMap != null &&
				memberMap.ContainsKey(memberName))
			{
				// Check properties for object member
				memberInfo = memberMap[memberName];

				if (memberInfo is PropertyInfo)
				{
					// maps to public property
					return ((PropertyInfo)memberInfo).PropertyType;
				}
				else if (memberInfo is FieldInfo)
				{
					// maps to public field
					return ((FieldInfo)memberInfo).FieldType;
				}
			}

			memberInfo = null;
			return null;
		}

		/// <summary>
		/// Helper method to set value of either property or field
		/// </summary>
		/// <param name="result"></param>
		/// <param name="memberType"></param>
		/// <param name="memberInfo"></param>
		/// <param name="value"></param>
		internal void SetMemberValue(Object result, Type memberType, MemberInfo memberInfo, object value)
		{
			if (memberInfo is PropertyInfo)
			{
				// set value of public property
				((PropertyInfo)memberInfo).SetValue(
					result,
					this.CoerceType(memberType, value),
					null);
			}
			else if (memberInfo is FieldInfo)
			{
				// set value of public field
				((FieldInfo)memberInfo).SetValue(
					result,
					this.CoerceType(memberType, value));
			}

			// all other values are ignored
		}

		#endregion Object Methods

		#region Type Methods

		internal object CoerceType(Type targetType, object value)
		{
			bool isNullable = TypeCoercionUtility.IsNullable(targetType);
			if (value == null)
			{
				if (!allowNullValueTypes &&
					targetType.IsValueType &&
					!isNullable)
				{
					throw new JsonTypeCoercionException(String.Format(TypeCoercionUtility.ErrorNullValueType, targetType.FullName));
				}
				return value;
			}

			if (isNullable)
			{
				// nullable types have a real underlying struct
				Type[] genericArgs = targetType.GetGenericArguments();
				if (genericArgs.Length == 1)
				{
					targetType = genericArgs[0];
				}
			}

			Type actualType = value.GetType();
			if (targetType.IsAssignableFrom(actualType))
			{
				return value;
			}

			if (targetType.IsEnum)
			{
				if (value is String)
				{
					if (!Enum.IsDefined(targetType, value))
					{
						// if isn't a defined value perhaps it is the JsonName
						foreach (FieldInfo field in targetType.GetFields())
						{
							string jsonName = JsonNameAttribute.GetJsonName(field);
							if (((string)value).Equals(jsonName))
							{
								value = field.Name;
								break;
							}
						}
					}

					return Enum.Parse(targetType, (string)value);
				}
				else
				{
					value = this.CoerceType(Enum.GetUnderlyingType(targetType), value);
					return Enum.ToObject(targetType, value);
				}
			}

			if (value is IDictionary)
			{
				Dictionary<string, MemberInfo> memberMap;
				return this.CoerceType(targetType, (IDictionary)value, out memberMap);
			}

			if (typeof(IEnumerable).IsAssignableFrom(targetType) &&
				typeof(IEnumerable).IsAssignableFrom(actualType))
			{
				return this.CoerceList(targetType, actualType, (IEnumerable)value);
			}

			if (value is String)
			{
				if (targetType == typeof(DateTime))
				{
					DateTime date;
					if (DateTime.TryParse(
						(string)value,
						DateTimeFormatInfo.InvariantInfo,
						DateTimeStyles.RoundtripKind | DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.NoCurrentDateDefault,
						out date))
					{
						return date;
					}
				}
				else if (targetType == typeof(Guid))
				{
					// try-catch is pointless since will throw upon generic conversion
					return new Guid((string)value);
				}
				else if (targetType == typeof(Char))
				{
					if (((string)value).Length == 1)
					{
						return ((string)value)[0];
					}
				}
				else if (targetType == typeof(Uri))
				{
					Uri uri;
					if (Uri.TryCreate((string)value, UriKind.RelativeOrAbsolute, out uri))
					{
						return uri;
					}
				}
				else if (targetType == typeof(Version))
				{
					// try-catch is pointless since will throw upon generic conversion
					return new Version((string)value);
				}
			}
			else if (targetType == typeof(TimeSpan))
			{
				return new TimeSpan((long)this.CoerceType(typeof(Int64), value));
			}

			TypeConverter converter = TypeDescriptor.GetConverter(targetType);
			if (converter.CanConvertFrom(actualType))
			{
				return converter.ConvertFrom(value);
			}

			converter = TypeDescriptor.GetConverter(actualType);
			if (converter.CanConvertTo(targetType))
			{
				return converter.ConvertTo(value, targetType);
			}

			try
			{
				// fall back to basics
				return Convert.ChangeType(value, targetType);
			}
			catch (Exception ex)
			{
				throw new JsonTypeCoercionException(
					String.Format("Error converting {0} to {1}", value.GetType().FullName, targetType.FullName), ex);
			}
		}

		private object CoerceType(Type targetType, IDictionary value, out Dictionary<string, MemberInfo> memberMap)
		{
			object newValue = this.InstantiateObject(targetType, out memberMap);
			if (memberMap != null)
			{
				// copy any values into new object
				foreach (object key in value.Keys)
				{
					MemberInfo memberInfo;
					Type memberType = TypeCoercionUtility.GetMemberInfo(memberMap, key as String, out memberInfo);
					this.SetMemberValue(newValue, memberType, memberInfo, value[key]);
				}
			}
			return newValue;
		}

		private object CoerceList(Type targetType, Type arrayType, IEnumerable value)
		{
			if (targetType.IsArray)
			{
				return this.CoerceArray(targetType.GetElementType(), value);
			}

			// targetType serializes as a JSON array but is not an array
			// assume is an ICollection / IEnumerable with AddRange, Add,
			// or custom Constructor with which we can populate it

			// many ICollection types take an IEnumerable or ICollection
			// as a constructor argument.  look through constructors for
			// a compatible match.
			ConstructorInfo[] ctors = targetType.GetConstructors();
			ConstructorInfo defaultCtor = null;
			foreach (ConstructorInfo ctor in ctors)
			{
				ParameterInfo[] paramList = ctor.GetParameters();
				if (paramList.Length == 0)
				{
					// save for in case cannot find closer match
					defaultCtor = ctor;
					continue;
				}

				if (paramList.Length == 1 &&
					paramList[0].ParameterType.IsAssignableFrom(arrayType))
				{
					try
					{
						// invoke first constructor that can take this value as an argument
						return ctor.Invoke(
								new object[] { value }
							);
					}
					catch
					{
						// there might exist a better match
						continue;
					}
				}
			}

			if (defaultCtor == null)
			{
				throw new JsonTypeCoercionException(
					String.Format(TypeCoercionUtility.ErrorDefaultCtor, targetType.FullName));
			}
			object collection;
			try
			{
				// always try-catch Invoke() to expose real exception
				collection = defaultCtor.Invoke(null);
			}
			catch (TargetInvocationException ex)
			{
				if (ex.InnerException != null)
				{
					throw new JsonTypeCoercionException(ex.InnerException.Message, ex.InnerException);
				}
				throw new JsonTypeCoercionException("Error instantiating " + targetType.FullName, ex);
			}

			// many ICollection types have an AddRange method
			// which adds all items at once
			MethodInfo method = targetType.GetMethod("AddRange");
			ParameterInfo[] parameters = (method == null) ?
					null : method.GetParameters();
			Type paramType = (parameters == null || parameters.Length != 1) ?
					null : parameters[0].ParameterType;
			if (paramType != null &&
				paramType.IsAssignableFrom(arrayType))
			{
				try
				{
					// always try-catch Invoke() to expose real exception
					// add all members in one method
					method.Invoke(
						collection,
						new object[] { value });
				}
				catch (TargetInvocationException ex)
				{
					if (ex.InnerException != null)
					{
						throw new JsonTypeCoercionException(ex.InnerException.Message, ex.InnerException);
					}
					throw new JsonTypeCoercionException("Error calling AddRange on " + targetType.FullName, ex);
				}
				return collection;
			}
			else
			{
				// many ICollection types have an Add method
				// which adds items one at a time
				method = targetType.GetMethod("Add");
				parameters = (method == null) ?
						null : method.GetParameters();
				paramType = (parameters == null || parameters.Length != 1) ?
						null : parameters[0].ParameterType;
				if (paramType != null)
				{
					// loop through adding items to collection
					foreach (object item in value)
					{
						try
						{
							// always try-catch Invoke() to expose real exception
							method.Invoke(
								collection,
								new object[] {
								this.CoerceType(paramType, item)
							});
						}
						catch (TargetInvocationException ex)
						{
							if (ex.InnerException != null)
							{
								throw new JsonTypeCoercionException(ex.InnerException.Message, ex.InnerException);
							}
							throw new JsonTypeCoercionException("Error calling Add on " + targetType.FullName, ex);
						}
					}
					return collection;
				}
			}

			try
			{
				// fall back to basics
				return Convert.ChangeType(value, targetType);
			}
			catch (Exception ex)
			{
				throw new JsonTypeCoercionException(String.Format("Error converting {0} to {1}", value.GetType().FullName, targetType.FullName), ex);
			}
		}

		private Array CoerceArray(Type elementType, IEnumerable value)
		{
			ArrayList target = new ArrayList();

			foreach (object item in value)
			{
				target.Add(this.CoerceType(elementType, item));
			}

			return target.ToArray(elementType);
		}

		private static bool IsNullable(Type type)
		{
			return type.IsGenericType && (typeof(Nullable<>) == type.GetGenericTypeDefinition());
		}

		#endregion Type Methods
	}
}


text:
// This file is automatically generated.

package adila.db;

/*
 * Siragon Siragon SP-5000
 *
 * DEVICE: SP-5000
 * MODEL: Siragon SP-5000
 */
final class sp2d5000_siragon20sp2d5000 {
    public static final String DATA = "Siragon|Siragon SP-5000|";
}


text:
<?php
namespace Produto;

class Module{
    public function getConfig(){
        return include __DIR__ . '/config/module.config.php';
    }

    public function getAutoloaderConfig(){
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getServiceConfig(){
        return array(
              'factories' => array(
        	       "Produto\Service\TipoService" => function($sm){
        	           return new Service\TipoService($sm->get('Doctrine\ORM\EntityManager')) ;
        	       },
        	       "Produto\Service\ProdutoService" => function($sm){
        	       	return new Service\ProdutoService($sm->get('Doctrine\ORM\EntityManager')) ;
        	       },
        	       "Produto\Form\ProdutoForm" => function($sm){
            	       	$em = $sm->get('Doctrine\ORM\EntityManager');
            	       	$repoTipos = $em->getRepository('Produto\Entity\TipoEntity');
            	       	$tipos = $repoTipos->buscaTipo();

            	       	return new Form\ProdutoForm("produtoform", $tipos);
        	       },
            )
        );
    }
}


text:
<?xml version="1.0" encoding="ASCII"?>
<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdo="commonj.sdo"
    xmlns:sdo_1="http://www.apache.org/tuscany/2005/SDO" xmlns:simple="http://www.example.com/simple">
  <changeSummary xmlns=""
      logging="false">
    <objectChanges key="#//@eRootObject">
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="symbol" set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="companyName" set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="price" set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="open1" set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="high" set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="low" set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="volume" dataValue="0.0"
          set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="change1" dataValue="0.0"
          set="false"/>
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="quotes" set="false"/>
    </objectChanges>
  </changeSummary>
  <simple:Quote>
    <symbol>fbnt</symbol>
    <companyName>FlyByNightTechnology</companyName>
    <price>1000.0</price>
    <open1>1000.0</open1>
    <high>1000.0</high>
    <low>1000.0</low>
    <volume>1000.0</volume>
    <change1>1000.0</change1>
    <quotes>
      <price>2000.0</price>
    </quotes>
  </simple:Quote>
</sdo:datagraph>


text:
using System;
using System.Collections;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "a Monstrous Interred Grizzle corpse" )]
	public class MonstrousInterredGrizzle : BaseCreature
	{
		[Constructable]
		public MonstrousInterredGrizzle() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a monstrous interred grizzle";
			Body = 0x103;
			BaseSoundID = 589;

			SetStr( 1198, 1207 );
			SetDex( 127, 135 );
			SetInt( 595, 646 );

			SetHits( 50000 );

			SetDamage( 27, 31 );

			SetDamageType( ResistanceType.Physical, 60 );
			SetDamageType( ResistanceType.Fire, 20 );
			SetDamageType( ResistanceType.Energy, 20 );

			SetResistance( ResistanceType.Physical, 48, 52 );
			SetResistance( ResistanceType.Fire, 77, 82 );
			SetResistance( ResistanceType.Cold, 56, 61 );
			SetResistance( ResistanceType.Poison, 32, 40 );
			SetResistance( ResistanceType.Energy, 69, 71 );

			SetSkill( SkillName.Wrestling, 112.6, 116.9 );
			SetSkill( SkillName.Tactics, 118.5, 119.2 );
			SetSkill( SkillName.MagicResist, 120 );
			SetSkill( SkillName.Anatomy, 111.0, 111.7 );
			SetSkill( SkillName.Magery, 100.0 );
			SetSkill( SkillName.EvalInt, 100 );
			SetSkill( SkillName.Meditation, 100 );

			Fame = 24000;
			Karma = -24000;

			VirtualArmor = 80;
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.AosSuperBoss, 8 );
		}

		public override int Meat{ get{ return 1; } }
		public override int TreasureMapLevel{ get{ return 5; } }

		public void DrainLife()
		{
			ArrayList list = new ArrayList();

			foreach ( Mobile m in this.GetMobilesInRange( 10 ) )
			{
				if ( m == this || !CanBeHarmful( m ) )
					continue;

				if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) )
					list.Add( m );
				else if ( m.Player )
					list.Add( m );
			}

			foreach ( Mobile m in list )
			{
				DoHarmful( m );

				m.FixedParticles( 0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist );
				m.PlaySound( 0x231 );

				m.SendMessage( "Your Life is Mine to feed on!" );

				int toDrain = Utility.RandomMinMax( 10, 40 );

				Hits += toDrain;
				m.Damage( toDrain, this );
			}
		}

		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( 0.1 >= Utility.RandomDouble() )
				DrainLife();
		}

		public override void OnGotMeleeAttack( Mobile attacker )
		{
			base.OnGotMeleeAttack( attacker );

			if ( 0.1 >= Utility.RandomDouble() )
				DrainLife();
		}

		public MonstrousInterredGrizzle( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}


text:
import assign from 'object-assign';

const m = function (...args: Array<Object>) {
  let res = {};
  for (let i = 0; i < args.length; ++i) {
    if (args[i]) assign(res, args[i]);
  }
  return res;
};

export default m;


text:
require 'test_helper'

class UserMoviesControllerTest < ActionController::TestCase
  setup do
    @user_movie = user_movies(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:user_movies)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create user_movie" do
    assert_difference('UserMovie.count') do
      post :create, user_movie: { response: @user_movie.response }
    end

    assert_redirected_to user_movie_path(assigns(:user_movie))
  end

  test "should show user_movie" do
    get :show, id: @user_movie
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @user_movie
    assert_response :success
  end

  test "should update user_movie" do
    put :update, id: @user_movie, user_movie: { response: @user_movie.response }
    assert_redirected_to user_movie_path(assigns(:user_movie))
  end

  test "should destroy user_movie" do
    assert_difference('UserMovie.count', -1) do
      delete :destroy, id: @user_movie
    end

    assert_redirected_to user_movies_path
  end
end


text:
package edu.neu.nutrons.reboundrumble;

import edu.neu.nutrons.lib.DualButton;
import edu.neu.nutrons.lib.ReverseButton;
import edu.neu.nutrons.lib.Utils;
import edu.neu.nutrons.reboundrumble.commands.CommandBase;
import edu.neu.nutrons.reboundrumble.commands.drivetrain.DTManualCheesyCmd;
import edu.neu.nutrons.reboundrumble.commands.drivetrain.DTManualCreepToTargetCmd;
import edu.neu.nutrons.reboundrumble.commands.elevator.*;
import edu.neu.nutrons.reboundrumble.commands.intake.IntakeSetCmd;
import edu.neu.nutrons.reboundrumble.commands.shifter.ShifterStaticCmd;
import edu.neu.nutrons.reboundrumble.commands.shooter.ShooterDeltaPowerCmd;
import edu.neu.nutrons.reboundrumble.commands.shooter.ShooterDeltaRateCmd;
import edu.neu.nutrons.reboundrumble.commands.shooter.ShooterSetPowerCmd;
import edu.neu.nutrons.reboundrumble.subsystems.Shifter;
import edu.neu.nutrons.reboundrumble.subsystems.Shooter;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO.EnhancedIOException;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.DigitalIOButton;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.command.StartCommand;

/**
 * Contains physical operator interface buttons and joysticks and links buttons
 * to commands.
 *
 * @author Ziv
 */
public class OI {

    // Constants.
    private final double CAM_JS_SCALE = 0.125;
    private final double PAD_DEADBAND = 0.1;

    // Driver.
    private Joystick driverPad = new Joystick(RobotMap.PAD_DRIVER);
    private DriverStationEnhancedIO io = DriverStation.getInstance().getEnhancedIO();
    private Button shift = new ReverseButton(new DigitalIOButton(1));
    private Button manOverride = new ReverseButton(new DigitalIOButton(1));

    // Operator.
    private Joystick opPad = new Joystick(RobotMap.PAD_OPERATOR);
    private Button manualMode = new JoystickButton(opPad, 9);
    private Button prepareFender = new JoystickButton(opPad, 4);
    private DualButton prepareFenderMan = new DualButton(prepareFender, manualMode);
    private Button prepareFenderAuto = prepareFenderMan.button1;
    private Button prepareKey = new JoystickButton(opPad, 3);
    private DualButton prepareKeyMan = new DualButton(prepareKey, manualMode);
    private Button prepareKeyAuto = prepareKeyMan.button1;
    private Button shooterPlus = new JoystickButton(opPad, 1);
    private Button shooterMinus = new JoystickButton(opPad, 2);
    private DualButton shooterPlusMan = new DualButton(shooterPlus, manualMode);
    private DualButton shooterMinusMan = new DualButton(shooterMinus, manualMode);
    private Button shooterPlusAuto = shooterPlusMan.button1;
    private Button shooterMinusAuto = shooterMinusMan.button1;
    private Button shooterZero = new JoystickButton(opPad, 10);
    private Button elevHopper = new JoystickButton(opPad, 5);
    private DualButton intakeDrop = new DualButton(new JoystickButton(opPad, 7), elevHopper);
    private Button elevShoot = new JoystickButton(opPad, 6);
    private DualButton elevSuperintake = new DualButton(elevShoot, elevHopper);
    private Button elevShootOnly = elevSuperintake.button1;
    private Button elevHopperOnly = elevSuperintake.button2;
    private DualButton elevShootAuto = new DualButton(elevShootOnly, manualMode);
    private Button elevShootMan = elevShootAuto.button1;
    private Button elevSpit = new JoystickButton(opPad, 8);
    public final AutoModeSelector ams = new AutoModeSelector(opPad);
    private Button autoAim = new JoystickButton(opPad, 11);

    public OI(){
        // Driver.
        // When shift is held, go into the non-default gear.
        shift.whileHeld(new ShifterStaticCmd(!Shifter.DEFAULT));
        //driverIntake.whileHeld(new IntakeSetCmd(true, true));
        manOverride.whenPressed(new StartCommand(new DTManualCheesyCmd()));

        // Operator.
        autoAim.whileHeld(new DTManualCreepToTargetCmd());
        prepareFenderAuto.whenPressed(CommandBase.prepareFenderCmd());
        prepareFenderMan.whenPressed(CommandBase.prepareFenderCmd(true));
        prepareFender.whileHeld(new ElevatorHopperCmd());
        prepareKeyAuto.whenPressed(CommandBase.prepareKeyCmd());
        prepareKeyMan.whenPressed(CommandBase.prepareKeyCmd(true));
        prepareKey.whileHeld(new ElevatorHopperCmd());
        shooterPlusAuto.whenPressed(new StartCommand(new ShooterDeltaRateCmd(Shooter.MANUAL_RATE_INC)));
        shooterMinusAuto.whenPressed(new StartCommand(new ShooterDeltaRateCmd(-Shooter.MANUAL_RATE_INC)));
        shooterPlusMan.whenPressed(new StartCommand(new ShooterDeltaPowerCmd(Shooter.MANUAL_POWER_INC)));
        shooterMinusMan.whenPressed(new StartCommand(new ShooterDeltaPowerCmd(-Shooter.MANUAL_POWER_INC)));
        shooterZero.whenPressed(new ShooterSetPowerCmd(0));
        elevHopperOnly.whileHeld(new ElevatorHopperCmd());
        // While we suck balls into the hopper, run the front intake whenever we
        // drop it down.
        // Otherwise, don't run the front intake when we drop it down.
        intakeDrop.button1.whileHeld(new IntakeSetCmd(true, false));
        intakeDrop.whileHeld(new IntakeSetCmd(true, true));
        elevShootAuto.whileHeld(new ElevatorShooterUntilShotCmd());
        elevShootMan.whileHeld(new ElevatorShooterCmd());
        elevSuperintake.whileHeld(new ElevatorSuperintakeCmd());
        elevSpit.whileHeld(new ElevatorSpitCmd());
    }

    private double capAndBand(double value) {
        value = Utils.deadband(value, .075, -1);
        value = Utils.deadband(value, .075, 0);
        value = Utils.deadband(value, .075, 1);
        return Utils.limit(value, -1, 1);
    }

    private double scaleAnalog(double voltageIn) {
        double normalized = (2 * voltageIn / 3.25) - 1;
        return normalized;
    }

    private double getIOAnalog(int port) {
        double in;
        try {
            in = io.getAnalogIn(port);
        }
        catch(EnhancedIOException ex) {
            return 0;
        }
        double refined = capAndBand(scaleAnalog(in));
        return refined;
    }

    private boolean getIODigital(int port) {
        boolean in = false;
        try {
            in = !io.getDigital(port); //active low
        }
        catch(EnhancedIOException ex) {
        }
        return in;
    }

    // On driverPad.
    public double getDriveLeft() {
        return -Utils.deadband(driverPad.getRawAxis(2), PAD_DEADBAND, 0);
    }

    public double getDriveRight() {
        return -Utils.deadband(driverPad.getRawAxis(4), PAD_DEADBAND, 0);
    }

    public double getDriveThrottle() {
        //return -Utils.deadband(driverPad.getRawAxis(2), PAD_DEADBAND, 0);
        return getIOAnalog(1);
    }

    public double getDriveWheel() {
        //return Utils.deadband(driverPad.getRawAxis(3), PAD_DEADBAND, 0);
        return getIOAnalog(5);
    }

    public boolean getDriveQuickTurn() {
        //return driverPad.getRawButton(6);
        return getIODigital(3);
    }

    // On opPad.
    public double getCamDelta() {
        return CAM_JS_SCALE * Utils.deadband(-opPad.getRawAxis(4), 2*PAD_DEADBAND, 0);
    }
}


text:
package gui;

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.awt.Dimension;

import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JToolBar;

@SuppressWarnings("serial")
class CalendarFrame extends JFrame implements ActionListener{

	private Calendar calendarRootComponent;

	// get language index for Japanese or English
	int japLangIdx, enLangIdx;

	private JMenuBar calendarMenuBar = null;

	private JMenu jMenuView = null;
	private JCheckBoxMenuItem viewNBest = null;
	private JCheckBoxMenuItem viewHistory = null;

	private javax.swing.JMenu jMenuLanguage = null;
	private javax.swing.ButtonGroup jButtonGroupLanguage = null ;
	private javax.swing.JRadioButtonMenuItem enLang = null;
	private javax.swing.JRadioButtonMenuItem japLang = null;

	private JMenu jMenuHelp = null;
	private JMenuItem jMenuItemHelpAbout = null;

	/**
	 * This method initializes
	 *
	 */
	public CalendarFrame() {
		super();
		initialize();
		japLangIdx = calendarRootComponent.getApplicationState().getLanguage().getLanguageIndex("Japanese");
		enLangIdx = calendarRootComponent.getApplicationState().getLanguage().getLanguageIndex("English");

	}

	/**
	 * This method initializes
	 *
	 */
	public CalendarFrame(Calendar rootComp, String frameTitle) {
		super(frameTitle);
		calendarRootComponent = rootComp;

		initialize();
		japLangIdx = calendarRootComponent.getApplicationState().getLanguage().getLanguageIndex("Japanese");
		enLangIdx = calendarRootComponent.getApplicationState().getLanguage().getLanguageIndex("English");

	}

	/**
	 * This method initializes this
	 *
	 */
	private void initialize() {

        this.setSize(new Dimension(524, 488));
		// Create the menu bar
        this.setTitle("Calendar Regulus Application");
        this.setJMenuBar(getCalendarMenuBar());
	}

	public void actionPerformed( ActionEvent event )
	{
		System.out.println( event );
	}

	/**
	 * This method initializes calendarMenuBar
	 *
	 * @return javax.swing.JMenuBar
	 */
	private JMenuBar getCalendarMenuBar() {
		if (calendarMenuBar == null) {
			calendarMenuBar = new JMenuBar();

			calendarMenuBar.add(getJMenuView());
			calendarMenuBar.add(getJMenuLanguage());
			calendarMenuBar.add(getJMenuHelp());
		}
		return calendarMenuBar;
	}

	/**
	 * This method initializes jMenuView
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getJMenuView() {
		if (jMenuView == null) {
			jMenuView = new JMenu();
			jMenuView.setText("View");
			jMenuView.add(getViewHistory());
			jMenuView.add(getViewNBest());
			jMenuView.addSeparator();
		}
		return jMenuView;
	}

	/**
	 * This method initializes jMenuLanguage
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getJMenuLanguage() {
		if (jMenuLanguage == null) {
			jMenuLanguage = new JMenu();
			jMenuLanguage.setText("Language");

			enLang = getEnglishRadioButton();
			japLang = getJapaneseRadioButton();

			// jMenuLanguage.addSeparator();

			jButtonGroupLanguage = getJButtonGroupLanguage();
			jMenuLanguage.add(enLang);
			jMenuLanguage.add(japLang);

		}
		return jMenuLanguage;
	}

	/**
	 * This method initializes jMenuLanguage
	 *
	 * @return javax.swing.JMenu
	 */
	private javax.swing.ButtonGroup getJButtonGroupLanguage() {
		if ( jButtonGroupLanguage == null){
			jButtonGroupLanguage = new ButtonGroup();
			jButtonGroupLanguage.add(getEnglishRadioButton());
			jButtonGroupLanguage.add(getJapaneseRadioButton());
		};
		return jButtonGroupLanguage;
	}

	/**
	 * This method initializes communication in English
	 *
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButtonMenuItem getEnglishRadioButton() {
		if (enLang == null) {
			enLang = new JRadioButtonMenuItem();
			enLang.setText("English");
			String language = calendarRootComponent.getApplicationState().getLanguage().getLanguageName();
			System.out.println("Language selected : " + language);

			if (language.contains("English")){
				enLang.setSelected(true);
				System.out.println("English = true ");
			}
			else
				enLang.setSelected(false);
			enLang.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
			    	// TODO
					calendarRootComponent.reconfigureToChangeLanguage(enLangIdx);

					calendarRootComponent.validateCalendarPanel();
			    	calendarRootComponent.repaintCalendarPanel();
				}
			});
		}
		return enLang;
	}

	/**
	 * This method initializes communication in Japanese
	 *
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButtonMenuItem getJapaneseRadioButton() {
		if (japLang == null) {
			japLang = new JRadioButtonMenuItem();
			japLang.setText("Japanese");
			// get old language name
			String language = calendarRootComponent.getApplicationState().getLanguage().getLanguageName();
			System.out.println("Language selected : " + language);
			if (language.contains("Japanese"))
				japLang.setSelected(true);
			else
				japLang.setSelected(false);
			japLang.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					calendarRootComponent.reconfigureToChangeLanguage(japLangIdx);
			    	calendarRootComponent.validateCalendarPanel();
			    	calendarRootComponent.repaintCalendarPanel();
				}
			});
		}
		return japLang;
	}

	/**
	 * This method initializes viewNBest
	 *
	 * @return javax.swing.JCheckBoxMenuItem
	 */
	private JCheckBoxMenuItem getViewNBest() {
		if (viewNBest == null) {
			viewNBest = new JCheckBoxMenuItem();
			viewNBest.setText("Raw Recognition Result");
			viewNBest.setMnemonic(KeyEvent.VK_N);
			viewNBest.setSelected(true);
			viewNBest.setVisible(true);
			viewNBest.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
			    	calendarRootComponent.setNBestShowing(viewNBest.isSelected());
			    	calendarRootComponent.validateCalendarPanel();
			    	calendarRootComponent.repaintCalendarPanel();

				}
			});
		}
		return viewNBest;
	}

	/**
	 * This method initializes viewHistory
	 *
	 * @return javax.swing.JCheckBoxMenuItem
	 */
	private JCheckBoxMenuItem getViewHistory() {
		if (viewHistory == null) {
			viewHistory = new JCheckBoxMenuItem();
			viewHistory.setMnemonic(KeyEvent.VK_H);
			viewHistory.setText("Show Dialogue History");
			viewHistory.setSelected(true);
			viewHistory.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
			    	calendarRootComponent.setHistoryShowing(viewHistory.isSelected());
			    	calendarRootComponent.validateCalendarPanel();
			    	calendarRootComponent.repaintCalendarPanel();
				}
			});
		}
		return viewHistory;
	}

	/**
	 * This method initializes jMenuHelp
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getJMenuHelp() {
		if (jMenuHelp == null) {
			jMenuHelp = new JMenu();
			jMenuHelp.setText("Help");
			jMenuHelp.setMnemonic(KeyEvent.VK_HELP);
			jMenuHelp.add(getJMenuItemHelpAbout());
			jMenuHelp.addSeparator();
		}
		return jMenuHelp;
	}

	/**
	 * This method initializes jMenuItemHelpAbout
	 *
	 * @return javax.swing.JMenuItem
	 */
	private JMenuItem getJMenuItemHelpAbout() {
		if (jMenuItemHelpAbout == null) {
			jMenuItemHelpAbout = new JMenuItem();
			jMenuItemHelpAbout.setText("About Calendar Application ");
		}
		return jMenuItemHelpAbout;
	}

	public static void main(String args[]){
		// createSwingComponents();
		CalendarFrame calendarFrame = new CalendarFrame();
		calendarFrame.setVisible(true);
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"


text:
<?php

namespace ZendTest\Filter;

use Zend\Filter\HtmlEntities as HtmlEntitiesFilter;

/**
 * @category   Zend
 * @package    Zend_Filter
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Filter
 */
class HtmlEntitiesTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Zend_Filter_HtmlEntities object
     *
     * @var Zend_Filter_HtmlEntities
     */
    protected $_filter;

    /**
     * Creates a new Zend_Filter_HtmlEntities object for each test method
     *
     * @return void
     */
    public function setUp()
    {
        $this->_filter = new HtmlEntitiesFilter();
    }

    /**
     * Ensures that the filter follows expected behavior
     *
     * @return void
     */
    public function testBasic()
    {
        $valuesExpected = array(
            'string' => 'string',
            '<'      => '<',
            '>'      => '>',
            '\''     => '\'',
            '"'      => '"',
            '&'      => '&'
            );
        $filter = $this->_filter;
        foreach ($valuesExpected as $input => $output) {
            $this->assertEquals($output, $filter($input));
        }
    }

    /**
     * Ensures that getQuoteStyle() returns expected default value
     *
     * @return void
     */
    public function testGetQuoteStyle()
    {
        $this->assertEquals(ENT_COMPAT, $this->_filter->getQuoteStyle());
    }

    /**
     * Ensures that setQuoteStyle() follows expected behavior
     *
     * @return void
     */
    public function testSetQuoteStyle()
    {
        $this->_filter->setQuoteStyle(ENT_QUOTES);
        $this->assertEquals(ENT_QUOTES, $this->_filter->getQuoteStyle());
    }

    /**
     * Ensures that getCharSet() returns expected default value
     *
     * @group ZF-8715
     * @return void
     */
    public function testGetCharSet()
    {
        $this->assertEquals('UTF-8', $this->_filter->getCharSet());
    }

    /**
     * Ensures that setCharSet() follows expected behavior
     *
     * @return void
     */
    public function testSetCharSet()
    {
        $this->_filter->setCharSet('UTF-8');
        $this->assertEquals('UTF-8', $this->_filter->getCharSet());
    }

    /**
     * Ensures that getDoubleQuote() returns expected default value
     *
     * @return void
     */
    public function testGetDoubleQuote()
    {
        $this->assertEquals(true, $this->_filter->getDoubleQuote());
    }

    /**
     * Ensures that setDoubleQuote() follows expected behavior
     *
     * @return void
     */
    public function testSetDoubleQuote()
    {
        $this->_filter->setDoubleQuote(false);
        $this->assertEquals(false, $this->_filter->getDoubleQuote());
    }

    /**
     * Ensure that fluent interfaces are supported
     *
     * @group ZF-3172
     */
    public function testFluentInterface()
    {
        $instance = $this->_filter->setCharSet('UTF-8')->setQuoteStyle(ENT_QUOTES)->setDoubleQuote(false);
        $this->assertTrue($instance instanceof HtmlEntitiesFilter);
    }

    /**
     * @group ZF-8995
     */
    public function testConfigObject()
    {
        $options = array('quotestyle' => 5, 'encoding' => 'ISO-8859-1');
        $config  = new \Zend\Config\Config($options);

        $filter = new HtmlEntitiesFilter(
            $config
        );

        $this->assertEquals('ISO-8859-1', $filter->getEncoding());
        $this->assertEquals(5, $filter->getQuoteStyle());
    }

    /**
     * Ensures that when ENT_QUOTES is set, the filtered value has both 'single' and "double" quotes encoded
     *
     * @group  ZF-8962
     * @return void
     */
    public function testQuoteStyleQuotesEncodeBoth()
    {
        $input  = "A 'single' and " . '"double"';
        $result = 'A 'single' and "double"';

        $this->_filter->setQuoteStyle(ENT_QUOTES);
        $this->assertEquals($result, $this->_filter->filter($input));
    }

    /**
     * Ensures that when ENT_COMPAT is set, the filtered value has only "double" quotes encoded
     *
     * @group  ZF-8962
     * @return void
     */
    public function testQuoteStyleQuotesEncodeDouble()
    {
        $input  = "A 'single' and " . '"double"';
        $result = "A 'single' and "double"";

        $this->_filter->setQuoteStyle(ENT_COMPAT);
        $this->assertEquals($result, $this->_filter->filter($input));
    }

    /**
     * Ensures that when ENT_NOQUOTES is set, the filtered value leaves both "double" and 'single' quotes un-altered
     *
     * @group  ZF-8962
     * @return void
     */
    public function testQuoteStyleQuotesEncodeNone()
    {
        $input  = "A 'single' and " . '"double"';
        $result = "A 'single' and " . '"double"';

        $this->_filter->setQuoteStyle(ENT_NOQUOTES);
        $this->assertEquals($result, $this->_filter->filter($input));
    }
}


text:
var searchData=
[
  ['find_2ddevice',['find-device',['../namespacefind-device.html',1,'']]],
  ['find_2dflow',['find-flow',['../namespacefind-flow.html',1,'']]],
  ['find_2dhost',['find-host',['../namespacefind-host.html',1,'']]],
  ['find_2dlink',['find-link',['../namespacefind-link.html',1,'']]],
  ['find_2dlink_2din_2dcluster',['find-link-in-cluster',['../namespacefind-link-in-cluster.html',1,'']]],
  ['find_2dtopo_2dinfrastructure',['find-topo-infrastructure',['../namespacefind-topo-infrastructure.html',1,'']]],
  ['flow_2dtester',['flow-tester',['../namespaceflow-tester.html',1,'']]],
  ['fractal',['fractal',['../namespacefractal.html',1,'']]]
];


text:
typedef void (^PresentToPublishVc)(void);

@interface ZJTabBar : UITabBar

@property (nonatomic,copy) PresentToPublishVc block;

@end


text:
package com.intellij.util.lang;

import com.intellij.openapi.util.text.StringHash;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.BloomFilterBase;
import com.intellij.util.io.DataInputOutputUtil;
import gnu.trove.TIntHashSet;
import gnu.trove.TLongHashSet;
import gnu.trove.TLongProcedure;
import org.jetbrains.annotations.Nullable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @author max
 */
public class ClasspathCache {
  static final int NUMBER_OF_ACCESSES_FOR_LAZY_CACHING = 1000;
  private final IntObjectHashMap myResourcePackagesCache = new IntObjectHashMap();
  private final IntObjectHashMap myClassPackagesCache = new IntObjectHashMap();

  private static final double PROBABILITY = 0.005d;

  static class LoaderData {
    private final int[] myResourcePackageHashes;
    private final int[] myClassPackageHashes;
    private final NameFilter myNameFilter;

    LoaderData(int[] resourcePackageHashes, int[] classPackageHashes, NameFilter nameFilter) {
      myResourcePackageHashes = resourcePackageHashes;
      myClassPackageHashes = classPackageHashes;
      myNameFilter = nameFilter;
    }

    LoaderData(DataInput dataInput) throws IOException {
      this(readIntList(dataInput), readIntList(dataInput), new ClasspathCache.NameFilter(dataInput));
    }

    private static int[] readIntList(DataInput reader) throws IOException {
      int numberOfElements = DataInputOutputUtil.readINT(reader);
      int[] ints = new int[numberOfElements];
      for(int i = 0; i < numberOfElements; ++i) ints[i] = (DataInputOutputUtil.readINT(reader));
      return ints;
    }

    void save(DataOutput dataOutput) throws IOException {
      writeIntArray(dataOutput, myResourcePackageHashes);
      writeIntArray(dataOutput, myClassPackageHashes);
      myNameFilter.save(dataOutput);
    }

    private static void writeIntArray(DataOutput writer, int[] hashes) throws IOException {
      DataInputOutputUtil.writeINT(writer, hashes.length);
      for(int hash: hashes) DataInputOutputUtil.writeINT(writer, hash);
    }

    NameFilter getNameFilter() {
      return myNameFilter;
    }
  }

  static class LoaderDataBuilder {
    private final TLongHashSet myUsedNameFingerprints = new TLongHashSet();
    private final TIntHashSet myResourcePackageHashes = new TIntHashSet();
    private final TIntHashSet myClassPackageHashes = new TIntHashSet();

    LoaderDataBuilder() {}

    void addPossiblyDuplicateNameEntry(String name) {
      name = transformName(name);
      myUsedNameFingerprints.add(NameFilter.toNameFingerprint(name));
    }

    void addResourcePackageFromName(String path) {
      myResourcePackageHashes.add(getPackageNameHash(path));
    }

    void addClassPackageFromName(String path) {
      myClassPackageHashes.add(getPackageNameHash(path));
    }

    LoaderData build() {
      int uniques = myUsedNameFingerprints.size();
      if (uniques > 20000) {
        uniques += (int)(uniques * 0.03d); // allow some growth for Idea main loader
      }
      final NameFilter nameFilter = new NameFilter(uniques, PROBABILITY);
      myUsedNameFingerprints.forEach(new TLongProcedure() {
        @Override
        public boolean execute(long value) {
          nameFilter.addNameFingerprint(value);
          return true;
        }
      });

      return new ClasspathCache.LoaderData(myResourcePackageHashes.toArray(), myClassPackageHashes.toArray(), nameFilter);
    }
  }

  private final ReadWriteLock myLock = new ReentrantReadWriteLock();

  public void applyLoaderData(LoaderData loaderData, final Loader loader) {
    myLock.writeLock().lock();
    try {
      for(int resourcePackageHash:loaderData.myResourcePackageHashes) {
        addResourceEntry(resourcePackageHash, myResourcePackagesCache, loader);
      }

      for(int classPackageHash:loaderData.myClassPackageHashes) {
        addResourceEntry(classPackageHash, myClassPackagesCache, loader);
      }

      loader.applyData(loaderData);
    } finally {
      myLock.writeLock().unlock();
    }
  }

  abstract static class LoaderIterator <ResultType, ParameterType, ParameterType2> {
    @Nullable
    abstract ResultType process(Loader loader, ParameterType parameter, ParameterType2 parameter2, String shortName);
  }

  @Nullable <ResultType, ParameterType, ParameterType2> ResultType iterateLoaders(
    String resourcePath,
    LoaderIterator<ResultType, ParameterType, ParameterType2> iterator,
    ParameterType parameter,
    ParameterType2 parameter2,
    String shortName) {
    Object o;

    myLock.readLock().lock();
    try {
      IntObjectHashMap map = resourcePath.endsWith(UrlClassLoader.CLASS_EXTENSION) ?
                                      myClassPackagesCache : myResourcePackagesCache;

      o = map.get(getPackageNameHash(resourcePath));
    }
    finally {
      myLock.readLock().unlock();
    }

    if (o == null) return null;
    if (o instanceof Loader) return iterator.process((Loader)o, parameter, parameter2, shortName);
    Loader[] loaders = (Loader[])o;
    for(Loader l:loaders) {
      ResultType result = iterator.process(l, parameter, parameter2, shortName);
      if (result != null) return result;
    }
    return null;
  }

  static int getPackageNameHash(String resourcePath) {
    final int idx = resourcePath.lastIndexOf('/');
    return StringUtil.stringHashCode(resourcePath, 0, idx);
  }

  private static void addResourceEntry(int hash, IntObjectHashMap map, Loader loader) {
    Object o = map.get(hash);
    if (o == null) map.put(hash, loader);
    else if (o instanceof Loader) {
      if (ClassPath.ourLogTiming) assert loader != o;
      map.put(hash, new Loader [] {(Loader)o, loader});
    } else {
      Loader[] loadersArray = (Loader[])o;
      if (ClassPath.ourLogTiming)  assert !ArrayUtil.contains(loader, loadersArray);
      map.put(hash, ArrayUtil.append(loadersArray, loader));
    }
  }

  static String transformName(String name) {
    name = StringUtil.trimEnd(name, "/");
    name = name.substring(name.lastIndexOf('/') + 1);

    if (name.endsWith(UrlClassLoader.CLASS_EXTENSION)) {
      String name1 = name;
      int $ = name1.indexOf('$');
      if ($ != -1) name1 = name1.substring(0, $);
      else {
        int index = name1.lastIndexOf('.');
        if (index >= 0) name1 = name1.substring(0, index);
      }
      name = name1;
    }
    return name;
  }

  static class NameFilter extends BloomFilterBase {
    private static final int SEED = 31;

    protected NameFilter(int _maxElementCount, double probability) {
      super(_maxElementCount, probability);
    }

    protected NameFilter(DataInput input) throws IOException {
      super(input);
    }

    private void addNameFingerprint(long nameFingerprint) {
      int hash = (int)(nameFingerprint >> 32);
      int hash2 = (int)nameFingerprint;
      addIt(hash, hash2);
    }

    boolean maybeContains(String name) {
      int hash = name.hashCode();
      int hash2 = StringHash.murmur(name, SEED);
      return maybeContains(hash, hash2);
    }

    @Override
    protected void save(DataOutput output) throws IOException {
      super.save(output);
    }

    private static long toNameFingerprint(String name) {
      int hash = name.hashCode();
      int hash2 = StringHash.murmur(name, SEED);
      return ((long)hash << 32) | (hash2 & 0xFFFFFFFFL);
    }
  }
}


text:
<?php

namespace Aws\S3\Exception;

/**
 * You must specify the Anonymous role.
 */
class InvalidAddressingHeaderException extends S3Exception {}


text:
package org.drools.examples.carinsurance.domain.policy;

import java.math.BigDecimal;
import java.util.List;

import org.drools.examples.carinsurance.domain.Car;
import org.drools.examples.carinsurance.domain.Driver;

public class Policy {

    private Car car;
    private Driver owner;
    private List<Coverage> coverageList;

    private BigDecimal totalPremium;

    // ############################################################################
    // Non getters and setters
    // ############################################################################

}


text:
using NodaTime.Calendars;
using NodaTime.Globalization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;

namespace NodaTime.Text.Patterns
{
    /// <summary>
    /// Common methods used when parsing dates - these are used from both LocalDateTimePatternParser
    /// and LocalDatePatternParser.
    /// </summary>
    internal static class DatePatternHelper
    {
        /// <summary>
        /// Creates a character handler for the year-of-era specifier (y).
        /// </summary>
        internal static CharacterHandler<TResult, TBucket> CreateYearOfEraHandler<TResult, TBucket>
            (Func<TResult, int> yearGetter, Action<TBucket, int> setter)
            where TBucket : ParseBucket<TResult>
        {
            return (pattern, builder) =>
            {
                int count = pattern.GetRepeatCount(4);
                builder.AddField(PatternFields.YearOfEra, pattern.Current);
                switch (count)
                {
                    case 2:
                        builder.AddParseValueAction(2, 2, 'y', 0, 99, setter);
                        // Force the year into the range 0-99.
                        builder.AddFormatLeftPad(2, value => ((yearGetter(value) % 100) + 100) % 100,
                            assumeNonNegative: true,
                            assumeFitsInCount: true);
                        // Just remember that we've set this particular field. We can't set it twice as we've already got the YearOfEra flag set.
                        builder.AddField(PatternFields.YearTwoDigits, pattern.Current);
                        break;
                    case 4:
                        // Left-pad to 4 digits when formatting; parse exactly 4 digits.
                        builder.AddParseValueAction(4, 4, 'y', 1, 9999, setter);
                        builder.AddFormatLeftPad(4, yearGetter,
                            assumeNonNegative: false,
                            assumeFitsInCount: true);
                        break;
                    default:
                        throw new InvalidPatternException(TextErrorMessages.InvalidRepeatCount, pattern.Current, count);
                }
            };
        }

        /// <summary>
        /// Creates a character handler for the month-of-year specifier (M).
        /// </summary>
        internal static CharacterHandler<TResult, TBucket> CreateMonthOfYearHandler<TResult, TBucket>
            (Func<TResult, int> numberGetter, Action<TBucket, int> textSetter, Action<TBucket, int> numberSetter)
            where TBucket : ParseBucket<TResult>
        {
            return (pattern, builder) =>
            {
                int count = pattern.GetRepeatCount(4);
                PatternFields field;
                switch (count)
                {
                    case 1:
                    case 2:
                        field = PatternFields.MonthOfYearNumeric;
                        // Handle real maximum value in the bucket
                        builder.AddParseValueAction(count, 2, pattern.Current, 1, 99, numberSetter);
                        builder.AddFormatLeftPad(count, numberGetter, assumeNonNegative: true, assumeFitsInCount: count == 2);
                        break;
                    case 3:
                    case 4:
                        field = PatternFields.MonthOfYearText;
                        var format = builder.FormatInfo;
                        IReadOnlyList<string> nonGenitiveTextValues = count == 3 ? format.ShortMonthNames : format.LongMonthNames;
                        IReadOnlyList<string> genitiveTextValues = count == 3 ? format.ShortMonthGenitiveNames : format.LongMonthGenitiveNames;
                        if (nonGenitiveTextValues == genitiveTextValues)
                        {
                            builder.AddParseLongestTextAction(pattern.Current, textSetter, format.CompareInfo, nonGenitiveTextValues);
                        }
                        else
                        {
                            builder.AddParseLongestTextAction(pattern.Current, textSetter, format.CompareInfo,
                                                              genitiveTextValues, nonGenitiveTextValues);
                        }

                        // Hack: see below
                        builder.AddFormatAction(new MonthFormatActionHolder<TResult, TBucket>(format, count, numberGetter).DummyMethod);
                        break;
                    default:
                        throw new InvalidOperationException("Invalid count!");
                }
                builder.AddField(field, pattern.Current);
            };
        }

        // Hacky way of building an action which depends on the final set of pattern fields to determine whether to format a month
        // using the genitive form or not.
        private sealed class MonthFormatActionHolder<TResult, TBucket> : SteppedPatternBuilder<TResult, TBucket>.IPostPatternParseFormatAction
            where TBucket : ParseBucket<TResult>
        {
            private readonly int count;
            private readonly NodaFormatInfo formatInfo;
            private readonly Func<TResult, int> getter;

            internal MonthFormatActionHolder(NodaFormatInfo formatInfo, int count, Func<TResult, int> getter)
            {
                this.count = count;
                this.formatInfo = formatInfo;
                this.getter = getter;
            }

            [ExcludeFromCodeCoverage]
            internal void DummyMethod(TResult value, StringBuilder builder)
            {
                // This method is never called. We use it to create a delegate with a target that implements
                // IPostPatternParseFormatAction. There's no test for this throwing.
                throw new InvalidOperationException("This method should never be called");
            }

            public Action<TResult, StringBuilder> BuildFormatAction(PatternFields finalFields)
            {
                bool genitive = (finalFields & PatternFields.DayOfMonth) != 0;
                IReadOnlyList<string> textValues = count == 3
                    ? (genitive ? formatInfo.ShortMonthGenitiveNames : formatInfo.ShortMonthNames)
                    : (genitive ? formatInfo.LongMonthGenitiveNames : formatInfo.LongMonthNames);
                return (value, sb) => sb.Append(textValues[getter(value)]);
            }
        }

        /// <summary>
        /// Creates a character handler for the day specifier (d).
        /// </summary>
        internal static CharacterHandler<TResult, TBucket> CreateDayHandler<TResult, TBucket>
            (Func<TResult, int> dayOfMonthGetter, Func<TResult, int> dayOfWeekGetter,
             Action<TBucket, int> dayOfMonthSetter, Action<TBucket, int> dayOfWeekSetter)
            where TBucket : ParseBucket<TResult>
        {
            return (pattern, builder) =>
            {
                int count = pattern.GetRepeatCount(4);
                PatternFields field;
                switch (count)
                {
                    case 1:
                    case 2:
                        field = PatternFields.DayOfMonth;
                        // Handle real maximum value in the bucket
                        builder.AddParseValueAction(count, 2, pattern.Current, 1, 99, dayOfMonthSetter);
                        builder.AddFormatLeftPad(count, dayOfMonthGetter, assumeNonNegative: true, assumeFitsInCount: count == 2);
                        break;
                    case 3:
                    case 4:
                        field = PatternFields.DayOfWeek;
                        var format = builder.FormatInfo;
                        IReadOnlyList<string> textValues = count == 3 ? format.ShortDayNames : format.LongDayNames;
                        builder.AddParseLongestTextAction(pattern.Current, dayOfWeekSetter, format.CompareInfo, textValues);
                        builder.AddFormatAction((value, sb) => sb.Append(textValues[dayOfWeekGetter(value)]));
                        break;
                    default:
                        throw new InvalidOperationException("Invalid count!");
                }
                builder.AddField(field, pattern.Current);
            };
        }

        /// <summary>
        /// Creates a character handler for the era specifier (g).
        /// </summary>
        internal static CharacterHandler<TResult, TBucket> CreateEraHandler<TResult, TBucket>
            (Func<TResult, Era> eraFromValue, Func<TBucket, LocalDatePatternParser.LocalDateParseBucket> dateBucketFromBucket)
            where TBucket : ParseBucket<TResult>
        {
            return (pattern, builder) =>
            {
                pattern.GetRepeatCount(2);
                builder.AddField(PatternFields.Era, pattern.Current);
                var formatInfo = builder.FormatInfo;
                // Note: currently the count is ignored. More work needed to determine whether abbreviated era names should be used for just "g".
                builder.AddParseAction((cursor, bucket) =>
                {
                    var dateBucket = dateBucketFromBucket(bucket);
                    return dateBucket.ParseEra<TResult>(formatInfo, cursor);
                });
                builder.AddFormatAction((value, sb) => sb.Append(formatInfo.GetEraPrimaryName(eraFromValue(value))));
            };
        }

        /// <summary>
        /// Creates a character handler for the calendar specifier (c).
        /// </summary>
        internal static CharacterHandler<TResult, TBucket> CreateCalendarHandler<TResult, TBucket>
            (Func<TResult, CalendarSystem> getter, Action<TBucket, CalendarSystem> setter)
            where TBucket : ParseBucket<TResult>
        {
            return (pattern, builder) =>
            {
                builder.AddField(PatternFields.Calendar, pattern.Current);

                builder.AddParseAction((cursor, bucket) =>
                {
                    foreach (var id in CalendarSystem.Ids)
                    {
                        if (cursor.Match(id))
                        {
                            setter(bucket, CalendarSystem.ForId(id));
                            return null;
                        }
                    }
                    return ParseResult<TResult>.NoMatchingCalendarSystem(cursor);
                });
                builder.AddFormatAction((value, sb) => sb.Append(getter(value).Id));
            };
        }
    }
}


text:
package com.antsoft.yecai.model;

import lombok.Data;

/**
 * Created by ant on 2015/10/1.
 */
@Data
public class GoodsPaymentRecord {
    private String userId;
    private String goodsKey;
    private long amount;
}


text:
package org.apereo.cas.digest;

import org.apereo.cas.authentication.credential.BasicIdentifiableCredential;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * This is {@link DigestCredential}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@ToString(callSuper = true)
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class DigestCredential extends BasicIdentifiableCredential {

    private static final long serialVersionUID = 1523693794392289803L;

    private String realm;

    private String hash;

    /**
     * Instantiates a new Basic identifiable credential.
     *
     * @param id    the id
     * @param realm the realm
     * @param hash  the hash
     */
    @JsonCreator
    public DigestCredential(@JsonProperty("id") final String id,
                            @JsonProperty("realm") final String realm,
                            @JsonProperty("hash") final String hash) {
        super(id);
        this.realm = realm;
        this.hash = hash;
    }

}


text:
<?php

namespace Joli\Jane\OpenApi\Client;

@trigger_error('Resource is deprecated since 1.3 and will be removed in 2.0, please use Joli\Jane\OpenApi\Runtime\Client\Resource instead.', E_USER_DEPRECATED);

/**
 * @deprecated Resource is deprecated since 1.3 and will be removed in 2.0, please use Joli\Jane\OpenApi\Runtime\Client\Resource instead.
 */
class Resource extends \Joli\Jane\OpenApi\Runtime\Client\Resource
{
}


text:
package de.free_creations.midiutil;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.sound.midi.*;
import static org.junit.Assert.*;
import org.junit.*;

/**
 *
 * @author Harald Postner <Harald at H-Postner.de>
 */
public class MidiUtilTest {

  public MidiUtilTest() {
  }

  @BeforeClass
  public static void setUpClass() throws Exception {
  }

  @AfterClass
  public static void tearDownClass() throws Exception {
  }

  @Before
  public void setUp() {
  }

  @After
  public void tearDown() {
  }

  @Test
  public void testReadTrackname() throws InvalidMidiDataException, IOException {
    //it is allowed to pass a null pointer
    assertEquals("", MidiUtil.readTrackname(null));

    // now let's verify on a real case
    System.out.println("TestReadTrackname(). ");
    URL midiUrl = this.getClass().getResource("resources/GoodNightLadies.midi");
    Sequence sequence = MidiSystem.getSequence(midiUrl);

    Track[] tracks = sequence.getTracks();
    assertEquals("control track", MidiUtil.readTrackname(tracks[0]));
    assertEquals("", MidiUtil.readTrackname(tracks[1]));
    assertEquals("\\new", MidiUtil.readTrackname(tracks[2]));
  }

  /**
   * This is not really a unit test. Here we we cut the last measures from a
   * midi file and write them to a new file. This file can be manually inspected
   * with an external midi file editor.
   */
  //--@Test
  public void testLeftCut() throws InvalidMidiDataException, IOException {
    System.out.println("Writing to an external midi file. ");
    URL midiUrl = this.getClass().getResource("resources/4_WieLieblich.mid");
    Sequence sequence = MidiSystem.getSequence(midiUrl);

    long startPos = 100000L; //max 130320

    sequence = MidiUtil.leftCut(sequence, startPos);

    File testOutDir = new File("test/temp/");
    testOutDir.mkdirs();

    File outFile = new File(testOutDir, "MidiUtilTest.mid");
    MidiSystem.write(sequence, 1, outFile);
    System.out.println("File " + outFile.getCanonicalPath() + " has been written. Please verify...");

  }

  @Test
  public void testUsedChannels() throws InvalidMidiDataException {
    System.out.println("testUsedChannels ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];
    int[] usedChannels = MidiUtil.usedChannels(track);
    assertEquals(0, usedChannels.length);

    // lets add events for eight different channels
    for (int channel = 0; channel < 8; channel++) {
      ShortMessage shortMessage = new ShortMessage();
      shortMessage.setMessage(ShortMessage.NOTE_ON, channel, 64, 64);
      MidiEvent event = new MidiEvent(shortMessage, 0);
      track.add(event);
    }

    // lets add again events for these eight channels
    for (int channel = 0; channel < 8; channel++) {
      ShortMessage shortMessage = new ShortMessage();
      shortMessage.setMessage(ShortMessage.NOTE_ON, channel, 64, 64);
      MidiEvent event = new MidiEvent(shortMessage, 200);
      track.add(event);
    }

    // now the function "usedChannels(track)" shall return eight channel numbers.
    usedChannels = MidiUtil.usedChannels(track);
    assertEquals(8, usedChannels.length);

    for (int channel = 0; channel < 8; channel++) {
      boolean found = false;
      for (int uch : usedChannels) {
        if (uch == channel) {
          found = true;
        }
      }
      assertTrue("channel " + channel + " missing.", found);
    }

  }

  @Test
  public void testPrependSequence() throws InvalidMidiDataException {
    System.out.println("testPrependSequence ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];

    // add an event at position zero
    ShortMessage shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_ON, 0, 64, 64);
    long position = 0;
    MidiEvent event = new MidiEvent(shortMessage, position);
    track.add(event);

    Sequence longerSeq = MidiUtil.leftCut(seq, -1000L);
    Track newTrack = longerSeq.getTracks()[0];
    assertEquals(2, newTrack.size());

    event = newTrack.get(0);
    assertEquals(1000L, event.getTick());

  }

  @Test
  public void testInsertSilence() throws InvalidMidiDataException {
    System.out.println("testInsertSilence ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];

    // add an event at position zero
    ShortMessage shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_ON, 0, 64, 64);
    long position = 0;
    MidiEvent event = new MidiEvent(shortMessage, position);
    track.add(event);

    Sequence seqWithSilence = MidiUtil.insertSilence(seq, 123L);
    Track newTrack = seqWithSilence.getTracks()[0];
    assertEquals(2, newTrack.size());

    event = newTrack.get(0);
    assertEquals(123L, event.getTick());

  }

  @Test
  public void testStretch() throws InvalidMidiDataException {
    System.out.println("testStretch ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];

    // add an event that should not be shifted
    ShortMessage shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_ON, 0, 64, 64);
    long position_noshiftEvent = 240;
    MidiEvent event_0 = new MidiEvent(shortMessage, position_noshiftEvent);
    track.add(event_0);

    // add the marker event (that should be shifted)
    long rightBorder = 4 * 240;
    MidiEvent event_1 = new MidiEvent(shortMessage, rightBorder);
    track.add(event_1);

    // add an additional event that should be shifted)
    long position_shift = 8 * 240;
    MidiEvent event_2 = new MidiEvent(shortMessage, position_shift);
    track.add(event_2);

    // now do the test
    long leftBorder = rightBorder - 240;
    long newRightBorder = leftBorder;
    Sequence shiftedSeq = MidiUtil.stretch(seq, leftBorder, rightBorder, newRightBorder);
    Track shiftedTrack = shiftedSeq.getTracks()[0];
    assertEquals(4, shiftedTrack.size());

    MidiEvent event_0s = shiftedTrack.get(0);
    assertEquals(position_noshiftEvent, event_0s.getTick());
    MidiEvent event_1s = shiftedTrack.get(1);
    assertEquals(leftBorder, event_1s.getTick());
    MidiEvent event_2s = shiftedTrack.get(2);
    assertEquals(position_shift - 240, event_2s.getTick());
  }

  @Test
  public void testCut() throws InvalidMidiDataException {
    System.out.println("testCut ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];

    // add an event that should not be shifted
    ShortMessage shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_ON, 0, 64, 64);
    long position_noshiftEvent = 240;
    MidiEvent event_0 = new MidiEvent(shortMessage, position_noshiftEvent);
    track.add(event_0);

    // add an event that should be deleted
    long positionDeleteEvent = 3 * 240;
    MidiEvent event_1 = new MidiEvent(shortMessage, positionDeleteEvent);
    track.add(event_1);

    // add an additional event that should be shifted)
    long position_shiftEvent = 8 * 240;
    MidiEvent event_2 = new MidiEvent(shortMessage, position_shiftEvent);
    track.add(event_2);

    // now do the test
    long fromCut = 2 * 240;
    long toCut = 4 * 240;
    long shift = toCut - fromCut;
    Sequence cutSeq = MidiUtil.cut(seq, fromCut, toCut);

    // verify
    assertNotNull(cutSeq);
    assertNotSame(seq, cutSeq);

    Track cutTrack = cutSeq.getTracks()[0];
    assertEquals(3, cutTrack.size());

    MidiEvent event_0c = cutTrack.get(0);
    assertEquals(position_noshiftEvent, event_0c.getTick());

    MidiEvent event_1c = cutTrack.get(1);
    assertEquals(position_shiftEvent - shift, event_1c.getTick());
  }

  @Test
  public void testTranspose() throws InvalidMidiDataException {
    System.out.println("testTranspose ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];

    // add a note on
    ShortMessage shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_ON, 0, 64, 64);
    long position = 0;
    MidiEvent event_on = new MidiEvent(shortMessage, position);
    track.add(event_on);

    // add a note off
    shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    position = 240;
    MidiEvent event_off = new MidiEvent(shortMessage, position);
    track.add(event_off);

    // now do the test
    int semiTones = 3;
    Sequence transposedSeq = MidiUtil.transpose(seq, semiTones);
    Track transposedTrack = transposedSeq.getTracks()[0];

    //verify
    assertEquals(2 + 1, transposedTrack.size());
    MidiEvent event_onT = transposedTrack.get(0);
    int pitchonT = ((ShortMessage) event_onT.getMessage()).getData1();
    assertEquals(64 + 3, pitchonT);
    MidiEvent event_offT = transposedTrack.get(1);
    int pitchoffT = ((ShortMessage) event_offT.getMessage()).getData1();
    assertEquals(64 + 3, pitchoffT);

  }

  @Test
  public void testAppendSequence() throws InvalidMidiDataException {
    System.out.println("testApendSequence ");
    Sequence seq = new Sequence(Sequence.PPQ, 240, 1);
    Track track = seq.getTracks()[0];

    // add an event at position 100
    ShortMessage shortMessage = new ShortMessage();
    shortMessage.setMessage(ShortMessage.NOTE_ON, 0, 64, 64);
    long position = 100;
    MidiEvent event = new MidiEvent(shortMessage, position);
    track.add(event);
    assertEquals(2, track.size());
    assertEquals(100L, seq.getTickLength());

    Sequence longerSeq = MidiUtil.rightCut(seq, 1000);
    Track newTrack = longerSeq.getTracks()[0];

    assertEquals(1000L, longerSeq.getTickLength());

  }
}


text:
package org.apache.sysds.runtime.instructions.cp;

import org.apache.sysds.api.DMLScript;
import org.apache.sysds.common.Types.DataType;
import org.apache.sysds.common.Types.ValueType;
import org.apache.sysds.runtime.DMLRuntimeException;
import org.apache.sysds.runtime.meta.DataCharacteristics;
import org.apache.sysds.runtime.meta.MetaData;
import org.apache.sysds.runtime.privacy.CheckedConstraintsLog;
import org.apache.sysds.runtime.privacy.PrivacyConstraint;

import java.io.Serializable;

public abstract class Data implements Serializable
{
	private static final long serialVersionUID = 9176228330268046168L;

	protected final DataType dataType;
	protected final ValueType valueType;

	/**
	 * Object holding all privacy constraints associated with the data.
	 */
	protected PrivacyConstraint _privacyConstraint = null;

	protected Data(DataType dt, ValueType vt) {
		dataType = dt;
		valueType = vt;
	}

	public abstract String getDebugName();

	public DataType getDataType() {
		return dataType;
	}

	public ValueType getValueType() {
		return valueType;
	}

	public void setPrivacyConstraints(PrivacyConstraint pc) {
		_privacyConstraint = pc;
		if ( DMLScript.CHECK_PRIVACY && pc != null )
			CheckedConstraintsLog.addLoadedConstraint(pc.getPrivacyLevel());
	}

	public PrivacyConstraint getPrivacyConstraint() {
		return _privacyConstraint;
	}

	public void setMetaData(MetaData md) {
		throw new DMLRuntimeException("This method in the base class should never be invoked.");
	}

	public MetaData getMetaData() {
		throw new DMLRuntimeException("This method in the base class should never be invoked.");
	}

	public void removeMetaData() {
		throw new DMLRuntimeException("This method in the base class should never be invoked.");
	}

	public void updateDataCharacteristics(DataCharacteristics mc) {
		throw new DMLRuntimeException("This method in the base class should never be invoked.");
	}
}


text:
[Stanislavski](http://github.com/youdevise/stanislavski) is a library for doing things with method calls:

  * Recording them (when they're made against a dynamic proxy),
  * Interpreting them, and
  * Using them to build useful objects like [Java Beans](http://en.wikipedia.org/wiki/JavaBeans) and [Hamcrest Matchers](http://code.google.com/p/hamcrest/).

For a basic introduction, see the wiki articles on [Bean Matching Made Easier (with MagicJavaBeanMatchers)](https://github.com/youdevise/stanislavski/wiki/Magic-Java-Bean-Matchers) and [Builders Without Boilerplate](https://github.com/youdevise/stanislavski/wiki/MagicRecordBuilders).

Or see these [slides for a short presentation on the goals of the project](https://docs.google.com/presentation/d/1toioIpW-HjOPlBNEios_KghNjhAaPcDNs8MvxC9MkRs/edit#slide=id.p).


text:
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tabmodel;

import androidx.test.filters.SmallTest;

import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.UiThreadTest;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CallbackHelper;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserverTestRule.TabModelSelectorTestTabModel;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.test.util.TestThreadUtils;

import java.util.List;
import java.util.concurrent.TimeoutException;

/**
 * Tests for the TabModelSelectorTabModelObserver.
 */
@RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.PER_CLASS)
public class TabModelSelectorTabModelObserverTest {
    @ClassRule
    public static final TabModelSelectorObserverTestRule sTestRule =
            new TabModelSelectorObserverTestRule();

    private TabModelSelectorBase mSelector;

    @Before
    public void setUp() {
        mSelector = sTestRule.getSelector();
    }

    @Test
    @SmallTest
    public void testAlreadyInitializedSelector() throws TimeoutException {
        final CallbackHelper registrationCompleteCallback = new CallbackHelper();
        TabModelSelectorTabModelObserver observer =
                TestThreadUtils.runOnUiThreadBlockingNoException(
                        () -> new TabModelSelectorTabModelObserver(mSelector) {
                            @Override
                            protected void onRegistrationComplete() {
                                registrationCompleteCallback.notifyCalled();
                            }
                        });
        registrationCompleteCallback.waitForCallback(0);
        assertAllModelsHaveObserver(mSelector, observer);
    }

    @Test
    @UiThreadTest
    @SmallTest
    public void testUninitializedSelector() throws TimeoutException {
        mSelector = new TabModelSelectorBase(null, EmptyTabModelFilter::new, false) {
            @Override
            public void requestToShowTab(Tab tab, int type) {}

            @Override
            public boolean closeAllTabsRequest(boolean incognito) {
                return false;
            }

            @Override
            public boolean isSessionRestoreInProgress() {
                return false;
            }

            @Override
            public Tab openNewTab(LoadUrlParams loadUrlParams, @TabLaunchType int type, Tab parent,
                    boolean incognito) {
                return null;
            }
        };
        final CallbackHelper registrationCompleteCallback = new CallbackHelper();
        TabModelSelectorTabModelObserver observer =
                new TabModelSelectorTabModelObserver(mSelector) {
                    @Override
                    protected void onRegistrationComplete() {
                        registrationCompleteCallback.notifyCalled();
                    }
                };
        mSelector.initialize(sTestRule.getNormalTabModel(), sTestRule.getIncognitoTabModel());
        registrationCompleteCallback.waitForCallback(0);
        assertAllModelsHaveObserver(mSelector, observer);
    }

    private static void assertAllModelsHaveObserver(
            TabModelSelector selector, TabModelObserver observer) {
        List<TabModel> models = selector.getModels();
        for (int i = 0; i < models.size(); i++) {
            Assert.assertTrue(models.get(i) instanceof TabModelSelectorTestTabModel);
            Assert.assertTrue(((TabModelSelectorTestTabModel) models.get(i))
                                      .getObservers()
                                      .contains(observer));
        }
    }
}


text:
<?php

declare(strict_types=1);

namespace FSi\Component\DataGrid\Data;

interface DataRowsetInterface extends \Iterator, \Countable, \ArrayAccess
{
}


text:
require_relative "../MoviesCreateTable"

describe "#create_table" do
  let(:table_status) { "ACTIVE" }
  let(:table_definition) do
    {
      table_name: "Movies",
      key_schema: [
        {
          attribute_name: "year",
          key_type: "HASH"  # Partition key.
        },
        {
          attribute_name: "title",
          key_type: "RANGE" # Sort key.
        }
      ],
      attribute_definitions: [
        {
          attribute_name: "year",
          attribute_type: "N"
        },
        {
          attribute_name: "title",
          attribute_type: "S"
        }
      ],
      provisioned_throughput: {
        read_capacity_units: 10,
        write_capacity_units: 10
      }
    }
  end
  let(:dynamodb_client) do
    Aws::DynamoDB::Client.new(
      stub_responses: {
        create_table: {
          table_description: {
            table_status: table_status
          }
        }
      }
    )
  end

  it "creates a table" do
    expect(create_table(dynamodb_client, table_definition)).to eq(table_status)
  end
end


text:
require_dependency 'formgen/application_controller'

module Formgen
  #
  class AnswersController < ApplicationController
    include QuestionsHelper
    begin
      include Formgen::AnswersControllerExtension
    rescue Exception => e
    end

    before_action :authenticate_user! unless Formgen.skip_answer_authentication
    before_action :find_reply, only: [:show]

    def create
      if I18n.locale.to_s != params['locale'] && I18n.available_locales.include?(params['locale'].to_sym)
        I18n.locale = params['locale'].to_sym
      end

      form = Form.find params[:id]
      if form.allow_anonym_answer? || Formgen.can_answer_form.call(current_user)
        before_create(form) if respond_to?(:before_create)
        errors = save_reply(form)
        after_create(form, errors) if respond_to?(:after_create)

        if errors.empty?
          FormMailer.confirm(@reply).deliver_later if @reply.user.present?
          FormMailer.notify(@reply).deliver_later
        end
      else
        errors = [t('.not_allowed')]
      end

      if errors.any?
        flash[:error] = errors_to_html(errors).html_safe
        session[:formgen_reply] = params['reply']
      else
        flash[:success] = t('.saved_reply_successfully')
      end

      redirect_to :back
    end

    def destroy_all
      form = Form.find params[:id]
      if form.replies.destroy_all
        redirect_to form_path(form), notice: t('.success')
      else
        redirect_to form_path(form), alert: t('.failure')
      end
    end

    private

    def find_reply
      @reply = Reply.includes(answers: :question).find(params[:id])
    end
  end
end


text:
Magic Mirror Module - Voice Control

This an extension for the [MagicMirror](https://github.com/MichMich/MagicMirror) to allow use of voice commands. Currently it is a very minimal module with support only for [MMM-Dublin-Bus](https://github.com/dr4ke616/MMM-Dublin-Bus)

## Installation
1. Navigate into your MagicMirror's `modules` folder
2. Execute `git clone https://github.com/dr4ke616/MMM-Voice-Control.git`
3. Execute `npm install` in that folder to download external libraries
4. Navigate back to MagicMirror's root directory
5. Start magic mirror

## Supported Commands:

- Go to sleep
- Wake up
- Dublin bus

## Using the module

To use this module, add it to the modules array in the `config/config.js` file:

```javascript
modules: [
    {
        module: 'MMM-Voice-Control',
        position: 'lower_third', // If you want to see the prompt and recognised speech, omit otherwise
        config: {
            // See 'Configuration options' for more information.
        }
    }
]
```

## Configuration Options

The following properties can be configured:

| Option 							| Default 	| Description 																																								|
|-----------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|`language`							| `en`		|The language used.																																							|
|`voiceTextRestTimeout`				| `3000`	|Tell the module to restart its listening process. Lower the value means it could reset mid sentence. Higher, means it could take longer time between each speech attempt.	|
|`listOfCommandsNotificationTime` 	| `10000`	|The time in which the "list of commands" notification will be displayed on screen.																							|

## Extending

Its quite simple to add more custom commands.

- Add the extra needed local values to any of the files in the `MMM-Voice-Control/translations/`.
- The behaviour can then be defined in the `MMM-Voice-Control/commands.js` file. It is recommended to interface with other modules using MagicMirror's default alert module.


text:
<?php

namespace Tabbi\Silex;

final class Config implements ConfigInterface {

    /**
     * Config Driver
     *
     * @var object
     */
	private $driver;

    /**
     * Settings container
     *
     * @var array
     */
	private $config = array();

    /**
     * Contructor
     *
     * @param ConfigDriver $driver
     */
	public function __construct(ConfigDriver $driver, $path = null)
	{
		$this->driver = $driver;

        // try to autoload all files in directory
        if($path)
        {
            if ($handle = opendir($path))
            {
                while (false !== ($entry = readdir($handle)))
                {
                    if ($entry == '.' || $entry == '..') continue;

                    $this->add($path . $entry);
                }

                closedir($handle);
            }
            else
            {
                throw new \RuntimeException('A valid configuration path must be passed before reading configs.');
            }
        }
	}

    /**
     * Add new config into settings container
     *
     * @param string $filename File name with path
     * @see   Config::readConfig()
     */
	public function add($filename)
	{
		$configTmp = $this->readConfig($filename);
        $configFileName = $this->driver->getFileName($filename);

        $config[$configFileName] = $configTmp;
		$this->config = array_merge($this->config, $config);
	}

    /**
     * Get settings value
     *
     * @param  string $key     A key where settings are stored ex.
     *                         error.exception.name Where first art is config
     *                         file name.
     * @param  mixed $default  Default value returned when key was not found
     * @return mixed
     */
	public function get($key, $default = null)
	{
		return $this->array_get($this->config, $key, $default);
	}

    /**
     * Set new settings
     *
     * @param string $key
     * @param mixed $value
     */
    public function set($key, $value)
    {
        $this->config[$key] = $value;
    }

    /**
     * Try to read config before merge
     *
     * @param  string $filename
     * @throws \RuntimeException
     * @throws \InvalidArgumentException
     */
	private function readConfig($filename)
    {
        if (!$filename) {
            throw new \RuntimeException('A valid configuration file must be passed before reading the config.');
        }

        if (!file_exists($filename)) {
            throw new \InvalidArgumentException(
                sprintf("The config file '%s' does not exist.", $filename));
        }

        if ($this->driver->supports($filename)) {
            return $this->driver->load($filename);
        }

        throw new \InvalidArgumentException(
                sprintf("The config file '%s' appears to have an invalid format.", $filename));
    }

    /**
     * Get an item from an array using "dot" notation.
     *
     * @param  array   $array
     * @param  string  $key
     * @param  mixed   $default
     * @return mixed
     */
    private function array_get($array, $key, $default = null)
    {
        if (is_null($key)) return $array;

        if (isset($array[$key])) return $array[$key];

        foreach (explode('.', $key) as $segment)
        {
            if ( ! is_array($array) || ! array_key_exists($segment, $array))
            {
                return $this->value($default);
            }

            $array = $array[$segment];
        }

        return $array;
    }

    /**
     * Return the default value of the given value.
     *
     * @param  mixed  $value
     * @return mixed
     */
    private function value($value)
    {
        return $value instanceof Closure ? $value() : $value;
    }
}