text:
function ComplexSchemaController (avsc, SCHEMA_TYPES, $scope, uuid, $timeout, SchemaHelper) {
  'ngInject';
  var vm = this;

  vm.SCHEMA_TYPES = SCHEMA_TYPES.types;

  vm.parsedSchema = [];
  let recordName;
  let timeout;
  let addFieldTimeout;
  vm.emptySchema = false;

  vm.addField = (index) => {
    let placement = index === undefined ? 0 : index + 1;
    let newField = {
      name: '',
      type: 'string',
      displayType: 'string',
      nullable: false,
      id: uuid.v4(),
      nested: false
    };

    vm.parsedSchema.splice(placement, 0, newField);

    vm.formatOutput();

    $timeout.cancel(addFieldTimeout);
    addFieldTimeout = $timeout(() => {
      let elem = document.getElementById(newField.id);
      angular.element(elem)[0].focus();
    });
  };

  vm.removeField = (index) => {
    vm.parsedSchema.splice(index, 1);
    if (vm.parsedSchema.length === 0) {
      vm.addField();
    }

    vm.formatOutput();
  };

  vm.changeType = (field) => {
    if (SCHEMA_TYPES.simpleTypes.indexOf(field.displayType) !== -1) {
      field.type = field.displayType;
      vm.formatOutput();
    } else {
      field.type = null;
    }

    field.nested = SchemaHelper.checkComplexType(field.displayType);
  };

  function init(strJson) {
    const isEmptySchema = (schemaJson) => {
      if (!schemaJson) {
        return true;
      }
      // we need to check if schemaJson has fields or is already returned by avsc parser in which case the fields will be
      // accessed using getFields() function.
      if (angular.isObject(schemaJson) && !(schemaJson.fields || ( schemaJson.getFields && schemaJson.getFields()) || []).length) {
        return true;
      }
      return false;
    };
    if ((!strJson || strJson === 'record') && !vm.isDisabled) {
      vm.addField();
      recordName = vm.recordName || 'a' + uuid.v4().split('-').join('');
      vm.formatOutput();
      return;
    }
    if (isEmptySchema(strJson) && vm.isDisabled) {
      vm.emptySchema = true;
      return;
    }
    let parsed = avsc.parse(strJson, { wrapUnions: true });
    recordName = vm.recordName || parsed._name;

    vm.parsedSchema = parsed.getFields().map((field) => {
      let type = field.getType();

      let partialObj = SchemaHelper.parseType(type);

      return Object.assign({}, partialObj, {
        id: uuid.v4(),
        name: field.getName()
      });

    });

    if (!vm.isDisabled && vm.parsedSchema.length === 0) {
      vm.addField();
      return;
    }

    vm.formatOutput();
  }

  vm.formatOutput = () => {
    vm.error = '';

    let outputFields = vm.parsedSchema.filter((field) => {
      return field.name && field.type ? true : false;
    }).map( (field) => {
      let obj = {
        name: field.name,
        type: field.nullable ? [field.type, 'null'] : field.type
      };
      return obj;
    });

    if (outputFields.length > 0) {
      let obj = {
        type: 'record',
        name: recordName || 'a' + uuid.v4().split('-').join(''),
        fields: outputFields
      };

      // Validate
      try {
        avsc.parse(obj);
      } catch (e) {
        let err = '' + e;
        err = err.split(':');
        vm.error = err[0] + ': ' + err[1];
        return;
      }

      if (!vm.error) {
        vm.model = obj;
      }
    } else {
      vm.model = '';
    }

    if (typeof vm.parentFormatOutput === 'function') {
      timeout = $timeout(vm.parentFormatOutput);
    }
  };

  init(vm.model);

  $scope.$on('$destroy', () => {
    $timeout.cancel(timeout);
    $timeout.cancel(addFieldTimeout);
  });

}

angular.module(PKG.name+'.commons')
.directive('myComplexSchema', function () {
  return {
    restrict: 'E',
    templateUrl: 'complex-schema/complex-schema.html',
    controller: ComplexSchemaController,
    controllerAs: 'ComplexSchema',
    bindToController: true,
    scope: {
      model: '=ngModel',
      recordName: '=',
      hideHeader: '=',
      parentFormatOutput: '&',
      isDisabled: '=',
      schemaPrefix: '='
    }
  };
})
.directive('myRecordSchema', function ($compile) {
  return {
    restrict: 'E',
    replace: true,
    scope: {
      model: '=ngModel',
      recordName: '=',
      parentFormatOutput: '&',
      isDisabled: '=',
      schemaPrefix: '='
    },
    link: (scope, element) => {
      let elemString = `<my-complex-schema
                          ng-model="model"
                          record-name="recordName"
                          hide-header="true"
                          parent-format-output="parentFormatOutput()"
                          is-disabled="isDisabled"
                          schema-prefix="schemaPrefix"
                        </my-complex-schema>`;

      $compile(elemString)(scope, (cloned) => {
        element.append(cloned);
      });
    }
  };
});


text:
package chapter36;

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

import javax.swing.*;
import javax.swing.table.*;

import java.io.*;
import java.util.Vector;

public class ModifyTable extends JApplet {
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	// Create table column names
	private String[] columnNames = { "Country", "Capital",
			"Population in Millions", "Democracy" };

	// Create table data
	private Object[][] rowData = { { "USA", "Washington DC", 280, true },
			{ "Canada", "Ottawa", 32, true },
			{ "United Kingdom", "London", 60, true },
			{ "Germany", "Berlin", 83, true }, { "France", "Paris", 60, true },
			{ "Norway", "Oslo", 4.5, true },
			{ "India", "New Delhi", 1046, true } };

	// Create a table model
	private DefaultTableModel tableModel = new DefaultTableModel(rowData,
			columnNames);

	// Create a table
	private JTable jTable1 = new JTable(tableModel);

	// Create buttons
	private JButton jbtAddRow = new JButton("Add New Row");
	private JButton jbtAddColumn = new JButton("Add New Column");
	private JButton jbtDeleteRow = new JButton("Delete Selected Row");
	private JButton jbtDeleteColumn = new JButton("Delete Selected Column");
	private JButton jbtSave = new JButton("Save");
	private JButton jbtClear = new JButton("Clear");
	private JButton jbtRestore = new JButton("Restore");

	// Create a combo box for selection modes
	private JComboBox<?> jcboSelectionMode = new JComboBox<Object>(new String[] {
			"SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION",
			"MULTIPLE_INTERVAL_SELECTION" });

	// Create check boxes
	private JCheckBox jchkRowSelectionAllowed = new JCheckBox(
			"RowSelectionAllowed", true);
	private JCheckBox jchkColumnSelectionAllowed = new JCheckBox(
			"ColumnSelectionAllowed", false);

