text:
namespace EDDiscovery2
{
    partial class RecordStep
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RecordStep));
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.textBoxPos = new System.Windows.Forms.TextBox();
            this.textBoxDir = new System.Windows.Forms.TextBox();
            this.textBoxZoom = new System.Windows.Forms.TextBox();
            this.textBoxFlyTime = new System.Windows.Forms.TextBox();
            this.textBoxPanTime = new System.Windows.Forms.TextBox();
            this.textBoxWait = new System.Windows.Forms.TextBox();
            this.buttonOK = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.textBoxMessage = new System.Windows.Forms.TextBox();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.textBoxZoomTime = new System.Windows.Forms.TextBox();
            this.label11 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.textBoxMsgTime = new System.Windows.Forms.TextBox();
            this.checkBoxWaitForSlew = new System.Windows.Forms.CheckBox();
            this.checkBoxPos = new System.Windows.Forms.CheckBox();
            this.checkBoxPan = new System.Windows.Forms.CheckBox();
            this.checkBoxChangeZoom = new System.Windows.Forms.CheckBox();
            this.label13 = new System.Windows.Forms.Label();
            this.checkBoxWaitComplete = new System.Windows.Forms.CheckBox();
            this.checkBoxDisplayMessageWhenComplete = new System.Windows.Forms.CheckBox();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(26, 49);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(33, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Go to";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(26, 112);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(58, 13);
            this.label2.TabIndex = 0;
            this.label2.Text = "Pointing At";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(26, 76);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(137, 13);
            this.label3.TabIndex = 0;
            this.label3.Text = "Time to take to change pos";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(26, 142);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(160, 13);
            this.label4.TabIndex = 0;
            this.label4.Text = "Time to take to change direction";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(26, 182);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(34, 13);
            this.label6.TabIndex = 0;
            this.label6.Text = "Zoom";
            //
            // textBoxPos
            //
            this.textBoxPos.Location = new System.Drawing.Point(196, 49);
            this.textBoxPos.Name = "textBoxPos";
            this.textBoxPos.ReadOnly = true;
            this.textBoxPos.Size = new System.Drawing.Size(186, 20);
            this.textBoxPos.TabIndex = 1;
            //
            // textBoxDir
            //
            this.textBoxDir.Location = new System.Drawing.Point(196, 112);
            this.textBoxDir.Name = "textBoxDir";
            this.textBoxDir.ReadOnly = true;
            this.textBoxDir.Size = new System.Drawing.Size(186, 20);
            this.textBoxDir.TabIndex = 1;
            //
            // textBoxZoom
            //
            this.textBoxZoom.Location = new System.Drawing.Point(196, 182);
            this.textBoxZoom.Name = "textBoxZoom";
            this.textBoxZoom.ReadOnly = true;
            this.textBoxZoom.Size = new System.Drawing.Size(100, 20);
            this.textBoxZoom.TabIndex = 1;
            //
            // textBoxFlyTime
            //
            this.textBoxFlyTime.Location = new System.Drawing.Point(196, 76);
            this.textBoxFlyTime.Name = "textBoxFlyTime";
            this.textBoxFlyTime.Size = new System.Drawing.Size(100, 20);
            this.textBoxFlyTime.TabIndex = 1;
            this.textBoxFlyTime.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            //
            // textBoxPanTime
            //
            this.textBoxPanTime.Location = new System.Drawing.Point(196, 142);
            this.textBoxPanTime.Name = "textBoxPanTime";
            this.textBoxPanTime.Size = new System.Drawing.Size(100, 20);
            this.textBoxPanTime.TabIndex = 2;
            this.textBoxPanTime.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            //
            // textBoxWait
            //
            this.textBoxWait.Location = new System.Drawing.Point(196, 12);
            this.textBoxWait.Name = "textBoxWait";
            this.textBoxWait.Size = new System.Drawing.Size(100, 20);
            this.textBoxWait.TabIndex = 0;
            this.textBoxWait.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            //
            // buttonOK
            //
            this.buttonOK.Location = new System.Drawing.Point(302, 391);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(75, 23);
            this.buttonOK.TabIndex = 5;
            this.buttonOK.Text = "OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            //
            // buttonCancel
            //
            this.buttonCancel.Location = new System.Drawing.Point(198, 391);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
            this.buttonCancel.TabIndex = 6;
            this.buttonCancel.Text = "Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
            //
            // textBoxMessage
            //
            this.textBoxMessage.Location = new System.Drawing.Point(196, 248);
            this.textBoxMessage.Name = "textBoxMessage";
            this.textBoxMessage.Size = new System.Drawing.Size(186, 20);
            this.textBoxMessage.TabIndex = 3;
            this.textBoxMessage.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            //
            // label7
            //
            this.label7.Location = new System.Drawing.Point(25, 248);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(132, 20);
            this.label7.TabIndex = 0;
            this.label7.Text = "Message to display";
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(25, 12);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(150, 13);
            this.label8.TabIndex = 0;
            this.label8.Text = "Wait for this time before action";
            //
            // textBoxZoomTime
            //
            this.textBoxZoomTime.Location = new System.Drawing.Point(196, 208);
            this.textBoxZoomTime.Name = "textBoxZoomTime";
            this.textBoxZoomTime.Size = new System.Drawing.Size(100, 20);
            this.textBoxZoomTime.TabIndex = 2;
            this.textBoxZoomTime.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            //
            // label11
            //
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(26, 208);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(108, 13);
            this.label11.TabIndex = 0;
            this.label11.Text = "Time to take to Zoom";
            //
            // label12
            //
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(26, 280);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(122, 13);
            this.label12.TabIndex = 0;
            this.label12.Text = "Message on screen time";
            //
            // textBoxMsgTime
            //
            this.textBoxMsgTime.Location = new System.Drawing.Point(195, 277);
            this.textBoxMsgTime.Name = "textBoxMsgTime";
            this.textBoxMsgTime.Size = new System.Drawing.Size(101, 20);
            this.textBoxMsgTime.TabIndex = 3;
            this.textBoxMsgTime.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            //
            // checkBoxWaitForSlew
            //
            this.checkBoxWaitForSlew.AutoSize = true;
            this.checkBoxWaitForSlew.Location = new System.Drawing.Point(302, 15);
            this.checkBoxWaitForSlew.Name = "checkBoxWaitForSlew";
            this.checkBoxWaitForSlew.Size = new System.Drawing.Size(87, 17);
            this.checkBoxWaitForSlew.TabIndex = 7;
            this.checkBoxWaitForSlew.Text = "Wait for slew";
            this.checkBoxWaitForSlew.UseVisualStyleBackColor = true;
            this.checkBoxWaitForSlew.CheckedChanged += new System.EventHandler(this.checkBoxWaitForSlew_CheckedChanged);
            //
            // checkBoxPos
            //
            this.checkBoxPos.AutoSize = true;
            this.checkBoxPos.Location = new System.Drawing.Point(302, 80);
            this.checkBoxPos.Name = "checkBoxPos";
            this.checkBoxPos.Size = new System.Drawing.Size(56, 17);
            this.checkBoxPos.TabIndex = 7;
            this.checkBoxPos.Text = "Go To";
            this.checkBoxPos.UseVisualStyleBackColor = true;
            this.checkBoxPos.CheckedChanged += new System.EventHandler(this.checkBoxGoTo_CheckedChanged);
            //
            // checkBoxPan
            //
            this.checkBoxPan.AutoSize = true;
            this.checkBoxPan.Location = new System.Drawing.Point(302, 145);
            this.checkBoxPan.Name = "checkBoxPan";
            this.checkBoxPan.Size = new System.Drawing.Size(79, 17);
            this.checkBoxPan.TabIndex = 7;
            this.checkBoxPan.Text = "Change Dir";
            this.checkBoxPan.UseVisualStyleBackColor = true;
            this.checkBoxPan.CheckedChanged += new System.EventHandler(this.checkBoxChangeDir_CheckedChanged);
            //
            // checkBoxChangeZoom
            //
            this.checkBoxChangeZoom.AutoSize = true;
            this.checkBoxChangeZoom.Location = new System.Drawing.Point(302, 211);
            this.checkBoxChangeZoom.Name = "checkBoxChangeZoom";
            this.checkBoxChangeZoom.Size = new System.Drawing.Size(93, 17);
            this.checkBoxChangeZoom.TabIndex = 7;
            this.checkBoxChangeZoom.Text = "Change Zoom";
            this.checkBoxChangeZoom.UseVisualStyleBackColor = true;
            this.checkBoxChangeZoom.CheckedChanged += new System.EventHandler(this.checkBoxChangeZoom_CheckedChanged);
            //
            // label13
            //
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(303, 284);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(73, 13);
            this.label13.TabIndex = 0;
            this.label13.Text = "0=default time";
            //
            // checkBoxWaitComplete
            //
            this.checkBoxWaitComplete.AutoSize = true;
            this.checkBoxWaitComplete.Location = new System.Drawing.Point(198, 317);
            this.checkBoxWaitComplete.Name = "checkBoxWaitComplete";
            this.checkBoxWaitComplete.Size = new System.Drawing.Size(158, 17);
            this.checkBoxWaitComplete.TabIndex = 7;
            this.checkBoxWaitComplete.Text = "Wait for actions to complete";
            this.checkBoxWaitComplete.UseVisualStyleBackColor = true;
            this.checkBoxWaitComplete.CheckedChanged += new System.EventHandler(this.checkBoxWaitForSlew_CheckedChanged);
            //
            // checkBoxDisplayMessageWhenComplete
            //
            this.checkBoxDisplayMessageWhenComplete.AutoSize = true;
            this.checkBoxDisplayMessageWhenComplete.Location = new System.Drawing.Point(195, 349);
            this.checkBoxDisplayMessageWhenComplete.Name = "checkBoxDisplayMessageWhenComplete";
            this.checkBoxDisplayMessageWhenComplete.Size = new System.Drawing.Size(174, 17);
            this.checkBoxDisplayMessageWhenComplete.TabIndex = 7;
            this.checkBoxDisplayMessageWhenComplete.Text = "Display Message with complete";
            this.checkBoxDisplayMessageWhenComplete.UseVisualStyleBackColor = true;
            this.checkBoxDisplayMessageWhenComplete.CheckedChanged += new System.EventHandler(this.checkBoxWaitForSlew_CheckedChanged);
            //
            // RecordStep
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(412, 426);
            this.Controls.Add(this.checkBoxChangeZoom);
            this.Controls.Add(this.checkBoxPan);
            this.Controls.Add(this.checkBoxPos);
            this.Controls.Add(this.checkBoxDisplayMessageWhenComplete);
            this.Controls.Add(this.checkBoxWaitComplete);
            this.Controls.Add(this.checkBoxWaitForSlew);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.textBoxMsgTime);
            this.Controls.Add(this.textBoxMessage);
            this.Controls.Add(this.textBoxWait);
            this.Controls.Add(this.textBoxZoomTime);
            this.Controls.Add(this.textBoxPanTime);
            this.Controls.Add(this.textBoxZoom);
            this.Controls.Add(this.textBoxFlyTime);
            this.Controls.Add(this.textBoxDir);
            this.Controls.Add(this.textBoxPos);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.label13);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label12);
            this.Controls.Add(this.label11);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "RecordStep";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "RecordStep";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox textBoxPos;
        private System.Windows.Forms.TextBox textBoxDir;
        private System.Windows.Forms.TextBox textBoxZoom;
        private System.Windows.Forms.TextBox textBoxFlyTime;
        private System.Windows.Forms.TextBox textBoxPanTime;
        private System.Windows.Forms.TextBox textBoxWait;
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.TextBox textBoxMessage;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.TextBox textBoxZoomTime;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.TextBox textBoxMsgTime;
        private System.Windows.Forms.CheckBox checkBoxWaitForSlew;
        private System.Windows.Forms.CheckBox checkBoxPos;
        private System.Windows.Forms.CheckBox checkBoxPan;
        private System.Windows.Forms.CheckBox checkBoxChangeZoom;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.CheckBox checkBoxWaitComplete;
        private System.Windows.Forms.CheckBox checkBoxDisplayMessageWhenComplete;
    }
}


