text:
$(document).ready(function(){
	$(document).on('click', '.delete_item', function(){
		if (!confirm('Удалить?')) { return false; }
	});

	$(document).on('change', '.per-page', function(){
		$.ajax({
			data: {
				_token: $('meta[name="csrf-token"]').attr('content'),
				perPage: $(this).val()
			},
			success: function() {
				location.reload();
			}
		});
	});

	$(document).on('click', '.delete_field', function(e){
		e.preventDefault();
		var widget = $(this).closest('.widget');
		if ($(this).closest('.field').siblings('.field').size() == 0)
		{
			$(this).closest('.field').find('INPUT').val('');
			$(this).closest('.field').find('TEXTAREA').val('');
			$(this).closest('.field').find('SELECT').val('');
			$(this).closest('.field').find('.img').html('');
			$(this).closest('.field').find('.logopicker').find('IMG').remove();
			$(this).closest('.field').find('.delete-related').val(true);
			$(this).closest('.field').find('.image-container').remove();
		}
		else
		{
			$(this).closest('.field').remove();
		}
		reorder_numbers(widget);
	});

	$(document).on('change', 'INPUT[type="file"]', function(){
		$(this).closest('.field').find('.old-file').val('');
	});

	$(document).on('click', '.add-field', function(e){
		e.preventDefault();
		var widget = $(this).closest('.widget');
		$new_field = clone_field($(this));
		$new_field.insertAfter(widget.find('.field:last'));
		reorder_numbers(widget);
		init_components();
	});

	$(document).on('change', '.placement-picker', function()
	{
		var name = $(this).find('OPTION:selected').attr('rel');

		if ($(this).closest('.widget').find('.journal-picker').length > 0)
		{
			if ($('TEXTAREA.limit').length > 0)
				upperMe($('TEXTAREA.limit'));

			if (name == 'site')
			{
				$(this).closest('.widget').find('.journal-picker').hide();
			}
			else
			{
				$(this).closest('.widget').find('.journal-picker').show();
			}
		}
	});

	if ($('.placement-picker').closest('.widget').find('.journal-picker').length > 0)
	{
		if ($('.placement-picker').find('OPTION:selected').attr('rel') == 'site')
		{
			$('.placement-picker').closest('.widget').find('.journal-picker').hide();
		}
		else
		{
			$('.placement-picker').closest('.widget').find('.journal-picker').show();
		}
	}

	if ($('TEXTAREA.limit').length > 0 && $('.placement-picker').length == 1)
	{
		$(document).on('focus change keyup keydown keypress', 'TEXTAREA.limit', function(){
			upperMe($(this));
		});
	}

	//Зависимые селекты
	if ($('SELECT[data-constraint-field]').length > 0)
	{
		$('SELECT[data-constraint-field]').each(function(){
			var self = this;
			var $field = $(this).attr('data-constraint-field');
			var $constraint_class = $(this).attr('data-constraint-class');
			var $property = $(this).attr('data-constraint-property');
			var $key = $(this).attr('data-key');
			var $filter = $(this).attr('data-constraint-filter');
			var $action = $(this).attr('data-action')+'/fetchconstraint';

			if ($(this).attr('data-constraint-value'))
			{
				$(self).attr('disabled', 'disabled');
				$(self).selectpicker('refresh');
				$.ajax({
					url: $action,
					type: 'post',
					data: {
						_token: $('meta[name="csrf-token"]').attr('content'),
						constraint_class: $constraint_class,
						property: $property,
						key: $key,
						key_val: $('SELECT[name="'+$field+'"]').val(),
						constraint_value: $(this).attr('data-constraint-value'),
					},
					success: function(r) {
						$(self).find('option[value!=""]').remove();
						$.each(r, function(k, v){
							var option = $("<option/>", {
								value: v[$key],
								text: v[$filter]
							});
							if (k == 0) option.attr('selected', 'selected');
							$(self).append(option);
						});
						$(self).removeAttr('disabled');
						$(self).selectpicker('refresh');
					}
				});
			}

			$('SELECT[name="'+$field+'"]').on('change', function(){
				$(self).attr('disabled', 'disabled');
				$(self).selectpicker('refresh');
				$.ajax({
					url: $action,
					type: 'post',
					data: {
						_token: $('meta[name="csrf-token"]').attr('content'),
						constraint_class: $constraint_class,
						property: $property,
						key_val: $(this).val()
					},
					success: function(r) {
						$(self).find('option[value!=""]').remove();
						$.each(r, function(k, v){
							$(self).append($("<option/>", {
								value: v[$key],
								text: v[$filter]
							}));
						});
						$(self).removeAttr('disabled');
						$(self).selectpicker('refresh');
					}
				});
			});

			$(self).closest('.widget').on('keyup', '.bs-searchbox INPUT[type="text"]', function(){
				if ($('SELECT[name="'+$field+'"]').val())
				{
					var $filter_val = $(this).val();
					$(self).attr('disabled', 'disabled');
					$(self).selectpicker('refresh');
					$.ajax({
						url: $action,
						type: 'post',
						data: {
							_token: $('meta[name="csrf-token"]').attr('content'),
							constraint_class: $constraint_class,
							property: $property,
							filter: $filter,
							filter_val: $filter_val,
							key_val: $('SELECT[name="'+$field+'"]').val(),
						},
						success: function(r) {
							$(self).find('option[value!=""]').remove();
							$.each(r, function(k, v){
								$(self).append($("<option/>", {
									value: v[$key],
									text: v[$filter]
								}));
							});
							$(self).removeAttr('disabled');
							$(self).selectpicker('refresh');
						}
					});
				}
			});
		});
	}

	init_components();
});

function clone_field(elem)
{
	$new_field = elem.closest('.widget').find('.field:first').clone();
	$new_field.find('SELECT').val('');
	$new_field.find('SELECT').removeClass('init');
	$new_field.find('SELECT').attr('data-value', '');
	$new_field.find('TEXTAREA').val('');
	$new_field.find('INPUT').val('');

	/*Очистка поля адреса*/
	$new_field.closest('.field').find('.address').removeClass('init');
	$new_field.closest('.field').find('.address').find('.address-label').text('');
	$new_field.closest('.field').find('.address').find('SPAN').remove();
	/*Очистка поля адреса*/

	/*Очистка поля логотип*/
	$new_field.closest('.field').find('.logopicker').logo({destroy: true});
	/*Очистка поля логотип*/

	$new_field.closest('.field').find('.bootstrap-select').remove();

	/*Очистка чекбокса*/
	var $tmp_input = $new_field.closest('.field').find('INPUT[type="checkbox"]');
	var $container = $new_field.closest('.field').find('INPUT[type="checkbox"]').parent().parent();
	$container.html('');
	$container.append($tmp_input);
	/*Очистка чекбокса*/

	$new_field.closest('.field').find('.image-container').remove();

	return $new_field;
}