	public ModifyTable() {
		JPanel panel1 = new JPanel();
		panel1.setLayout(new GridLayout(2, 2));
		panel1.add(jbtAddRow);
		panel1.add(jbtAddColumn);
		panel1.add(jbtDeleteRow);
		panel1.add(jbtDeleteColumn);

		JPanel panel2 = new JPanel();
		panel2.add(jbtSave);
		panel2.add(jbtClear);
		panel2.add(jbtRestore);

		JPanel panel3 = new JPanel();
		panel3.setLayout(new BorderLayout(5, 0));
		panel3.add(new JLabel("Selection Mode"), BorderLayout.WEST);
		panel3.add(jcboSelectionMode, BorderLayout.CENTER);

		JPanel panel4 = new JPanel();
		panel4.setLayout(new FlowLayout(FlowLayout.LEFT));
		panel4.add(jchkRowSelectionAllowed);
		panel4.add(jchkColumnSelectionAllowed);

		JPanel panel5 = new JPanel();
		panel5.setLayout(new GridLayout(2, 1));
		panel5.add(panel3);
		panel5.add(panel4);

		JPanel panel6 = new JPanel();
		panel6.setLayout(new BorderLayout());
		panel6.add(panel1, BorderLayout.SOUTH);
		panel6.add(panel2, BorderLayout.CENTER);

		add(panel5, BorderLayout.NORTH);
		add(new JScrollPane(jTable1), BorderLayout.CENTER);
		add(panel6, BorderLayout.SOUTH);

		// Initialize table selection mode
		jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

		jbtAddRow.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (jTable1.getSelectedRow() >= 0)
					tableModel.insertRow(jTable1.getSelectedRow(),
							new java.util.Vector());
				else
					tableModel.addRow(new java.util.Vector());
			}
		});

		jbtAddColumn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String name = JOptionPane.showInputDialog("New Column Name");
				tableModel.addColumn(name, new java.util.Vector());
			}
		});

		jbtDeleteRow.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (jTable1.getSelectedRow() >= 0)
					tableModel.removeRow(jTable1.getSelectedRow());
			}
		});

		jbtDeleteColumn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (jTable1.getSelectedColumn() >= 0) {
					TableColumnModel columnModel = jTable1.getColumnModel();
					TableColumn tableColumn = columnModel.getColumn(jTable1
							.getSelectedColumn());
					columnModel.removeColumn(tableColumn);
				}
			}
		});

		jbtSave.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					ObjectOutputStream out = new ObjectOutputStream(
							new FileOutputStream("tablemodel.dat"));
					out.writeObject(tableModel.getDataVector());
					out.writeObject(getColumnNames());
					out.close();
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			}
		});

		jbtClear.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				tableModel.setRowCount(0);
			}
		});

		jbtRestore.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					ObjectInputStream in = new ObjectInputStream(
							new FileInputStream("tablemodel.dat"));
					Vector<?> rowData = (Vector<?>) in.readObject();
					Vector<?> columnNames = (Vector<?>) in.readObject();
					tableModel.setDataVector(rowData, columnNames);
					in.close();
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			}
		});

		jchkRowSelectionAllowed.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jTable1.setRowSelectionAllowed(jchkRowSelectionAllowed
						.isSelected());
			}
		});

		jchkColumnSelectionAllowed.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jTable1.setColumnSelectionAllowed(jchkColumnSelectionAllowed
						.isSelected());
			}
		});

		jcboSelectionMode.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String selectedItem = (String) jcboSelectionMode
						.getSelectedItem();

				if (selectedItem.equals("SINGLE_SELECTION"))
					jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
				else if (selectedItem.equals("SINGLE_INTERVAL_SELECTION"))
					jTable1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
				else if (selectedItem.equals("MULTIPLE_INTERVAL_SELECTION"))
					jTable1.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
			}
		});
	}

	private Vector<String> getColumnNames() {
		Vector<String> columnNames = new Vector<String>();

		for (int i = 0; i < jTable1.getColumnCount(); i++)
			columnNames.add(jTable1.getColumnName(i));

		return columnNames;
	}

	// Main method
	public static void main(String[] args) {
		ModifyTable applet = new ModifyTable();
		JFrame frame = new JFrame();
		// EXIT_ON_CLOSE == 3
		frame.setDefaultCloseOperation(3);
		frame.setTitle("ModifyTable");
		frame.getContentPane().add(applet, java.awt.BorderLayout.CENTER);
		applet.init();
		applet.start();
		frame.setSize(400, 320);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
	}
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED
#define BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED

// Copyright Aleksey Gurtovoy 2001-2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.

// $Id$
// $Date$
// $Revision$

#include <boost/mpl/void.hpp>
#include <boost/mpl/lambda_fwd.hpp>
#include <boost/mpl/int_fwd.hpp>
#include <boost/mpl/aux_/preprocessor/params.hpp>
#include <boost/mpl/aux_/lambda_arity_param.hpp>
#include <boost/mpl/aux_/config/lambda.hpp>

#if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)

#   define BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(i, name) \
template< \
      BOOST_MPL_PP_PARAMS(i, typename T) \
    , typename Tag \
    > \
struct lambda< \
      name< BOOST_MPL_PP_PARAMS(i, T) > \
    , Tag \
    BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(int_<i>) \
    > \
{ \
    typedef false_ is_le; \
    typedef name< BOOST_MPL_PP_PARAMS(i, T) > result_; \
    typedef result_ type; \
}; \
/**/

#else

#   define BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(i, name) /**/

#endif

#endif // BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Axis2/C: WS-Addressing</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Modules

Classes

Files

Directories

Related Pages

Examples

      <form action="search.php" method="get">

             Search for
            <input type="text" name="query" value="" size="20" accesskey="s"/>

      </form>

WS-Addressing

Modules

 	WS-Addressing related constants

 	any content type

 	endpoint reference

 	message information headers

 	relates to

 	service name

<address style="text-align: right;">Generated on Fri Apr 17 11:49:44 2009 for Axis2/C by

 1.5.3 </address>


text:
  <button (click)="clearCache()">clear cache</button>

      {{mode.display}}
      edit

      add new

  <editor-selected
    *ngIf="selectedMode"
    [selectedMode]="selectedMode"
    (update)="handleSelect($event)"
    class="editor-selected"></editor-selected>

  <editor-add
    *ngIf="newMode"
    [newMode]="newMode"
    [generatorModes]="generatorModes"
    (update)="handleAdd($event)"
    class="editor-new"></editor-add>


text:
<?xml version="1.0"?>
<KhronosLogMap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <command name="eglBindAPI">
    <param name="api" flags="enum" />
  </command>
  <command name="eglCreateFenceSyncNV">
    <param name="dpy" />
    <param name="condition" flags="enum" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreateImage">
    <param name="dpy" />
    <param name="ctx" />
    <param name="target" flags="enum" />
    <param name="buffer" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreateImageKHR">
    <param name="dpy" />
    <param name="ctx" />
    <param name="target" flags="enum" />
    <param name="buffer" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreatePbufferFromClientBuffer">
    <param name="dpy" />
    <param name="buftype" flags="enum" />
    <param name="buffer" />
    <param name="config" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreateStreamSyncNV">
    <param name="dpy" />
    <param name="stream" />
    <param name="type" flags="enum" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreateSync">
    <param name="dpy" />
    <param name="type" flags="enum" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreateSyncKHR">
    <param name="dpy" />
    <param name="type" flags="enum" />
    <param name="attrib_list" />
  </command>
  <command name="eglCreateSync64KHR">
    <param name="dpy" />
    <param name="type" flags="enum" />
    <param name="attrib_list" />
  </command>
  <command name="eglGetPlatformDisplay">
    <param name="platform" flags="enum" />
    <param name="native_display" />
    <param name="attrib_list" />
  </command>
  <command name="eglGetPlatformDisplayEXT">
    <param name="platform" flags="enum" />
    <param name="native_display" />
    <param name="attrib_list" />
  </command>
  <command name="eglLabelObjectKHR">
    <param name="display" />
    <param name="objectType" flags="enum" />
    <param name="object" />
    <param name="label" />
  </command>
  <command name="eglQueryStreamKHR">
    <param name="dpy" />
    <param name="stream" />
    <param name="attribute" flags="enum" />
    <param name="value" />
  </command>
  <command name="eglQueryStreamAttribKHR">
    <param name="dpy" />
    <param name="stream" />
    <param name="attribute" flags="enum" />
    <param name="value" />
  </command>
  <command name="eglQueryStreamMetadataNV">
    <param name="dpy" />
    <param name="stream" />
    <param name="name" flags="enum" />
    <param name="n" />
    <param name="offset" />
    <param name="size" />
    <param name="data" />
  </command>
  <command name="eglQueryStreamTimeKHR">
    <param name="dpy" />
    <param name="stream" />
    <param name="attribute" flags="enum" />
    <param name="value" />
  </command>
  <command name="eglQueryStreamu64KHR">
    <param name="dpy" />
    <param name="stream" />
    <param name="attribute" flags="enum" />
    <param name="value" />
  </command>
  <command name="eglSetStreamAttribKHR">
    <param name="dpy" />
    <param name="stream" />
    <param name="attribute" flags="enum" />
    <param name="value" />
  </command>
  <command name="eglSignalSyncKHR">
    <param name="dpy" />
    <param name="sync" />
    <param name="mode" flags="enum" />
  </command>
  <command name="eglSignalSyncNV">
    <param name="sync" />
    <param name="mode" flags="enum" />
  </command>
  <command name="eglStreamAttribKHR">
    <param name="dpy" />
    <param name="stream" />
    <param name="attribute" flags="enum" />
    <param name="value" />
  </command>