text:
var prettyCode = function(code){
	if (typeof code === "function") {
		code = code.toString();
	}
	code = code || "";
	var start = "function (){";
	code = code.substring(code.indexOf(start) + start.length + 2, code.length - 1).replace(/(^\s+|$\s+)/g, "");
	return code;
};

/**
 * Load all dependent URLs
 */
var getUrls = function(container, callback){
	var base = $("script[src*=demoer\\.js]").attr("src");
	base = base.substring(0, base.lastIndexOf("demoer.js"));

	// Loading Firebug
	var E = document.createElement('script');
	E.setAttribute('id', "FirebugLite");
	E.setAttribute('src', "https://getfirebug.com/firebug-lite.js#startOpened=true");
	E.setAttribute("FirebugLite", "4");
	document.getElementsByTagName('body')[0].appendChild(E);
	E.onload = function(){
		Firebug.DOM.addListener("onHSplitterMouseMove", function(){
			console.log("Resized");
		})
	}
	var count = 0;
	var timerHandle = window.setInterval(function(){
		count++;
		if (count > 10) {
			window.clearInterval(timerHandle);
		}
		if (typeof firebug !== "undefined") {
			window.clearInterval(timerHandle);
			window.console = firebug;
		}
	}, 1000);

	// Loading beautify, and then the container
	$.getScript(base + "beautify.js", function(){
		$(container).load(base + "demoer.html", function(){
			callback();
		});
	});

	$("head").append($("<link>").attr({
		"type": "text/css",
		"rel": "stylesheet",
		"href": base + "demoer.css"
	}));
}

// Start populating the samples
var loadDemoes = function(container, exampleList){
	getUrls(container, function(){
		var exampleDiv = $(container).children("ul.examples:first");
		var template = exampleDiv.children("li.sample:first");
		var list = [];
		for (example in exampleList) {
			var exampleItem = template.clone(false).attr("id", example);
			var html = exampleItem.html().replace(/__EXAMPLE__/g, example);
			html = html.replace(/\s*__EXAMPLE_CODE__\s*/g, js_beautify(prettyCode(exampleList[example].code)));
			html = html.replace(/\s*__EXAMPLE_ALTERNATE__\s*/g, js_beautify(prettyCode(exampleList[example].alternate)));
			exampleItem.html(html);
			exampleDiv.append(exampleItem.removeClass("sample"));
		}
	});

	var run = function(code, title){
		console.group(title);
		eval(code);
		setTimeout(function(){
			console.groupEnd(title);
		}, 1000);
		$(".more-code").hide();
	}

	$(".example-more-code").live("click", function(e){
		$(this).parent().nextAll(".code-full").toggle();
		return false;
	});

	$("button.code-run").live("click", function(e){
		var root = $(this).parent().parent();
		run(root.find(".code-linq").children(".code").text(), root.find("a.example-title").html());
	});

	$("#examples").css("overflow-y", "scroll");
	function resize(){
		var h = window.innerHeight - $("#FirebugUI").height() - $("h1").parent().height();
		$("#examples").height(h);
		height = h;
	}
};

redpajama_set_name: RedPajamaGithub


text:
// Importar el servicio DatosService desde el fichero
import { DatosService } from './datos.service';

import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

/** Importa un componente que declara y que luego exporta */
import { HomeComponent } from './home.component';

@NgModule({
  imports: [
    CommonModule,
    FormsModule
  ],
  declarations: [
    HomeComponent
  ],
  exports: [
    HomeComponent
  ],
  providers: [
    DatosService
  ]
})
export class HomeModule { }


text:
Template Manager
================

As your application grows, you may want to better organize e-mail templates in object-oriented manner.

What are the benefits?

* you have single place (template manager configuration) that lists all available templates
* you get access to advanced configuration options: default template headers and customized layout
* unit testing is easier: you can check that tested service returns given template by using "instance of" assertion

Available interfaces
--------------------

* **HtmlTemplateInterface** - template provides view script to be rendered as `text/html` message part
* **TextTemplateInterface** - template provides view script to be rendered as `text/plain` message part
* **LayoutProviderInterface** - template has a separate layout (see example below)
* [**HeadersProviderInterface**](#HeadersProviderInterface) - template provides specific headers (`Subject:`)

MtMail uses templates internally. When passing view script name, as in this example:

```php
$message = $mailService->compose($headers, 'application/mail/welcome.phtml');
```

...Mail service will create and instance of `MtMail\Template\SimpleHtml` class, which implements `HtmlTemplateInterface`.

Example - multiple layouts
--------------------------

Start with simple layout configuration:

```php
return [
    'mt_mail' => [
        'composer_plugins' => [
            'Layout'
        ],
        'layout' => 'mail/layout.phtml',
    ],
];
```

Create your template:

```php
namespace FooModule\EmailTemplate;

use MtMail\Template\HtmlTemplateInterface;
use MtMail\Template\LayoutProviderInterface;

class FooBarTemplate implements HtmlTemplateInterface, LayoutProviderInterface
{

    /**
     * @return string
     */
    public function getHtmlTemplateName()
    {
        return 'mail/test.phtml';
    }

    public function getLayout()
    {
        return 'mail/another-layout.phtml';
    }
}
```

Configure template manager:

```php
return [
    'mt_mail' => [
        'template_manager' => [
            'invokables' => [
                'FooBarTemplate' => \FooModule\EmailTemplate\FooBarTemplate::class,
            ],
        ],
    ],
];
```

Finally, usage:

```php
$headers = array(...);
$mail = $this->mtMail()->compose($headers, 'FooBarTemplate');
```

### HeadersProviderInterface

This interface allows the template to provide default headers to be set when the template is used. This can be either an
object or simple configuration as shown in the example below.

```php
namespace FooModule\EmailTemplate;

use MtMail\Template\HtmlTemplateInterface;
use MtMail\Template\LayoutProviderInterface;
use MtMail\Template\HeadersProviderInterface;

class FooBarTemplate implements HtmlTemplateInterface, LayoutProviderInterface, HeadersProviderInterface
{
    /* .. */

    public function getHeaders()
    {
        $subject = (new Subject())->setSubject('Hello!');

        return array(
           'from' => 'My Website <information-no-reply@mywebsite.com>',
           'subject' => $subject,
        )
    }
}
```


text:
<?php

namespace Symfony\Component\Form;

use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;

/**
 * Allows creating a form based on a name, a class or a property.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
interface FormFactoryInterface
{
    /**
     * Returns a form.
     *
     * @see createBuilder()
     *
     * @param mixed $data The initial data
     *
     * @return FormInterface
     *
     * @throws InvalidOptionsException if any given option is not applicable to the given type
     */
    public function create(string $type = FormType::class, $data = null, array $options = []);

    /**
     * Returns a form.
     *
     * @see createNamedBuilder()
     *
     * @param mixed $data The initial data
     *
     * @return FormInterface
     *
     * @throws InvalidOptionsException if any given option is not applicable to the given type
     */
    public function createNamed(string $name, string $type = FormType::class, $data = null, array $options = []);

    /**
     * Returns a form for a property of a class.
     *
     * @see createBuilderForProperty()
     *
     * @param string $class    The fully qualified class name
     * @param string $property The name of the property to guess for
     * @param mixed  $data     The initial data
     *
     * @return FormInterface
     *
     * @throws InvalidOptionsException if any given option is not applicable to the form type
     */
    public function createForProperty(string $class, string $property, $data = null, array $options = []);

    /**
     * Returns a form builder.
     *
     * @param mixed $data The initial data
     *
     * @return FormBuilderInterface
     *
     * @throws InvalidOptionsException if any given option is not applicable to the given type
     */
    public function createBuilder(string $type = FormType::class, $data = null, array $options = []);

    /**
     * Returns a form builder.
     *
     * @param mixed $data The initial data
     *
     * @return FormBuilderInterface
     *
     * @throws InvalidOptionsException if any given option is not applicable to the given type
     */
    public function createNamedBuilder(string $name, string $type = FormType::class, $data = null, array $options = []);

    /**
     * Returns a form builder for a property of a class.
     *
     * If any of the 'required' and type options can be guessed,
     * and are not provided in the options argument, the guessed value is used.
     *
     * @param string $class    The fully qualified class name
     * @param string $property The name of the property to guess for
     * @param mixed  $data     The initial data
     *
     * @return FormBuilderInterface
     *
     * @throws InvalidOptionsException if any given option is not applicable to the form type
     */
    public function createBuilderForProperty(string $class, string $property, $data = null, array $options = []);
}


text:
package ggstat

import (
	"reflect"

	"github.com/aclements/go-gg/generic/slice"
	"github.com/aclements/go-gg/table"
)

// Normalize normalizes each group such that some data point is 1.
//
// Either X or Index is required (though 0 is a reasonable value of
// Index).
//
// The result of Normalize is the same as the input table, plus
// additional columns for each normalized column. These columns will
// be named "normalized <col>" where <col> is the name of the original
// column and will have type []float64.
type Normalize struct {
	// X is the name of the column to use to find the denominator
	// row. If X is "", Index is used instead.
	X string

	// Index is the row index of the denominator row if X is ""
	// (otherwise it is ignored). Index may be negative, in which
	// case it is added to the number of rows (e.g., -1 is the
	// last row).
	Index int

	// By is a function func([]T) int that returns the index of
	// the denominator row given column X. By may be nil, in which
	// case it defaults to generic.ArgMin.
	By interface{}

	// Cols is a slice of the names of columns to normalize
	// relative to their value in the denominator row. Cols may be
	// nil, in which case it defaults to all integral and floating
	// point columns.
	Cols []string
}

func (s Normalize) F(g table.Grouping) table.Grouping {
	// Find the columns to normalize.
	if s.Cols == nil {
		cols := []string{}
		for i, ct := range colTypes(g) {
			if canNormalize(ct.Elem().Kind()) {
				cols = append(cols, g.Columns()[i])
			}
		}
		s.Cols = cols
	}
	if len(s.Cols) == 0 {
		return g
	}

	// Construct new column names.
	newcols := make([]string, len(s.Cols))
	for i, col := range s.Cols {
		newcols[i] = "normalized " + col
	}

	// Get "by" function.
	var byv reflect.Value
	byargs := make([]reflect.Value, 1)
	if s.By != nil {
		byv = reflect.ValueOf(s.By)
		// TODO: Type check byv better.
	}

	return table.MapTables(g, func(_ table.GroupID, t *table.Table) *table.Table {
		if t.Len() == 0 {
			return t
		}

		// Find the denominator row.
		var drow int
		if s.X == "" {
			drow = s.Index
			if drow < 0 {
				drow += t.Len()
			}
		} else {
			xs := t.MustColumn(s.X)
			if s.By == nil {
				drow = slice.ArgMin(xs)
			} else {
				byargs[0] = reflect.ValueOf(xs)
				byout := byv.Call(byargs)
				drow = int(byout[0].Int())
			}
		}

		// Normalize columns.
		newt := table.NewBuilder(t)
		for coli, col := range s.Cols {
			out := normalizeTo(t.MustColumn(col), drow)
			newt.Add(newcols[coli], out)
		}

		return newt.Done()
	})
}