function init_components()
{
	$('.logopicker').logo();
	$('.address').address();
	$('.geoposition').geo();

	if ($('.tag').length > 0)
	{
		$('.tag').tagedit({
			autocompleteURL: $('.tag').attr('data-action')+'/fetchtags?class='+$('.tag').attr('data-class')+'&name='+$('.tag').attr('data-name'),
		});
	}

	$('.selectpicker').selectpicker({
		noneSelectedText: "Ничего не выбрано",
		noneResultsText: "Совпадений не найдено {0}"
	});
	$('input.icheck').iCheck({
		checkboxClass: 'icheckbox_square-blue',
		radioClass: 'iradio_square-blue'
	});
	$('.datenotimepicker:not(.init)').each(function(i){
		$(this).datetimepicker(
		{
			pickTime: false,
			language: 'ru'
		});
		$(this).addClass('init');
	});
	$('.datetimepicker:not(.init)').each(function(i){
		$(this).datetimepicker(
		{
			pickTime: true,
			language: 'ru'
		});
		$(this).addClass('init');
	});
	$('INPUT.phone').inputmask({ alias: 'phone', url: '/packages/azat/adminka/js/adminlte/plugins/input-mask/phone-codes/phone-codes.json'});
	$('INPUT.price').inputmask({ alias: 'integer', groupSeparator: ' ', autoGroup: true, digits: 0, digitsOptional: false, placeholder: '0' });

	//Toolbar полный
	var ckeditorToolbarFull = [
		{ name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
		{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
		{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
		{ name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
			'HiddenField' ] },
		'/',
		{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
		{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv',
		'-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
		{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
		{ name: 'insert', items : [ 'Image','VideoInfograph','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
		'/',
		{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
		{ name: 'colors', items : [ 'TextColor','BGColor' ] },
		{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
	];
	//Toolbar базовый
	var ckeditorToolbarBasic = [
		['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']
	];

	$('TEXTAREA.ckeditor:not(".init")').each(function()
	{
		CKEDITOR.replace($(this).attr('name'), {
			filebrowserUploadUrl: $(this).attr('data-action')+'/ckupload?_token='+$('meta[name=csrf-token]').attr('content'),
			allowedContent: true,
			toolbar: ckeditorToolbarFull,
			extraAllowedContent: 'iframe[*]',
			extraPlugins: 'videoinfograph',
			skin: 'moonocolor',
		});
		$(this).addClass('init');
	});

	$('TEXTAREA.ckeditor-basic:not(".init")').each(function()
	{
		CKEDITOR.replace($(this).not('.init').attr('name'), {
			filebrowserUploadUrl: $(this).attr('data-action')+'/ckupload?_token='+$('meta[name=csrf-token]').attr('content'),
			toolbar: ckeditorToolbarBasic,
			extraPlugins: 'videoinfograph',
			skin: 'moonocolor',
		});
		$(this).addClass('init');
	});

	//Ajax'вый селект
	$('SELECT.ajax:not(.init)').each(function(){
		var self = this;
		var $class = $(this).attr('data-class');
		var $key = $(this).attr('data-key');
		var $filter = $(this).attr('data-filter');
		var $subfield = $(this).attr('data-subfield');
		var $length = $(this).attr('data-length');
		var $value = $(this).attr('data-value');
		var $action = $(this).attr('data-action')+'/fetchselect';

		$(self).attr('disabled', 'disabled');
		$(self).selectpicker('refresh');
		$.ajax({
			url: $action,
			type: 'post',
			data: {
				_token: $('meta[name="csrf-token"]').attr('content'),
				class: $class,
				value: $value,
				length: $length,
			},
			success: function(r) {
				$(self).find('option[value!=""]').remove();
				$.each(r, function(k, v){
					var option = $('<option value="'+v[$key]+'" data-subtext="'+v[$subfield]+'">'+v[$filter]+'</option>');
					if (parseInt(v[$key]) == parseInt($value)) option.attr('selected', 'selected');
					$(self).append(option);
				});
				$(self).removeAttr('disabled');
				$(self).selectpicker('refresh');
			}
		});

		$(self).closest('.field').on('keyup', '.bs-searchbox INPUT[type="text"]', function(){
			var $filter_val = $(this).val();
			$(self).attr('disabled', 'disabled');
			$(self).selectpicker('refresh');
			$.ajax({
				url: $action,
				type: 'post',
				data: {
					_token: $('meta[name="csrf-token"]').attr('content'),
					class: $class,
					filter: $filter,
					filter_val: $filter_val,
					length: $length,
				},
				success: function(r) {
					$(self).find('option[value!=""]').remove();
					$.each(r, function(k, v){
						$(self).append($('<option value="'+v[$key]+'" data-subtext="'+v[$subfield]+'">'+v[$filter]+'</option>'));
					});
					$(self).removeAttr('disabled');
					$(self).selectpicker('refresh');
				}
			});
		});

		$(self).addClass('init');
	});
}

function reorder_numbers($fieldset)
{
	if (!$fieldset || $fieldset.size() == 0) return;
	$fieldset.find('.field').each(function(i)
	{
		if ($(this).find('.address').length > 0)
		{
			$(this).find('.address').attr('data-name', $(this).find('.address').attr('data-name').replace(/\[[0-9]+\]/, '['+i+']'));
		}

		if ($(this).find('.logopicker').length > 0)
		{
			$(this).find('.logopicker').attr('data-name', $(this).find('.logopicker').attr('data-name').replace(/\[[0-9]+\]/, '['+i+']'));
		}

		$(this).find('INPUT,SELECT,TEXTAREA').each(function()
		{
			this.name = this.name.replace(/\[[0-9]+\]/, '['+i+']');
		});
	});
}

//Подсчет символов
function upperMe($inputStr)
{
	MaxLen = $inputStr.attr('data-limit');
	$inputNum = $inputStr.closest('.widget').find('.label-limit');

	if ($('.placement-picker').find('OPTION:selected').attr('rel') == 'sitejournal')
	{
		if ($inputStr.val().length > MaxLen)
			$inputNum.addClass('red');
		else
			$inputNum.removeClass('red');
		$inputNum.html('Осталось '+(MaxLen - $inputStr.val().length)+' символов');
	}
	else
	{
		$inputNum.html('');
	}
}

redpajama_set_name: RedPajamaGithub


text:
require 'rails_helper'
RSpec.describe User, type: :model do
  context " Name validation check user Model" do
      it "is not valid without name" do
        build(:user, name: nil).should_not be_valid
      end
      it "is valid with a title" do
        build(:user, name: "something").should be_valid
      end
  end

  context "Associations" do
    it "has many project_users" do
      assc = described_class.reflect_on_association(:project_users)
      expect(assc.macro).to eq :has_many
    end
    it "has many project" do
      assc = described_class.reflect_on_association(:project_users)
      expect(assc.macro).to eq :has_many
    end
    it "has many tasks" do
      assc = described_class.reflect_on_association(:tasks)
      expect(assc.macro).to eq :has_many
    end
    it "has many Posts " do
      create(:user).posts.length # 0
      create(:user_with_posts).posts.length # 5
      create(:user_with_posts, posts_count: 15).posts.length # 15
    end
    it "has many Comments " do
      assc = described_class.reflect_on_association(:comments)
      expect(assc.macro).to eq :has_many
    end
    it "has many notifications " do
      assc = described_class.reflect_on_association(:notifications)
      expect(assc.macro).to eq :has_many
    end
  end

  context "Test Instance methods" do
    it "returns a user's name initials" do
      user = build(:user, name: "John poee Doe")
      user.set_initials.should == "JD"
    end
    it "returns a task by due dates" do
       user = create(:user)
       task1 = create(:task, user: user, due_date: "2016-10-17 10:01:38",status: "none")
       task2 = create(:task, user: user, due_date: "2016-10-15 10:01:38",status: "active")
       user.tasks_due_soon.should == [task2, task1]
    end
  end
end


text:
package org.fiteagle.adapters.common;

public interface SSHAccessable {

	public String getHardwareType();

	public void setHardwareType(String hardwareType);

	public String getIp();

	public void setIp(String ip);

	public String getPort();

	public void setPort(String port);

	public String getUsername();

	public void setUsername(String username);

	public String getPassword();

	public void setPassword(String password);

	public String getSshKey();

	public void setSshKey(String sshKey);

}


text:
package de.garbereder;

import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class TestAutomationTest extends TestCase {

    private DummyClassWithAllBasicDatatypes dummy1;
    private DummyClassWithAllBasicDatatypes dummy2;
    private CorrectEqualsAndHashCode correct1;
    private CorrectEqualsAndHashCode correct2;
    private WrongEqualsAndHashCode wrong1;
    private WrongEqualsAndHashCode wrong2;

    protected TestAutomation testAutomation = new TestAutomation();

    @Before
    public void setUp() throws Exception {
        dummy1 = new DummyClassWithAllBasicDatatypes();
        dummy2 = new DummyClassWithAllBasicDatatypes();
        correct1 = new CorrectEqualsAndHashCode();
        correct2 = new CorrectEqualsAndHashCode();
        wrong1 = new WrongEqualsAndHashCode();
        wrong2 = new WrongEqualsAndHashCode();
    }

    private class DummyClassWithAllBasicDatatypes {
        protected int myInt;
        protected Integer myIntObject;
        protected float myFloat;
        protected Float myFloatObject;
        protected double myDouble;
        protected Double myDoubleObject;
        protected long myLong;
        protected Long myLongObject;
        protected byte myByte;
        protected Byte myByteObject;
        protected short myShort;
        protected Short myShortObject;
        protected char myChar;
        protected Character myCharObject;
        protected boolean myBoolean;
        protected Boolean myBooleanObject;
        protected String myString;

        public int setCounter = 0;

        public String getMyString() {
            return myString;
        }

        public void setMyString(String myString) {
            setCounter++;
            this.myString = myString;
        }

        public int getMyInt() {
            return myInt;
        }

        public void setMyInt(int myInt) {
            setCounter++;
            this.myInt = myInt;
        }

        public Integer getMyIntObject() {
            return myIntObject;
        }

        public void setMyIntObject(Integer myIntObject) {
            setCounter++;
            this.myIntObject = myIntObject;
        }

        public float getMyFloat() {
            return myFloat;
        }

        public void setMyFloat(float myFloat) {
            setCounter++;
            this.myFloat = myFloat;
        }

        public Float getMyFloatObject() {
            return myFloatObject;
        }

        public void setMyFloatObject(Float myFloatObject) {
            setCounter++;
            this.myFloatObject = myFloatObject;
        }

        public double getMyDouble() {
            return myDouble;
        }

        public void setMyDouble(double myDouble) {
            setCounter++;
            this.myDouble = myDouble;
        }

        public Double getMyDoubleObject() {
            return myDoubleObject;
        }

        public void setMyDoubleObject(Double myDoubleObject) {
            setCounter++;
            this.myDoubleObject = myDoubleObject;
        }

        public long getMyLong() {
            return myLong;
        }

        public void setMyLong(long myLong) {
            setCounter++;
            this.myLong = myLong;
        }

        public Long getMyLongObject() {
            setCounter++;
            return myLongObject;
        }

        public void setMyLongObject(Long myLongObject) {
            setCounter++;
            this.myLongObject = myLongObject;
        }

        public byte getMyByte() {
            return myByte;
        }

        public void setMyByte(byte myByte) {
            setCounter++;
            this.myByte = myByte;
        }

        public Byte getMyByteObject() {
            return myByteObject;
        }

        public void setMyByteObject(Byte myByteObject) {
            setCounter++;
            this.myByteObject = myByteObject;
        }

        public short getMyShort() {
            return myShort;
        }

        public void setMyShort(short myShort) {
            setCounter++;
            this.myShort = myShort;
        }

        public Short getMyShortObject() {
            return myShortObject;
        }

        public void setMyShortObject(Short myShortObject) {
            setCounter++;
            this.myShortObject = myShortObject;
        }

        public char getMyChar() {
            return myChar;
        }

        public void setMyChar(char myChar) {
            setCounter++;
            this.myChar = myChar;
        }

        public Character getMyCharObject() {
            return myCharObject;
        }

        public void setMyCharObject(Character myCharObject) {
            setCounter++;
            this.myCharObject = myCharObject;
        }

        public boolean isMyBoolean() {
            return myBoolean;
        }

        public void setMyBoolean(boolean myBoolean) {
            setCounter++;
            this.myBoolean = myBoolean;
        }

        public Boolean getMyBooleanObject() {
            return myBooleanObject;
        }

        public void setMyBooleanObject(Boolean myBooleanObject) {
            setCounter++;
            this.myBooleanObject = myBooleanObject;
        }

        @Override
        public String toString() {
            return "DummyClassWithAllBasicDatatypes{" +
                    "myInt=" + myInt +
                    ", myIntObject=" + myIntObject +
                    ", myFloat=" + myFloat +
                    ", myFloatObject=" + myFloatObject +
                    ", myDouble=" + myDouble +
                    ", myDoubleObject=" + myDoubleObject +
                    ", myLong=" + myLong +
                    ", myLongObject=" + myLongObject +
                    ", myByte=" + myByte +
                    ", myByteObject=" + myByteObject +
                    ", myShort=" + myShort +
                    ", myShortObject=" + myShortObject +
                    ", myChar=" + myChar +
                    ", myCharObject=" + myCharObject +
                    ", myBoolean=" + myBoolean +
                    ", myBooleanObject=" + myBooleanObject +
                    ", myString=" + myString +
                    ", setCounter=" + setCounter +
                    '}';
        }
    }

    private class CorrectEqualsAndHashCode extends DummyClassWithAllBasicDatatypes {

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof CorrectEqualsAndHashCode)) return false;

            CorrectEqualsAndHashCode that = (CorrectEqualsAndHashCode) o;

            if (myBoolean != that.myBoolean) return false;
            if (myByte != that.myByte) return false;
            if (myChar != that.myChar) return false;
            if (Double.compare(that.myDouble, myDouble) != 0) return false;
            if (Float.compare(that.myFloat, myFloat) != 0) return false;
            if (myInt != that.myInt) return false;
            if (myLong != that.myLong) return false;
            if (myShort != that.myShort) return false;
            if (myBooleanObject != null ? !myBooleanObject.equals(that.myBooleanObject) : that.myBooleanObject != null)
                return false;
            if (myByteObject != null ? !myByteObject.equals(that.myByteObject) : that.myByteObject != null)
                return false;
            if (myCharObject != null ? !myCharObject.equals(that.myCharObject) : that.myCharObject != null)
                return false;
            if (myDoubleObject != null ? !myDoubleObject.equals(that.myDoubleObject) : that.myDoubleObject != null)
                return false;
            if (myFloatObject != null ? !myFloatObject.equals(that.myFloatObject) : that.myFloatObject != null)
                return false;
            if (myIntObject != null ? !myIntObject.equals(that.myIntObject) : that.myIntObject != null) return false;
            if (myLongObject != null ? !myLongObject.equals(that.myLongObject) : that.myLongObject != null)
                return false;
            if (myShortObject != null ? !myShortObject.equals(that.myShortObject) : that.myShortObject != null)
                return false;
            if (myString != null ? !myString.equals(that.myString) : that.myString != null)
                return false;

            return true;
        }

        @Override
        public int hashCode() {
            int result;
            long temp;
            result = myInt;
            result = 31 * result + (myIntObject != null ? myIntObject.hashCode() : 0);
            result = 31 * result + (myFloat != +0.0f ? Float.floatToIntBits(myFloat) : 0);
            result = 31 * result + (myFloatObject != null ? myFloatObject.hashCode() : 0);
            temp = Double.doubleToLongBits(myDouble);
            result = 31 * result + (int) (temp ^ (temp >>> 32));
            result = 31 * result + (myDoubleObject != null ? myDoubleObject.hashCode() : 0);
            result = 31 * result + (int) (myLong ^ (myLong >>> 32));
            result = 31 * result + (myLongObject != null ? myLongObject.hashCode() : 0);
            result = 31 * result + (int) myByte;
            result = 31 * result + (myByteObject != null ? myByteObject.hashCode() : 0);
            result = 31 * result + (int) myShort;
            result = 31 * result + (myShortObject != null ? myShortObject.hashCode() : 0);
            result = 31 * result + (int) myChar;
            result = 31 * result + (myCharObject != null ? myCharObject.hashCode() : 0);
            result = 31 * result + (myBoolean ? 1 : 0);
            result = 31 * result + (myBooleanObject != null ? myBooleanObject.hashCode() : 0);
            result = 31 * result + (myString != null ? myString.hashCode() : 0);
            return result;
        }
    }

    private class WrongEqualsAndHashCode extends DummyClassWithAllBasicDatatypes {

        @Override
        public int hashCode() {
            return myInt;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof WrongEqualsAndHashCode)) return false;

            WrongEqualsAndHashCode that = (WrongEqualsAndHashCode) o;

            if (myBoolean != that.myBoolean) return false;

            return true;
        }
    }

    @Test
    public void testTestEqualsAutomated() throws Exception {
        try {
            testAutomation.testEqualsAutomated(dummy1, dummy2);
        } catch (Error e) {
            return;
        }
        fail("Expected AssertionError in testEqualsAutomated().");
    }

    @Test
    public void testTestHashCodeAutomated() throws Exception {
        try {
            testAutomation.testHashCodeAutomated(dummy1, dummy2);
        } catch (Error e) {
            return;
        }
        fail("Expected AssertionError in testHashCodeAutomated().");
    }

    @Test
    public void testTestEqualsAutomatedCorrect() throws Exception {
        testAutomation.testEqualsAutomated(correct1, correct2);
        Assert.assertEquals(26, correct1.setCounter);
        Assert.assertEquals(43, correct2.setCounter);
    }

    @Test
    public void testTestHashCodeAutomatedCorrect() throws Exception {
        testAutomation.testHashCodeAutomated(correct1, correct2);
        Assert.assertEquals(26, correct1.setCounter);
        Assert.assertEquals(43, correct2.setCounter);
    }

    @Test
    public void testTestEqualsAutomatedWrong() throws Exception {
        try {
            testAutomation.testEqualsAutomated(wrong1, wrong2);
        } catch (Error e) {
            return;
        }
        fail("Expected AssertionError in testEqualsAutomated().");
    }

    @Test
    public void testTestHashCodeAutomatedWrong() throws Exception {
        try {
            testAutomation.testHashCodeAutomated(wrong1, wrong2);
        } catch (Error e) {
            return;
        }
        fail("Expected AssertionError in testHashCodeAutomated().");
    }

}


text:
<?php

namespace SlmQueue\Queue;

trait QueueAwareTrait
{
    /**
     * @var QueueInterface
     */
    protected $queue;

    public function getQueue(): QueueInterface
    {
        return $this->queue;
    }

    public function setQueue(QueueInterface $queue): void
    {
        $this->queue = $queue;
    }
}


text:
package core.table;

import com.google.common.collect.ContiguousSet;
import com.google.common.collect.DiscreteDomain;
import com.google.common.collect.Range;
import core.Stone;
import core.color.Color;
import core.color.ColorView;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.function.Function;

/**
 * Created by maxus on 03.03.16.
 */
public abstract class TableTest {

	private static class LinAdj implements Function<Integer, Collection<Integer>> {
		@Override
		public Collection<Integer> apply(Integer integer) {
			return Arrays.asList(integer - 1, integer + 1);
		}
	}

	private Function<Integer, Collection<Integer>> adjacency = new LinAdj();

	protected abstract ITable<Integer, ?> createInstance(Collection<Integer> fields, Function<Integer, Collection<Integer>> adjacency, Color<Integer> whites, Color<Integer> blacks);

	@org.junit.Test
	public final void simpleTest() {
		List<Integer> range = ContiguousSet.create(Range.closed(-20, 20), DiscreteDomain.integers()).asList();
		ITable<Integer, ?> table = createInstance(range, adjacency, new Color<>(adjacency), new Color<>(adjacency));
		ColorView<Integer, ?> whites = table.getView(Stone.WHITE);
		ColorView<Integer, ?> blacks = table.getView(Stone.BLACK);

		assert null != table.put(Stone.WHITE, 1);
		assert whites.getFields().equals(_makeSet(1));
		assert blacks.getFields().equals(_makeSet());

		assert null != table.put(Stone.WHITE, 2);
		assert whites.getFields().equals(_makeSet(1, 2));
		assert blacks.getFields().equals(_makeSet());

		assert null != table.put(Stone.BLACK, 0);
		assert whites.getFields().equals(_makeSet(1, 2));
		assert blacks.getFields().equals(_makeSet(0));

		assert null != table.put(Stone.BLACK, 3);
		assert whites.getFields().equals(_makeSet());
		assert blacks.getFields().equals(_makeSet(0, 3));

		assert null != table.put(Stone.WHITE, 2);
		assert whites.getFields().equals(_makeSet(2));
		assert blacks.getFields().equals(_makeSet(0, 3));

		assert null != table.put(Stone.WHITE, 4);
		assert whites.getFields().equals(_makeSet(2, 4));
		assert blacks.getFields().equals(_makeSet(0));
	}

	@SafeVarargs
	private final <F> HashSet<F> _makeSet(F... elems) {
		return new HashSet<>(Arrays.asList(elems));
	}

}


text:
<?php

namespace denbora\R_T_G_Services\examples\RESTv3\Casino;

use denbora\R_T_G_Services\examples\RESTv3\RestExample;

class AddIdInformationPOST extends RestExample
{
}


text:
<?xml version="1.0" ?>
<parameterMap>
  <title>JMA JRA-25 Parameter Code Table 3</title>
  <parameter code="1">
    <shortName>PRES</shortName>
    <description>Surface pressure</description>
    <units>Pa</units>
    <CF>air_pressure</CF>
    <GCMD ifLevelType="1">EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Surface Pressure</GCMD>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Hydrostatic Pressure</GCMD>
  </parameter>
  <parameter code="2">
    <shortName>PRMSL</shortName>
    <description>Pressure reduced to MSL</description>
    <units>Pa</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Sea Level Pressure</GCMD>
  </parameter>
  <parameter code="4">
    <shortName>PVORT</shortName>
    <description>Potential vorticity</description>
    <units>K m^2 kg^-1 s^-1</units>
    <CF>ertel_potential_vorticity</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Vorticity</GCMD>
  </parameter>
  <parameter code="7">
    <shortName>HGT</shortName>
    <description>Geopotential height</description>
    <units>gpm</units>
    <CF>geopotential_height</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Altitude > Geopotential Height</GCMD>
  </parameter>
  <parameter code="8">
    <shortName>DIST</shortName>
    <description>Geometric height</description>
    <units>m</units>
    <CF>altitude</CF>
  </parameter>
  <parameter code="11">
    <shortName>TMP</shortName>
    <description>Temperature</description>
    <units>K</units>
    <CF>air_temperature</CF>
    <GCMD ifLevelType="1">EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Surface Air Temperature</GCMD>
    <GCMD ifLevelType="105">EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Surface Air Temperature</GCMD>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Air Temperature</GCMD>
  </parameter>
  <parameter code="13">
    <shortName>POT</shortName>
    <description>Potential temperature</description>
    <units>K</units>
    <CF>air_potential_temperature</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Potential Temperature</GCMD>
  </parameter>
  <parameter code="15">
    <shortName>T MAX</shortName>
    <description>Maximum temperature</description>
    <units>K</units>
    <CF>maximum_air_temperature</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Maximum/Minimum Temperature</GCMD>
  </parameter>
  <parameter code="16">
    <shortName>T MIN</shortName>
    <description>Minimum temperature</description>
    <units>K</units>
    <CF>minimum_air_temperature</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Maximum/Minimum Temperature</GCMD>
  </parameter>
  <parameter code="18">
    <shortName>DEPR</shortName>
    <description>Dewpoint depression (or deficit)</description>
    <units>K</units>
    <CF>dew_point_depression</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Dew Point Temperature</GCMD>
  </parameter>
  <parameter code="33">
    <shortName>U GRD</shortName>
    <description>u-component of wind</description>
    <units>m s^-1</units>
    <CF>eastward_wind</CF>
    <GCMD ifLevelType="105">EARTH SCIENCE > Atmosphere > Atmospheric Winds > Surface Winds</GCMD>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Upper Level Winds</GCMD>
  </parameter>
  <parameter code="34">
    <shortName>V GRD</shortName>
    <description>v-component of wind</description>
    <units>m s^-1</units>
    <CF>northward_wind</CF>
    <GCMD ifLevelType="105">EARTH SCIENCE > Atmosphere > Atmospheric Winds > Surface Winds</GCMD>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Upper Level Winds</GCMD>
  </parameter>
  <parameter code="35">
    <shortName>STRM</shortName>
    <description>Stream function</description>
    <units>m^2 s^-1</units>
    <CF>atmosphere_horizontal_streamfunction</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Streamfunctions</GCMD>
  </parameter>
  <parameter code="36">
    <shortName>V POT</shortName>
    <description>Velocity potential</description>
    <units>m^2 s^-1</units>
    <CF>atmosphere_horizontal_velocity_potential</CF>
  </parameter>
  <parameter code="37">
    <shortName>MNTSF</shortName>
    <description>Montgomery stream function</description>
    <units>m^2 s^-2</units>
    <CF>atmosphere_horizontal_montgomery_streamfunction</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Streamfunctions</GCMD>
  </parameter>
  <parameter code="39">
    <shortName>V VEL</shortName>
    <description>Vertical velocity</description>
    <units>Pa s^-1</units>
    <CF>lagrangian_tendency_of_air_pressure</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Vertical Wind Motion</GCMD>
  </parameter>
  <parameter code="43">
    <shortName>REL V</shortName>
    <description>Relative vorticity</description>
    <units>s^-1</units>
    <CF>atmosphere_relative_vorticity</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Vorticity</GCMD>
  </parameter>
  <parameter code="44">
    <shortName>REL D</shortName>
    <description>Relative divergence</description>
    <units>s^-1</units>
    <CF>divergence_of_wind</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Convergence/Divergence</GCMD>
  </parameter>
  <parameter code="51">
    <shortName>SPF H</shortName>
    <description>Specific humidity</description>
    <units>kg kg^-1</units>
    <CF>specific_humidity</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Humidity</GCMD>
  </parameter>
  <parameter code="52">
    <shortName>R H</shortName>
    <description>Relative humidity</description>
    <units>%</units>
    <CF>relative_humidity</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Humidity</GCMD>
  </parameter>
  <parameter code="54">
    <shortName>P WAT</shortName>
    <description>Precipitable water</description>
    <units>kg m^-2</units>
    <CF>atmosphere_water_vapor_content</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Precipitable Water</GCMD>
  </parameter>
  <parameter code="61">
    <shortName>TPRAT</shortName>
    <description>6-hourly total precipitation rate</description>
    <units>mm day^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Precipitation > Precipitation Rate</GCMD>
  </parameter>
  <parameter code="62">
    <shortName>NCPCP</shortName>
    <description>Large scale precipitation</description>
    <units>kg m^-2</units>
    <CF>large_scale_precipitation_amount</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Precipitation > Precipitation Amount</GCMD>
  </parameter>
  <parameter code="63">
    <shortName>ACPCP</shortName>
    <description>Convective precipitation</description>
    <units>kg m^-2</units>
    <CF>convective_precipitation_amount</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Precipitation > Precipitation Amount</GCMD>
  </parameter>
  <parameter code="64">
    <shortName>SRWEQ</shortName>
    <description>Snowfall rate water equivalent</description>
    <units>kg m^-2 s^-1</units>
    <CF>snowfall_flux</CF>
    <GCMD>EARTH SCIENCE > Hydrosphere > Snow/Ice > Snow Water Equivalent</GCMD>
  </parameter>
  <parameter code="65">
    <shortName>SNWE</shortName>
    <description>Water equivalent snow depth</description>
    <units>m</units>
    <GCMD>EARTH SCIENCE > Hydrosphere > Snow/Ice > Snow Water Equivalent</GCMD>
  </parameter>
  <parameter code="66">
    <shortName>SNOWD</shortName>
    <description>Snow depth</description>
    <units>m</units>
    <CF>surface_snow_thickness</CF>
    <GCMD>EARTH SCIENCE > Hydrosphere > Snow/Ice > Snow Depth</GCMD>
  </parameter>
  <parameter code="71">
    <shortName>T CDC</shortName>
    <description>Total cloud cover</description>
    <units>%</units>
    <CF>cloud_area_fraction</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Clouds > Cloud Amount/Frequency</GCMD>
  </parameter>
  <parameter code="73">
    <shortName>L CDC</shortName>
    <description>Low cloud cover</description>
    <units>%</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Clouds > Cloud Amount/Frequency</GCMD>
  </parameter>
  <parameter code="74">
    <shortName>M CDC</shortName>
    <description>Medium cloud cover</description>
    <units>%</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Clouds > Cloud Amount/Frequency</GCMD>
  </parameter>
  <parameter code="75">
    <shortName>H CDC</shortName>
    <description>High cloud cover</description>
    <units>%</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Clouds > Cloud Amount/Frequency</GCMD>
  </parameter>
  <parameter code="76">
    <shortName>C WAT</shortName>
    <description>Cloud water</description>
    <units>kg m^-2</units>
    <CF>atmosphere_cloud_condensed_water_content</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Clouds > Cloud Liquid Water/Ice</GCMD>
  </parameter>
  <parameter code="80">
    <shortName>WTMP</shortName>
    <description>SST and sea ice temperature (or temperature anomaly)</description>
    <units>K</units>
    <CF>sea_water_temperature</CF>
    <GCMD ifLevelType="1">EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature</GCMD>
    <GCMD>EARTH SCIENCE > Oceans > Ocean Temperature > Water Temperature</GCMD>
  </parameter>
  <parameter code="83">
    <shortName>SFC R</shortName>
    <description>Surface roughness</description>
    <units>m</units>
    <CF>surface_roughness_length</CF>
    <GCMD>EARTH SCIENCE > Land Surface > Topography > Surface Roughness</GCMD>
  </parameter>
  <parameter code="85">
    <shortName>SOILT</shortName>
    <description>Soil temperature</description>
    <units>K</units>
    <GCMD>EARTH SCIENCE > Land Surface > Soils > Soil Temperature</GCMD>
  </parameter>
  <parameter code="86">
    <shortName>SOILW</shortName>
    <description>Soil wetness or water content</description>
    <units>fraction or mm</units>
    <GCMD>EARTH SCIENCE > Land Surface > Soils > Soil Moisture/Water Content</GCMD>
  </parameter>
  <parameter code="90">
    <shortName>ROF</shortName>
    <description>Surface runoff</description>
    <units>mm day^-1</units>
    <GCMD>EARTH SCIENCE > Hydrosphere > Surface Water > Runoff</GCMD>
  </parameter>
  <parameter code="91">
    <shortName>ICE C</shortName>
    <description>Ice cover</description>
    <units>fraction</units>
    <CF>sea_ice_area_fraction</CF>
    <GCMD>EARTH SCIENCE > Oceans > Sea Ice > Ice Extent</GCMD>
  </parameter>
  <parameter code="118">
    <shortName>PRESM</shortName>
    <description>Mean surface pressure</description>
    <units>Pa</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Surface Pressure</GCMD>
  </parameter>
  <parameter code="121">
    <shortName>LHTFL</shortName>
    <description>Latent heat flux</description>
    <units>W m^-2</units>
    <CF>surface_upward_latent_heat_flux</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Heat Flux;EARTH SCIENCE > Oceans > Ocean Heat Budget > Heat Flux</GCMD>
  </parameter>
  <parameter code="122">
    <shortName>SHTFL</shortName>
    <description>Sensible heat flux</description>
    <units>W m^-2</units>
    <CF>surface_upward_sensible_heat_flux</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Heat Flux;EARTH SCIENCE > Oceans > Ocean Heat Budget > Heat Flux</GCMD>
  </parameter>
  <parameter code="124">
    <shortName>U FLX</shortName>
    <description>Momentum flux, u-component</description>
    <units>N m^-2</units>
    <CF>downward_eastward_momentum_flux_in_air</CF>
  </parameter>
  <parameter code="125">
    <shortName>V FLX</shortName>
    <description>Momentum flux, v-component</description>
    <units>N m^-2</units>
    <CF>downward_northward_momentum_flux_in_air</CF>
  </parameter>
  <parameter code="132">
    <shortName>BVF2tht</shortName>
    <description>Square of Brunt Vaisala frequency</description>
    <units>1 s^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Atmospheric Stability</GCMD>
  </parameter>
  <parameter code="136">
    <shortName>UGRDM</shortName>
    <description>Surface 10m zonal wind</description>
    <units>m s^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Surface Winds</GCMD>
  </parameter>
  <parameter code="137">
    <shortName>VGRDM</shortName>
    <description>Surface 10m meridional wind</description>
    <units>m s^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Surface Winds</GCMD>
  </parameter>
  <parameter code="138">
    <shortName>TMPM</shortName>
    <description>Surface 2m air temperature</description>
    <units>K</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Surface Air Temperature</GCMD>
  </parameter>
  <parameter code="139">
    <shortName>SPFHM</shortName>
    <description>Surface specific humidity</description>
    <units>kg kg^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Humidity</GCMD>
  </parameter>
  <parameter code="144">
    <shortName>TSC</shortName>
    <description>Canopy temperature</description>
    <units>K</units>
    <GCMD>EARTH SCIENCE > Biosphere > Vegetation > Canopy Characteristics</GCMD>
  </parameter>
  <parameter code="145">
    <shortName>TSG</shortName>
    <description>Ground temperature</description>
    <units>K</units>
    <GCMD>EARTH SCIENCE > Land Surface > Land Temperature > Land Surface Temperature</GCMD>
  </parameter>
  <parameter code="146">
    <shortName>CWORK</shortName>
    <description>Cloud workfunction</description>
    <units>J kg^-1</units>
  </parameter>
  <parameter code="147">
    <shortName>FGLU</shortName>
    <description>U surface momentum flux by long gravity wave</description>
    <units>N m^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Gravity Wave</GCMD>
  </parameter>
  <parameter code="148">
    <shortName>FGLV</shortName>
    <description>V surface momentum flux by long gravity wave</description>
    <units>N m^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Gravity Wave</GCMD>
  </parameter>
  <parameter code="151">
    <shortName>ADVUA</shortName>
    <description>Advective zonal acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="152">
    <shortName>VWV</shortName>
    <description>Column total of meridional water vapor flux</description>
    <units>kg m^-1 s^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Water Vapor</GCMD>
  </parameter>
  <parameter code="154">
    <shortName>FGSV</shortName>
    <description>V surface momentum flux by short gravity wave</description>
    <units>N m^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Gravity Wave</GCMD>
  </parameter>
  <parameter code="155">
    <shortName>GFLX</shortName>
    <description>Ground heat flux</description>
    <units>W m^-2</units>
  </parameter>
  <parameter code="157">
    <shortName>UWV</shortName>
    <description>Column total of zonal water vapor flux</description>
    <units>kg m^-1 s^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Water Vapor</GCMD>
  </parameter>
  <parameter code="159">
    <shortName>FGSU</shortName>
    <description>U surface momentum flux by short gravity wave</description>
    <units>N m^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Pressure > Gravity Wave</GCMD>
  </parameter>
  <parameter code="160">
    <shortName>CSUSF</shortName>
    <description>Clear sky upward solar flux</description>
    <units>W m^-2</units>
    <CF>upward_shortwave_flux_in_air_assuming_clear_sky</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Shortwave Radiation</GCMD>
  </parameter>
  <parameter code="161">
    <shortName>CSDSF</shortName>
    <description>Clear sky downward solar flux</description>
    <units>W m^-2</units>
    <CF>downward_shortwave_flux_in_air_assuming_clear_sky</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Shortwave Radiation</GCMD>
  </parameter>
  <parameter code="162">
    <shortName>CSULF</shortName>
    <description>Clear sky upward longwave flux</description>
    <units>W m^-2</units>
    <CF>upward_longwave_flux_in_air_assuming_clear_sky</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Longwave Radiation</GCMD>
  </parameter>
  <parameter code="163">
    <shortName>CSDLF</shortName>
    <description>Clear sky downward longwave flux</description>
    <units>W m^-2</units>
    <CF>downward_longwave_flux_in_air_assuming_clear_sky</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Longwave Radiation</GCMD>
  </parameter>
  <parameter code="165">
    <shortName>ADVV</shortName>
    <description>Advective meridional acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="168">
    <shortName>FRQP</shortName>
    <description>Frequency of precipitation</description>
    <units>%</units>
  </parameter>
  <parameter code="169">
    <shortName>FRQC</shortName>
    <description>Frequency of cumulus precipitation</description>
    <units>%</units>
  </parameter>
  <parameter code="173">
    <shortName>GWDUA</shortName>
    <description>Gravity wave zonal acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="174">
    <shortName>GWDVA</shortName>
    <description>Gravity wave meridional acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="175">
    <shortName>HGT</shortName>
    <description>Mean geopotential height</description>
    <units>m</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Altitude > Geopotential Height</GCMD>
  </parameter>
  <parameter code="176">
    <shortName>UGRDM</shortName>
    <description>Mean zonal wind</description>
    <units>m s^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Upper Level Winds</GCMD>
  </parameter>
  <parameter code="177">
    <shortName>VGRDM</shortName>
    <description>Mean meridional wind</description>
    <units>m s^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Upper Level Winds</GCMD>
  </parameter>
  <parameter code="178">
    <shortName>VVELM</shortName>
    <description>Mean pressure vertical velocity</description>
    <units>Pa s^-1</units>
  </parameter>
  <parameter code="179">
    <shortName>TMPM</shortName>
    <description>Mean temperature</description>
    <units>K</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Temperature > Air Temperature</GCMD>
  </parameter>
  <parameter code="180">
    <shortName>SPFHM</shortName>
    <description>Mean specific humidity</description>
    <units>kg kg^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Humidity</GCMD>
  </parameter>
  <parameter code="200">
    <shortName>VTU</shortName>
    <description>Column total of TU</description>
    <units>(K*Pa*m) s^-1</units>
  </parameter>
  <parameter code="201">
    <shortName>VTV</shortName>
    <description>Column total of TV</description>
    <units>(K*Pa*m) s^-1</units>
  </parameter>
  <parameter code="202">
    <shortName>LTRS</shortName>
    <description>Evapotranspiration</description>
    <units>W m^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Water Vapor > Evapotranspiration</GCMD>
  </parameter>
  <parameter code="203">
    <shortName>LINT</shortName>
    <description>Interception loss</description>
    <units>W m^-2</units>
  </parameter>
  <parameter code="204">
    <shortName>DSWRF</shortName>
    <description>Downward shortwave radiation flux</description>
    <units>W m^-2</units>
    <CF>downward_shortwave_flux_in_air</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Shortwave Radiation</GCMD>
  </parameter>
  <parameter code="205">
    <shortName>DLWRF</shortName>
    <description>Downward longwave radiation flux</description>
    <units>W m^-2</units>
    <CF>downward_longwave_flux_in_air</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Longwave Radiation</GCMD>
  </parameter>
  <parameter code="211">
    <shortName>USWRF</shortName>
    <description>Upward shortwave radiation flux</description>
    <units>W m^-2</units>
    <CF>upward_shortwave_flux_in_air</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Shortwave Radiation</GCMD>
  </parameter>
  <parameter code="212">
    <shortName>ULWRF</shortName>
    <description>Upward longwave radiation flux</description>
    <units>W m^-2</units>
    <CF>upward_longwave_flux_in_air</CF>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Longwave Radiation</GCMD>
  </parameter>
  <parameter code="218">
    <shortName>TTHM</shortName>
    <description>Column total of diabatic heat</description>
    <units>W m^-2</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Heat Flux</GCMD>
  </parameter>
  <parameter code="219">
    <shortName>WSMX</shortName>
    <description>Maximum wind speed</description>
    <units>m s^-1</units>
    <GCMD ifLevelType="1">EARTH SCIENCE > Atmosphere > Atmospheric Winds > Surface Winds</GCMD>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Winds > Upper Level Winds</GCMD>
  </parameter>
  <parameter code="220">
    <shortName>PRMX</shortName>
    <description>Maximum hourly precipitation</description>
    <units>mm hr^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Precipitation > Precipitation Rate</GCMD>
  </parameter>
  <parameter code="222">
    <shortName>ADVHR</shortName>
    <description>Advective heating rate</description>
    <units>K day^-1</units>
  </parameter>
  <parameter code="223">
    <shortName>MSC</shortName>
    <description>Canopy water content</description>
    <units>mm</units>
    <GCMD>EARTH SCIENCE > Biosphere > Vegetation > Canopy Characteristics</GCMD>
  </parameter>
  <parameter code="224">
    <shortName>MSG</shortName>
    <description>Ground water content</description>
    <units>mm</units>
    <GCMD>EARTH SCIENCE > Land Surface > Soils > Soil Moisture/Water Content</GCMD>
  </parameter>
  <parameter code="230">
    <shortName>MFLXB</shortName>
    <description>Upward mass flux at cloud base</description>
    <units>kg m^-2 s^-1</units>
  </parameter>
  <parameter code="231">
    <shortName>MFLUX</shortName>
    <description>Upward mass flux</description>
    <units>kg m^-2 s^-1</units>
  </parameter>
  <parameter code="236">
    <shortName>ADVMR</shortName>
    <description>Advective moistening rate</description>
    <units>kg kg^-1 day^-1</units>
  </parameter>
  <parameter code="237">
    <shortName>OZONE</shortName>
    <description>Ozone mass mixing ratio</description>
    <units>ppm</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Air Quality > Tropospheric Ozone</GCMD>
  </parameter>
  <parameter code="239">
    <shortName>CNVUA</shortName>
    <description>Convective zonal acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="240">
    <shortName>CNVVA</shortName>
    <description>Convective meridional acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="241">
    <shortName>LRGHR</shortName>
    <description>Large scale condensation heating rate</description>
    <units>K day^-1</units>
  </parameter>
  <parameter code="242">
    <shortName>CNVHR</shortName>
    <description>Convective heating rate</description>
    <units>K day^-1</units>
  </parameter>
  <parameter code="243">
    <shortName>CNVMR</shortName>
    <description>Convective moistening rate</description>
    <units>kg kg^-1 day^-1</units>
  </parameter>
  <parameter code="246">
    <shortName>VDFHR</shortName>
    <description>Vertical diffusion heating rate</description>
    <units>K day^-1</units>
  </parameter>
  <parameter code="247">
    <shortName>VDFUA</shortName>
    <description>Vertical diffusion zonal acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="248">
    <shortName>VDFVA</shortName>
    <description>Vertical diffusion meridional acceleration</description>
    <units>m s^-1 day^-1</units>
  </parameter>
  <parameter code="249">
    <shortName>VDFMR</shortName>
    <description>Vertical diffusion moistening rate</description>
    <units>kg kg^-1 day^-1</units>
  </parameter>
  <parameter code="250">
    <shortName>SWHR</shortName>
    <description>Solar radiative heating rate</description>
    <units>K day^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Atmospheric Heating</GCMD>
  </parameter>
  <parameter code="251">
    <shortName>LWHR</shortName>
    <description>Longwave radiative heating rate</description>
    <units>K day^-1</units>
    <GCMD>EARTH SCIENCE > Atmosphere > Atmospheric Radiation > Atmospheric Heating</GCMD>
  </parameter>
  <parameter code="253">
    <shortName>LRGMR</shortName>
    <description>Large scale moistening heating rate</description>
    <units>kg kg^-1 day^-1</units>
  </parameter>
</parameterMap>


text:
// <copyright file="AppBuilderExtensions.cs" company="App Metrics Contributors">
// Copyright (c) App Metrics Contributors. All rights reserved.
// </copyright>

using System;
using System.Net.Http;
using System.Threading.Tasks;
using App.Metrics.Scheduling;
using MetricsDatadogSandboxMvc.Controllers;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

// ReSharper disable CheckNamespace
namespace Microsoft.AspNetCore.Builder
    // ReSharper restore CheckNamespace
{
    public static class AppBuilderExtensions
    {
        private const int ApdexSamplesInterval = 2;
        private const int GetEndpointSuccessInterval = 1;
        private const int PutAndPostRequestsInterval = 6;
        private const int RandomSamplesInterval = 10;
        private const int SlaEndpointsInterval = 2;
        private static readonly HttpClient HttpClient = new HttpClient { BaseAddress = new Uri("http://localhost:1111/") };

        public static IApplicationBuilder UseTestStuff(
            this IApplicationBuilder app,
            IHostApplicationLifetime lifetime,
            bool runSampleRequestsFromApp)
        {
            app.Use(
                (context, next) =>
                {
                    RandomClientIdForTesting.SetTheFakeClaimsPrincipal(context);
                    return next();
                });

            var token = lifetime.ApplicationStopping;

            if (runSampleRequestsFromApp)
            {
                var apdexSamples = new AppMetricsTaskScheduler(
                    TimeSpan.FromSeconds(ApdexSamplesInterval),
                    () =>
                    {
                        var satisfied = HttpClient.GetAsync("api/satisfying", token);
                        var tolerating = HttpClient.GetAsync("api/tolerating", token);
                        var frustrating = HttpClient.GetAsync("api/frustrating", token);

                        return Task.WhenAll(satisfied, tolerating, frustrating);
                    });

                apdexSamples.Start();

                var randomErrorSamples = new AppMetricsTaskScheduler(
                    TimeSpan.FromSeconds(RandomSamplesInterval),
                    () =>
                    {
                        var randomStatusCode = HttpClient.GetAsync("api/randomstatuscode", token);
                        var randomException = HttpClient.GetAsync("api/randomexception", token);

                        return Task.WhenAll(randomStatusCode, randomException);
                    });

                randomErrorSamples.Start();

                var testSamples = new AppMetricsTaskScheduler(
                    TimeSpan.FromSeconds(GetEndpointSuccessInterval),
                    () => HttpClient.GetAsync("api/test", token));

                testSamples.Start();

                var slaSamples = new AppMetricsTaskScheduler(
                    TimeSpan.FromSeconds(SlaEndpointsInterval),
                    () => HttpClient.GetAsync("api/slatest/timer", token));

                slaSamples.Start();

                var randomBufferGenerator = new RandomBufferGenerator(50000);
                var postPutSamples = new AppMetricsTaskScheduler(
                    TimeSpan.FromSeconds(PutAndPostRequestsInterval),
                    () =>
                    {
                        var putBytes = new ByteArrayContent(randomBufferGenerator.GenerateBufferFromSeed());
                        var putFormData = new MultipartFormDataContent { { putBytes, "put-file", "rnd-put" } };
                        var putRequest = HttpClient.PutAsync("api/file", putFormData, token);

                        var postBytes = new ByteArrayContent(randomBufferGenerator.GenerateBufferFromSeed());
                        var postFormData = new MultipartFormDataContent { { postBytes, "post-file", "rnd-post" } };
                        var postRequest = HttpClient.PostAsync("api/file", postFormData, token);

                        return Task.WhenAll(putRequest, postRequest);
                    });

                postPutSamples.Start();
            }

            return app;
        }
    }
}


text:
const Analytics = require('./analytics').constructor;

class AnalyticsForWorker extends Analytics {
    record(name, before, after) {
        process.send({
            type: 'analytics',
            name: `${process.pid}:${this.groupName}:${name}`,
            before,
            after,
        });
    }
}

module.exports = function(name) {
    return new AnalyticsForWorker(name);
};


text:
<?php
/**
 * This is just a proxy to detect if we can use the "fast" Pagination
 * or if we use the "safe" variant by Doctrine2
 *
 */
namespace Zf2datatable\DataSource\Doctrine2;

use Zend\Paginator\Adapter\AdapterInterface;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Tools\Pagination\Paginator as Doctrine2Paginator;
use Zf2datatable\DataSource\Doctrine2\PaginatorFast as ZfcDatagridPaginator;

class Paginator implements AdapterInterface
{

    /**
     *
     * @var QueryBuilder
     */
    protected $qb = null;

    /**
     * Total item count
     *
     * @var integer
     */
    protected $rowCount = null;

    /**
     *
     * @var \Doctrine\ORM\Tools\Pagination\Paginator
     */
    private $paginator;

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

    /**
     *
     * @return \Doctrine\ORM\QueryBuilder
     */
    public function getQueryBuilder()
    {
        return $this->qb;
    }

    /**
     * Test which pagination solution to use
     *
     * @return boolean
     */
    private function useCustomPaginator()
    {
        $qb = $this->getQueryBuilder();
        $parts = $qb->getDQLParts();

        if ($parts['having'] !== null || $parts['distinct'] === true) {
            // never tried having in such queries...
            return false;
        }

        // @todo maybe more detection needed :-/
        return true;
    }

    /**
     *
     * @return \Doctrine\ORM\Tools\Pagination\Paginator
     */
    private function getPaginator()
    {
        if ($this->paginator !== null) {
            return $this->paginator;
        }

        if ($this->useCustomPaginator() === true) {
            //var_dump($this->getQueryBuilder()->getQuery()->getSQL());
            $this->paginator = new ZfcDatagridPaginator($this->getQueryBuilder());
        } else {
            // Doctrine2Paginator as fallback...they are using 3 queries

            $this->paginator = new Doctrine2Paginator($this->getQueryBuilder());
        }

        return $this->paginator;
    }

    /**
     * Returns an array of items for a page.
     *
     * @param  integer $offset
     * @param  integer $itemCountPerPage
     * @return array
     */
    public function getItems($offset, $itemCountPerPage)
    {
        $paginator = $this->getPaginator();
        if ($paginator instanceof Doctrine2Paginator) {
            $this->getQueryBuilder()
                ->setFirstResult($offset)
                ->setMaxResults($itemCountPerPage);

            return $paginator->getIterator()->getArrayCopy();
        } else {
            return $paginator->getItems($offset, $itemCountPerPage);
        }
    }

    /**
     * Returns the total number of rows in the result set.
     *
     * @return integer
     */
    public function count()
    {
        return $this->getPaginator()->count();
    }
}


text:
package common.datastructure;

import java.util.Set;

import com.blogspot.illyakeeplearning.suffixtree.SuffixTree;

public class SuffixTreeWrapper implements ReferenceIndexStructure {

	private String string;
	private SuffixTree suffixTree;

	@Override
	public void init(final String sequence) {
		if (sequence == null) {
			throw new IllegalArgumentException("sequence must not be null");
		}
		string = sequence;
		suffixTree = new SuffixTree(sequence + "$");
	}

	@Override
	public Set<Integer> indicesOf(final String substring) {
		if (suffixTree == null) {
			throw new IllegalStateException("index structure has not been initialized");
		}
		return suffixTree.indicesOf(substring);
	}

	@Override
	public String substring(final int beginIndex, final int length) {
		if (string == null) {
			throw new IllegalStateException("index structure has not been initialized");
		}
		return string.substring(beginIndex, beginIndex + length);
	}

	@Override
	public HasIndexAndLength findLongestPrefixSuffixMatch(final String otherString) {
		throw new UnsupportedOperationException();
	}
}


text:
- Upgrade the original Kite9 to Grails 3.
- We can keep our existing Kite9 infrastructure working by moving to Grails 3, which is based on Spring Boot.
- This probably means moving to gradle builds too, and therefore a gradle fabric8 plugin.
- I think ideally we should stick to the spring/jpa-based persistence because it's more future proof, so we need to move the rest of those entites and add tests for them.
- This means that Kite9 should be completely ported to AWS.
- Add a table for the diagram contents, unrendered and rendered
- Need to check email works

## Problem

The problem with even doing this sprint is that it's a backward step:  we're not going to be able to get this UI working correctly anyway.  At what stage will we have a converted Kite9?

## Background

This sprint came about because of talks with Andrew Lockley.  He said we needed to get users in front of the system and the best way I can think to do this is to port the platform onto AWS fully.

This means we're carrying a bit of baggage:  we have Grails baked into our application still, which will be mainly used for rendering views.  (Ideally, that's all it will be used for:  I think we should convert all the rest of the controllers to Java / Spring Boot.. in [Sprint 5](sprint_005.md) )

## Downloading Grails 3

From the look of it, the simplest thing might be to try and 'port' all the code from my existing server project into a new installation of grails.   This is going to involve moving some files around and upgrading the configuration.
However, from the off, it looks like Grails 3 is going to be a big problem:

 - I'm struggling now with my code not compiling, because my domain objects are gradle, and compiled *after* java code, which sadly depends on it.
 - The security plugins seems completely broken here.

What to do?  I guess the basic problem is neither of these things - I want to move them to straight java anyway.  The bigger problem is the GSP pages.    Can I get these working at all?

I am thinking the answer is no:  there's just too much crazy going on in them.  A better option might be to port them across and convert them to something else at the same time, but that's likely
to take a *loong* time.

## Other options.

- We could simply rewrite the GORM code as JPA, and then drop this in as a replacement for

** Pausing This Sprint:  Going To Work on Sprint 4+5 first.  **

** Cancelling this entirely - we're not going to do this (13/5/2016) **