text:
"""
zkb
~~~

ZKB, a static blog generator.

:Copyright: Copyright 2014 Yang LIU <zesikliu@gmail.com>
:License: BSD, see LICENSE for details.
"""

__version__ = '0.1'
__docformat__ = 'restructuredtext'

redpajama_set_name: RedPajamaGithub


text:
var path = require('path');
var webpack = require('webpack');
var fs = require('fs');

var nodeModules = {};
fs.readdirSync('node_modules')
  .filter(function(x) {
    return ['.bin'].indexOf(x) === -1;
  })
  .forEach(function(module) {
    nodeModules[module] = 'commonjs ' + module;
  });

module.exports = {
  entry: ['babel-polyfill', './src/main.js'],
  target: 'node',
  output: {
    path: path.join(__dirname, 'build'),
    filename: 'mytype-backend.js',
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: 'node_modules',
        loader: 'babel-loader',
        query: {
          presets: ['es2015'],
        }
      }
    ]
  },
  externals: nodeModules,
};


text:
require 'kaltura_client.rb'

module Kaltura

	class KalturaMetadataProfileCreateMode
		API = 1
		KMC = 2
		APP = 3
	end

	class KalturaMetadataProfileStatus
		ACTIVE = 1
		DEPRECATED = 2
		TRANSFORMING = 3
	end

	class KalturaMetadataStatus
		VALID = 1
		INVALID = 2
		DELETED = 3
	end

	class KalturaMetadataObjectType
		AD_CUE_POINT = "adCuePointMetadata.AdCuePoint"
		ANNOTATION = "annotationMetadata.Annotation"
		CODE_CUE_POINT = "codeCuePointMetadata.CodeCuePoint"
		ENTRY = "1"
		CATEGORY = "2"
		USER = "3"
		PARTNER = "4"
	end

	class KalturaMetadataOrderBy
		CREATED_AT_ASC = "+createdAt"
		METADATA_PROFILE_VERSION_ASC = "+metadataProfileVersion"
		UPDATED_AT_ASC = "+updatedAt"
		VERSION_ASC = "+version"
		CREATED_AT_DESC = "-createdAt"
		METADATA_PROFILE_VERSION_DESC = "-metadataProfileVersion"
		UPDATED_AT_DESC = "-updatedAt"
		VERSION_DESC = "-version"
	end

	class KalturaMetadataProfileOrderBy
		CREATED_AT_ASC = "+createdAt"
		UPDATED_AT_ASC = "+updatedAt"
		CREATED_AT_DESC = "-createdAt"
		UPDATED_AT_DESC = "-updatedAt"
	end

	class KalturaMetadata < KalturaObjectBase
		attr_accessor :id
		attr_accessor :partner_id
		attr_accessor :metadata_profile_id
		attr_accessor :metadata_profile_version
		attr_accessor :metadata_object_type
		attr_accessor :object_id
		attr_accessor :version
		attr_accessor :created_at
		attr_accessor :updated_at
		attr_accessor :status
		attr_accessor :xml

		def id=(val)
			@id = val.to_i
		end
		def partner_id=(val)
			@partner_id = val.to_i
		end
		def metadata_profile_id=(val)
			@metadata_profile_id = val.to_i
		end
		def metadata_profile_version=(val)
			@metadata_profile_version = val.to_i
		end
		def version=(val)
			@version = val.to_i
		end
		def created_at=(val)
			@created_at = val.to_i
		end
		def updated_at=(val)
			@updated_at = val.to_i
		end
		def status=(val)
			@status = val.to_i
		end
	end

	class KalturaMetadataListResponse < KalturaObjectBase
		attr_accessor :objects
		attr_accessor :total_count

		def total_count=(val)
			@total_count = val.to_i
		end
	end

	class KalturaMetadataProfile < KalturaObjectBase
		attr_accessor :id
		attr_accessor :partner_id
		attr_accessor :metadata_object_type
		attr_accessor :version
		attr_accessor :name
		attr_accessor :system_name
		attr_accessor :description
		attr_accessor :created_at
		attr_accessor :updated_at
		attr_accessor :status
		attr_accessor :xsd
		attr_accessor :views
		attr_accessor :xslt
		attr_accessor :create_mode

		def id=(val)
			@id = val.to_i
		end
		def partner_id=(val)
			@partner_id = val.to_i
		end
		def version=(val)
			@version = val.to_i
		end
		def created_at=(val)
			@created_at = val.to_i
		end
		def updated_at=(val)
			@updated_at = val.to_i
		end
		def status=(val)
			@status = val.to_i
		end
		def create_mode=(val)
			@create_mode = val.to_i
		end
	end

	class KalturaMetadataProfileField < KalturaObjectBase
		attr_accessor :id
		attr_accessor :x_path
		attr_accessor :key
		attr_accessor :label

		def id=(val)
			@id = val.to_i
		end
	end

	class KalturaMetadataProfileFieldListResponse < KalturaObjectBase
		attr_accessor :objects
		attr_accessor :total_count

		def total_count=(val)
			@total_count = val.to_i
		end
	end

	class KalturaMetadataProfileListResponse < KalturaObjectBase
		attr_accessor :objects
		attr_accessor :total_count

		def total_count=(val)
			@total_count = val.to_i
		end
	end

	class KalturaImportMetadataJobData < KalturaJobData
		attr_accessor :src_file_url
		attr_accessor :dest_file_local_path
		attr_accessor :metadata_id

		def metadata_id=(val)
			@metadata_id = val.to_i
		end
	end

	class KalturaMetadataBaseFilter < KalturaFilter
		attr_accessor :partner_id_equal
		attr_accessor :metadata_profile_id_equal
		attr_accessor :metadata_profile_version_equal
		attr_accessor :metadata_profile_version_greater_than_or_equal
		attr_accessor :metadata_profile_version_less_than_or_equal
		attr_accessor :metadata_object_type_equal
		attr_accessor :object_id_equal
		attr_accessor :object_id_in
		attr_accessor :version_equal
		attr_accessor :version_greater_than_or_equal
		attr_accessor :version_less_than_or_equal
		attr_accessor :created_at_greater_than_or_equal
		attr_accessor :created_at_less_than_or_equal
		attr_accessor :updated_at_greater_than_or_equal
		attr_accessor :updated_at_less_than_or_equal
		attr_accessor :status_equal
		attr_accessor :status_in

		def partner_id_equal=(val)
			@partner_id_equal = val.to_i
		end
		def metadata_profile_id_equal=(val)
			@metadata_profile_id_equal = val.to_i
		end
		def metadata_profile_version_equal=(val)
			@metadata_profile_version_equal = val.to_i
		end
		def metadata_profile_version_greater_than_or_equal=(val)
			@metadata_profile_version_greater_than_or_equal = val.to_i
		end
		def metadata_profile_version_less_than_or_equal=(val)
			@metadata_profile_version_less_than_or_equal = val.to_i
		end
		def version_equal=(val)
			@version_equal = val.to_i
		end
		def version_greater_than_or_equal=(val)
			@version_greater_than_or_equal = val.to_i
		end
		def version_less_than_or_equal=(val)
			@version_less_than_or_equal = val.to_i
		end
		def created_at_greater_than_or_equal=(val)
			@created_at_greater_than_or_equal = val.to_i
		end
		def created_at_less_than_or_equal=(val)
			@created_at_less_than_or_equal = val.to_i
		end
		def updated_at_greater_than_or_equal=(val)
			@updated_at_greater_than_or_equal = val.to_i
		end
		def updated_at_less_than_or_equal=(val)
			@updated_at_less_than_or_equal = val.to_i
		end
		def status_equal=(val)
			@status_equal = val.to_i
		end
	end

	class KalturaMetadataProfileBaseFilter < KalturaFilter
		attr_accessor :id_equal
		attr_accessor :partner_id_equal
		attr_accessor :metadata_object_type_equal
		attr_accessor :metadata_object_type_in
		attr_accessor :version_equal
		attr_accessor :name_equal
		attr_accessor :system_name_equal
		attr_accessor :system_name_in
		attr_accessor :created_at_greater_than_or_equal
		attr_accessor :created_at_less_than_or_equal
		attr_accessor :updated_at_greater_than_or_equal
		attr_accessor :updated_at_less_than_or_equal
		attr_accessor :status_equal
		attr_accessor :status_in
		attr_accessor :create_mode_equal
		attr_accessor :create_mode_not_equal
		attr_accessor :create_mode_in
		attr_accessor :create_mode_not_in

		def id_equal=(val)
			@id_equal = val.to_i
		end
		def partner_id_equal=(val)
			@partner_id_equal = val.to_i
		end
		def version_equal=(val)
			@version_equal = val.to_i
		end
		def created_at_greater_than_or_equal=(val)
			@created_at_greater_than_or_equal = val.to_i
		end
		def created_at_less_than_or_equal=(val)
			@created_at_less_than_or_equal = val.to_i
		end
		def updated_at_greater_than_or_equal=(val)
			@updated_at_greater_than_or_equal = val.to_i
		end
		def updated_at_less_than_or_equal=(val)
			@updated_at_less_than_or_equal = val.to_i
		end
		def status_equal=(val)
			@status_equal = val.to_i
		end
		def create_mode_equal=(val)
			@create_mode_equal = val.to_i
		end
		def create_mode_not_equal=(val)
			@create_mode_not_equal = val.to_i
		end
	end

	class KalturaTransformMetadataJobData < KalturaJobData
		attr_accessor :src_xsl_path
		attr_accessor :src_version
		attr_accessor :dest_version
		attr_accessor :dest_xsd_path
		attr_accessor :metadata_profile_id

		def src_version=(val)
			@src_version = val.to_i
		end
		def dest_version=(val)
			@dest_version = val.to_i
		end
		def metadata_profile_id=(val)
			@metadata_profile_id = val.to_i
		end
	end

	class KalturaCompareMetadataCondition < KalturaCompareCondition
		# May contain the full xpath to the field in three formats
		# 	 1. Slashed xPath, e.g. /metadata/myElementName
		# 	 2. Using local-name function, e.g. /[local-name()='metadata']/[local-name()='myElementName']
		# 	 3. Using only the field name, e.g. myElementName, it will be searched as //myElementName
		#
		attr_accessor :x_path
		# Metadata profile id
		#
		attr_accessor :profile_id
		# Metadata profile system name
		#
		attr_accessor :profile_system_name

		def profile_id=(val)
			@profile_id = val.to_i
		end
	end

	class KalturaFileAssetFilter < KalturaFileAssetBaseFilter

	end

	class KalturaMatchMetadataCondition < KalturaMatchCondition
		# May contain the full xpath to the field in three formats
		# 	 1. Slashed xPath, e.g. /metadata/myElementName
		# 	 2. Using local-name function, e.g. /[local-name()='metadata']/[local-name()='myElementName']
		# 	 3. Using only the field name, e.g. myElementName, it will be searched as //myElementName
		#
		attr_accessor :x_path
		# Metadata profile id
		#
		attr_accessor :profile_id
		# Metadata profile system name
		#
		attr_accessor :profile_system_name

		def profile_id=(val)
			@profile_id = val.to_i
		end
	end

	class KalturaMetadataFieldChangedCondition < KalturaMatchCondition
		# May contain the full xpath to the field in three formats
		# 	 1. Slashed xPath, e.g. /metadata/myElementName
		# 	 2. Using local-name function, e.g. /[local-name()='metadata']/[local-name()='myElementName']
		# 	 3. Using only the field name, e.g. myElementName, it will be searched as //myElementName
		#
		attr_accessor :x_path
		# Metadata profile id
		#
		attr_accessor :profile_id
		# Metadata profile system name
		#
		attr_accessor :profile_system_name
		attr_accessor :version_a
		attr_accessor :version_b

		def profile_id=(val)
			@profile_id = val.to_i
		end
	end

	class KalturaMetadataFilter < KalturaMetadataBaseFilter

	end

	class KalturaMetadataProfileFilter < KalturaMetadataProfileBaseFilter

	end

	class KalturaMetadataSearchItem < KalturaSearchOperator
		attr_accessor :metadata_profile_id
		attr_accessor :order_by

		def metadata_profile_id=(val)
			@metadata_profile_id = val.to_i
		end
	end

	# Metadata service
	#
	class KalturaMetadataService < KalturaServiceBase
		def initialize(client)
			super(client)
		end

		# Allows you to add a metadata object and metadata content associated with Kaltura object
		#
		def add(metadata_profile_id, object_type, object_id, xml_data)
			kparams = {}
			client.add_param(kparams, 'metadataProfileId', metadata_profile_id);
			client.add_param(kparams, 'objectType', object_type);
			client.add_param(kparams, 'objectId', object_id);
			# XML metadata
			client.add_param(kparams, 'xmlData', xml_data);
			client.queue_service_action_call('metadata_metadata', 'add', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Allows you to add a metadata object and metadata file associated with Kaltura object
		#
		def add_from_file(metadata_profile_id, object_type, object_id, xml_file)
			kparams = {}
			client.add_param(kparams, 'metadataProfileId', metadata_profile_id);
			client.add_param(kparams, 'objectType', object_type);
			client.add_param(kparams, 'objectId', object_id);
			# XML metadata
			client.add_param(kparams, 'xmlFile', xml_file);
			client.queue_service_action_call('metadata_metadata', 'addFromFile', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Allows you to add a metadata xml data from remote URL
		#
		def add_from_url(metadata_profile_id, object_type, object_id, url)
			kparams = {}
			client.add_param(kparams, 'metadataProfileId', metadata_profile_id);
			client.add_param(kparams, 'objectType', object_type);
			client.add_param(kparams, 'objectId', object_id);
			# XML metadata remote url
			client.add_param(kparams, 'url', url);
			client.queue_service_action_call('metadata_metadata', 'addFromUrl', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Allows you to add a metadata xml data from remote URL.
		# 	 Enables different permissions than addFromUrl action.
		#
		def add_from_bulk(metadata_profile_id, object_type, object_id, url)
			kparams = {}
			client.add_param(kparams, 'metadataProfileId', metadata_profile_id);
			client.add_param(kparams, 'objectType', object_type);
			client.add_param(kparams, 'objectId', object_id);
			# XML metadata remote url
			client.add_param(kparams, 'url', url);
			client.queue_service_action_call('metadata_metadata', 'addFromBulk', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Retrieve a metadata object by id
		#
		def get(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadata', 'get', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object with new XML content
		#
		def update(id, xml_data=KalturaNotImplemented, version=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'id', id);
			# XML metadata
			client.add_param(kparams, 'xmlData', xml_data);
			# Enable update only if the metadata object version did not change by other process
			client.add_param(kparams, 'version', version);
			client.queue_service_action_call('metadata_metadata', 'update', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object with new XML file
		#
		def update_from_file(id, xml_file=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'id', id);
			# XML metadata
			client.add_param(kparams, 'xmlFile', xml_file);
			client.queue_service_action_call('metadata_metadata', 'updateFromFile', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# List metadata objects by filter and pager
		#
		def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'filter', filter);
			client.add_param(kparams, 'pager', pager);
			client.queue_service_action_call('metadata_metadata', 'list', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Delete an existing metadata
		#
		def delete(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadata', 'delete', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Mark existing metadata as invalid
		# 	 Used by batch metadata transform
		#
		def invalidate(id, version=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'id', id);
			# Enable update only if the metadata object version did not change by other process
			client.add_param(kparams, 'version', version);
			client.queue_service_action_call('metadata_metadata', 'invalidate', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Serves metadata XML file
		#
		def serve(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadata', 'serve', kparams);
			return client.get_serve_url();
		end

		# Action transforms current metadata object XML using a provided XSL.
		#
		def update_from_xsl(id, xsl_file)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.add_param(kparams, 'xslFile', xsl_file);
			client.queue_service_action_call('metadata_metadata', 'updateFromXSL', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end
	end

	# Metadata Profile service
	#
	class KalturaMetadataProfileService < KalturaServiceBase
		def initialize(client)
			super(client)
		end

		# Allows you to add a metadata profile object and metadata profile content associated with Kaltura object type
		#
		def add(metadata_profile, xsd_data, views_data=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'metadataProfile', metadata_profile);
			# XSD metadata definition
			client.add_param(kparams, 'xsdData', xsd_data);
			# UI views definition
			client.add_param(kparams, 'viewsData', views_data);
			client.queue_service_action_call('metadata_metadataprofile', 'add', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Allows you to add a metadata profile object and metadata profile file associated with Kaltura object type
		#
		def add_from_file(metadata_profile, xsd_file, views_file=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'metadataProfile', metadata_profile);
			# XSD metadata definition
			client.add_param(kparams, 'xsdFile', xsd_file);
			# UI views definition
			client.add_param(kparams, 'viewsFile', views_file);
			client.queue_service_action_call('metadata_metadataprofile', 'addFromFile', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Retrieve a metadata profile object by id
		#
		def get(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadataprofile', 'get', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object
		#
		def update(id, metadata_profile, xsd_data=KalturaNotImplemented, views_data=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.add_param(kparams, 'metadataProfile', metadata_profile);
			# XSD metadata definition
			client.add_param(kparams, 'xsdData', xsd_data);
			# UI views definition
			client.add_param(kparams, 'viewsData', views_data);
			client.queue_service_action_call('metadata_metadataprofile', 'update', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# List metadata profile objects by filter and pager
		#
		def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
			kparams = {}
			client.add_param(kparams, 'filter', filter);
			client.add_param(kparams, 'pager', pager);
			client.queue_service_action_call('metadata_metadataprofile', 'list', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# List metadata profile fields by metadata profile id
		#
		def list_fields(metadata_profile_id)
			kparams = {}
			client.add_param(kparams, 'metadataProfileId', metadata_profile_id);
			client.queue_service_action_call('metadata_metadataprofile', 'listFields', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Delete an existing metadata profile
		#
		def delete(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadataprofile', 'delete', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object definition file
		#
		def revert(id, to_version)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.add_param(kparams, 'toVersion', to_version);
			client.queue_service_action_call('metadata_metadataprofile', 'revert', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object definition file
		#
		def update_definition_from_file(id, xsd_file)
			kparams = {}
			client.add_param(kparams, 'id', id);
			# XSD metadata definition
			client.add_param(kparams, 'xsdFile', xsd_file);
			client.queue_service_action_call('metadata_metadataprofile', 'updateDefinitionFromFile', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object views file
		#
		def update_views_from_file(id, views_file)
			kparams = {}
			client.add_param(kparams, 'id', id);
			# UI views file
			client.add_param(kparams, 'viewsFile', views_file);
			client.queue_service_action_call('metadata_metadataprofile', 'updateViewsFromFile', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Update an existing metadata object xslt file
		#
		def update_transformation_from_file(id, xslt_file)
			kparams = {}
			client.add_param(kparams, 'id', id);
			# XSLT file, will be executed on every metadata add/update
			client.add_param(kparams, 'xsltFile', xslt_file);
			client.queue_service_action_call('metadata_metadataprofile', 'updateTransformationFromFile', kparams);
			if (client.is_multirequest)
				return nil;
			end
			return client.do_queue();
		end

		# Serves metadata profile XSD file
		#
		def serve(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadataprofile', 'serve', kparams);
			return client.get_serve_url();
		end

		# Serves metadata profile view file
		#
		def serve_view(id)
			kparams = {}
			client.add_param(kparams, 'id', id);
			client.queue_service_action_call('metadata_metadataprofile', 'serveView', kparams);
			return client.get_serve_url();
		end
	end

	class KalturaClient < KalturaClientBase
		attr_reader :metadata_service
		def metadata_service
			if (@metadata_service == nil)
				@metadata_service = KalturaMetadataService.new(self)
			end
			return @metadata_service
		end
		attr_reader :metadata_profile_service
		def metadata_profile_service
			if (@metadata_profile_service == nil)
				@metadata_profile_service = KalturaMetadataProfileService.new(self)
			end
			return @metadata_profile_service
		end
	end

end


text:
package io.sasta.hateos.loanApplication.model;

import java.util.HashMap;
import lombok.Getter;

public enum LoanApplicationStates {
  NEW                           (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_APPLICATION_FORM, new Command(ClientActions.SEND_APPLICATION_FORM, ActionTypes.EVENT, RESTVerbs.POST));}}),

  SEND_LOAN_APPLICATION_ID      (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_APPLICATION_FORM, new Command(ClientActions.SEND_APPLICATION_FORM, ActionTypes.EVENT, RESTVerbs.POST));}}),
  SEND_APPLICATION_FORM         (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_APPLICATION_FORM, new Command(ClientActions.SEND_APPLICATION_FORM, ActionTypes.EVENT, RESTVerbs.POST));}}),
  SEND_DRIVERS_LICENSE          (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_DRIVERS_LICENSE, new Command(ClientActions.SEND_DRIVERS_LICENSE, ActionTypes.EVENT, RESTVerbs.POST));
                                  put(ClientActions.CANCEL_APPLICATION, new Command(ClientActions.CANCEL_APPLICATION, ActionTypes.USER, RESTVerbs.DELETE));}}),
  SEND_UTILITY_BILL             (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_UTILITY_BILL, new Command(ClientActions.SEND_UTILITY_BILL, ActionTypes.EVENT, RESTVerbs.POST));}}),
  SEND_PASSPORT                 (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_PASSPORT, new Command(ClientActions.SEND_PASSPORT, ActionTypes.EVENT, RESTVerbs.POST));}}),

  READY_TO_PROCESS              (null),
  PROCESSED                     (new HashMap<ClientActions, Command>(){{ put(ClientActions.SEND_APPLICATION_FORM, new Command(ClientActions.SEND_APPLICATION_FORM, ActionTypes.EVENT, RESTVerbs.POST));}});

  @Getter
  private final HashMap<ClientActions, Command> commands;

  LoanApplicationStates(
      HashMap<ClientActions, Command> commands) {
    this.commands = commands;
  }
}


text:
<?php
declare(strict_types=1);

namespace SwagImportExport\Components\Service;

use SwagImportExport\Components\Session\Session;
use SwagImportExport\Components\Structs\ImportRequest;

interface ImportServiceInterface
{
    /**
     * Prepares import session based on profile and input file
     * and delivers information on how many records to import.
     */
    public function prepareImport(ImportRequest $importRequest): int;

    /**
     * Processes import based on profile and session and will be called
     * many times based on batch size.
     *
     * @return \Generator<string, int>
     */
    public function import(ImportRequest $importRequest, Session $session): \Generator;
}


text:
/**
  @module ember-flexberry-gis
*/

import Ember from 'ember';
import {
  getLeafletCrs
} from '../utils/leaflet-crs';

/**
  Mixin containing logic which builds leaflet coordinate reference system (CRS).

  @class LeafletCrsMixin
  @extends Ember.Mixin
*/
export default Ember.Mixin.create({
  /**
    Leaflet CRS relies on 'coordinateReferenceSystem' property,
    which  is CRS must be a serialized JSON with the following structure: { code: '...', definition: '...' },
    'code' is necessary CRS code, 'definition' is optional CRS definition in Proj4 format.

    @property crs
    @type L.CRS
    @readOnly
  */
  crs: Ember.computed('coordinateReferenceSystem', function () {
    let coordinateReferenceSystem = this.get('coordinateReferenceSystem');

    return getLeafletCrs(coordinateReferenceSystem, this);
  })
});


text:
package jxl;

import java.text.NumberFormat;

/**
 * A cell which contains a numerical value
 */
public interface NumberCell extends Cell
{
  /**
   * Gets the double contents for this cell.
   *
   * @return the cell contents
   */
  public double getValue();

  /**
   * Gets the NumberFormat used to format this cell.  This is the java
   * equivalent of the Excel format
   *
   * @return the NumberFormat used to format the cell
   */
  public NumberFormat getNumberFormat();
}


text:
ProjectNarrativeEditor = ProjectNarrativeEditor or class(ProjectModuleEditor)
ProjectEditor.EDITORS.narrative = ProjectNarrativeEditor
ProjectEditor.ACTIONS["CloneHeist"] = function(parent, create_data)
    local levels = {}
    for id, narr in pairs(tweak_data.narrative.jobs) do
        if not narr.custom and not narr.hidden then
            --dunno why the name_id is nil for some of them..
            table.insert(levels, {name = id.." / " .. managers.localization:text((narr.name_id or ("heist_"..id)):gsub("_prof", ""):gsub("_night", "")), id = id})
        end
    end
    BLE.ListDialog:Show({
        list = levels,
        callback = function(selection)
            BLE.ListDialog:hide()
            ProjectNarrativeEditor:new(parent, nil, table.merge({clone_id = selection.id}, create_data))
        end
    })
end

local EU = BLE.Utils
local XML = BeardLib.Utils.XML
local DIFFS = {"Normal", "Hard", "Very Hard", "Overkill", "Mayhem", "Death Wish", "Death Sentence"}

--- @param menu ProjectEditor
--- @param data table
function ProjectNarrativeEditor:build_menu(menu, data)
    local up = ClassClbk(self, "set_data_callback")

    data.orig_id = data.orig_id or data.id
    menu:textbox("NarrativeID", up, data.id)

    local divgroup_opt = {border_position_below_title = true, private = {size = 22}}
    local contacts = table.map_keys(tweak_data.narrative.contacts)
    menu:combobox("Contact", up, contacts, table.get_key(contacts, data.contact or "custom"))
    menu:textbox("BriefingEvent", up, data.briefing_event)
    data.crimenet_callouts = type(data.crimenet_callouts) == "table" and data.crimenet_callouts or {data.crimenet_callouts}
    data.debrief_event = type(data.debrief_event) == "table" and data.debrief_event or {data.debrief_event}

    menu:textbox("DebriefEvent", up, table.concat(data.debrief_event, ","))
    menu:textbox("CrimenetCallouts", up, table.concat(data.crimenet_callouts, ","))
    menu:button("SetCrimenetVideos", ClassClbk(self, "set_crimenet_videos_dialog"))
    menu:tickbox("HideFromCrimenet", up, data.hide_from_crimenet)

    local chain = menu:divgroup("Chain", divgroup_opt)
    chain:button("AddExistingLevel", ClassClbk(self, "add_exisiting_level_dialog"))
    chain:button("AddNewLevel", function()
        ProjectEditor.EDITORS.level:new(self._parent, nil, {chain = data.chain})
    end)
    chain:button("CloneLevel", function()
        ProjectEditor.ACTIONS["CloneSingleLevel"](self._parent, {chain = data.chain})
    end)
    self._levels = chain:divgroup("Levels")
    self:build_levels(data)

    self._contract_costs = {}
    self._experience_multipliers = {}
    self._max_mission_xps = {}
    self._min_mission_xps = {}
    self._payouts = {}
    local function convertnumber(n)
        local t = {}
        for i=1, #DIFFS do table.insert(t, n) end
        return t
    end
    data.contract_cost = type(data.contract_cost) == "table" and data.contract_cost or convertnumber(data.contract_cost)
    data.experience_mul = type(data.experience_mul) == "table" and data.experience_mul or convertnumber(data.experience_mul)
    data.max_mission_xp = type(data.max_mission_xp) == "table" and data.max_mission_xp or convertnumber(data.max_mission_xp)
    data.min_mission_xp = type(data.min_mission_xp) == "table" and data.min_mission_xp or convertnumber(data.min_mission_xp)
    data.payout = type(data.payout) == "table" and data.payout or convertnumber(data.payout)
    local diff_settings = menu:divgroup("DifficultySettings", divgroup_opt)
    local diff_settings_holder = diff_settings:pan("DifficultySettingsHolder", {
        text_offset_y = 0, align_method = "grid", offset = {diff_settings.offset[1], 0}})

    local diff_settings_opt = {w = diff_settings_holder:ItemsWidth() / (#DIFFS + 1) - 2, offset = {2, 4}, size = 18}
    local diff_settings_texts = diff_settings_holder:divgroup("Setting", diff_settings_opt)

    diff_settings_opt.border_left = false

    local div_texts_opt = {size_by_text = true, border_left = true, offset = {0, diff_settings_texts.offset[2]}}
    diff_settings_texts:lbl("Contract Cost", div_texts_opt)
    diff_settings_texts:lbl("Payout", div_texts_opt)
    diff_settings_texts:lbl("Maximum XP", div_texts_opt)
    diff_settings_texts:lbl("Minimum XP", div_texts_opt)
    diff_settings_texts:lbl("Stealth XP bonus", div_texts_opt)

    for i, diff in pairs(DIFFS) do
        local group = diff_settings_holder:divgroup(diff, diff_settings_opt)
        local opt = {max = 10000000, min = 0, size_by_text = true, text = "", control_slice = 1, offset = 2}
        self._contract_costs[i] = group:numberbox("ContractCost"..i, up, data.contract_cost[i] or 0, opt)
        self._payouts[i] = group:numberbox("Payout"..i, up, data.payout[i] or 0, opt)
        self._max_mission_xps[i] = group:numberbox("MaxMissionXp"..i, up, data.max_mission_xp[i] or 0, opt)
        self._min_mission_xps[i] = group:numberbox("MinMissionXp"..i, up, data.min_mission_xp[i] or 0, opt)
        opt.max = 5
        self._experience_multipliers[i] = group:numberbox("ExperienceMul"..i, up, data.experience_mul[i] or 0, opt)
    end
end

function ProjectNarrativeEditor:create(create_data)
    BLE.InputDialog:Show({
        title = "Enter a name for the narrative",
        yes = "Create",
        text = create_data.name or "",
        check_value = function(name)
            local warn
            for k in pairs(tweak_data.narrative.jobs) do
                if string.lower(k) == name:lower() then
                    warn = string.format("A narrative with the id %s already exists! Please use a unique id", k)
                end
            end
            if name == "" then
                warn = string.format("Id cannot be empty!", name)
            elseif string.begins(name, " ") then
                warn = "Invalid ID!"
            end
            if warn then
                BLE.Utils:Notify("Error", warn)
            end
            return warn == nil
        end,
        no_callback = function()
            if create_data.final_callback then
                create_data.final_callback(false)
            end
        end,
        callback = function(name)
            local template
            template = deep_clone(BLE.MapProject._narr_module_template)
            template.id = name

            if create_data.clone_id then
                table.merge(template, tweak_data.narrative.jobs[create_data.clone_id])
                local cv = template.contract_visuals
                template.max_mission_xp = cv and cv.max_mission_xp or template.max_mission_xp
                template.min_mission_xp = cv and cv.min_mission_xp or template.min_mission_xp
                template.contract_visuals = nil
                template.name_id = nil
                template.briefing_id = nil
                template.package = nil --packages should only be in levels.

                local already_cloned = {}
                local taken_names = {}
                local function clone_level(chain_level, last)
                    local id = chain_level.level_id

                    --If we already cloned it then just update the ID, if it's last then finalize creation.
                    if already_cloned[id] then
                        chain_level[id].level_id = already_cloned[id].level_id
                        if last then
                            self:finalize_creation(template, create_data)
                        end
                        return
                    end
                    --We try to clone each level, final_callback will call regardless if the user decided to cancel the input dialog or not. So the last one should at least call.
                    --We disable reloading so we can clone all levels without issues. Plus only reload it once after we're done entirely.
                    ProjectLevelEditor:new(self._parent, nil, {clone_id = id, chain_level = chain_level, taken_names = taken_names, no_reload = true, final_callback = last and function(success)
                        if success then
                            already_cloned[id] = chain_level
                        end
                        self:finalize_creation(template, create_data)
                    end})
                end
                if #template.chain > 0 then
                    for i, level_in_chain in pairs(template.chain) do
                        local last = i == #template.chain
                        if type(level_in_chain) == "table" then
                            if #level_in_chain > 0 then
                                for ii, inner_level in pairs(level_in_chain) do
                                    clone_level(inner_level, last and ii == #level_in_chain)
                                end
                            else
                                clone_level(level_in_chain, last)
                            end
                        end
                    end
                else
                    self:finalize_creation(template, create_data)
                end
            else
                self:finalize_creation(template, create_data)
            end
        end
    })
end

---Builds buttons for all levels in the chain
function ProjectNarrativeEditor:build_levels()
    local levels_group = self._levels
    local data = self._data
    levels_group:ClearItems()
    local function build_level_ctrls(level_in_chain, chain_group, btn, level)
        local narr_chain = chain_group or data.chain
        local my_index = table.get_key(narr_chain, level_in_chain)

        local tx = "textures/editor_icons_df"
        local toolbar = btn
        if level_in_chain.level_id then
            btn:tb_imgbtn(level_in_chain.level_id, ClassClbk(self, "delete_chain_level_dialog", level_in_chain), tx, EU.EditorIcons["cross"], {highlight_color = Color.red})
            if chain_group then
                btn:tb_imgbtn("Ungroup", ClassClbk(self, "ungroup_level", level_in_chain, chain_group), tx, EU.EditorIcons["minus"], {help = "Group level", highlight_color = Color.red})
            else
                btn:tb_imgbtn("Group", ClassClbk(self, "group_level", level_in_chain), tx, EU.EditorIcons["plus"], {help = "Ungroup level", highlight_color = Color.red})
            end
        else
            toolbar = btn:GetToolbar()
        end
        toolbar:tb_imgbtn("MoveDown", ClassClbk(self, "set_chain_index", narr_chain, level_in_chain, my_index + 1), tx, EU.EditorIcons["arrow_down"], {highlight_color = Color.red, enabled = my_index < #narr_chain})
        toolbar:tb_imgbtn("MoveUp", ClassClbk(self, "set_chain_index", narr_chain, level_in_chain, my_index - 1), tx, EU.EditorIcons["arrow_up"], {highlight_color = Color.red, enabled = my_index > 1})
    end
    local function build_level_button(level_in_chain, chain_group, group)
        local level_id = level_in_chain.level_id
        local mod = self._parent:get_module(level_id, "level")
        local parent = (group or levels_group)
        local btn = parent:button(level_id, mod and ClassClbk(self._parent, "open_module", mod), {text = level_id, divider_type = mod == nil})
        return btn, level
    end
    for i, v in ipairs(data.chain) do
        if type(v) == "table" then
            if v.level_id then
                local btn, actual_level = build_level_button(v, false)
                build_level_ctrls(v, false, btn, actual_level)
            else
                local grouped = levels_group:divgroup("Day "..tostring(i).."[Grouped]")
                build_level_ctrls(v, nil, grouped)
                for k, level in pairs(v) do
                    local btn, actual_level = build_level_button(level, v, grouped, k == 1)
                    build_level_ctrls(level, v, btn, actual_level)
                end
            end
        end
    end
    if #levels_group._my_items == 0 then
        levels_group:divider("NoLevelsNotice", {text = "No levels found, sadly."})
    end
end

--- Deletes a level from a chain
--- @param level_in_chain table
function ProjectNarrativeEditor:delete_chain_level_dialog(level_in_chain)
    EU:YesNoQuestion("Delete level from chain?", function()
        local chain = self._data.chain
        local success
        for k, v in ipairs(chain) do
            if success then
                break
            end
            if v == level_in_chain then
                table.remove(chain, k)
                break
            else
                for i, level in pairs(v) do
                    if level == level_in_chain then
                        table.remove(v, i)
                        success = true
                        break
                    end
                end
            end
        end
        self:build_levels()
    end)
end

--- Removes a level from a group
--- @param level_in_chain table
--- @param chain_group table
function ProjectNarrativeEditor:ungroup_level(level_in_chain, chain_group)
    table.delete_value(chain_group, level_in_chain)
    if #chain_group == 1 then
        narr.chain[table.get_key(self._data.chain, chain_group)] = chain_group[1]
    end
    table.insert(self._data.chain, level_in_chain)
end

--- Opens a dialog to choose levels to group with.
--- @param level_in_chain table
function ProjectNarrativeEditor:group_level(level_in_chain)
    local chain = {}
    local data = self._data
    for i, v in ipairs(data.chain) do
        if v ~= level_in_chain then
            table.insert(chain, {name = v.level_id or ("Day "..tostring(i).."[Grouped]"), value = v})
        end
    end
    BLE.ListDialog:Show({
        list = chain,
        callback = function(selection)
            table.delete_value(data.chain, level_in_chain)
            local key = table.get_key(data.chain, selection.value)
            local chain_group = selection.value
            if chain_group.level_id then
                data.chain[key] = {chain_group}
            end
            table.insert(data.chain[key], level_in_chain)
            BLE.ListDialog:hide()
            self:build_levels()
        end
    })
end

--- Sets the index of a level in a narrative chain
--- @param chain table
--- @param level_in_chain table
--- @param index number
function ProjectNarrativeEditor:set_chain_index(chain, level_in_chain, index)
    local key = table.get_key(chain, level_in_chain)

    table.remove(chain, tonumber(key))
    table.insert(chain, tonumber(index), level_in_chain)

    self:build_levels()
end

---Opens a dialog of all levels in the game to add to the level chain.
function ProjectNarrativeEditor:add_exisiting_level_dialog()
    local levels = {}
    for k, level in pairs(tweak_data.levels) do
        if type(level) == "table" and level.world_name and not string.begins(level.world_name, "wip/") then
            table.insert(levels, {name = k .. " / " .. managers.localization:text(level.name_id or k), id = k})
        end
    end
    BLE.ListDialog:Show({
        list = levels,
        callback = function(seleciton)
            local chain = self._data.chain
            table.insert(chain, {level_id = seleciton.id, type = "d", type_id = "heist_type_assault"})
            BLE.ListDialog:hide()
            self:build_levels(self._data)
        end
    })
end

--- Open a dialog to select crimenet videos for the narrative
function ProjectNarrativeEditor:set_crimenet_videos_dialog()
    BLE.SelectDialog:Show({
        selected_list = self._data.crimenet_videos,
        list = EU:GetEntries({type = "movie", check = function(entry)
            return entry:match("movies/")
        end}),
        callback = function(list) self._data.crimenet_videos = list end
    })
end

--- The callback function for all items for this menu.
function ProjectNarrativeEditor:set_data_callback()
    local data = self._data

    local name_item = self:GetItem("NarrativeID")
    local new_name = name_item:Value()
    local title = "Narrative ID"
    if data.id ~= new_name then
        local exists = false
        for _, mod in pairs(self._parent:get_modules("narrative")) do
            if mod.id == new_name then
                exists = true
            end
        end
        if exists or new_name == "" or (data.orig_id ~= new_name and tweak_data.narrative.jobs[new_name]) then
            title = title .. "[Invalid]"
        else
            data.id = new_name
        end
    end

    name_item:SetText(title)

    for i in pairs(DIFFS) do
        data.contract_cost[i] = self._contract_costs[i]:Value()
        data.experience_mul[i] = self._experience_multipliers[i]:Value()
        data.max_mission_xp[i] = self._max_mission_xps[i]:Value()
        data.min_mission_xp[i] = self._min_mission_xps[i]:Value()
        data.payout[i] = self._payouts[i]:Value()
    end

    data.crimenet_callouts = data.crimenet_callouts or {}
    data.debrief_event = data.debrief_event or {}
    local callouts = self:GetItemValue("CrimenetCallouts")
    local events = self:GetItemValue("DebriefEvent")
    data.crimenet_callouts = callouts:match(",") and string.split(callouts, ",") or {callouts}
    data.debrief_event = events:match(",") and string.split(events, ",") or {events}
    data.briefing_event = self:GetItemValue("BriefingEvent")
    data.contact = self:GetItem("Contact"):SelectedItem()
    data.hide_from_crimenet = self:GetItemValue("HideFromCrimenet")
end

function ProjectNarrativeEditor:save_data()
    local narr = self._data
    local orig_id = narr.orig_id or narr.id -- Narrative ID has been changed, let's delete the old ID.
    if orig_id ~= narr.id then
        tweak_data.narrative.jobs[orig_id] = nil
        table.delete(tweak_data.narrative._jobs_index, orig_id)
    end
    narr.orig_id = nil
end


text:
<?php
namespace Faker\Tests\Engine\Common\Datasource\Mock;

use Faker\Tests\Engine\Common\Datasource\Mock\MockDatasource;
use Faker\Components\Engine\Common\Datasource\AbstractDefinition;

class MockDefinition extends AbstractDefinition
{

    public function getNode()
    {
        return new MockDatasource();
    }

}
/* End of Class */


text:
@import GameKit;
@import JavaScriptCore;

@protocol JSBGKChallenge;

@protocol JSBGKAchievementChallenge <JSExport, JSBGKChallenge>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

#pragma clang diagnostic pop

@end


text:
import { clamp } from './clamp.js';

function easeOut(value: number) {
  return 1 - Math.pow(1 - value, 3);
}

type Resolver = (value?: void | PromiseLike<void>) => void;

const animations = new WeakMap<HTMLElement, {id: number, resolve: Resolver}>();

/**
 * Fades an element using `requestAnimationFrame`. Takes a parameter detailing
 * the animation, which is an object containing `to` (`0 <= to <= 1`), `from`
 * (`0 <= to <= 1`), duration (milliseconds), and `ease` (a function that takes
 * a value between `0` and `1` and returns a new value, also between `0` and
 * `1`) properties.
 *
 * ```javascript
 * fade(someElement, { from: 1, to: 1, duration: 200, ease: (v) => v })
 * ```
 *
 * @param target The element to fade.
 */
export function fade(target: HTMLElement,
                     {from = 1,
                      to = 0,
                      delay = 0,
                      duration = 250,
                      ease = easeOut} = {}): Promise<void> {
  return new Promise((resolve) => {
    const existingAnimation = animations.get(target);
    if (existingAnimation) {
      cancelAnimationFrame(existingAnimation.id);
      animations.delete(target);
      existingAnimation.resolve();
    }

    target.style.opacity = from.toString();
    const start = self.performance.now() + delay;
    const update = () => {
      const now = self.performance.now();
      const time = clamp((now - start) / duration, 0, 1);
      const value = from + ((to - from) * ease(time));

      target.style.opacity = value.toString();

      if (time < 1) {
        animations.set(target, {id: requestAnimationFrame(update), resolve});
      } else {
        target.style.opacity = to.toString();
        animations.delete(target);
        resolve();
      }
    };

    animations.set(target, {id: requestAnimationFrame(update), resolve});
  });
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

<title>OPTION :: disabled</title>

you should see a dropdown with 3 options below. The second option should be inaccessible

<form action="">
<select>
	<option>one</option>
	<option disabled>two</option>
	<option>three</option>
</select>
</form>


text:
module YamWow
  class LimitedMessagesWithTopicIdRequest

    def initialize(client, responder)
      @client = client
      @responder = responder
    end

    def send(topic_id, options={})
      data = @client.get_messages_about_topic topic_id, threaded: true, older_than: options[:older_than_id]
      @responder.create_response data['messages'], data['references']
    end

  end
end


text:
package nl.mycompany.webapp.conf;

import nl.mycompany.questionaire.domain.Question;
import nl.mycompany.webapp.aspect.EngineLoginAspect;
import nl.mycompany.webapp.ui.process.answerquestion.AnswerQuestionPresenter;
import nl.mycompany.webapp.ui.process.answerquestion.AnswerQuestionPresenterFactory;
import nl.mycompany.webapp.ui.process.answerquestion.NewAnswerQuestionProcessFormFactory;
import nl.mycompany.webapp.ui.process.answerquestion.NewAnswerQuestionProcessFormImpl;
import nl.mycompany.webapp.ui.process.answerquestion.SingleQuestionComponent;
import nl.mycompany.webapp.ui.process.answerquestion.SingleQuestionComponentFactory;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.aspectj.EnableSpringConfigured;

import com.vaadin.spring.annotation.EnableVaadin;

@Configuration
@EnableVaadin
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableSpringConfigured
public class WebappConfiguration {

	private static final Logger LOG = Logger
			.getLogger(WebappConfiguration.class);

	@Bean
	public SingleQuestionComponentFactory singleQuestionComponentFactory() {
		return new SingleQuestionComponentFactory() {

			@Override
			public SingleQuestionComponent createSingleQuestionComponent(Question question
					) {
				return singleQuestionComponent(question);
			}
		};
	}

	@Bean
	public NewAnswerQuestionProcessFormFactory startAnswerQuestionFormFactory() {
		return new NewAnswerQuestionProcessFormFactory() {

			@Override
			public NewAnswerQuestionProcessFormImpl startAnswerQuestionForm(
					) {
				return new NewAnswerQuestionProcessFormImpl();
			}
		};
	}

	@Bean
	@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
	SingleQuestionComponent singleQuestionComponent(Question question)
	{
		return new SingleQuestionComponent(question);
	}

	@Bean
	EngineLoginAspect engineLogingAspect() {
		return new EngineLoginAspect();
	}

}


text:
package org.sports.hbaseparse.repository;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.impl.XMLResponseParser;
import org.apache.solr.common.SolrInputDocument;

public class SolrUpdater {
	private final String urlSolr = "http://localhost:8983/solr/nutch";

	private Collection<SolrInputDocument> documents;
	private SolrServer server;

	private final int commitCount;

	public SolrUpdater(int commitCount) {
		this.documents = new ArrayList<SolrInputDocument>();
		this.server = this.getSolrServer();
		this.commitCount = commitCount;
	}

	private SolrServer getSolrServer() {
		HttpSolrServer server = new HttpSolrServer(urlSolr);
		server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
		server.setConnectionTimeout(5000); // 5 seconds to establish TCP
		// Setting the XML response parser is only required for cross
		// version compatibility and only when one side is 1.4.1 or
		// earlier and the other side is 3.1 or later.
		server.setParser(new XMLResponseParser()); // binary parser is used by
													// default
		// The following settings are provided here for completeness.
		// They will not normally be required, and should only be used
		// after consulting javadocs to know whether they are truly required.
		server.setSoTimeout(5000); // socket read timeout
		server.setDefaultMaxConnectionsPerHost(100);
		server.setMaxTotalConnections(100);
		server.setFollowRedirects(false); // defaults to false
		// allowCompression defaults to false.
		// Server side must support gzip or deflate for this to have any effect.
		server.setAllowCompression(true);

		return server;
	}

	public boolean doCommit() {
		return documents.size() % this.commitCount == 0;
	}

	public void commitDocuments() throws SolrServerException, IOException {
		int docCount = documents.size();
		if (docCount == 0) {
			return;
		}

		server.add(documents);
		server.commit();

		documents.clear();

		System.out.println("Commited " + docCount + " documents");
	}

	public void updateEntry(Map<String, Object> values)
			throws SolrServerException, IOException {

		SolrInputDocument doc = new SolrInputDocument();

		for (Entry<String, Object> entry : values.entrySet()) {
			doc.addField(entry.getKey(), entry.getValue());
		}

		this.documents.add(doc);

		if (this.doCommit()) {
			this.commitDocuments();
		}
	}

}


text:
package com.github.rollingmetrics.util;

import com.github.rollingmetrics.histogram.accumulator.ResetByChunksAccumulator;

import java.util.Objects;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Util class which should be used for execution tasks(like histogram rotation) in background.
 * Known clients: {@link ResetByChunksAccumulator}.
 *
 * For background execution this class maintains own implementation of executor {@link SingleThreadExecutor}
 * which extremely fast and has no blocking on task queueing.
 */
public final class ResilientExecutionUtil {

    private static final ThreadFactory DEFAULT_THREAD_FACTORY = new DaemonThreadFactory("metrics-core-hdr-background-worker");

    private static final ResilientExecutionUtil INSTANCE = new ResilientExecutionUtil();

    private volatile SingleThreadExecutor executorInstance;
    private ThreadFactory threadFactory = DEFAULT_THREAD_FACTORY;

    /**
     * @return instance of {@link ResilientExecutionUtil}
     */
    public static ResilientExecutionUtil getInstance() {
        return INSTANCE;
    }

    /**
     * The constructor visibility is package-private for unit testing
     */
    ResilientExecutionUtil() {
        // do nothing
    }

    /**
     * Executes task on executor. If executor is terminated or overloaded then executes task in current thread.
     *
     * @param executor
     * @param task
     */
    public void execute(Executor executor, Runnable task) {
        if (executor instanceof SingleThreadExecutor) {
            // we can trust to own executor implementation and schedule task without advanced control
            executor.execute(task);
            return;
        }

        // We are having deal with unknown executor implementation in the unknown state.
        // So we need to execute task in current thread if executor failed to do it by itself,
        // but to avoid of twice execution we need to wrap around the task by AtomicBoolean
        AtomicBoolean alreadyExecuted = new AtomicBoolean(false);
        Runnable oneShotRunnable = () -> {
            if (alreadyExecuted.compareAndSet(false, true)) {
                task.run();
            }
        };
        try {
            executor.execute(oneShotRunnable);
        } catch (Throwable e) {
            // The executor can be stopped or overloaded,
            // just execute task in current thread and ignore exception
            oneShotRunnable.run();
        }
    }

    /**
     * @return instance of {@link SingleThreadExecutor}
     */
    public Executor getBackgroundExecutor() {
        return getExecutorInstance();
    }

    /**
     * If the {@link #getBackgroundExecutor} was called before, the this method perform shutdown of background execution thread.
     */
    public synchronized void shutdownBackgroundExecutor() {
        if (executorInstance != null) {
            executorInstance.stopExecutionThread();
        }
    }

    /**
     * Sets the thread threadFactory which will be used for construction of {@link SingleThreadExecutor}.
     *

     * This method should be called strongly before first invocation of {@link #getBackgroundExecutor}.
     *

     *
     *

     * This method is designed to be used in restricted environments with enabled SecurityManager,
     * when creation of new thread can fail by security limitation.
     * Normally, you should not use this method, because {@link #DEFAULT_THREAD_FACTORY} is quit enough.
     *

     *
     * @param threadFactory
     * @throws IllegalStateException if executor already created
     */
    public synchronized void setThreadFactory(ThreadFactory threadFactory) {
        if (executorInstance != null) {
            String msg = "The executor instance already created with " + threadFactory +
                    ", so it is impossible to replace threadFactory." +
                    " You should call setThreadFactory strongly before first invocation of getBackgroundExecutor";
            throw new IllegalStateException(msg);
        }
        this.threadFactory = Objects.requireNonNull(threadFactory);
    }

    private SingleThreadExecutor getExecutorInstance() {
        SingleThreadExecutor executorInstance = this.executorInstance;
        if (executorInstance == null) {
            synchronized (this) {
                executorInstance = this.executorInstance;
                if (executorInstance == null) {
                    executorInstance = new SingleThreadExecutor(threadFactory);
                    this.executorInstance = executorInstance;
                }
            }
        }
        return executorInstance;
    }

}


text:
package org.telegram.telegrambots.meta.api.methods.send;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.MessageEntity;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

import java.util.List;

/**
 * @author Ruben Bermudez
 * @version 4.0.0
 * Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
 * On success, the sent Message is returned.
 *
 * Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
 */
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SendAnimation extends PartialBotApiMethod<Message> {
    public static final String PATH = "sendAnimation";

    public static final String CHATID_FIELD = "chat_id";
    public static final String MESSAGETHREADID_FIELD = "message_thread_id";
    public static final String ANIMATION_FIELD = "animation";
    public static final String DURATION_FIELD = "duration";
    public static final String WIDTH_FIELD = "width";
    public static final String HEIGHT_FIELD = "height";
    public static final String CAPTION_FIELD = "caption";
    public static final String PARSEMODE_FIELD = "parse_mode";
    public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
    public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
    public static final String REPLYMARKUP_FIELD = "reply_markup";
    public static final String THUMB_FIELD = "thumb";
    public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
    public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
    public static final String PROTECTCONTENT_FIELD = "protect_content";

    @NonNull
    private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
    /**
     * Animation to send. Pass a file_id as String to send an animation that exists on the
     * Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation
     * from the Internet, or upload a new animation using multipart/form-data.
     */
    /**
     * Unique identifier for the target message thread (topic) of the forum;
     * for forum supergroups only
     */
    private Integer messageThreadId;
    @NonNull
    private InputFile animation;
    private Integer duration; ///< Optional. Duration of sent animation in seconds
    private String caption; ///< Optional. Animation caption (may also be used when resending videos by file_id).
    private Integer width; ///< Optional. Animation width
    private Integer height; ///< Optional. Animation height
    private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
    private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message
    private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
    private String parseMode; ///< Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
    /**
     * Optional.
     * Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
     * A thumbnail's width and height should not exceed 320.
     * Ignored if the file is not uploaded using multipart/form-data.
     * Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>"
     * if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
     */
    private InputFile thumb;
    @Singular
    private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
    private Boolean allowSendingWithoutReply; ///< Optional	Pass True, if the message should be sent even if the specified replied-to message is not found
    private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving

    @Tolerate
    public void setChatId(@NonNull Long chatId) {
        this.chatId = chatId.toString();
    }

    public void enableNotification() {
        this.disableNotification = false;
    }

    public void disableNotification() {
        this.disableNotification = true;
    }

    @Override
    public Message deserializeResponse(String answer) throws TelegramApiRequestException {
        return deserializeResponse(answer, Message.class);
    }

    @Override
    public void validate() throws TelegramApiValidationException {
        if (chatId.isEmpty()) {
            throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
        }

        if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
            throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
        }

        animation.validate();

        if (replyMarkup != null) {
            replyMarkup.validate();
        }
        if (thumb != null) {
            thumb.validate();
        }
    }

    public static class SendAnimationBuilder {

        @Tolerate
        public SendAnimationBuilder chatId(@NonNull Long chatId) {
            this.chatId = chatId.toString();
            return this;
        }
    }
}


text:
Yii 2 Basic Project Template
============================

Yii 2 Basic Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
rapidly creating small projects.

The template contains the basic features including user login/logout and a contact page.
It includes all commonly used configurations that would allow you to focus on adding new
features to your application.

[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-basic/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-basic)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-basic/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-basic)
[![Build Status](https://travis-ci.org/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-basic)

DIRECTORY STRUCTURE
-------------------

      assets/             contains assets definition
      commands/           contains console commands (controllers)
      config/             contains application configurations
      controllers/        contains Web controller classes
      mail/               contains view files for e-mails
      models/             contains model classes
      runtime/            contains files generated during runtime
      tests/              contains various tests for the basic application
      vendor/             contains dependent 3rd-party packages
      views/              contains view files for the Web application
      web/                contains the entry script and Web resources

REQUIREMENTS
------------

The minimum requirement by this project template that your Web server supports PHP 5.4.0.

INSTALLATION
------------

### Install from an Archive File

Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
a directory named `basic` that is directly under the Web root.

Set cookie validation key in `config/web.php` file to some random secret string:

```php
'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '<secret random string goes here>',
],
```

You can then access the application through the following URL:

~~~
http://localhost/basic/web/
~~~

### Install via Composer

If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).

You can then install this project template using the following command:

~~~
php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
~~~

Now you should be able to access the application through the following URL, assuming `basic` is the directory
directly under the Web root.

~~~
http://localhost/basic/web/
~~~

CONFIGURATION
-------------

### Database

Edit the file `config/db.php` with real data, for example:

```php
//MySql
return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];
//SQL Server
return [
    'class' => 'yii\db\Connection',
    'dsn' => 'sqlsrv:server=SERVERNAME;Database=DBNAME',
    'username' => 'sa',
    'password' => '123',
    'charset' => 'utf8',
];
```

### RBAC

Execute:
- php yii migrate --migrationPath=@yii/rbac/migrations
- php yii rbac/init

### Migrations
- php yii migrate/create create_TABLENAME_table
- php yii migrate

### Date picker plugin
- php composer.phar require "2amigos/yii2-date-picker-widget" "*"

### Suggest Dropdown Search
- composer require kartik-v/yii2-widget-select2 "*"

### Dynamic Forms
- composer require --prefer-dist wbraganca/yii2-dynamicform "*"

### Gridview Karthik expand row
- composer require kartik-v/yii2-grid "*"

**NOTES:**
- Yii won't create the database for you, this has to be done manually before you can access it.
- Check and edit the other files in the `config/` directory to customize your application as required.
- Refer to the README in the `tests` directory for information specific to basic application tests.


text:
<?php

namespace Spatie\MediaLibrary\Models\Traits;

trait CustomMediaProperties
{
    public function setCustomHeaders(array $customHeaders): self
    {
        $this->setCustomProperty('custom_headers', $customHeaders);

        return $this;
    }

    public function getCustomHeaders(): array
    {
        return $this->getCustomProperty('custom_headers', []);
    }
}


text:
package sample.actuator;

import java.util.Map;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Integration tests for insecured service endpoints (even with Spring Security on
 * classpath).
 *
 * @author Dave Syer
 */
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
		"security.basic.enabled:false", "server.servlet.path:/spring" })
@DirtiesContext
public class ServletPathInsecureSampleActuatorApplicationTests {

	@Autowired
	private TestRestTemplate restTemplate;

	@Test
	public void testHome() throws Exception {
		@SuppressWarnings("rawtypes")
		ResponseEntity<Map> entity = this.restTemplate.getForEntity("/spring/",
				Map.class);
		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
		@SuppressWarnings("unchecked")
		Map<String, Object> body = entity.getBody();
		assertThat(body.get("message")).isEqualTo("Hello Phil");
		assertThat(entity.getHeaders()).doesNotContainKey("Set-Cookie");
	}

	@Test
	public void testMetricsIsSecure() throws Exception {
		@SuppressWarnings("rawtypes")
		ResponseEntity<Map> entity = this.restTemplate.getForEntity("/spring/metrics",
				Map.class);
		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
	}

}


text:
package org.para.distributed.master;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.Logger;
import org.para.constant.ParaConstant;
import org.para.distributed.dto.DistributedTaskMessage;
import org.para.distributed.memcache.SpringInitContextMemcache;
import org.para.distributed.mq.StartJobJmsSend;
import org.para.distributed.task.DistributedParallelTask;
import org.para.distributed.util.MQMessageBuilder;
import org.para.enums.TaskCycle;
import org.para.exception.ParallelException;
import org.para.execute.model.JobProperty;
import org.para.execute.model.TaskProperty;
import org.para.trace.listener.FailEventListener;
import org.para.util.MessageOutUtil;

public abstract class DistributedParallelExecute {

	private static Logger logger = Logger
			.getLogger(DistributedParallelExecute.class);

	/**
	 * 同样的任务实例,可以并发,无线程安全问题,因为每个任务实例是newInstence出来的对象
	 */
	public CountDownLatch countDownLatch = null;

	/**
	 * 发送topic的jms消息的发送器,直接从spring里面取得
	 */
	public StartJobJmsSend startJobJmsSend = MasterServer.MasterApplicationContext
			.getBean("startJobJmsSend", StartJobJmsSend.class);

	public CountDownLatch getCountDownLatch() {
		return countDownLatch;
	}

	public void setCountDownLatch(CountDownLatch countDownLatch) {
		this.countDownLatch = countDownLatch;
	}

	public StartJobJmsSend getStartJobJmsSend() {
		return startJobJmsSend;
	}

	public void setStartJobJmsSend(StartJobJmsSend startJobJmsSend) {
		this.startJobJmsSend = startJobJmsSend;
	}

	/**
	 * 初始化分布式任务,init Distributed job about some prepare work
	 *
	 * @param sourceObjectConf
	 */
	protected abstract void init(Map<String, String> sourceObjectConf);

	/**
	 * 执行分布式任务逻辑,exe big Paralle Job template,this is croe execute logic
	 *
	 * @param jarHttpURI
	 * @param sourceObjectConf
	 * @param parallelism_hint
	 * @return
	 * @throws ParallelException
	 */
	public JobProperty exeParalleJob(String jarHttpURI,
			Map<String, String> sourceObjectConf, int parallelism_hint)
			throws ParallelException {
		return this.exeParalleJob(jarHttpURI, sourceObjectConf,
				parallelism_hint, 0, null);
	}

	/**
	 * 带有失败监听的分布式执行器,exe big Paralle Job template,this is croe execute logic
	 *
	 * @param jarHttpURI
	 * @param sourceObjectConf
	 * @param parallelism_hint
	 * @param failEventListener
	 * @return
	 * @throws ParallelException
	 */
	public JobProperty exeParalleJob(String jarHttpURI,
			Map<String, String> sourceObjectConf, int parallelism_hint,
			FailEventListener failEventListener) throws ParallelException {
		return this.exeParalleJob(jarHttpURI, sourceObjectConf,
				parallelism_hint, 0, failEventListener);
	}

	/**
	 * 带有失败监听,超时器的分布式执行器,,exe big Paralle Job template,this is croe execute
	 * logic
	 *
	 * @param jarHttpURI
	 * @param sourceObjectConf
	 * @param parallelism_hint
	 * @param timeOut
	 * @param failEventListener
	 * @return
	 * @throws ParallelException
	 */
	public JobProperty exeParalleJob(String jarHttpURI,
			Map<String, String> sourceObjectConf, int parallelism_hint,
			long timeOut, FailEventListener failEventListener)
			throws ParallelException {

		logger.info("exe Distributed Paralle Job");

		// 没有任何资源节点执行任务
		if (!WorkerManagers.isHaveWorkerNodeToExecuteDistributed()) {
			logger.info("there is not any one workernode to Execute Distributed task");
			return null;
		}

		// 做一些初始化的动作
		init(sourceObjectConf);

		// 将一个大的任务分割成为一个个小的任务属性数组
		TaskProperty[] taskPropertyArray = splitJob(sourceObjectConf,
				parallelism_hint);

		// 建立计数器
		countDownLatch = new CountDownLatch(taskPropertyArray.length);

		// 生成jobid作为标识
		long jobId = System.nanoTime();

		// 进行执行逻辑,这里实际上是将任务进行分发,分发到各个子节点去执行,此时已经是异步执行了
		execute(jarHttpURI, jobId, taskPropertyArray, sourceObjectConf,
				failEventListener);
		try {

			if (timeOut > 0) {
				countDownLatch.await(timeOut, TimeUnit.SECONDS);
			} else {
				countDownLatch.await();
			}
		} catch (InterruptedException interruptedException) {
			throw new ParallelException(interruptedException);
		}
		return joinJob(jobId, taskPropertyArray);
	}

	/**
	 * 将一个大的任务分割成为一个个小的任务属性数组,split big Job to TaskProperty Arrys
	 *
	 * @param sourceObjectConf
	 * @param 并行度
	 *            :parallelism_hint
	 * @return
	 */
	protected TaskProperty[] splitJob(Map<String, String> sourceObjectConf,
			int parallelism_hint) {

		// 可计量的任务总的数字count
		int resultCount = analyzeResultCount(sourceObjectConf);

		// 实际的任务分块数目,也就是并行度,actual block Num
		int currentBlockNum = (parallelism_hint <= 0 ? ParaConstant.DefaultFileBlockNum
				: parallelism_hint);

		// 平均每个并行任务分摊的个数
		int averageBlockSize = resultCount / currentBlockNum;

		// 最后一个任务分块的个数
		int lastBlockSize = averageBlockSize + resultCount % currentBlockNum;

		TaskProperty[] taskPropertyArray = new TaskProperty[currentBlockNum];
		for (int i = 0; i < currentBlockNum; i++) {

			if (i == currentBlockNum - 1) {
				taskPropertyArray[i] = new TaskProperty(i + 1, resultCount, i,
						lastBlockSize,averageBlockSize);
				break;
			}

			taskPropertyArray[i] = new TaskProperty(i + 1, resultCount, i,
					averageBlockSize,averageBlockSize);
		}

		return taskPropertyArray;
	}

	/**
	 * 分析原始任务源的大小,这个需要具体的插件子类自己实现,analyze source job count Result num
	 *
	 * @param sourceObjectConf
	 * @return
	 */
	protected abstract int analyzeResultCount(
			Map<String, String> sourceObjectConf);

	/**
	 * 构建一个分布式任务实体
	 *
	 * @param countDownLatch
	 * @param taskProperty
	 * @param srcObject
	 * @param failEventListener
	 * @param objects
	 * @return
	 */
	protected abstract DistributedParallelTask buildDistributedParallelTask(
			CountDownLatch countDownLatch, TaskProperty taskProperty,
			Map<String, String> sourceObjectConf,
			FailEventListener failEventListener);

	/**
	 * execute Parallel task
	 *
	 * @param taskPropertyArray
	 * @param targetObject
	 * @param failEventListener
	 * @param objects
	 */
	private void execute(String jarHttpURI, long jobId,
			TaskProperty[] taskPropertyArray,
			Map<String, String> sourceObjectConf,
			FailEventListener failEventListener) {

		// 之前已经分割的子任务个数
		int taskPropertyArrayLength = taskPropertyArray.length;

		//
		List<DistributedParallelTask> distributedParallelTaskList = new ArrayList<DistributedParallelTask>(taskPropertyArrayLength);

		DistributedParallelTask distributedParallelTask = null;

		// 将任务进行List形式的重组
		for (int i = 0; i < taskPropertyArrayLength; i++) {
			taskPropertyArray[i].setTaskCycle(TaskCycle.TASK_RUNNING);
			distributedParallelTask = buildDistributedParallelTask(
					countDownLatch, taskPropertyArray[i], sourceObjectConf,
					failEventListener);
			distributedParallelTask.setJobId(jobId);
			distributedParallelTaskList.add(distributedParallelTask);

			//往memcache缓存中存储任务实体信息,费时间
			SpringInitContextMemcache.putDistributedParallelTask(jobId,
					taskPropertyArray[i].getTaskId(), distributedParallelTask);

		}

		// 构建分布式驱动消息
		DistributedTaskMessage distributedTaskMessage = MQMessageBuilder
				.buildDistributeTasks(jobId, distributedParallelTaskList);
		distributedTaskMessage.setJarHttpURI(jarHttpURI);

		// 调用mq接口进行分发
		logger.info("send distributedTaskMessage :" + distributedTaskMessage);

		startJobJmsSend.sendJms(distributedTaskMessage);

		// 任务池暂存正在[运行的任务],放入内存中
		DistributedTaskManagers.getDistributedTaskManagerInstence()
				.putParallelTaskList(jobId, distributedParallelTaskList);

	}

	/**
	 * final collect execute result
	 *
	 * @param jobId
	 * @param taskPropertyArray
	 * @return
	 */
	protected JobProperty joinJob(long jobId, TaskProperty[] taskPropertyArray) {

		boolean executeResult = true;
		TaskCycle taskCycle = null;
		int countTaskNum = 0;
		int successTaskNum = 0;
		int errorTaskNum = 0;
		for (TaskProperty taskProperty : taskPropertyArray) {
			taskCycle = taskProperty.getTaskCycle();
			if (taskCycle != TaskCycle.TASK_SUCCEED) {
				int taskId = taskProperty.getTaskId();
				MessageOutUtil.SystemOutPrint(jobId + ":" + taskId
						+ ":executeResult is false");
				executeResult = false;
				errorTaskNum++;
			} else {
				successTaskNum++;
			}
		}
		StringBuilder sb = new StringBuilder(128);

		sb.append("Distributed job:").append(jobId)
				.append(":execute Distributed job result [")
				.append(executeResult).append("],countTaskNum=")
				.append(countTaskNum).append(",successTaskNum=")
				.append(successTaskNum).append(",errorTaskNum=")
				.append(errorTaskNum);

		MessageOutUtil.SystemOutPrint(sb);

		JobProperty jobProperty = new JobProperty(jobId, taskPropertyArray,
				executeResult);

		return jobProperty;
	}

}


text:
package collection

import (
	"testing"

	_ "github.com/gogo/protobuf/types"
	. "github.com/onsi/gomega"
)

func TestSpecs_Basic(t *testing.T) {
	g := NewGomegaWithT(t)
	b := NewSpecsBuilder()

	s := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	err := b.Add(s)
	g.Expect(err).To(BeNil())

	specs := b.Build()
	g.Expect(specs.All()).To(HaveLen(1))
	g.Expect(specs.All()[0]).To(Equal(s))
}

func TestSpecs_MustAdd(t *testing.T) {
	g := NewGomegaWithT(t)
	defer func() {
		r := recover()
		g.Expect(r).To(BeNil())
	}()
	b := NewSpecsBuilder()

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	b.MustAdd(spec)
}

func TestSpecs_MustRegister_Panic(t *testing.T) {
	g := NewGomegaWithT(t)
	defer func() {
		r := recover()
		g.Expect(r).NotTo(BeNil())
	}()
	b := NewSpecsBuilder()

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	b.MustAdd(spec)
	b.MustAdd(spec)
}

func TestSpecsBuilder_Remove(t *testing.T) {
	g := NewGomegaWithT(t)
	b := NewSpecsBuilder()

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	b.MustAdd(spec)

	b.Remove(spec.Name)

	specs := b.Build()
	g.Expect(specs.All()).To(HaveLen(0))
}

func TestSpecsBuilder_RemoveSpecs(t *testing.T) {
	g := NewGomegaWithT(t)

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")

	b1 := NewSpecsBuilder()
	b1.MustAdd(spec)

	b2 := NewSpecsBuilder()
	b2.MustAdd(spec)
	s := b2.Build()

	b1.UnregisterSpecs(s)
	s = b1.Build()
	g.Expect(s.All()).To(HaveLen(0))
}

func TestSpecs_Lookup(t *testing.T) {
	g := NewGomegaWithT(t)
	b := NewSpecsBuilder()

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")

	b.MustAdd(spec)
	specs := b.Build()

	s2, found := specs.Lookup("foo")
	g.Expect(found).To(BeTrue())
	g.Expect(s2).To(Equal(spec))

	_, found = specs.Lookup("zoo")
	g.Expect(found).To(BeFalse())
}

func TestSpecs_Get(t *testing.T) {
	g := NewGomegaWithT(t)
	defer func() {
		r := recover()
		g.Expect(r).To(BeNil())
	}()

	b := NewSpecsBuilder()

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")

	b.MustAdd(spec)
	specs := b.Build()

	s2 := specs.Get("foo")
	g.Expect(s2).To(Equal(spec))
}

func TestSpecs_Get_Panic(t *testing.T) {
	g := NewGomegaWithT(t)
	defer func() {
		r := recover()
		g.Expect(r).NotTo(BeNil())
	}()

	b := NewSpecsBuilder()

	spec := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")

	b.MustAdd(spec)
	specs := b.Build()

	_ = specs.Get("zoo")
}

func TestSpecs_CollectionNames(t *testing.T) {
	g := NewGomegaWithT(t)
	b := NewSpecsBuilder()

	s1 := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	s2 := MustNewSpec("bar", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	b.MustAdd(s1)
	b.MustAdd(s2)

	names := b.Build().CollectionNames()
	expected := []string{"bar", "foo"}
	g.Expect(names).To(Equal(expected))
}

func TestSpecs_Validate(t *testing.T) {
	g := NewGomegaWithT(t)
	b := NewSpecsBuilder()

	s1 := MustNewSpec("foo", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	s2 := MustNewSpec("bar", "github.com/gogo/protobuf/types", "google.protobuf.Empty")
	b.MustAdd(s1)
	b.MustAdd(s2)

	err := b.Build().Validate()
	g.Expect(err).To(BeNil())
}

func TestSpecs_Validate_Error(t *testing.T) {
	g := NewGomegaWithT(t)
	b := NewSpecsBuilder()

	s1 := MustNewSpec("foo", "github.com/gogo/protobuf/types", "zoo")
	b.MustAdd(s1)

	err := b.Build().Validate()
	g.Expect(err).NotTo(BeNil())
}


text:
CREATE TABLE stat_notifier (
  `datetime` datetime NOT NULL,
  `interval` tinyint(3) unsigned NOT NULL,
  `elapsed` int(10) unsigned NOT NULL,
  `user_count` int(10) unsigned NOT NULL,
  `followed_teacher_count` int(10) unsigned NOT NULL,
  PRIMARY KEY (`datetime`, `interval`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back
DROP TABLE stat_notifier;


text:
package v1beta1

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"
	"knative.dev/pkg/apis"
	duckv1 "knative.dev/pkg/apis/duck/v1"
	"knative.dev/pkg/kmeta"
)

// +genclient
// +genreconciler
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// NatssChannel is a resource representing a NATSS Channel.
type NatssChannel struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the desired state of the Channel.
	Spec NatssChannelSpec `json:"spec,omitempty"`

	// Status represents the current state of the NatssChannel. This data may be out of
	// date.
	// +optional
	Status NatssChannelStatus `json:"status,omitempty"`
}

// Check that Channel can be validated, can be defaulted, and has immutable fields.
var (
	_ apis.Validatable = (*NatssChannel)(nil)
	_ apis.Defaultable = (*NatssChannel)(nil)
	// Check that InMemoryChannel can return its spec untyped.
	_ apis.HasSpec = (*NatssChannel)(nil)
	// Check that we can create OwnerReferences to an InMemoryChannel.
	_ kmeta.OwnerRefable = (*NatssChannel)(nil)
	_ runtime.Object     = (*NatssChannel)(nil)
	_ duckv1.KRShaped    = (*NatssChannel)(nil)
)

// NatssChannelSpec defines the specification for a NatssChannel.
type NatssChannelSpec struct {
	// inherits duck/v1 ChannelableSpec, which currently provides:
	// * SubscribableSpec - List of subscribers
	// * DeliverySpec - contains options controlling the event delivery
	eventingduckv1.ChannelableSpec `json:",inline"`
}

// NatssChannelStatus represents the current state of a NatssChannel.
type NatssChannelStatus struct {
	// inherits duck/v1 ChannelableStatus, which currently provides:
	// * ObservedGeneration - the 'Generation' of the Service that was last processed by the controller.
	// * Conditions - the latest available observations of a resource's current state.
	// * AddressStatus is the part where the Channelable fulfills the Addressable contract.
	// * Subscribers is populated with the statuses of each of the Channelable's subscribers.
	// * DeadLetterChannel is a KReference and is set by the channel when it supports native error handling via a channel
	//   Failed messages are delivered here.
	eventingduckv1.ChannelableStatus `json:",inline"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// NatssChannelList is a collection of NatssChannels.
type NatssChannelList struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NatssChannel `json:"items"`
}

// GetGroupVersionKind returns GroupVersionKind for NatssChannels
func (*NatssChannel) GetGroupVersionKind() schema.GroupVersionKind {
	return SchemeGroupVersion.WithKind("NatssChannel")
}

// GetStatus retrieves the duck status for this resource. Implements the KRShaped interface.
func (n *NatssChannel) GetStatus() *duckv1.Status {
	return &n.Status.Status
}


text:
using Sce.Atf;

namespace TextureEditor
{
    ///
    /// Filenames for standard game icons. Call ResourceUtil.Register(typeof(Resources))
    /// to cause the referenced images to become globally available to other users of ResourceUtil.
    public static class Resources
    {
        ///
        /// Source icon name
		[ImageResource( "Source16.png", "Source24.png", "Source32.png" )]
        public static readonly string SourceImage;

		///
		/// Exported icon name
		[ImageResource( "Exported16.png", "Exported24.png", "Exported32.png" )]
		public static readonly string ExportedImage;

		///
		/// Difference icon name
		[ImageResource( "Difference16.png", "Difference24.png", "Difference32.png" )]
		public static readonly string DifferenceImage;

		///
		/// Show red channel icon
		[ImageResource( "ShowRed.png" )]
		public static readonly string ShowRedChannelImage;

		///
		/// Show green channel icon
		[ImageResource( "ShowGreen.png" )]
		public static readonly string ShowGreenChannelImage;

		///
		/// Show blue channel icon
		[ImageResource( "ShowBlue.png" )]
		public static readonly string ShowBlueChannelImage;

		///
		/// Show alpha channel icon
		[ImageResource( "ShowAlpha.png" )]
		public static readonly string ShowAlphaChannelImage;

		///
		/// Default program icon
		[ImageResource( "ProgramIcon.ico" )]
		public static readonly string ProgramIcon;

        private const string ResourcePath = "TextureEditor.Resources.";

        static Resources()
        {
            ResourceUtil.Register(typeof(Resources), ResourcePath);
        }
    }
}


text:
module SnakesAndLadders
  class Game
    attr_reader :board, :players, :winner, :turn, :player

    def initialize(board:, players: [], turn: 0)
      @board = board
      @players = players
      @turn = turn
    end

    def add_player(player)
      players.push(player)
    end

    def play_turn
      return if over?

      init_turn

      puts "#{player} rolls #{player.last_roll}!"

      if board.move(player, player_position, player_destination_after_last_roll)
        self.winner = player if won?
      else
        self.winner = player if will_win?
      end
    end

    def over?
      !!winner
    end

    def simulate
      play_turn until over?
    end

  private

    def init_turn
      @player = players.at(turn % players.size)
      @player.roll_die
      @turn += 1
    end

    def won?
      player_position.equal?(board_size)
    end

    def will_win?
      player_destination_after_last_roll >= board_size
    end

    def winner=(player)
      @winner = player
      puts "Game over! #{winner} wins in #{winner.turns} turns. Congratulations!"
    end

    def player_position
      player.position
    end

    def player_destination_after_last_roll
      player.destination_after_last_roll
    end

    def board_size
      board.size
    end
  end
end


text:
package proxy

import (
	"net/http"
	"reflect"
	"testing"
)

func TestOptions_String(t *testing.T) {
	tests := []struct {
		Options *Options
		String  string
	}{
		{emptyOptions, "0x0"},
		{
			&Options{1, 2, true, 90, true, true},
			"1x2,fit,r90,fv,fh",
		},
	}

	for i, tt := range tests {
		if got, want := tt.Options.String(), tt.String; got != want {
			t.Errorf("%d. Options.String returned %v, want %v", i, got, want)
		}
	}
}

func TestParseOptions(t *testing.T) {
	tests := []struct {
		Input   string
		Options *Options
	}{
		{"", emptyOptions},
		{"x", emptyOptions},
		{"0", emptyOptions},
		{",,,,", emptyOptions},

		// size variations
		{"1x", &Options{Width: 1}},
		{"x1", &Options{Height: 1}},
		{"1x2", &Options{Width: 1, Height: 2}},
		{"0.1x0.2", &Options{Width: 0.1, Height: 0.2}},

		// additional flags
		{"fit", &Options{Fit: true}},
		{"r90", &Options{Rotate: 90}},
		{"fv", &Options{FlipVertical: true}},
		{"fh", &Options{FlipHorizontal: true}},

		// duplicate flags (last one wins)
		{"1x2,3x4", &Options{Width: 3, Height: 4}},
		{"1x2,3", &Options{Width: 3, Height: 3}},
		{"1x2,0x3", &Options{Width: 0, Height: 3}},
		{"1x,x2", &Options{Width: 1, Height: 2}},
		{"r90,r270", &Options{Rotate: 270}},

		// mix of valid and invalid flags
		{"FOO,1,BAR,r90,BAZ", &Options{Width: 1, Height: 1, Rotate: 90}},

		{"1x2,fit,r90,fv,fh", &Options{1, 2, true, 90, true, true}},
		{"r90,fh,1x2,fv,fit", &Options{1, 2, true, 90, true, true}},
	}

	for i, tt := range tests {
		if got, want := ParseOptions(tt.Input), tt.Options; !reflect.DeepEqual(got, want) {
			t.Errorf("%d. ParseOptions returned %#v, want %#v", i, got, want)
		}
	}
}

// Test that request URLs are properly parsed into Options and RemoteURL.  This
// test verifies that invalid remote URLs throw errors, and that valid
// combinations of Options and URL are accept.  This does not exhaustively test
// the various Options that can be specified; see TestParseOptions for that.
func TestNewRequest(t *testing.T) {
	tests := []struct {
		URL         string
		RemoteURL   string
		Options     *Options
		ExpectError bool
	}{
		// invalid URLs
		{
			"http://localhost/", "", nil, true,
		},
		{
			"http://localhost/1/", "", nil, true,
		},
		{
			"http://localhost//example.com/foo", "", nil, true,
		},
		{
			"http://localhost//ftp://example.com/foo", "", nil, true,
		},

		// invalid options.  These won't return errors, but will not fully parse the options
		{
			"http://localhost/s/http://example.com/",
			"http://example.com/", emptyOptions, false,
		},
		{
			"http://localhost/1xs/http://example.com/",
			"http://example.com/", &Options{Width: 1}, false,
		},

		// valid URLs
		{
			"http://localhost/http://example.com/foo",
			"http://example.com/foo", nil, false,
		},
		{
			"http://localhost//http://example.com/foo",
			"http://example.com/foo", emptyOptions, false,
		},
		{
			"http://localhost//https://example.com/foo",
			"https://example.com/foo", emptyOptions, false,
		},
		{
			"http://localhost/1x2/http://example.com/foo",
			"http://example.com/foo", &Options{Width: 1, Height: 2}, false,
		},
		{
			"http://localhost//http://example.com/foo?bar",
			"http://example.com/foo?bar", emptyOptions, false,
		},
	}

	for i, tt := range tests {
		req, err := http.NewRequest("GET", tt.URL, nil)
		if err != nil {
			t.Errorf("%d. Error parsing request: %v", i, err)
			continue
		}

		r, err := NewRequest(req)
		if tt.ExpectError {
			if err == nil {
				t.Errorf("%d. Expected parsing error", i)
			}
			continue
		} else if err != nil {
			t.Errorf("%d. Error parsing request: %v", i, err)
			continue
		}

		if got := r.URL.String(); tt.RemoteURL != got {
			t.Errorf("%d. Request URL = %v, want %v", i, got, tt.RemoteURL)
		}
		if !reflect.DeepEqual(tt.Options, r.Options) {
			t.Errorf("%d. Request Options = %v, want %v", i, r.Options, tt.Options)
		}
	}
}


text:
/**
 * View Models used by Spring MVC REST controllers.
 */
package ua.cie.snooker.domain.player.web.rest.vm;