</KhronosLogMap>


text:
using System.Drawing;
using System.Globalization;
using ReClassNET.Controls;
using ReClassNET.Extensions;
using ReClassNET.Memory;
using ReClassNET.UI;

namespace ReClassNET.Nodes
{
	public class UInt8Node : BaseNumericNode
	{
		public override int MemorySize => 1;

		public override void GetUserInterfaceInfo(out string name, out Image icon)
		{
			name = "UInt8 / BYTE";
			icon = Properties.Resources.B16x16_Button_UInt_8;
		}

		public override Size Draw(DrawContext context, int x, int y)
		{
			var value = ReadValueFromMemory(context.Memory);
			return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt8", value.ToString(), $"0x{value:X}");
		}

		public override void Update(HotSpot spot)
		{
			base.Update(spot);

			if (spot.Id == 0 || spot.Id == 1)
			{
				if (byte.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && byte.TryParse(hexValue, NumberStyles.HexNumber, null, out val))
				{
					spot.Process.WriteRemoteMemory(spot.Address, val);
				}
			}
		}

		public byte ReadValueFromMemory(MemoryBuffer memory)
		{
			return memory.ReadUInt8(Offset);
		}
	}
}


text:
// model/player.js
//
// Model for representing a player's game state
//
// A player's state is summed up as a set of four tuples (appeal, capacity) for
// each of the four goods.
//
// exports: factory method for creating Player model objects
define(['jquery', 'backbone'], function ($, Backbone) {

  var goods = [ 'bread', 'clothes', 'cutlery', 'lamps' ];

  function isImporter(p) {
    return p.color === 'black';
  }

  var PlayerModel = Backbone.Model.extend({
    cool: 'beans',
    me: function () { console.log('i am ' + this.color); },

    initialize: function (opts) {

      var industry = {}
        , that = this;

      this.color = opts.color;

      // Set default appeal levels
      $.each(goods, function (i, g) {
        var def = {
          appeal: 0,
          capacity: isImporter(that) ? Number.POSITIVE_INFINITY : 0
        };

        industry[g] = def;
      });

      // Pre-load appeal levels
      $.each(opts.data, function (i, d) {
        console.log(opts.color+' restore saved data '+i+', d='+JSON.stringify(d));
        industry[i].appeal = d.appeal;
        industry[i].capacity = d.capacity;
      });

      this.industry = industry;
    },

    /**
     * Return the most that this player can sell of a given good
     *
     * @param good 'bread', 'clothes', etc
     */
    getLimit: function (good) {
      var def = this.industry[good];

      return Math.min(def.appeal, def.capacity);
    },

    setAppeal: function (good, value) {
      var industry = this.industry[good];

      industry.appeal = value;

      this.trigger(good+':appeal', { value: value });
    }
  });

  var factory = function (color, data) {
    var model = new PlayerModel({ color: color, data: data || {} }); // Object.create(proto);

    return model;
  };

  return factory;
});


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2017 Riyaz Ahamed
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey_0"
    >

  <android.support.v4.widget.NestedScrollView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_marginBottom="80dp"
      >

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

      <TextView
          android:id="@+id/label_header"
          style="@style/App.Text.Body.Emphasized.One"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_marginTop="@dimen/space_medium"
          android:padding="@dimen/space_large"
          android:text="@string/configuration"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          />

      <CheckedTextView
          android:id="@+id/cb_section_decoration"
          style="@style/App.Text.Body.Primary.Two"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:checkMark="?android:attr/listChoiceIndicatorMultiple"
          android:gravity="center_vertical"
          android:padding="@dimen/space_large"
          android:text="@string/section_decoration"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/label_header"
          />

      <CheckedTextView
          android:id="@+id/cb_header_decoration"
          style="@style/App.Text.Body.Primary.Two"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:checkMark="?android:attr/listChoiceIndicatorMultiple"
          android:gravity="center_vertical"
          android:padding="@dimen/space_large"
          android:text="@string/header_divider_decoration"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/cb_section_decoration"
          />

      <CheckedTextView
          android:id="@+id/cb_item_decoration"
          style="@style/App.Text.Body.Primary.Two"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:checkMark="?android:attr/listChoiceIndicatorMultiple"
          android:gravity="center_vertical"
          android:padding="@dimen/space_large"
          android:text="@string/item_divider_decoration"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/cb_header_decoration"
          />

    </android.support.constraint.ConstraintLayout>

  </android.support.v4.widget.NestedScrollView>

  <include
      layout="@layout/include_config_button_panel"/>

</FrameLayout>


text:
namespace blink {

namespace {

class MultiColumnRenderingTest : public RenderingTest {
public:
    LayoutMultiColumnFlowThread* findFlowThread(const char* id) const;

    // Generate a signature string based on what kind of column boxes the flow thread has
    // established. 'c' is used for regular column content sets, while 's' is used for spanners.
    // '?' is used when there's an unknown box type (which should be considered a failure).
    String columnSetSignature(LayoutMultiColumnFlowThread*);
    String columnSetSignature(const char* multicolId);