func colTypes(g table.Grouping) []reflect.Type {
	cts := make([]reflect.Type, len(g.Columns()))
	for i, col := range g.Columns() {
		cts[i] = table.ColType(g, col)
	}
	return cts
}

var canNormalizeKinds = map[reflect.Kind]bool{
	reflect.Float32: true,
	reflect.Float64: true,
	reflect.Int:     true,
	reflect.Int8:    true,
	reflect.Int16:   true,
	reflect.Int32:   true,
	reflect.Int64:   true,
	reflect.Uint:    true,
	reflect.Uintptr: true,
	reflect.Uint8:   true,
	reflect.Uint16:  true,
	reflect.Uint32:  true,
	reflect.Uint64:  true,
}

func canNormalize(k reflect.Kind) bool {
	return canNormalizeKinds[k]
}

func normalizeTo(s interface{}, index int) interface{} {
	switch s := s.(type) {
	case []float64:
		denom := s[index]
		out := make([]float64, len(s))
		for i, numer := range s {
			out[i] = numer / denom
		}
		return out
	}

	sv := reflect.ValueOf(s)
	denom := sv.Index(index).Convert(float64Type).Float()

	out := reflect.MakeSlice(float64SliceType, sv.Len(), sv.Len())
	for i, len := 0, sv.Len(); i < len; i++ {
		numer := sv.Index(i).Convert(float64Type).Float()
		out.Index(i).SetFloat(numer / denom)
	}
	return out.Interface()
}


text:
namespace blink {

class ResourceFetcher;

class ClientHintsPreferences {
public:
    ClientHintsPreferences()
        : m_shouldSendDPR(false)
        , m_shouldSendResourceWidth(false)
        , m_shouldSendViewportWidth(false)
    {
    }

    void set(const ClientHintsPreferences& other)
    {
        m_shouldSendDPR = other.m_shouldSendDPR;
        m_shouldSendResourceWidth = other.m_shouldSendResourceWidth;
        m_shouldSendViewportWidth = other.m_shouldSendViewportWidth;
    }

    void setShouldSendDPR(bool should) { m_shouldSendDPR = should; }
    void setShouldSendResourceWidth(bool should) { m_shouldSendResourceWidth = should; }
    void setShouldSendViewportWidth(bool should) { m_shouldSendViewportWidth = should; }
    bool shouldSendDPR() const { return m_shouldSendDPR; }
    bool shouldSendResourceWidth() const { return m_shouldSendResourceWidth; }
    bool shouldSendViewportWidth() const { return m_shouldSendViewportWidth; }

private:
    bool m_shouldSendDPR;
    bool m_shouldSendResourceWidth;
    bool m_shouldSendViewportWidth;
};

CORE_EXPORT void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPreferences&, ResourceFetcher*);
} // namespace blink
#endif


text:
"""The iCloud component."""
import voluptuous as vol

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant, ServiceCall
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.storage import Store
from homeassistant.util import slugify

from .account import IcloudAccount
from .const import (
    CONF_GPS_ACCURACY_THRESHOLD,
    CONF_MAX_INTERVAL,
    CONF_WITH_FAMILY,
    DOMAIN,
    PLATFORMS,
    STORAGE_KEY,
    STORAGE_VERSION,
)

ATTRIBUTION = "Data provided by Apple iCloud"

# entity attributes
ATTR_ACCOUNT_FETCH_INTERVAL = "account_fetch_interval"
ATTR_BATTERY = "battery"
ATTR_BATTERY_STATUS = "battery_status"
ATTR_DEVICE_NAME = "device_name"
ATTR_DEVICE_STATUS = "device_status"
ATTR_LOW_POWER_MODE = "low_power_mode"
ATTR_OWNER_NAME = "owner_fullname"

# services
SERVICE_ICLOUD_PLAY_SOUND = "play_sound"
SERVICE_ICLOUD_DISPLAY_MESSAGE = "display_message"
SERVICE_ICLOUD_LOST_DEVICE = "lost_device"
SERVICE_ICLOUD_UPDATE = "update"
ATTR_ACCOUNT = "account"
ATTR_LOST_DEVICE_MESSAGE = "message"
ATTR_LOST_DEVICE_NUMBER = "number"
ATTR_LOST_DEVICE_SOUND = "sound"

SERVICE_SCHEMA = vol.Schema({vol.Optional(ATTR_ACCOUNT): cv.string})

SERVICE_SCHEMA_PLAY_SOUND = vol.Schema(
    {vol.Required(ATTR_ACCOUNT): cv.string, vol.Required(ATTR_DEVICE_NAME): cv.string}
)

SERVICE_SCHEMA_DISPLAY_MESSAGE = vol.Schema(
    {
        vol.Required(ATTR_ACCOUNT): cv.string,
        vol.Required(ATTR_DEVICE_NAME): cv.string,
        vol.Required(ATTR_LOST_DEVICE_MESSAGE): cv.string,
        vol.Optional(ATTR_LOST_DEVICE_SOUND): cv.boolean,
    }
)

SERVICE_SCHEMA_LOST_DEVICE = vol.Schema(
    {
        vol.Required(ATTR_ACCOUNT): cv.string,
        vol.Required(ATTR_DEVICE_NAME): cv.string,
        vol.Required(ATTR_LOST_DEVICE_NUMBER): cv.string,
        vol.Required(ATTR_LOST_DEVICE_MESSAGE): cv.string,
    }
)

CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Set up an iCloud account from a config entry."""

    hass.data.setdefault(DOMAIN, {})

    username = entry.data[CONF_USERNAME]
    password = entry.data[CONF_PASSWORD]
    with_family = entry.data[CONF_WITH_FAMILY]
    max_interval = entry.data[CONF_MAX_INTERVAL]
    gps_accuracy_threshold = entry.data[CONF_GPS_ACCURACY_THRESHOLD]

    # For backwards compat
    if entry.unique_id is None:
        hass.config_entries.async_update_entry(entry, unique_id=username)

    icloud_dir = Store(hass, STORAGE_VERSION, STORAGE_KEY)

    account = IcloudAccount(
        hass,
        username,
        password,
        icloud_dir,
        with_family,
        max_interval,
        gps_accuracy_threshold,
        entry,
    )
    await hass.async_add_executor_job(account.setup)

    hass.data[DOMAIN][entry.unique_id] = account

    hass.config_entries.async_setup_platforms(entry, PLATFORMS)

    def play_sound(service: ServiceCall) -> None:
        """Play sound on the device."""
        account = service.data[ATTR_ACCOUNT]
        device_name = service.data.get(ATTR_DEVICE_NAME)
        device_name = slugify(device_name.replace(" ", "", 99))

        for device in _get_account(account).get_devices_with_name(device_name):
            device.play_sound()

    def display_message(service: ServiceCall) -> None:
        """Display a message on the device."""
        account = service.data[ATTR_ACCOUNT]
        device_name = service.data.get(ATTR_DEVICE_NAME)
        device_name = slugify(device_name.replace(" ", "", 99))
        message = service.data.get(ATTR_LOST_DEVICE_MESSAGE)
        sound = service.data.get(ATTR_LOST_DEVICE_SOUND, False)

        for device in _get_account(account).get_devices_with_name(device_name):
            device.display_message(message, sound)

    def lost_device(service: ServiceCall) -> None:
        """Make the device in lost state."""
        account = service.data[ATTR_ACCOUNT]
        device_name = service.data.get(ATTR_DEVICE_NAME)
        device_name = slugify(device_name.replace(" ", "", 99))
        number = service.data.get(ATTR_LOST_DEVICE_NUMBER)
        message = service.data.get(ATTR_LOST_DEVICE_MESSAGE)

        for device in _get_account(account).get_devices_with_name(device_name):
            device.lost_device(number, message)

    def update_account(service: ServiceCall) -> None:
        """Call the update function of an iCloud account."""
        if (account := service.data.get(ATTR_ACCOUNT)) is None:
            for account in hass.data[DOMAIN].values():
                account.keep_alive()
        else:
            _get_account(account).keep_alive()

    def _get_account(account_identifier: str) -> any:
        if account_identifier is None:
            return None

        icloud_account = hass.data[DOMAIN].get(account_identifier)
        if icloud_account is None:
            for account in hass.data[DOMAIN].values():
                if account.username == account_identifier:
                    icloud_account = account

        if icloud_account is None:
            raise Exception(
                f"No iCloud account with username or name {account_identifier}"
            )
        return icloud_account

    hass.services.async_register(
        DOMAIN, SERVICE_ICLOUD_PLAY_SOUND, play_sound, schema=SERVICE_SCHEMA_PLAY_SOUND
    )

    hass.services.async_register(
        DOMAIN,
        SERVICE_ICLOUD_DISPLAY_MESSAGE,
        display_message,
        schema=SERVICE_SCHEMA_DISPLAY_MESSAGE,
    )

    hass.services.async_register(
        DOMAIN,
        SERVICE_ICLOUD_LOST_DEVICE,
        lost_device,
        schema=SERVICE_SCHEMA_LOST_DEVICE,
    )

    hass.services.async_register(
        DOMAIN, SERVICE_ICLOUD_UPDATE, update_account, schema=SERVICE_SCHEMA
    )

    return True

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Unload a config entry."""
    unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
    if unload_ok:
        hass.data[DOMAIN].pop(entry.data[CONF_USERNAME])
    return unload_ok