    void setMulticolHTML(const String&);
};

LayoutMultiColumnFlowThread* MultiColumnRenderingTest::findFlowThread(const char* id) const
{
    Node* multicol = document().getElementById(id);
    if (!multicol)
        return nullptr;
    LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(multicol->layoutObject());
    if (!multicolContainer)
        return nullptr;
    return multicolContainer->multiColumnFlowThread();
}

String MultiColumnRenderingTest::columnSetSignature(LayoutMultiColumnFlowThread* flowThread)
{
    String signature = "";
    for (LayoutBox* columnBox = flowThread->firstMultiColumnBox();
        columnBox;
        columnBox = columnBox->nextSiblingMultiColumnBox()) {
        if (columnBox->isLayoutMultiColumnSpannerPlaceholder())
            signature.append('s');
        else if (columnBox->isLayoutMultiColumnSet())
            signature.append('c');
        else
            signature.append('?');
    }
    return signature;
}

String MultiColumnRenderingTest::columnSetSignature(const char* multicolId)
{
    return columnSetSignature(findFlowThread(multicolId));
}

void MultiColumnRenderingTest::setMulticolHTML(const String& html)
{
    const char* style =
        "";
    setBodyInnerHTML(style + html);
}

TEST_F(MultiColumnRenderingTest, OneBlockWithInDepthTreeStructureCheck)
{
    // Examine the layout tree established by a simple multicol container with a block with some text inside.
    setMulticolHTML("

xxx

");
    Node* multicol = document().getElementById("mc");
    ASSERT_TRUE(multicol);
    LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(multicol->layoutObject());
    ASSERT_TRUE(multicolContainer);
    LayoutMultiColumnFlowThread* flowThread = multicolContainer->multiColumnFlowThread();
    ASSERT_TRUE(flowThread);
    EXPECT_EQ(columnSetSignature(flowThread), "c");
    EXPECT_EQ(flowThread->parent(), multicolContainer);
    EXPECT_FALSE(flowThread->previousSibling());
    LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet();
    ASSERT_TRUE(columnSet);
    EXPECT_EQ(columnSet->previousSibling(), flowThread);
    EXPECT_FALSE(columnSet->nextSibling());
    LayoutBlockFlow* block = toLayoutBlockFlow(flowThread->firstChild());
    ASSERT_TRUE(block);
    EXPECT_FALSE(block->nextSibling());
    ASSERT_TRUE(block->firstChild());
    EXPECT_TRUE(block->firstChild()->isText());
    EXPECT_FALSE(block->firstChild()->nextSibling());
}

TEST_F(MultiColumnRenderingTest, Empty)
{
    // If there's no column content, there should be no column set.
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnRenderingTest, OneBlock)
{
    // There is some content, so we should create a column set.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "c");
    LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("block")->layoutObject()), columnSet);
}

TEST_F(MultiColumnRenderingTest, TwoBlocks)
{
    // No matter how much content, we should only create one column set (unless there are spanners).
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "c");
    LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("block1")->layoutObject()), columnSet);
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("block2")->layoutObject()), columnSet);
}

TEST_F(MultiColumnRenderingTest, Spanner)
{
    // With one spanner and no column content, we should create a spanner set.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "s");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->firstMultiColumnSet(), nullptr);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner")->layoutObject()), columnBox);
    EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlaceholder(), columnBox);
}

TEST_F(MultiColumnRenderingTest, ContentThenSpanner)
{
    // With some column content followed by a spanner, we need a column set followed by a spanner set.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "cs");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("columnContent")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner")->layoutObject()), columnBox);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("columnContent")->layoutObject()), nullptr);
}

TEST_F(MultiColumnRenderingTest, SpannerThenContent)
{
    // With a spanner followed by some column content, we need a spanner set followed by a column set.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "sc");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("columnContent")->layoutObject()), columnBox);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("columnContent")->layoutObject()), nullptr);
}

TEST_F(MultiColumnRenderingTest, ContentThenSpannerThenContent)
{
    // With column content followed by a spanner followed by some column content, we need a column
    // set followed by a spanner set followed by a column set.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "csc");
    LayoutBox* columnBox = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("columnContentBefore")->layoutObject()), columnBox);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("columnContentBefore")->layoutObject()), nullptr);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("columnContentAfter")->layoutObject()), columnBox);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("columnContentAfter")->layoutObject()), nullptr);
}

TEST_F(MultiColumnRenderingTest, TwoSpanners)
{
    // With two spanners and no column content, we need two spanner sets.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "ss");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->firstMultiColumnSet(), nullptr);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner1")->layoutObject()), columnBox);
    EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlaceholder(), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner2")->layoutObject()), columnBox);
    EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlaceholder(), columnBox);
}

TEST_F(MultiColumnRenderingTest, SpannerThenContentThenSpanner)
{
    // With two spanners and some column content in-between, we need a spanner set, a column set and another spanner set.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "scs");
    LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet();
    EXPECT_EQ(columnSet->nextSiblingMultiColumnSet(), nullptr);
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner1")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(columnBox, columnSet);
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("columnContent")->layoutObject()), columnSet);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("columnContent")->layoutObject()), nullptr);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner2")->layoutObject()), columnBox);
}

TEST_F(MultiColumnRenderingTest, SpannerWithSpanner)
{
    // column-span:all on something inside column-span:all has no effect.
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    ASSERT_EQ(columnSetSignature(flowThread), "s");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner")->layoutObject()), columnBox);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("invalidSpanner")->layoutObject()), columnBox);
    EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFlowThread(), document().getElementById("spanner")->layoutObject());
    EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlaceholder(), columnBox);
    EXPECT_EQ(document().getElementById("invalidSpanner")->layoutObject()->spannerPlaceholder(), nullptr);
}

TEST_F(MultiColumnRenderingTest, SubtreeWithSpanner)
{
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    EXPECT_EQ(columnSetSignature(flowThread), "csc");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("outer")->layoutObject()), columnBox);
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("block1")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner")->layoutObject()), columnBox);
    EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlaceholder(), columnBox);
    EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFlowThread(), document().getElementById("spanner")->layoutObject());
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("outer")->layoutObject()), nullptr);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("block1")->layoutObject()), nullptr);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("block2")->layoutObject()), nullptr);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("block2")->layoutObject()), columnBox);
}

TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerAfterSpanner)
{
    setMulticolHTML("

text

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    EXPECT_EQ(columnSetSignature(flowThread), "scsc");
    LayoutBox* columnBox = flowThread->firstMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner1")->layoutObject()), columnBox);
    EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFlowThread(), document().getElementById("spanner1")->layoutObject());
    EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlaceholder(), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("outer")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner2")->layoutObject()), columnBox);
    EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFlowThread(), document().getElementById("spanner2")->layoutObject());
    EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlaceholder(), columnBox);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("outer")->layoutObject()), nullptr);
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("after")->layoutObject()), nullptr);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("after")->layoutObject()), columnBox);
}

TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerBeforeSpanner)
{
    setMulticolHTML("

text

text

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    EXPECT_EQ(columnSetSignature(flowThread), "cscs");
    LayoutBox* columnBox = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("outer")->layoutObject()), columnBox);
    columnBox = columnBox->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner1")->layoutObject()), columnBox);
    EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlaceholder(), columnBox);
    EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFlowThread(), document().getElementById("spanner1")->layoutObject());
    columnBox = columnBox->nextSiblingMultiColumnBox()->nextSiblingMultiColumnBox();
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("spanner2")->layoutObject()), columnBox);
    EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlaceholder(), columnBox);
    EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFlowThread(), document().getElementById("spanner2")->layoutObject());
    EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getElementById("outer")->layoutObject()), nullptr);
}

TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset)
{
    setMulticolHTML("
text
text
text
text
text
spanner
text
text
text
text
text
");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
    LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
    LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow);
    LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
}

TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl)
{
    setMulticolHTML("
text
text
text
text
text
spanner
text
text
text
text
text
");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
    LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
    LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow);
    LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
}

TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr)
{
    setMulticolHTML("
text
text
text
text
text
spanner
text
text
text
text
text
");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
    LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
    LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow);
    LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow);
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row
    EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
}

class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest {
public:
    void setMulticolHTML(const char*);
    void reparentLayoutObject(const char* newParentId, const char* childId, const char* insertBeforeId = nullptr);
    void destroyLayoutObject(LayoutObject* child);
    void destroyLayoutObject(const char* childId);
};

void MultiColumnTreeModifyingTest::setMulticolHTML(const char* html)
{
    MultiColumnRenderingTest::setMulticolHTML(html);
    // Allow modifications to the layout tree structure, because that's what we want to test.
    document().lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc);
}

void MultiColumnTreeModifyingTest::reparentLayoutObject(const char* newParentId, const char* childId, const char* insertBeforeId)
{
    LayoutObject* newParent = document().getElementById(newParentId)->layoutObject();
    LayoutObject* child = document().getElementById(childId)->layoutObject();
    LayoutObject* insertBefore = insertBeforeId ? document().getElementById(insertBeforeId)->layoutObject() : nullptr;
    child->remove();
    newParent->addChild(child, insertBefore);
}

void MultiColumnTreeModifyingTest::destroyLayoutObject(LayoutObject* child)
{
    // Remove and destroy in separate steps, so that we get to test removal of subtrees.
    child->remove();
    child->node()->detach();
}

void MultiColumnTreeModifyingTest::destroyLayoutObject(const char* childId)
{
    destroyLayoutObject(document().getElementById(childId)->layoutObject());
}

TEST_F(MultiColumnTreeModifyingTest, InsertFirstContentAndRemove)
{
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    LayoutBlockFlow* block = toLayoutBlockFlow(document().getElementById("block")->layoutObject());
    LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(document().getElementById("mc")->layoutObject());
    block->remove();
    multicolContainer->addChild(block);
    EXPECT_EQ(block->parent(), flowThread);
    // A set should have appeared, now that the multicol container has content.
    EXPECT_EQ(columnSetSignature(flowThread), "c");

    destroyLayoutObject(block);
    // The set should be gone again now, since there's nothing inside the multicol container anymore.
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentBeforeContentAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "c");
    reparentLayoutObject("mc", "block", "insertBefore");
    // There was already some content prior to our insertion, so no new set should be inserted.
    EXPECT_EQ(columnSetSignature("mc"), "c");
    destroyLayoutObject("block");
    // There's still some content after the removal, so the set should remain.
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentAfterContentAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "c");
    reparentLayoutObject("mc", "block");
    // There was already some content prior to our insertion, so no new set should be inserted.
    EXPECT_EQ(columnSetSignature("mc"), "c");
    destroyLayoutObject("block");
    // There's still some content after the removal, so the set should remain.
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerAndRemove)
{
    setMulticolHTML("

");
    LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
    LayoutBlockFlow* spanner = toLayoutBlockFlow(document().getElementById("spanner")->layoutObject());
    LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(document().getElementById("mc")->layoutObject());
    spanner->remove();
    multicolContainer->addChild(spanner);
    EXPECT_EQ(spanner->parent(), flowThread);
    // We should now have a spanner placeholder, since we just moved a spanner into the multicol container.
    EXPECT_EQ(columnSetSignature(flowThread), "s");
    destroyLayoutObject(spanner);
    EXPECT_EQ(columnSetSignature(flowThread), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertTwoSpannersAndRemove)
{
    setMulticolHTML("
ee

");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "css");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerAfterContentAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "spanner");
    // We should now have a spanner placeholder, since we just moved a spanner into the multicol container.
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerBeforeContentAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "spanner", "columnContent");
    // We should now have a spanner placeholder, since we just moved a spanner into the multicol container.
    EXPECT_EQ(columnSetSignature("mc"), "sc");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerBetweenContentAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "spanner", "insertBefore");
    // Since the spanner was inserted in the middle of column content, what used to be one column
    // set had to be split in two, in order to get a spot to insert the spanner placeholder.
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("spanner");
    // The spanner placeholder should be gone again now, and the two sets be merged into one.
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithContentAndSpannerAndRemove)
{
    setMulticolHTML("
text

text

");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertInsideSpannerAndRemove)
{
    setMulticolHTML("
text

");
    reparentLayoutObject("spanner", "block");
    EXPECT_EQ(columnSetSignature("mc"), "s");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerInContentBeforeSpannerAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    reparentLayoutObject("mc", "spanner", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "cscs");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerInContentAfterSpannerAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "sc");
    reparentLayoutObject("mc", "spanner", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "scsc");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "sc");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerAfterSpannerAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "spanner");
    EXPECT_EQ(columnSetSignature("mc"), "ss");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerBeforeSpannerAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "spanner", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "ss");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentBeforeSpannerAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "block", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentAfterContentBeforeSpannerAndRemove)
{
    setMulticolHTML("

text

");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    reparentLayoutObject("mc", "block", "insertBefore");
    // There was already some content before the spanner prior to our insertion, so no new set
    // should be inserted.
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentAfterContentAndSpannerAndRemove)
{
    setMulticolHTML("

content

");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentBeforeSpannerAndContentAndRemove)
{
    setMulticolHTML("

content
");
    EXPECT_EQ(columnSetSignature("mc"), "sc");
    reparentLayoutObject("mc", "block", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "sc");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerIntoContentBeforeSpannerAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "cssc");
    reparentLayoutObject("mc", "spanner", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "cscssc");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "cssc");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerIntoContentAfterSpannerAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "cssc");
    reparentLayoutObject("mc", "spanner", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "csscsc");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "cssc");
}