text:
"use strict";
const ava_1 = require("ava");
const sinon = require("sinon");
const monads_1 = require("../lib/monads");
// Identity
ava_1.default("Identity.unit(a) is new Identity(a) shorthand", t => {
    t.deepEqual(monads_1.Identity.unit("foo"), new monads_1.Identity("foo"));
});
ava_1.default("Identity.of is an Identity.unit alias", t => {
    t.deepEqual(monads_1.Identity.of("foo"), monads_1.Identity.unit("foo"));
});
ava_1.default("Identity.bind allows for chaining transformations", t => {
    const actual = monads_1.Identity.of("foo")
        .bind(str => monads_1.Identity.of(str.length))
        .bind(len => monads_1.Identity.of(len * 2));
    t.deepEqual(actual, monads_1.Identity.of(6));
});
ava_1.default("Identity.map allows for chaining underlaying value transformations", t => {
    const actual = monads_1.Identity.of("foo")
        .map(str => str.length)
        .map(len => len * 2);
    t.deepEqual(actual, monads_1.Identity.of(6));
});
ava_1.default("Identity implements Comonad", t => {
    t.is(monads_1.Identity.of("Comonad").extract(), "Comonad");
});
ava_1.default("Identity implements .toString() method", t => {
    t.is(monads_1.Identity.of(6).toString(), "Identity(6)");
    t.is(monads_1.Identity.of("foo").toString(), "Identity(\"foo\")");
    t.is(monads_1.Identity.of(["foo", 6]).toString(), "Identity([\"foo\",6])");
});
ava_1.default("Identity obey monad laws", t => {
    const f = (word) => monads_1.Identity.of(word.length);
    const g = (len) => monads_1.Identity.of(len * 2);
    const m = monads_1.Identity.of("foo");
    t.deepEqual(monads_1.Identity.of("foo").bind(f), f("foo"));
    t.deepEqual(m.bind(monads_1.Identity.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// Just
ava_1.default("Just.unit(a) is new Just(a) shorthand", t => {
    t.deepEqual(monads_1.Just.unit("foo"), new monads_1.Just("foo"));
});
ava_1.default("Just.bind returns Nothing in case of exception", t => {
    function firstWordLength(words) {
        return words[0].length;
    }
    const m = monads_1.Just.unit([])
        .bind(strs => monads_1.Just.unit(firstWordLength(strs)));
    t.deepEqual(m, new monads_1.Nothing());
});
ava_1.default("Just.map returns Nothing in case of exception", t => {
    function firstWordLength(words) {
        return words[0].length;
    }
    const m = monads_1.Just.unit([])
        .map(strs => firstWordLength(strs));
    t.deepEqual(m, new monads_1.Nothing());
});
ava_1.default("Just implements .toString() method", t => {
    t.is("Just(6)", monads_1.Just.of(6).toString());
    t.is("Just(\"foo\")", monads_1.Just.of("foo").toString());
    t.is("Just([\"foo\",6])", monads_1.Just.of(["foo", 6]).toString());
});
ava_1.default("Just obey monad laws", t => {
    const f = (word) => monads_1.Just.of(word.length);
    const g = (len) => monads_1.Just.of(len * 2);
    const m = monads_1.Just.of("foo");
    t.deepEqual(monads_1.Just.of("foo").bind(f), f("foo"));
    t.deepEqual(m.bind(monads_1.Just.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// Nothing
ava_1.default("Nothing.unit() is new Nothing() shorthand", t => {
    t.deepEqual(monads_1.Nothing.unit(), new monads_1.Nothing());
});
ava_1.default("Nothing.of is an Nothing.unit alias", t => {
    t.deepEqual(monads_1.Nothing.of(), monads_1.Nothing.unit());
});
ava_1.default("Nothing implements .toString() method", t => {
    t.is("Nothing()", monads_1.Nothing.of().toString());
});
ava_1.default("Nothing obey monad laws", t => {
    const f = (word) => monads_1.Just.of(word.length);
    const f1 = (word) => monads_1.Nothing.unit();
    const g = (len) => monads_1.Just.of(len * 2);
    const m = monads_1.Nothing.unit();
    t.deepEqual(monads_1.Nothing.unit().bind(f1), f1("foo"));
    t.deepEqual(m.bind(monads_1.Just.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// Maybe
ava_1.default("Maybe when is Just allows for chaining transformations", t => {
    const doubleFirstWordLength = monads_1.Just.of(["foo", "bar", "foo"])
        .bind(words => words[0] ? monads_1.Just.of(words[0]) : new monads_1.Nothing())
        .bind(word => monads_1.Just.of(word.length))
        .bind(len => monads_1.Just.of(len * 2));
    t.true(doubleFirstWordLength instanceof monads_1.Just);
    t.is(doubleFirstWordLength.toString(), "Just(6)");
});
ava_1.default("Maybe when is Nothing skips chained transformations", t => {
    const doubleFirstWordLength = monads_1.Just.of([])
        .bind(words => words[0] ? monads_1.Just.of(words[0]) : new monads_1.Nothing())
        .bind(word => monads_1.Just.of(word.length))
        .bind(len => monads_1.Just.of(len * 2));
    t.true(doubleFirstWordLength instanceof monads_1.Nothing);
    t.is(doubleFirstWordLength.toString(), "Nothing()");
});
// IO
ava_1.default("IO.unit(IOSideEffect) is new IO(IOSideEffect) shorthand", t => {
    const sideEffect = () => { alert("I'm a side effect!"); };
    t.deepEqual(monads_1.IO.unit(sideEffect), new monads_1.IO(sideEffect));
});
ava_1.default("IO.of is an IO.unit alias", t => {
    const sideEffect = () => { alert("I'm a side effect!"); };
    t.deepEqual(monads_1.IO.of(sideEffect), monads_1.IO.unit(sideEffect));
});
ava_1.default("IO.bind allows for chaining side effects", t => {
    const sideEffect = () => { alert("I'm a side effect!"); };
    const anotherSideEffect = () => { alert("I'm an another side effect!"); };
    const actual = monads_1.IO.of(sideEffect)
        .bind(() => monads_1.IO.of(anotherSideEffect));
    t.deepEqual(actual, monads_1.IO.of(anotherSideEffect));
});
ava_1.default("IO implements .toString() method", t => {
    const sideEffect = name => { alert(`Hello ${name}! I'm a side effect!`); };
    t.is(monads_1.IO.of(sideEffect, "World").toString(), "IO(sideEffect, [\"World\"])");
});
ava_1.default("IO.equals check IO monads deep quality", t => {
    const sideEffect = () => { alert("I'm a side effect!"); };
    const anotherSideEffect = () => { alert("I'm a another side effect!"); };
    const m1 = monads_1.IO.unit(sideEffect, 1, 2, 3);
    t.true(m1.equals(monads_1.IO.unit(sideEffect, 1, 2, 3)));
    t.false(m1.equals(monads_1.IO.unit(sideEffect, 1, 2)));
    t.false(m1.equals(monads_1.IO.unit(anotherSideEffect, 1, 2, 3)));
});
ava_1.default("IO can run() side effect", t => {
    const sideEffectSpy = sinon.spy();
    monads_1.IO.of(sideEffectSpy, 101).run();
    t.true(sideEffectSpy.calledWith(101));
});
ava_1.default("IO obey monad laws", t => {
    const sideEffect = () => { alert("I'm a side effect!"); };
    const anotherSideEffect = () => { alert("I'm an another side effect!"); };
    const yetAnotherSideEffect = () => { alert("I'm a yet another side effect!"); };
    const f = (sf) => monads_1.IO.of(sideEffect);
    const g = (sf) => monads_1.IO.of(anotherSideEffect);
    const m = monads_1.IO.of(yetAnotherSideEffect);
    t.deepEqual(monads_1.IO.of(sideEffect).bind(f), f(sideEffect));
    t.deepEqual(m.bind(monads_1.IO.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// Right
ava_1.default("Right.unit(a) is new Right(a) shorthand", t => {
    t.deepEqual(monads_1.Right.unit("foo"), new monads_1.Right("foo"));
});
ava_1.default("Right.of is an Right.unit alias", t => {
    t.deepEqual(monads_1.Right.of("foo"), monads_1.Right.unit("foo"));
});
ava_1.default("Right.bind returns Left in case of exception", t => {
    function firstWordLength(words) {
        return words[0].length;
    }
    const m = monads_1.Right.unit([])
        .bind(strs => monads_1.Right.of(firstWordLength(strs)));
    t.deepEqual(m, monads_1.Left.unit(new TypeError()));
});
ava_1.default("Right.map returns Left in case of exception", t => {
    function firstWordLength(words) {
        return words[0].length;
    }
    const m = monads_1.Right.unit([])
        .map(strs => firstWordLength(strs));
    t.deepEqual(m, monads_1.Left.unit(new TypeError()));
});
ava_1.default("Right implements .toString() method", t => {
    t.is("Right(6)", monads_1.Right.of(6).toString());
    t.is("Right(\"foo\")", monads_1.Right.of("foo").toString());
    t.is("Right([\"foo\",6])", monads_1.Right.of(["foo", 6]).toString());
});
ava_1.default("Right obey monad laws", t => {
    const f = (word) => monads_1.Right.of(word.length);
    const g = (len) => monads_1.Right.of(len * 2);
    const m = monads_1.Right.of("foo");
    t.deepEqual(monads_1.Right.of("foo").bind(f), f("foo"));
    t.deepEqual(m.bind(monads_1.Right.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// Left
ava_1.default("Left.unit(a) is new Left(a) shorthand", t => {
    t.deepEqual(monads_1.Left.unit("foo"), new monads_1.Left("foo"));
});
ava_1.default("Left.of is an Left.unit alias", t => {
    t.deepEqual(monads_1.Left.of("foo"), monads_1.Left.unit("foo"));
});
ava_1.default("Left implements .toString() method", t => {
    t.is("Left(Error: foo)", monads_1.Left.of(new Error("foo")).toString());
});
ava_1.default("Left obey monad laws", t => {
    const f = (word) => monads_1.Left.of("foo");
    const g = (word) => monads_1.Left.of(word.length);
    const m = monads_1.Left.of("foo");
    t.deepEqual(monads_1.Left.of("foo").bind(f), f("foo"));
    t.deepEqual(m.bind(monads_1.Left.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// Either
ava_1.default("Either when it's Right allows for chaining transformations", t => {
    const monad = monads_1.Right.of("{\"foo\":\"bar\"}")
        .bind(json => {
        try {
            return monads_1.Right.of(JSON.parse(json));
        }
        catch (err) {
            return monads_1.Left.of(err);
        }
    })
        .bind(obj => monads_1.Right.of(obj.foo));
    t.true(monad instanceof monads_1.Right);
    t.is(monad.toString(), "Right(\"bar\")");
});
ava_1.default("Either when it's Left skips chained transformations", t => {
    const monad = monads_1.Right.of("{\"foo\" \"bar\"}")
        .bind(json => {
        try {
            return monads_1.Right.of(JSON.parse(json));
        }
        catch (err) {
            return monads_1.Left.of(err);
        }
    })
        .bind(obj => monads_1.Right.of(obj.foo));
    t.true(monad instanceof monads_1.Left);
    t.is(monad.toString(), "Left(SyntaxError: Unexpected string in JSON at position 7)");
});
// Continuation
ava_1.default("Continuation.unit(a) is new Continuation(a) shorthand", t => {
    t.deepEqual(monads_1.Continuation.unit("foo"), new monads_1.Continuation("foo"));
});
ava_1.default("Continuation.of is an Continuation.unit alias", t => {
    t.deepEqual(monads_1.Continuation.of("foo"), monads_1.Continuation.unit("foo"));
});
ava_1.default("Continuation.binds allows for chaining async transformations", t => {
    t.plan(1);
    const spy = sinon.spy();
    return new Promise(resolve => {
        monads_1.Continuation.of(Promise.resolve({ orders: [{ id: 1 }, { id: 2 }] }))
            .bind(response => response.orders)
            .bind(orders => Promise.resolve(orders[0]))
            .bind(spy)
            .bind(() => {
            t.true(spy.calledWith({ id: 1 }));
            resolve();
        });
    });
});
ava_1.default("Continuation implements .toString() method", t => {
    t.is(monads_1.Continuation.of(6).toString(), "Continuation([object Promise])");
});
ava_1.default("Continuation obey monad laws", t => {
    const f = (word) => monads_1.Continuation.of(word.length);
    const g = (len) => monads_1.Continuation.of(len * 2);
    const m = monads_1.Continuation.of("foo");
    t.deepEqual(monads_1.Continuation.of("foo").bind(f), f("foo"));
    t.deepEqual(m.bind(monads_1.Continuation.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
// List
ava_1.default("List.unit([a]) is new List([a]) shorthand", t => {
    t.deepEqual(monads_1.List.unit([1, 2, 3]), new monads_1.List([1, 2, 3]));
});
ava_1.default("List.of is an List.unit alias", t => {
    t.deepEqual(monads_1.List.of([1, 2, 3]), monads_1.List.unit([1, 2, 3]));
});
ava_1.default("List.bind allows for chaining iterable transformations", t => {
    const actual = monads_1.List.of([1, 2, 3])
        .bind(iterable => monads_1.List.of(Array.from(iterable).map(x => x + 1)))
        .bind(iterable => monads_1.List.of(Array.from(iterable).map(x => x + 1)));
    t.deepEqual(actual, monads_1.List.of([3, 4, 5]));
});
ava_1.default("List.map allows for chaining items transformations and lazy computation", t => {
    const lazySpy = sinon.spy();
    const nextLazySpy = sinon.spy();
    const m = monads_1.List.of([1, 2, 3]).map(x => {
        lazySpy();
        return x + 1;
    }).map(x => {
        nextLazySpy();
        return x + 1;
    });
    const underlayingIterable = m[Symbol.iterator]();
    t.true(lazySpy.notCalled);
    t.true(nextLazySpy.notCalled);
    t.is(underlayingIterable.next().value, 3);
    t.true(lazySpy.calledOnce);
    t.true(nextLazySpy.calledOnce);
    t.is(underlayingIterable.next().value, 4);
    t.true(lazySpy.calledTwice);
    t.true(nextLazySpy.calledTwice);
    t.is(underlayingIterable.next().value, 5);
    t.true(lazySpy.calledThrice);
    t.true(nextLazySpy.calledThrice);
});
ava_1.default("List.forEach allows for performing computation and iterate through the result", t => {
    const actual = [];
    const expected = [1, 2, 3];
    monads_1.List.unit([1, 2, 3]).forEach(item => {
        actual.push(item);
    });
    t.deepEqual(actual, expected);
});
ava_1.default("List implements Symbol.iterate", t => {
    const actual = [];
    const expected = [1, 2, 3];
    for (let item of monads_1.List.unit([1, 2, 3])) {
        actual.push(item);
    }
    t.deepEqual(actual, expected);
});
ava_1.default("List implements .toString() method", t => {
    t.is(monads_1.List.of([1, 2, 3]).toString(), "List([1,2,3])");
});
ava_1.default("List obey monad laws", t => {
    const f = (iterable) => monads_1.List.of(iterable);
    const g = (iterable) => monads_1.List.of(Array.from(iterable).map(x => x + 1));
    const m = monads_1.List.of([1, 2, 3]);
    t.deepEqual(monads_1.List.of([1, 2, 3]).bind(f), f([1, 2, 3]));
    t.deepEqual(m.bind(monads_1.List.of), m);
    t.deepEqual(m.bind(f).bind(g), m.bind(x => f(x).bind(g)));
});
//# sourceMappingURL=monads.test.js.map


text:
<?php

namespace OC\Preview;

class Image extends Provider {

	public function getMimeType() {
		return '/image\/.*/';
	}

	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
		//get fileinfo
		$fileInfo = $fileview->getFileInfo($path);
		if(!$fileInfo) {
			return false;
		}

		$image = new \OC_Image();
		//check if file is encrypted
		if($fileInfo['encrypted'] === true) {
			$image->loadFromData(stream_get_contents($fileview->fopen($path, 'r')));
		}else{
			$image->loadFromFile($fileview->getLocalFile($path));
		}

		return $image->valid() ? $image : false;
	}
}

\OC\Preview::registerProvider('OC\Preview\Image');


text:
3dpct
=====

3d printer control toolchain for reprap machines

Main purpose?
-------------

Command line tool for 3d printing with a reprap machine from given G-code.

What's this?
------------

3dpct is a simple lightweight python script which lets you control your 3d printer using G-code.

Features:
* __G-code parser__:
  It provides a simple G-code parser which removes G-code comments and empty lines, so that only the necessary information
  will be sent to the reprap machine.
* __Checksum generator__:
  The parser also adds a line number and checksum to each line of G-code, so that the
  3d printer is able to indicate transmission errors and re-requests corrupt lines of G-code.
* __Code sender__:
  3dpct overtakes the whole printer communication for you. You just have to feed it with the G-code file and the printer
  device (baudrate).
* __G-code cli__:
  3dpct also provides a cli which turns you able to write gcode on the command line and send it directly to the printer

All features are packed into two python classes, which you could also use in your own python program.

But how?
--------

Example usage:
* __Print a model__:

  ```
  ./3dpct.py -f model.gcode -p -d /dev/ttyUSB0 -b 250000
  ```

* __Output filtered G-code__:

  ```
  ./3dpct.py -f model.gcode -o
  ```

* __Use as part of a pipeline__:

  ```
  cat model.gcode | ./3dpct.py -f - -o > filtered_gcode.gcode
  ```

* __Simple command execution (without checksum and line numbers)__:

  ```
  ./3dpct.py --no-checksum -e G28
  ```

Please also check out the -h option:

```
usage: 3dpct.py [-h] [-f [FILE]] [-o] [-p] [-c] [-n] [-e ...] [--no-checksum]
                [--silent] [-d [DEVICE]] [-b [BAUD]]

3dpct - a 3d printer control toolchain

optional arguments:
  -h, --help            show this help message and exit
  -f [FILE], --file [FILE]
                        load gcode from given file name or use '-' for STDIN
  -o, --output          output filtered gcode to STDOUT
  -p, --print           use 3d printer to print gcode
  -c, --cli             start a cli for manual printer control using gcodes
  -n, --no-direction-mark
                        don't show direction marks and prompt (eg: <~: ,~>:
                        ,<-: )
  -e ..., --execute ...
                        execute a single gcode line (must be last argument)
  --no-checksum         don't generate line numbers and checksums
  --silent              don't output communication while printing
  -d [DEVICE], --device [DEVICE]
                        the device to use for printing (default: /dev/ttyUSB0)
  -b [BAUD], --baud [BAUD]
                        the baudrate to use on device (default: 250000)
```

Disclaimer
----------

The programm has only been tested with a Velleman K8200. Please contact me if you get errors with your reprap (Just open a GitHub issue). Then I'll try to fix them. Please also let me know if it works with your reprap.

See also
--------

* http://reprap.org
* http://reprap.org/wiki/G-code


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>io.lumify</groupId>
        <artifactId>lumify-core-plugins-group</artifactId>
        <version>0.5.0-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <artifactId>lumify-model-sql</artifactId>
    <name>Lumify: Core: Plugin: Model: SQL</name>

    <dependencies>
        <dependency>
            <groupId>io.lumify</groupId>
            <artifactId>lumify-core</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.lumify</groupId>
            <artifactId>lumify-web</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.4.Final</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.3.175</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.29</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>4.3.4.Final</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptor>src/main/assembly/descriptor.xml</descriptor>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
package scalapb

import com.google.protobuf.ByteString
import com.google.protobuf.test.unittest_import.{ImportEnum, ImportMessage}
import com.google.protobuf.test.unittest_import_public.PublicImportMessage
import protobuf_unittest.unittest.{ForeignMessage, ForeignEnum, TestAllTypes}
import org.scalactic.source.Position

import scala.reflect.ClassTag
import scala.annotation.nowarn

object TestUtil {
  def isScalaJS = System.getProperty("java.vm.name") == "Scala.js"

  private def toBytes(str: String) = ByteString.copyFrom(str.getBytes("UTF-8"))

  def isAnyVal[T](
      @nowarn value: T
  )(implicit pos: Position, tag: ClassTag[T], ev: T <:< AnyVal = null): Unit = {
    if (ev == null) {
      org.scalatest.matchers.must.Matchers.fail(s"${tag.toString()} is not AnyVal")
    }
  }

  def getAllTypesAllSet: TestAllTypes = {
    TestAllTypes().update(
      _.optionalInt32               := 101,
      _.optionalInt64               := 102,
      _.optionalUint32              := 103,
      _.optionalUint64              := 104,
      _.optionalSint32              := 105,
      _.optionalSint64              := 106,
      _.optionalFixed32             := 107,
      _.optionalFixed64             := 108,
      _.optionalSfixed32            := 109,
      _.optionalSfixed64            := 110,
      _.optionalFloat               := 111,
      _.optionalDouble              := 112,
      _.optionalBool                := true,
      _.optionalString              := "115",
      _.optionalBytes               := toBytes("116"),
      _.optionalNestedMessage       := TestAllTypes.NestedMessage(bb = Some(118)),
      _.optionalForeignMessage      := ForeignMessage(c = Some(119)),
      _.optionalImportMessage       := ImportMessage(d = Some(120)),
      _.optionalPublicImportMessage := PublicImportMessage(e = Some(126)),
      _.optionalLazyMessage         := TestAllTypes.NestedMessage(bb = Some(127)),
      _.optionalNestedEnum          := TestAllTypes.NestedEnum.BAZ,
      _.optionalForeignEnum         := ForeignEnum.FOREIGN_BAZ,
      _.optionalImportEnum          := ImportEnum.IMPORT_BAZ,
      _.optionalStringPiece         := "124",
      _.optionalCord                := "125",

      // -----------------------------------------------------------------

      _.repeatedInt32 :+= 201,
      _.repeatedInt64 :+= 202,
      _.repeatedUint32 :+= 203,
      _.repeatedUint64 :+= 204,
      _.repeatedSint32 :+= 205,
      _.repeatedSint64 :+= 206,
      _.repeatedFixed32 :+= 207,
      _.repeatedFixed64 :+= 208,
      _.repeatedSfixed32 :+= 209,
      _.repeatedSfixed64 :+= 210,
      _.repeatedFloat :+= 211,
      _.repeatedDouble :+= 212,
      _.repeatedBool :+= true,
      _.repeatedString :+= "215",
      _.repeatedBytes :+= toBytes("216"),
      _.repeatedNestedMessage :+= TestAllTypes.NestedMessage(bb = Some(218)),
      _.repeatedForeignMessage :+= ForeignMessage(c = Some(219)),
      _.repeatedImportMessage :+= ImportMessage(d = Some(220)),
      _.repeatedLazyMessage :+= TestAllTypes.NestedMessage(bb = Some(227)),
      _.repeatedNestedEnum :+= TestAllTypes.NestedEnum.BAR,
      _.repeatedForeignEnum :+= ForeignEnum.FOREIGN_BAR,
      _.repeatedImportEnum :+= ImportEnum.IMPORT_BAR,
      _.repeatedStringPiece :+= "224",
      _.repeatedCord :+= "225",

      // Add second one of each field.
      _.repeatedInt32 :+= 301,
      _.repeatedInt64 :+= 302,
      _.repeatedUint32 :+= 303,
      _.repeatedUint64 :+= 304,
      _.repeatedSint32 :+= 305,
      _.repeatedSint64 :+= 306,
      _.repeatedFixed32 :+= 307,
      _.repeatedFixed64 :+= 308,
      _.repeatedSfixed32 :+= 309,
      _.repeatedSfixed64 :+= 310,
      _.repeatedFloat :+= 311,
      _.repeatedDouble :+= 312,
      _.repeatedBool :+= false,
      _.repeatedString :+= "315",
      _.repeatedBytes :+= toBytes("316"),
      _.repeatedNestedMessage :+= TestAllTypes.NestedMessage(bb = Some(318)),
      _.repeatedForeignMessage :+= ForeignMessage(c = Some(319)),
      _.repeatedImportMessage :+= ImportMessage(d = Some(320)),
      _.repeatedLazyMessage :+= TestAllTypes.NestedMessage(bb = Some(327)),
      _.repeatedNestedEnum :+= TestAllTypes.NestedEnum.BAZ,
      _.repeatedForeignEnum :+= ForeignEnum.FOREIGN_BAZ,
      _.repeatedImportEnum :+= ImportEnum.IMPORT_BAZ,
      _.repeatedStringPiece :+= "324",
      _.repeatedCord :+= "325",

      // -----------------------------------------------------------------

      _.defaultInt32       := 401,
      _.defaultInt64       := 402,
      _.defaultUint32      := 403,
      _.defaultUint64      := 404,
      _.defaultSint32      := 405,
      _.defaultSint64      := 406,
      _.defaultFixed32     := 407,
      _.defaultFixed64     := 408,
      _.defaultSfixed32    := 409,
      _.defaultSfixed64    := 410,
      _.defaultFloat       := 411,
      _.defaultDouble      := 412,
      _.defaultBool        := false,
      _.defaultString      := "415",
      _.defaultBytes       := toBytes("416"),
      _.defaultNestedEnum  := TestAllTypes.NestedEnum.FOO,
      _.defaultForeignEnum := ForeignEnum.FOREIGN_FOO,
      _.defaultImportEnum  := ImportEnum.IMPORT_FOO,
      _.defaultStringPiece := "424",
      _.defaultCord        := "425",
      _.oneofUint32        := 601,
      _.oneofNestedMessage := TestAllTypes.NestedMessage(bb = Some(602)),
      _.oneofString        := "603",
      _.oneofBytes         := toBytes("604")
    )
  }
}


text:
package com.lachesis.mnis.core.workload.repository;

import java.util.HashMap;
import java.util.List;

import com.lachesis.mnis.core.workload.entity.WorkLoadInfo;
import com.lachesis.mnis.core.workload.entity.WorkLoadType;

public interface WorkLoadRepository {
	/**
	 * 获取--当天--大类统计
	 * @param params
	 * @return
	 */
	List<WorkLoadInfo> getTodayWorkLoadInfosByNurse(HashMap<String, Object> params);
	/**
	 * 获取--当天以前--大类统计
	 * @param params
	 * @return
	 */
	List<WorkLoadInfo> getPreTodayWorkLoadInfosByNurse(HashMap<String, Object> params);
	/**
	 * 获取--当天和当天一起--大类统计
	 * @param params
	 * @return
	 */
	List<WorkLoadInfo> getWorkLoadInfosByNurse(HashMap<String, Object> params);
	/**
	 * 获取--当天--小类统计
	 * @param params
	 * @return
	 */
	List<WorkLoadInfo> getTodayWorkLoadInfosByNurseType(HashMap<String, Object> params);
	/**
	 * 获取--当天以前--小类统计
	 * @param params
	 * @return
	 */
	List<WorkLoadInfo> getPreTodayWorkLoadInfosByNurseType(HashMap<String, Object> params);
	/**
	 * 获取--当天和当天以前--小类统计
	 * @param params
	 * @return
	 */
	List<WorkLoadInfo> getWorkLoadInfosByNurseType(HashMap<String, Object> params);

	/**
	 * 获取父级统计类型
	 * @return
	 */
	List<WorkLoadType> getTopWorkLoadTypes();

	/**
	 * 获取子级统计类型
	 * @param parentType
	 * @return
	 */
	List<WorkLoadType> getChildrenWorkLoadTypes(String parentType);
}


text:
/*
  ==============================================================================

    playerMessage.h
    Created: 9 Apr 2015 1:40:20pm
    Author:  yvan

  ==============================================================================
*/

#ifndef PLAYERMESSAGE_H_INCLUDED
#define PLAYERMESSAGE_H_INCLUDED

#include "player.hpp"
#include "../headers/types.hpp"

namespace YSE {
  namespace PLAYER {

    /*
    Message objects are used to send messages from interface to implementation. In this
    case, a message will be sent from a channelInterfaceObject to a
    channelImplementationObject. They are a way to ensure threadsafe and lockfree communication
    between the two.
    */
    class messageObject {
    public:
      /** The ID of a message defines how it will be stored in the implementation
      */
      MESSAGE ID;

      /** The data is stored in a union, so to not use more data as needed. Other types
      could be added to this union if needed, but they should not exeed the current
      length (Flt[3]). (Doing so won't be unsafe, but it will affect every message
      used in by all subSystems. So don't.)
      */
      union {
        Bool boolValue;
        Int intValue;
        UInt uIntValue;
        Flt floatValue;
        Flt floatPair[2]; // linear interpolation, 0 = target value, 1 = time
        struct {
          void * ptr;
          Flt time;
        } object;
      };
    };

  }
}

#endif  // PLAYERMESSAGE_H_INCLUDED


text:
--TEST--
Bug #20175 (Static vars can't store ref to new instance)
--SKIPIF--
<?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip ZE1 does not have static class members'); ?>
--INI--
error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
print zend_version()."\n";

/* Part 1:
 * Storing the result of a function in a static variable.
 * foo_global() increments global variable $foo_count whenever it is executed.
 * When foo_static() is called it checks for the static variable $foo_value
 * being initialised. In case initialisation is necessary foo_global() will be
 * called. Since that must happen only once the return value should be equal.
 */
$foo_count = 0;

function foo_global() {
	global $foo_count;
	echo "foo_global()\n";
	return 'foo:' . ++$foo_count;
}

function foo_static() {
	static $foo_value;
	echo "foo_static()\n";
	if (!isset($foo_value)) {
		$foo_value = foo_global();
	}
	return $foo_value;
}

/* Part 2:
 * Storing a reference to the result of a function in a static variable.
 * Same as Part 1 but:
 * The return statment transports a copy of the value to return. In other
 * words the return value of bar_global() is a temporary variable only valid
 * after the function call bar_global() is done in current local scope.
 */
$bar_count = 0;

function bar_global() {
	global $bar_count;
	echo "bar_global()\n";
	return 'bar:' . ++$bar_count;
}

function bar_static() {
	static $bar_value;
	echo "bar_static()\n";
	if (!isset($bar_value)) {
		$bar_value = &bar_global();
	}
	return $bar_value;
}

/* Part 3: TO BE DISCUSSED
 *
 * Storing a reference to the result of a function in a static variable.
 * Same as Part 2 but wow_global() returns a reference so $wow_value
 * should store a reference to $wow_global. Therefor $wow_value is already
 * initialised in second call to wow_static() and hence shouldn't call
 * wow_global() again.
 */ /*
$wow_count = 0;
$wow_name = '';

function &wow_global() {
	global $wow_count, $wow_name;
	echo "wow_global()\n";
	$wow_name = 'wow:' . ++$wow_count;
	return $wow_name;
}

function wow_static() {
	static $wow_value;
	echo "wow_static()\n";
	if (!isset($wow_value)) {
		$wow_value = &wow_global();
	}
	return $wow_value;
}*/

/* Part 4:
 * Storing a reference to a new instance (that's where the name of the  test
 * comes from). First there is the global counter $oop_global again which
 * counts the calls to the constructor of oop_class and hence counts the
 * creation of oop_class instances.
 * The class oop_test uses a static reference to a oop_class instance.
 * When another oop_test instance is created it must reuse the statically
 * stored reference oop_value. This way oop_class gets some singleton behavior
 * since it will be created only once for all insatnces of oop_test.
 */
$oop_global = 0;
class oop_class {
	var $oop_name;

	function oop_class() {
		global $oop_global;
		echo "oop_class()\n";
		$this->oop_name = 'oop:' . ++$oop_global;
	}
}

class oop_test {
	static $oop_value;

	function oop_test() {
		echo "oop_test()\n";
	}

	function oop_static() {
		echo "oop_static()\n";
		if (!isset(self::$oop_value)) {
			self::$oop_value = & new oop_class;
		}
		echo self::$oop_value->oop_name;
	}
}

print foo_static()."\n";
print foo_static()."\n";
print bar_static()."\n";
print bar_static()."\n";
//print wow_static()."\n";
//print wow_static()."\n";
echo "wow_static()
wow_global()
wow:1
wow_static()
wow:1
";
$oop_tester = new oop_test;
print $oop_tester->oop_static()."\n";
print $oop_tester->oop_static()."\n";
$oop_tester = new oop_test; // repeated.
print $oop_tester->oop_static()."\n";
?>
--EXPECTF--
Deprecated: Assigning the return value of new by reference is deprecated in %s.php on line %d
%s
foo_static()
foo_global()
foo:1
foo_static()
foo:1
bar_static()
bar_global()

Strict Standards: Only variables should be assigned by reference in %sbug20175.php on line 47
bar:1
bar_static()
bar:1
wow_static()
wow_global()
wow:1
wow_static()
wow:1
oop_test()
oop_static()
oop_class()
oop:1
oop_static()
oop:1
oop_test()
oop_static()
oop:1


text:
package com.thoughtworks.go.config.elastic;

import com.thoughtworks.go.config.ConfigCollection;
import com.thoughtworks.go.config.ConfigTag;
import com.thoughtworks.go.config.PluginProfiles;
import com.thoughtworks.go.config.Validatable;

import java.util.Arrays;

@ConfigTag("clusterProfiles")
@ConfigCollection(ClusterProfile.class)
public class ClusterProfiles extends PluginProfiles<ClusterProfile> implements Validatable {

    public ClusterProfiles() {
    }

    public ClusterProfiles(ClusterProfile... clusters) {
        super(Arrays.asList(clusters));
    }

}


text:
FROM python:latest

RUN apt-get update && apt-get install git

RUN mkdir /services
WORKDIR /services

RUN pip install networkx

# TODO: replace with the new cxmate SDK.
RUN git clone https://github.com/keiono/cxmate-py.git
WORKDIR /services/cxmate-py
RUN git checkout 3-support

RUN python setup.py install

WORKDIR /services

COPY GraphGeneratorService.py ./
COPY RandomGraphGeneratorService.py ./

EXPOSE 8080
CMD ["python", "./RandomGraphGeneratorService.py"]


text:
package org.grobid.core.utilities;

import org.apache.commons.lang3.StringUtils;
import org.grobid.core.GrobidModel;
import org.grobid.core.GrobidModels;
import org.grobid.core.exceptions.GrobidPropertyException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class GrobidPropertiesTest {
    @Before
    public void setUp() {
        GrobidProperties.getInstance();
    }

    @After
    public void tearDown() throws Exception {
        GrobidProperties.reset();
    }

    @Test(expected = GrobidPropertyException.class)
    public void testSet_GROBID_HOME_PATH_NullPath_shouldThrowException() {
        GrobidProperties.set_GROBID_HOME_PATH(null);
    }

    @Test(expected = GrobidPropertyException.class)
    public void testSet_GROBID_HOME_PATH_FileNotExisting_shouldThrowException() {
        GrobidProperties.set_GROBID_HOME_PATH("/NotExistingPath");
    }

    @Test(expected = GrobidPropertyException.class)
    public void testSetGrobidProperties_NullPath_shouldThrowException() {
        GrobidProperties.setGrobidPropertiesPath(null);
    }

    @Test(expected = GrobidPropertyException.class)
    public void testSetGrobidProperties_PathFileNotExisting() {
        GrobidProperties.setGrobidPropertiesPath("/NotExistingPath");
    }

    @Test(expected = GrobidPropertyException.class)
    public void testLoadGrobidProperties_PathNoContext_shouldThrowException() throws Exception {
        GrobidProperties.reset();
        GrobidProperties.loadGrobidPropertiesPath();
    }

    @Test
    public void testNativeLibraryPath() throws IOException {
//        File expectedFile = new File(MockContext.GROBID_HOME_PATH
//                + File.separator + "/lib");
        assertNotNull(GrobidProperties
                .getNativeLibraryPath().getCanonicalFile());
    }

    @Test(expected = GrobidPropertyException.class)
    public void testCheckPropertiesException_shouldThrowException() {
        GrobidProperties.getProps().put(
                GrobidPropertyKeys.PROP_3RD_PARTY_PDFTOXML, "");
        GrobidProperties.checkProperties();
    }

    @Test
    public void testGetTempPath() {
        assertEquals("The value of temp dir doesn't match the one expected",
                GrobidProperties
                        .getPropertyValue(GrobidPropertyKeys.PROP_TMP_PATH),
                GrobidProperties.getTempPath().getAbsolutePath());
    }

    @Test
    public void testgetsetNativeLibraryPath() {
        String value = "value";
        GrobidProperties.setNativeLibraryPath(value);
        assertEquals("The property has not the value expected", value,
                GrobidProperties.getNativeLibraryPath().getPath());
    }

    @Test
    public void testsetgetProxyHost() {
        String value = "host";
        GrobidProperties.setProxyHost(value);
        assertEquals("The property has not the value expected", value,
                GrobidProperties.getProxyHost());
    }

    @Test
    public void testsetgetProxyPort() {
        String value = "1";
        GrobidProperties.setProxyPort(value);
        assertEquals("The property has not the value expected", value,
                GrobidProperties.getProxyPort().toString());
    }

    @Test
    public void testsetgetNBThreads() {
        String value = "1";
        GrobidProperties.setNBThreads(value);
        assertEquals("The property has not the value expected", value,
                GrobidProperties.getNBThreads().toString());
    }

    @Test
    public void testgetNBThreadsShouldReturnAvailableProcessorsIfZero() {
        String value = "0";
        GrobidProperties.setNBThreads(value);
        assertEquals("The property has not the value expected",
                String.valueOf(Runtime.getRuntime().availableProcessors()),
                GrobidProperties.getNBThreads().toString());
        assertTrue("The property is not greater than zero",
            GrobidProperties.getNBThreads().intValue() > 0);
    }

    @Test
    public void testsetisUseLanguageId() {
        String value = "true";
        GrobidProperties.setUseLanguageId(value);
        assertTrue("The property has not the value expected",
                GrobidProperties.isUseLanguageId());
    }

    @Test
    public void testsetisResourcesInHome() {
        String value = "true";
        GrobidProperties.setResourcesInHome(value);
        assertTrue("The property has not the value expected",
                GrobidProperties.isResourcesInHome());
    }

    //@Test
    public void testGetModelPath() {
        GrobidModels value = GrobidModels.DATE;
        assertEquals("The property has not the value expected",
                new File(GrobidProperties.get_GROBID_HOME_PATH(),
                        GrobidProperties.FOLDER_NAME_MODELS + File.separator
                                + value.getFolderName() + File.separator
                                + GrobidProperties.FILE_NAME_MODEL),
                GrobidProperties.getModelPath(value));
    }

    //@Test
    public void testgetTemplatePath() {
        GrobidModels value = GrobidModels.DATE;
        assertEquals(
                "The property has not the value expected",
                new File(GrobidProperties.get_GROBID_HOME_PATH(), "dataset/"
                        + value.getFolderName() + "/crfpp-templates/"
                        + value.getTemplateName()),
                GrobidProperties.getTemplatePath(
                        GrobidProperties.get_GROBID_HOME_PATH(), value));
    }

    //@Test
    public void testgetEvalCorpusPath() {
        GrobidModels value = GrobidModels.DATE;
        assertEquals(
                "The property has not the value expected",
                new File(GrobidProperties.get_GROBID_HOME_PATH(), "dataset/"
                        + value.getFolderName() + "/evaluation/"),
                GrobidProperties.getEvalCorpusPath(
                        GrobidProperties.get_GROBID_HOME_PATH(), value));
    }

    //@Test
    public void testgetCorpusPath() {
        GrobidModel value = GrobidModels.DATE;
        assertEquals(
                "The property has not the value expected",
                new File(GrobidProperties.get_GROBID_HOME_PATH(), "dataset/"
                        + value.getFolderName() + "/corpus"),
                GrobidProperties.getCorpusPath(
                        GrobidProperties.get_GROBID_HOME_PATH(), value));
    }

    //@Test
    public void testgetLexiconPath() {
        assertEquals("The property has not the value expected",
                new File(GrobidProperties.get_GROBID_HOME_PATH(), "lexicon")
                        .getAbsolutePath(), GrobidProperties.getLexiconPath());
    }

    @Test(expected = GrobidPropertyException.class)
    public void testgetLanguageDetectorFactory_shouldThrowException() {
        GrobidProperties.setUseLanguageId("true");
        GrobidProperties.getProps().put(
                GrobidPropertyKeys.PROP_LANG_DETECTOR_FACTORY, "");
        GrobidProperties.getLanguageDetectorFactory();
    }

    @Test(expected = GrobidPropertyException.class)
    public void testgetLanguageDetectorFactory2_shouldThrowException() {
        GrobidProperties.getProps().put(
                GrobidPropertyKeys.PROP_LANG_DETECTOR_FACTORY, "");
        GrobidProperties.setUseLanguageId("true");
        GrobidProperties.getLanguageDetectorFactory();
    }

    @Test
    public void testgetLanguageDetectorFactory() {
        GrobidProperties.setUseLanguageId("false");
        assertEquals("The property has not the value expected",
                "org.grobid.core.lang.impl.CybozuLanguageDetectorFactory",
                GrobidProperties.getLanguageDetectorFactory());
    }

    @Test
    public void testgetPdf2XMLPath() throws Exception {
        assertNotNull("The property has not the value expected", GrobidProperties
                .getPdfToXMLPath().getAbsolutePath());
    }

    @Test(expected = GrobidPropertyException.class)
    public void testloadPdf2XMLPath_shouldThrowException() {
        GrobidProperties.getProps().put(
                GrobidPropertyKeys.PROP_3RD_PARTY_PDFTOXML, "/notExistingPath");
        GrobidProperties
                .getPropertyValue(GrobidPropertyKeys.PROP_3RD_PARTY_PDFTOXML);
        GrobidProperties.loadPdf2XMLPath();
    }

    @Test(expected = GrobidPropertyException.class)
    public void testinitException2_shouldThrowException() {
        GrobidProperties.GROBID_PROPERTY_PATH = new File(StringUtils.EMPTY);
        GrobidProperties.getNewInstance();
    }

    @Test
    public void testLoadGrobidPropertiesPath() throws Exception {
        GrobidProperties.GROBID_PROPERTY_PATH = null;
        GrobidProperties.loadGrobidPropertiesPath();
        assertNotNull("The property has not the value expected",
                GrobidProperties.getGrobidPropertiesPath().getAbsolutePath());
    }

    @Test
    public void testGetInstance() throws Exception {
        GrobidProperties.reset();
        GrobidProperties.getInstance();
        // test the resue of the instance created previously
        GrobidProperties.reset();
        assertTrue("GrobidProperties.getInstance() does not return an instance of GrobidProperties",
                GrobidProperties.getInstance() != null);
    }

}


text:
include github.com/msales/make/golang

# Run all benchmarks
bench:
	@go test -bench=. $(shell go list ./... | grep -v /vendor/)
.PHONY: bench

# Build the docker image
docker:
	docker build -t kage .
.PHONY: docker

# Read data from Kafka
producer:
	for x in {1..100}; do echo PING; sleep 0.1; done | \
	docker-compose exec -T kafka \
		kafka-console-producer.sh \
        --broker-list localhost:9092 \
		--topic=test
.PHONY: producer

# Produce data to Kafka
consumer:
	@docker-compose exec -T kafka \
		kafka-console-consumer.sh \
		--bootstrap-server localhost:9092 \
		--topic=test
.PHONY: consumer


text:
package website.automate.teamcity.server.io.model;

import com.thoughtworks.xstream.annotations.XStreamAlias;

@XStreamAlias("scenario")
public class ScenarioSerializable extends AbstractSerializable {

    private static final long serialVersionUID = 1488221815086152013L;

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}


text:
using System;
using Twilio;
using Twilio.Rest.Chat.V2.Service.Channel;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        const string serviceSid = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string channelSid = "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string messageSid = "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        // Retrieve a message
        var message = MessageResource.Fetch(serviceSid, channelSid, messageSid);
        Console.WriteLine(message.Body);
    }
}


text:
 1. First list

 1. First list

 1. Second list

 1. Second list

    Part of the list

 1. Second list

 1. Second list

    Code block


text:
local aSettings = {
	File = nil,
	Cache = {}
}

serverCachedSettings = {}

function sendAllSettingsToClient()
	triggerClientEvent(player, 'onAcpClientSettingsChanged', resourceRoot, aSettings.Cache )
end

---------------------------------------------------------
-- Change from client
---------------------------------------------------------
addEvent( "onAcpSettingsChange", true )
addEventHandler( "onAcpSettingsChange", resourceRoot,
	function( name, value )
		if not isPlayerAllowedHere(client) then return false end
		setPanelSetting( name, value )
	end
)

---------------------------------------------------------
-- getPanelSetting
---------------------------------------------------------
function getPanelSetting(name)
	return aSettings.Cache[name]
end

---------------------------------------------------------
-- setPanelSetting
---------------------------------------------------------
function setPanelSetting(name, value)
	name = tostring ( name )
	value = tostring ( value )
	aSettings.Cache[name] = value
	local node = xmlFindChild ( aSettings.File, name, 0 )
	if ( not node ) then
		node = xmlCreateChild ( aSettings.File, name )
	end
	xmlNodeSetValue ( node, tostring ( value ) )
	startDelayedSave()

	local minclientconfig_type = getPanelSetting("minclientconfig.type")
	-- If name is "lastFetchedLatestVersion" and minclientconfig.type is "latest"
	--		Then set minclientversion
	-- If name is "lastFetchedReleaseVersion" and minclientconfig.type is "release"
	--		Then set minclientversion
	-- If name is "minclientconfig.customText" and minclientconfig.type is "custom"
	--		Then set minclientversion
	if
		( name == "lastFetchedLatestVersion" and minclientconfig_type == "latest" )
		or
		( name == "lastFetchedReleaseVersion" and minclientconfig_type == "release" )
		or
		( name == "minclientconfig.customText" and minclientconfig_type == "custom" )
	then
		--outputDebug("Setting minclientversion to " .. value )
		setServerConfigSetting( "minclientversion", value, true )
	end

	if name == "minclientconfig.type" or name == "blockmods.type" then

		if minclientconfig_type == "latest" then
			setServerConfigSetting( "minclientversion", getPanelSetting("lastFetchedLatestVersion"), true )
		end

		if minclientconfig_type == "release" then
			setServerConfigSetting( "minclientversion", getPanelSetting("lastFetchedReleaseVersion"), true )
		end

		if minclientconfig_type == "custom" then
			setServerConfigSetting( "minclientversion", getPanelSetting("minclientconfig.customText"), true )
		end

		if minclientconfig_type == "none" then
			setServerConfigSetting( "minclientversion", "", true )
		end

	end
--[[
	if name == "minclientconfig.type" and minclientconfig_type == "latest" then
		setServerConfigSetting( "minclientversion", getPanelSetting("lastFetchedLatestVersion"), true )
	end

	if name == "minclientconfig.type" and minclientconfig_type == "release" then
		setServerConfigSetting( "minclientversion", getPanelSetting("lastFetchedReleaseVersion"), true )
	end

	if name == "minclientconfig.type" and minclientconfig_type == "custom" then
		setServerConfigSetting( "minclientversion", getPanelSetting("minclientconfig.customText"), true )
	end

	if name == "minclientconfig.type" and minclientconfig_type == "none" then
		setServerConfigSetting( "minclientversion", "", true )
	end

	if name == "blockmods.type" and minclientconfig_type == "none" then
		setServerConfigSetting( "minclientversion", "", true )
	end
--]]
end

---------------------------------------------------------
-- Enforce min client override
---------------------------------------------------------
_setServerConfigSetting = setServerConfigSetting
function setServerConfigSetting( name, value, save )
	if name == "minclientversion" then
		local type = getPanelSetting( "blockmods.type" )
		if type and type ~= "none" then
			if value < MIN_CLIENT_VERSION_FOR_MOD_BLOCKS then
				--outputDebug("Enforcing minclientversion from " .. value .. " to " .. MIN_CLIENT_VERSION_FOR_MOD_BLOCKS )
				value = MIN_CLIENT_VERSION_FOR_MOD_BLOCKS
			end
		end
	end
	_setServerConfigSetting( name, value, save )
	--outputDebug("setServerConfigSetting( " .. name .. ", " .. value .. ", " .. tostring(save) )
end

---------------------------------------------------------
-- Save settings in 2 seconds
---------------------------------------------------------
function startDelayedSave()
	if isTimer(saveTimer) then
		killTimer(saveTimer)
		saveTimer = nil
	end
	saveTimer = setTimer( doSave, 2000, 1 )
end

---------------------------------------------------------
-- Make sure we save on exit
---------------------------------------------------------
addEventHandler ( "onResourceStop", resourceRoot,
	function ()
		doSave()
		xmlUnloadFile( aSettings.File )
	end
)

---------------------------------------------------------
-- Set default if name not set
---------------------------------------------------------
function maybeSetDefault( name, value )
	if aSettings.Cache[name] == nil then
		aSettings.Cache[name] = value
	end
end

---------------------------------------------------------
-- Actually do load
---------------------------------------------------------
function doLoad()
	aSettings.File = xmlLoadFile( "settings.xml" )
	if ( not aSettings.File ) then
		aSettings.File = xmlCreateFile( "settings.xml", "main" )
		xmlSaveFile( aSettings.File )
	end
	local messageNodes = xmlNodeGetChildren( aSettings.File )
    for _,node in ipairs( messageNodes ) do
		local name = xmlNodeGetName( node )
        local value = xmlNodeGetValue( node )
		aSettings.Cache[name] = value
    end
	-- Defaults
	maybeSetDefault( "blockmods.type", "none" )
	maybeSetDefault( "blockmods.customText", "Enter your matches" )
	maybeSetDefault( "lastFetchedReleaseVersion", "1.3.2" )
	maybeSetDefault( "lastFetchedLatestVersion", "1.3.2" )

	local minclientversion = getServerConfigSetting("minclientversion")
	if minclientversion == "" then
		maybeSetDefault( "minclientconfig.type", "none" )
		maybeSetDefault( "minclientconfig.customText", "1.3.2-9.01234" )
	else
		maybeSetDefault( "minclientconfig.type", "custom" )
		maybeSetDefault( "minclientconfig.customText", minclientversion )
	end
	GetVersInfoFromRemoteServer()
end

---------------------------------------------------------
-- Actually do save
---------------------------------------------------------
function doSave()
	if isTimer(saveTimer) then
		killTimer(saveTimer)
		saveTimer = nil
	end
	xmlSaveFile ( aSettings.File )
end

---------------------------------------------------------
-- Get version data from remote server
---------------------------------------------------------
function GetVersInfoFromRemoteServer()
	fetchRemote( "http://nightly.mtasa.com/ver/", onGotVersInfo )
end

function onGotVersInfo( responseData, errno )
	if errno == 0 then

		local ver = string.sub( getVersion().sortable, 0, 3 )

-- ## REMOVE ME ##
--outputChatBox("## REMOVE ME ##")
--if ver=="1.4" then
--	ver="1.3"
--end

		releaseMinVersion = string.match( responseData, "default: " ..ver .. ".(.-)[^0-9.-]" )
		latestMinVersion = string.match( responseData, "minclientversion: " .. ver .. ".(.-)[^0-9.-]" )

		if releaseMinVersion and latestMinVersion then
			releaseMinVersion = ver .. "." .. releaseMinVersion
			latestMinVersion = ver .. "." .. latestMinVersion

			if isValidVersionString(releaseMinVersion) and isValidVersionString(releaseMinVersion) then
				setPanelSetting( "lastFetchedReleaseVersion", releaseMinVersion )
				setPanelSetting( "lastFetchedLatestVersion", latestMinVersion )
				sendAllSettingsToClient()
				--outputDebug("valid version datas")
			end
		end
	end
	GetAcPanelVersInfoFromRemoteServer()
end

function isValidVersionString( text )
	return string.match(text, "%d%.%d%.%d%-%d%.%d%d%d%d%d%.%d") ~= nil
end

---------------------------------------------------------
-- Get version info about this resource
---------------------------------------------------------
function GetAcPanelVersInfoFromRemoteServer()
	fetchRemote( "http://nightly.mtasa.com/ver/acpanel/", onGotAcPanelVersInfo )
end

function onGotAcPanelVersInfo( responseData, errno )
	if errno == 0 then

		acpanelVersion = string.match( responseData, "acpanel ver:(.-)[^0-9.-]" )
		acpanelUrl = string.match( responseData, "acpanel url:(.-)[^A-z0-9.-:/?=&]" )
		--outputDebug("acpanelVersion:" .. acpanelVersion)
		--outputDebug("acpanelUrl:" .. acpanelUrl)
		if acpanelVersion and acpanelUrl then
			setPanelSetting( "acpanelVersion", acpanelVersion )
			setPanelSetting( "acpanelUrl", acpanelUrl )
			if acpanelVersion > _version then
				outputChatBox("New version of Anti-Cheat panel is available!")
			end
		end
	end
end

doLoad()	-- Load during resource startup


text:
package com.github.ingarabr.mi.mapper;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableMap;

import com.google.common.io.Resources;
import org.junit.Test;

public class CodahaleMetricV3MapperTest {

    private CodahaleMetricV3Mapper mapper = new CodahaleMetricV3Mapper();

    @Test
    public void shouldMapToCustomFormat() throws Exception {
        String metric = getResourceAsString();

        List<String> map = mapper.map(metric, ImmutableMap.of("host", "localhost"));

        assertThat(map.get(0), not(containsString("gauges\":{\"gc.PS-MarkSweep.count\"")));
        assertThat(map.get(0), containsString("\"name\":\"gc.PS-MarkSweep.count\""));
    }

    @Test(expected = RuntimeException.class)
    public void shouldCastExceptionIfTheVersionIsWrong() throws Exception {
        mapper.map("{\"version\": \"2.0.0\"}", ImmutableMap.of("host", "localhost"));
    }

    private String getResourceAsString() throws IOException {
        URL resource = Resources.getResource("codahale_metric_v3.json");
        return Resources.toString(resource, Charsets.UTF_8);
    }

}


text:
package org.apache.flink.runtime.state.heap;

import org.apache.flink.api.common.functions.AggregateFunction;
import org.apache.flink.api.common.state.AggregatingState;
import org.apache.flink.api.common.state.AggregatingStateDescriptor;
import org.apache.flink.api.common.state.State;
import org.apache.flink.api.common.state.StateDescriptor;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.runtime.state.StateTransformationFunction;
import org.apache.flink.runtime.state.internal.InternalAggregatingState;
import org.apache.flink.util.Preconditions;

import java.io.IOException;

/**
 * Heap-backed partitioned {@link AggregatingState} that is
 * snapshotted into files.
 *
 * @param <K> The type of the key.
 * @param <N> The type of the namespace.
 * @param <IN> The type of the value added to the state.
 * @param <ACC> The type of the value stored in the state (the accumulator type).
 * @param <OUT> The type of the value returned from the state.
 */
class HeapAggregatingState<K, N, IN, ACC, OUT>
	extends AbstractHeapMergingState<K, N, IN, ACC, OUT>
	implements InternalAggregatingState<K, N, IN, ACC, OUT> {
	private final AggregateTransformation<IN, ACC, OUT> aggregateTransformation;

	/**
	 * Creates a new key/value state for the given hash map of key/value pairs.
	 *
	 * @param stateTable The state table for which this state is associated to.
	 * @param keySerializer The serializer for the keys.
	 * @param valueSerializer The serializer for the state.
	 * @param namespaceSerializer The serializer for the namespace.
	 * @param defaultValue The default value for the state.
	 * @param aggregateFunction The aggregating function used for aggregating state.
	 */
	private HeapAggregatingState(
		StateTable<K, N, ACC> stateTable,
		TypeSerializer<K> keySerializer,
		TypeSerializer<ACC> valueSerializer,
		TypeSerializer<N> namespaceSerializer,
		ACC defaultValue,
		AggregateFunction<IN, ACC, OUT> aggregateFunction) {

		super(stateTable, keySerializer, valueSerializer, namespaceSerializer, defaultValue);
		this.aggregateTransformation = new AggregateTransformation<>(aggregateFunction);
	}

	@Override
	public TypeSerializer<K> getKeySerializer() {
		return keySerializer;
	}

	@Override
	public TypeSerializer<N> getNamespaceSerializer() {
		return namespaceSerializer;
	}

	@Override
	public TypeSerializer<ACC> getValueSerializer() {
		return valueSerializer;
	}

	// ------------------------------------------------------------------------
	//  state access
	// ------------------------------------------------------------------------

	@Override
	public OUT get() {
		ACC accumulator = getInternal();
		return accumulator != null ? aggregateTransformation.aggFunction.getResult(accumulator) : null;
	}

	@Override
	public void add(IN value) throws IOException {
		final N namespace = currentNamespace;

		if (value == null) {
			clear();
			return;
		}

		try {
			stateTable.transform(namespace, value, aggregateTransformation);
		} catch (Exception e) {
			throw new IOException("Exception while applying AggregateFunction in aggregating state", e);
		}
	}

	// ------------------------------------------------------------------------
	//  state merging
	// ------------------------------------------------------------------------

	@Override
	protected ACC mergeState(ACC a, ACC b) {
		return aggregateTransformation.aggFunction.merge(a, b);
	}

	static final class AggregateTransformation<IN, ACC, OUT> implements StateTransformationFunction<ACC, IN> {

		private final AggregateFunction<IN, ACC, OUT> aggFunction;

		AggregateTransformation(AggregateFunction<IN, ACC, OUT> aggFunction) {
			this.aggFunction = Preconditions.checkNotNull(aggFunction);
		}

		@Override
		public ACC apply(ACC accumulator, IN value) {
			if (accumulator == null) {
				accumulator = aggFunction.createAccumulator();
			}
			return aggFunction.add(value, accumulator);
		}
	}

	@SuppressWarnings("unchecked")
	static <T, K, N, SV, S extends State, IS extends S> IS create(
		StateDescriptor<S, SV> stateDesc,
		StateTable<K, N, SV> stateTable,
		TypeSerializer<K> keySerializer) {
		return (IS) new HeapAggregatingState<>(
			stateTable,
			keySerializer,
			stateTable.getStateSerializer(),
			stateTable.getNamespaceSerializer(),
			stateDesc.getDefaultValue(),
			((AggregatingStateDescriptor<T, SV, ?>) stateDesc).getAggregateFunction());
	}
}