TEST_F(MultiColumnTreeModifyingTest, InsertInvalidSpannerAndRemove)
{
    setMulticolHTML("

");
    EXPECT_EQ(columnSetSignature("mc"), "s");
    reparentLayoutObject("spanner", "invalidSpanner");
    // It's not allowed to nest spanners.
    EXPECT_EQ(columnSetSignature("mc"), "s");
    destroyLayoutObject("invalidSpanner");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSpannerWithInvalidSpannerAndRemove)
{
    setMulticolHTML("

");
    reparentLayoutObject("mc", "spanner");
    // It's not allowed to nest spanners.
    EXPECT_EQ(columnSetSignature("mc"), "s");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertInvalidSpannerInSpannerBetweenContentAndRemove)
{
    setMulticolHTML("

text

text
");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    reparentLayoutObject("spanner", "invalidSpanner");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("invalidSpanner");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentAndSpannerAndRemove)
{
    setMulticolHTML("
text

text
");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertContentAndSpannerAndContentAndRemove)
{
    setMulticolHTML("

text

");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithSpannerAndRemove)
{
    setMulticolHTML("
text

text

");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithSpannerAfterContentAndRemove)
{
    setMulticolHTML("
text

text

column content
");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithSpannerBeforeContentAndRemove)
{
    setMulticolHTML("
text

text

column content

");
    reparentLayoutObject("mc", "block", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithSpannerInsideContentAndRemove)
{
    setMulticolHTML("
text

text

outside
outside

");
    EXPECT_EQ(columnSetSignature("mc"), "c");
    reparentLayoutObject("mc", "block", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithSpannerAfterSpannerAndRemove)
{
    setMulticolHTML("
text

text

");
    EXPECT_EQ(columnSetSignature("mc"), "s");
    reparentLayoutObject("mc", "block");
    EXPECT_EQ(columnSetSignature("mc"), "scsc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, InsertSubtreeWithSpannerBeforeSpannerAndRemove)
{
    setMulticolHTML("
text

text

");
    EXPECT_EQ(columnSetSignature("mc"), "s");
    reparentLayoutObject("mc", "block", "insertBefore");
    EXPECT_EQ(columnSetSignature("mc"), "cscs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "s");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndContent)
{
    setMulticolHTML("

text

text

");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndSomeContentBefore)
{
    setMulticolHTML("
text
text

");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndAllContentBefore)
{
    setMulticolHTML("

text

");
    EXPECT_EQ(columnSetSignature("mc"), "cs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndAllContentBeforeWithContentAfter)
{
    setMulticolHTML("

text

text
");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndSomeContentAfter)
{
    setMulticolHTML("

text
text
");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndAllContentAfter)
{
    setMulticolHTML("

text

");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndAllContentAfterWithContentBefore)
{
    setMulticolHTML("
text

text

");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveTwoSpannersBeforeContent)
{
    setMulticolHTML("

text
");
    EXPECT_EQ(columnSetSignature("mc"), "cssc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndContentAndSpanner)
{
    setMulticolHTML("

text

text

");
    EXPECT_EQ(columnSetSignature("mc"), "cscsc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndContentAndSpannerBeforeContent)
{
    setMulticolHTML("

text

text
");
    EXPECT_EQ(columnSetSignature("mc"), "cscsc");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerAndContentAndSpannerAfterContent)
{
    setMulticolHTML("
text

text

");
    EXPECT_EQ(columnSetSignature("mc"), "cscs");
    destroyLayoutObject("block");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveInvalidSpannerInSpannerBetweenContent)
{
    setMulticolHTML("
text

text
");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
}

TEST_F(MultiColumnTreeModifyingTest, RemoveSpannerWithInvalidSpannerBetweenContent)
{
    setMulticolHTML("
text

text
");
    EXPECT_EQ(columnSetSignature("mc"), "csc");
    destroyLayoutObject("spanner");
    EXPECT_EQ(columnSetSignature("mc"), "c");
}

} // anonymous namespace

} // namespace blink


text:
.class final Landroid/net/wifi/WifiLinkLayerStats$1;
.super Ljava/lang/Object;
.source "WifiLinkLayerStats.java"

# interfaces
.implements Landroid/os/Parcelable$Creator;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/net/wifi/WifiLinkLayerStats;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Landroid/os/Parcelable$Creator",
        "<",
        "Landroid/net/wifi/WifiLinkLayerStats;",
        ">;"
    }
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

    .prologue
    .line 188
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public createFromParcel(Landroid/os/Parcel;)Landroid/net/wifi/WifiLinkLayerStats;
    .locals 2
    .param p1, "in"    # Landroid/os/Parcel;

    .prologue
    .line 190
    new-instance v0, Landroid/net/wifi/WifiLinkLayerStats;

    invoke-direct {v0}, Landroid/net/wifi/WifiLinkLayerStats;-><init>()V

    .line 191
    .local v0, "stats":Landroid/net/wifi/WifiLinkLayerStats;
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/WifiLinkLayerStats;->SSID:Ljava/lang/String;

    .line 192
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/WifiLinkLayerStats;->BSSID:Ljava/lang/String;

    .line 193
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/WifiLinkLayerStats;->on_time:I

    .line 194
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/WifiLinkLayerStats;->tx_time:I

    .line 195
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/WifiLinkLayerStats;->rx_time:I

    .line 196
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/WifiLinkLayerStats;->on_time_scan:I

    .line 197
    return-object v0
.end method

.method public bridge synthetic createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
    .locals 1
    .param p1, "in"    # Landroid/os/Parcel;

    .prologue
    .line 189
    invoke-virtual {p0, p1}, Landroid/net/wifi/WifiLinkLayerStats$1;->createFromParcel(Landroid/os/Parcel;)Landroid/net/wifi/WifiLinkLayerStats;

    move-result-object v0

    return-object v0
.end method

.method public newArray(I)[Landroid/net/wifi/WifiLinkLayerStats;
    .locals 1
    .param p1, "size"    # I

    .prologue
    .line 200
    new-array v0, p1, [Landroid/net/wifi/WifiLinkLayerStats;

    return-object v0
.end method

.method public bridge synthetic newArray(I)[Ljava/lang/Object;
    .locals 1
    .param p1, "size"    # I

    .prologue
    .line 199
    invoke-virtual {p0, p1}, Landroid/net/wifi/WifiLinkLayerStats$1;->newArray(I)[Landroid/net/wifi/WifiLinkLayerStats;

    move-result-object v0

    return-object v0
.end method


text:
'use strict';

var gonzales = require('gonzales-pe');

module.exports = function () {
  var valueFromSettings;
  var blockIndent;

  function getLastWhitespaceNode(node) {
    var lastNode = node.last();
    if (!lastNode || !lastNode.content) return null;
    if (lastNode.is('block')) return null;
    if (lastNode.is('space')) return lastNode;
    return getLastWhitespaceNode(lastNode);
  }

  function processBlock(x, level) {
    level = level || 0;
    x.forEach(function (node) {
      if (!node.is('block') && !node.is('atrulers')) return processBlock(node, level);
      level++;
      var value = valueFromSettings;

      if (value.indexOf('\n') > -1) {
        // TODO: Check that it works for '' block indent value <tg>
        if (blockIndent) {
          value += new Array(level).join(blockIndent);
        }
      } // If found block node stop at the next one for space check
      // For the pre-block node, find its last (the deepest) child

      var whitespaceNode = getLastWhitespaceNode(node); // If it's spaces, modify this node
      // If it's something different from spaces, add a space node
      // to the end

      if (whitespaceNode) {
        whitespaceNode.content = value;
      } else if (value !== '') {
        var space = gonzales.createNode({
          type: 'space',
          content: value
        });
        node.content.push(space);
      }

      processBlock(node, level);
    });
  }

  return {
    name: 'space-before-closing-brace',
    runBefore: 'tab-size',
    syntax: ['css', 'less', 'scss'],
    accepts: {
      number: true,
      string: /^[ \t\n]*$/
    },

    /**
     * Processes tree node.
     * @param {node} ast
     * @param {Object} config
     */
    process: function (ast, config) {
      valueFromSettings = this.value;
      blockIndent = config['block-indent'];
      processBlock(ast);
    },

    /**
     * Detects the value of an option at the tree node.
     *
     * @param {node} ast
     */
    detect: function (ast) {
      let detected = [];
      ast.traverseByTypes(['block', 'atrulers'], function (node) {
        // For the block node, find its last (the deepest) child
        var whitespaceNode = getLastWhitespaceNode(node);

        if (whitespaceNode) {
          detected.push(whitespaceNode.content);
        } else {
          detected.push('');
        }
      });
      return detected;
    }
  };
}();


text:
/**
 * @file
 *
 * TODO Add file description.
 */

#ifndef WORKER_H_
#define WORKER_H_

#include <stdint.h>
#include <stdbool.h>

#include <mouros/tasks.h>

typedef struct worker {
	task_t task;
	void (*action)(void *);
	void *params;
	bool stop_flag;
} worker_t;

bool worker_task_init(worker_t *worker,
                      const char *name,
                      uint8_t *stack_base,
                      uint32_t stack_size,
                      uint8_t priority,
                      void (*action)(void *),
                      void *action_params);

bool worker_start(worker_t *worker);
void worker_stop(worker_t *worker);
void worker_join(worker_t *worker);

#endif /* WORKER_H_ */


text:
import React from 'react';
import PropTypes from 'prop-types';
//
import { withStyles } from '@material-ui/core/styles';
//
import * as Basic from '../../basic';
import { ScriptArea } from '../../basic/ScriptArea/ScriptArea';
import ScriptOptionDecorator from './ScriptOptionDecorator';
import ScriptValueDecorator from './ScriptValueDecorator';
import RichTextArea from '../RichTextArea/RichTextArea';

/**
 * ScriptArea + select script by category.
 * Component with select from available script (select from script category).
 * Select script from agenda is realized as new modal window.
 *
 * @author Ondřej Kopr
 * @author Radek Tomiška
 */
export class AdvancedScriptArea extends ScriptArea {

  constructor(props, context) {
    super(props, context);
    this.state = {
      showModal: false,
      script: null
    };
  }

  _closeDetail(value, event) {
    if (event) {
      event.preventDefault();
    }
    this.setState({
      showModal: false
    });
  }

  _selectScript(value, event) {
    const { scriptManager } = this.props;
    if (event) {
      event.preventDefault();
    }
    if (value === null) {
      return;
    }
    const selectedScriptId = this.refs.form.getData().selectedScript;
    this.context.store.dispatch(scriptManager.fetchEntity(selectedScriptId, selectedScriptId, (entity) => {
      if (entity !== null) {
        const currentValue = this.getValue();
        if (currentValue) {
          this.setValue(this.getValue() + entity.template);
        } else {
          this.setValue(entity.template);
        }
      }
    }));
    //
    this.setState({
      showModal: false
    });
    //
    // TODO: set into cursor?
    // TODO: script area focus not working
  }

  _showModal(value, event) {
    if (event) {
      event.preventDefault();
    }
    this.setState({
      showModal: true
    });
  }

  _chageScript(script, event) {
    if (event) {
      event.preventDefault();
    }
    if (script) {
      this.setState({
        script
      });
    } else {
      this.setState({
        script: null
      });
    }
  }

  _getAddButton() {
    return (
      <Basic.Button
        type="button"
        className="btn-xs"
        level="success"
        onClick={this._showModal.bind(this)}>
        {this.i18n('entity.Script.select.button')}
        {' '}
        <Basic.Icon icon="arrow-down"/>
      </Basic.Button>
    );
  }

  getOptionsButton() {
    const { showMaximalizationBtn, showScriptSelection } = this.props;
    if (showScriptSelection === false) {
      return super.getOptionsButton();
    }
    return (

        { this._getAddButton() }
        {' '}
        { this._getMaximalizationButton(showMaximalizationBtn) }

    );
  }

  render() {
    const { scriptCategory, scriptManager, headerText, rendered, showScriptSelection, completers } = this.props;
    const { showModal, script } = this.state;
    if (rendered === false) {
      return
;
    }
    if (showScriptSelection === false) {
      return this._getComponent();
    }
    return (

        { this._getComponent() }
        <Basic.Modal
          bsSize="default"
          show={showModal}
          onHide={this._closeDetail.bind(this)}
          backdrop="static">

          <form onSubmit={this._selectScript.bind(this)}>
            <Basic.Modal.Header closeButton text={headerText} rendered/>
            <Basic.Modal.Body>
              <Basic.AbstractForm ref="form" >
                <Basic.SelectBox
                  ref="selectedScript"
                  manager={ scriptManager }
                  useFirst
                  clearable={ false }
                  onChange={ this._chageScript.bind(this) }
                  forceSearchParameters={
                    scriptManager.getDefaultSearchParameters().setFilter('inCategory', scriptCategory)
                  }
                  label={ this.i18n('entity.Script.select.label') }
                  optionComponent={ ScriptOptionDecorator }
                  valueComponent={ ScriptValueDecorator }/>
              </Basic.AbstractForm>
              <Basic.AbstractForm ref="scriptDetail" data={script} >
                <Basic.Row>
                  <Basic.Col lg={ 4 }>
                    <Basic.TextField
                      ref="code"
                      readOnly
                      label={this.i18n('entity.Script.code')}/>
                  </Basic.Col>
                  <Basic.Col lg={ 8 }>
                    <Basic.TextField
                      ref="name"
                      readOnly
                      label={this.i18n('entity.Script.name')}/>
                  </Basic.Col>
                </Basic.Row>
                <RichTextArea
                  ref="description"
                  readOnly
                  label={this.i18n('entity.Script.description')}/>
                <Basic.ScriptArea
                  completers={completers}
                  ref="script"
                  readOnly
                  label={this.i18n('entity.Script.script.label')}/>
              </Basic.AbstractForm>
            </Basic.Modal.Body>
            <Basic.Modal.Footer>
              <Basic.Button
                level="link"
                onClick={this._closeDetail.bind(this)}>
                {this.i18n('button.close')}
              </Basic.Button>
              <Basic.Button
                level="success"
                onClick={this._selectScript.bind(this)}>
                {this.i18n('button.select')}
              </Basic.Button>
            </Basic.Modal.Footer>
          </form>
        </Basic.Modal>

    );
  }
}

AdvancedScriptArea.propTypes = {
  scriptCategory: PropTypes.array,
  scriptManager: PropTypes.object,
  headerText: PropTypes.string.isRequired,
  mode: PropTypes.string,
  height: PropTypes.string,
  showScriptSelection: PropTypes.bool
};

AdvancedScriptArea.defaultProps = {
  scriptCategory: null,
  height: '10em',
  mode: 'groovy',
  showScriptSelection: true
};

export default withStyles(ScriptArea.STYLES, { withTheme: true })(AdvancedScriptArea);


text:
module Notifications
  class ApplicationController < ::ApplicationController
    helper_method :current_user

    alias_method :origin_current_user, Notifications.config.current_user_method.to_sym
    if Notifications.config.authenticate_user_method
      alias_method :origin_authenticate_user!, Notifications.config.authenticate_user_method.to_sym
    end

    before_action :authenticate_user!

    def current_user
      origin_current_user
    end

    def authenticate_user!
      origin_authenticate_user! if Notifications.config.authenticate_user_method
    end
  end
end


text:
import { Component, OnInit , EventEmitter, Output} from '@angular/core';
import { WeatherService } from '../weather.service';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.css']
})
export class HeaderComponent implements OnInit {

  constructor() { }

  ngOnInit() {

  }

}


text:
class Favorite < ApplicationRecord
  belongs_to :user
  belongs_to :firewood
end


text:
<?php

namespace JiriNapravnik\Doctrine\Functions;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;

/**
 * RandFunction ::= "RAND" "(" ")"
 */
class RandFunction extends FunctionNode
{

	public function parse(Parser $parser)
	{
		$parser->match(Lexer::T_IDENTIFIER);
		$parser->match(Lexer::T_OPEN_PARENTHESIS);
		$parser->match(Lexer::T_CLOSE_PARENTHESIS);
	}

	public function getSql(SqlWalker $sqlWalker)
	{
		return 'RAND()';
	}

}


text:
'use strict';

/**
 * Ensure Authenticated.
 * @param req
 * @param res
 * @param next
 * @returns {*}
 */
function ensureAuthenticated(req, res, next) {
  if (req.isAuthenticated()) {
    return next();
  }
  res.set('X-Auth-Required', 'true');
  res.redirect('/login/');
}

/**
 * Ensure Admin.
 * @param req
 * @param res
 * @param next
 * @returns {*}
 */
function ensureAdmin(req, res, next) {
  if (req.user.isMemberOf('root')) {
    return next();
  }
  res.redirect('/');
}

/**
 * Web router.
 * @type {Function}
 */
exports = module.exports = function (app, passport) {
  // Front end.
  app.get('/', require('./index').init);
  app.get('/about/', require('./about/index').init);

  // Register.
  app.get('/register/', require('./register/index').init);
  app.post('/register/', require('./register/index').register);

  // Social register.
  app.post('/register/social/', require('./social/index').registerSocial);

  app.get('/register/twitter/', passport.authenticate('twitter', {callbackURL: '/register/twitter/callback/'}));
  app.get('/register/github/', passport.authenticate('github', {callbackURL: '/register/github/callback/', scope: ['user:email']}));
  app.get('/register/facebook/', passport.authenticate('facebook', {callbackURL: '/register/facebook/callback/', scope: ['email']}));
  app.get('/register/google/', passport.authenticate('google', {callbackURL: '/register/google/callback/', scope: ['profile email']}));
  app.get('/register/tumblr/', passport.authenticate('tumblr', {callbackURL: '/register/tumblr/callback/'}));

  app.get('/register/:social/callback/', require('./social/index').registerOauth);

  // Login/out.
  app.get('/login/', require('./login/index').init);
  app.post('/login/', require('./login/index').login);
  app.get('/login/forgot/', require('./login/forgot/index').init);
  app.post('/login/forgot/', require('./login/forgot/index').send);
  app.get('/login/reset/', require('./login/reset/index').init);
  app.get('/login/reset/:email/:token/', require('./login/reset/index').init);
  app.put('/login/reset/:email/:token/', require('./login/reset/index').set);
  app.get('/login/2step/', require('./login/twostep/index').init);
  app.get('/logout/', require('./logout/index').init);

  // Admin.
  app.all('/admin*', ensureAuthenticated);
  app.all('/admin*', ensureAdmin);
  app.get('/admin/', require('./admin/index').init);

  // Admin > Users.
  app.get('/admin/users/', require('./admin/users/index').find);
  app.post('/admin/users/', require('./admin/users/index').create);
  app.get('/admin/users/:id/', require('./admin/users/index').read);
  app.put('/admin/users/:id/', require('./admin/users/index').update);
  app.put('/admin/users/:id/password/', require('./admin/users/index').password);
  app.put('/admin/users/:id/roles/', require('./admin/users/index').roles);
  app.delete('/admin/users/:id/', require('./admin/users/index').delete);
  app.post('/admin/users/:id/notes/', require('./admin/users/index').newNote);
  app.post('/admin/users/:id/status/', require('./admin/users/index').newStatus);

  // Admin > Fields.
  app.get('/admin/fields/', require('./admin/fields/index').find);
  app.post('/admin/fields/', require('./admin/fields/index').create);
  app.get('/admin/fields/:id/', require('./admin/fields/index').read);
  app.put('/admin/fields/:id/', require('./admin/fields/index').update);
  app.delete('/admin/fields/:id/', require('./admin/fields/index').delete);

  // Admin > Rules.
  app.get('/admin/rules/', require('./admin/rules/index').find);
  app.post('/admin/rules/', require('./admin/rules/index').create);
  app.get('/admin/rules/:id/', require('./admin/rules/index').read);
  app.put('/admin/rules/:id/', require('./admin/rules/index').update);
  app.post('/admin/rules/:id/', require('./admin/rules/index').update);
  app.delete('/admin/rules/:id/', require('./admin/rules/index').delete);

  // Admin > Roles.
  app.get('/admin/roles/', require('./admin/roles/index').find);
  app.post('/admin/roles/', require('./admin/roles/index').create);
  app.get('/admin/roles/:id/', require('./admin/roles/index').read);
  app.put('/admin/roles/:id/', require('./admin/roles/index').update);
  app.put('/admin/roles/:id/permissions/', require('./admin/roles/index').permissions);
  app.delete('/admin/roles/:id/', require('./admin/roles/index').delete);

  // Admin > Statuses.
  app.get('/admin/statuses/', require('./admin/statuses/index').find);
  app.post('/admin/statuses/', require('./admin/statuses/index').create);
  app.get('/admin/statuses/:id/', require('./admin/statuses/index').read);
  app.put('/admin/statuses/:id/', require('./admin/statuses/index').update);
  app.delete('/admin/statuses/:id/', require('./admin/statuses/index').delete);

  // Admin > Settings.
  app.get('/admin/settings/', require('./admin/settings/index').read);
  app.put('/admin/settings/', require('./admin/settings/index').update);
  app.post('/admin/settings/', require('./admin/settings/index').update);
  app.put('/admin/settings/reset', require('./admin/settings/index').reset);
  app.post('/admin/settings/reset', require('./admin/settings/index').reset);

  // Admin > Emails.
  app.get('/admin/emails/', require('./admin/emails/index').read);
  app.get('/admin/emails/test', require('./admin/emails/index').test);
  app.put('/admin/emails/', require('./admin/emails/index').update);
  app.post('/admin/emails/', require('./admin/emails/index').update);

  // Admin > Search.
  app.get('/admin/search/', require('./admin/search/index').find);

  // Account.
  app.all('/account*', ensureAuthenticated);
  app.get('/account/', require('./account/index').init);
  app.put('/account/', require('./account/index').update);
  app.post('/account/', require('./account/index').update);
  app.put('/account/password/', require('./account/index').password);
  app.delete('/account/', require('./account/index').delete);

  // Account connect.
  app.get('/account/twitter/', passport.authenticate('twitter', {callbackURL: '/account/twitter/callback/'}));
  app.get('/account/github/', passport.authenticate('github', {callbackURL: '/account/github/callback/'}));
  app.get('/account/facebook/', passport.authenticate('facebook', {callbackURL: '/account/facebook/callback/'}));
  app.get('/account/google/', passport.authenticate('google', {callbackURL: '/account/google/callback/', scope: ['profile email']}));
  app.get('/account/tumblr/', passport.authenticate('tumblr', {callbackURL: '/account/tumblr/callback/'}));

  app.get('/account/:social/callback/', require('./account/index').connectOauth);

  // Account disconnect.
  app.get('/account/:social/disconnect/', require('./account/index').disconnectOauth);

  // Account > Verification.
  app.get('/account/verify/', require('./account/verify/index').init);
  app.post('/account/verify/', require('./account/verify/index').resendVerification);
  app.get('/account/verify/:token/', require('./account/verify/index').verify);

  app.put('/account/session/remove/', require('./account/index').removeSession);
  app.post('/account/session/remove/', require('./account/index').removeSession);

  // 2 step
  app.put('/account/twostep/', require('./account/index').twostep);
  app.post('/account/twostep/', require('./account/index').twostep);

  // Two Step.
  app.post('/twostep-login', require('./login/twostep/index').twostep);

  // Installation
  app.get('/install/', require('./install/index').init);
  app.post('/install/', require('./install/index').install);

  // File for source map.
  app.all('*/web/client/*.*', function(req, res) {
    if (app.get('env') === 'development') {
      res.sendFile(req.url, {root: './'});
    }
  });

  // Route not found.
  app.all('*', require('./http/index').http404);
};


text:
<?php

declare(strict_types=1);

namespace Tests\Greenter\Xml\Filter;

use Greenter\Xml\Filter\FormatFilter;
use PHPUnit\Framework\TestCase;

class FormatFilterTest extends TestCase
{
    /**
     * @var FormatFilter
     */
    private $formatter;

    protected function setUp(): void
    {
        $this->formatter = new FormatFilter();
    }

    /**
     * @dataProvider getNumberDecimals
     *
     * @param float $number
     * @param int   $decimals
     */
    public function testNumber($number, $decimals)
    {
        $value = $this->formatter->number($number, $decimals);

        $this->assertEquals($decimals, $this->countDecimals($value));
    }

    public function testNumberLimitMax()
    {
        $value = $this->formatter->numberLimit(10.343434223423423, 10);

        $this->assertEquals(10, $this->countDecimals($value));
    }

    public function testNumberLimitMin()
    {
        $number = 432.23;
        $value = $this->formatter->numberLimit($number, 10);

        $this->assertEquals($this->countDecimals((string)$number), $this->countDecimals($value));
    }

    public function getNumberDecimals()
    {
        return [[10.4, 2], [17.22111, 1], [20.677722, 3], [30.22, 0]];
    }

    private function countDecimals(string $number)
    {
        $lasPosition = strrchr($number, '.');
        if ($lasPosition === false) {
            return 0;
        }

        return strlen(substr($lasPosition, 1));
    }
}


text:
package pe.archety;

import org.neo4j.graphdb.Label;

public enum Labels implements Label {
    City,
    Continent,
    Country,
    Metro,
    State,
    User,
    Timezone
}