text:
#include "characterpropertiesui.h"

#include "src/ui/treegraphicsitem.h"
#include "src/ui/hkxclassesui/behaviorui/boneweightarrayui.h"
#include "src/ui/genericdatawidgets.h"
#include "src/hkxclasses/behavior/generators/hkbgenerator.h"
#include "src/filetypes/behaviorfile.h"
#include "src/ui/behaviorgraphview.h"
#include "src/hkxclasses/behavior/generators/bsistatetagginggenerator.h"
#include "src/hkxclasses/behavior/generators/hkbmodifiergenerator.h"
#include "src/ui/hkxclassesui/behaviorui/generators/bsistatetagginggeneratorui.h"
#include "src/ui/hkxclassesui/behaviorui/generators/modifiergeneratorui.h"
#include "src/ui/hkxclassesui/behaviorui/generators/manualselectorgeneratorui.h"

#include "src/hkxclasses/behavior/hkbcharacterdata.h"
#include "src/hkxclasses/behavior/hkbcharacterstringdata.h"
#include "src/hkxclasses/behavior/hkbvariablevalueset.h"

#include <QPushButton>
#include <QMessageBox>
#include <QSignalMapper>
#include <QTableWidget>
#include <QHeaderView>
#include <QComboBox>

#include "src/ui/genericdatawidgets.h"
#include <QDoubleSpinBox>
#include <QSpinBox>
#include <QStackedLayout>

const QStringList CharacterPropertiesUI::types = {
    "BOOL",
    "INT32",
    "REAL",
    "POINTER",
    "VECTOR4",
    "QUATERNION"
};

const QStringList CharacterPropertiesUI::headerLabels = {
    "Name",
    "Type",
    "Value"
};

CharacterPropertiesUI::CharacterPropertiesUI(const QString &title)
    : dataUI(nullptr),
      verLyt(new QVBoxLayout),
      loadedData(nullptr),
      table(new TableWidget),
      addObjectPB(new QPushButton("Add Variable")),
      removeObjectPB(new QPushButton("Remove Selected Variable")),
      buttonLyt(new QHBoxLayout),
      boolName(new LineEdit),
      intName(new LineEdit),
      doubleName(new LineEdit),
      quadName(new LineEdit),
      boolCB(new CheckBox),
      intSB(new SpinBox),
      doubleSB(new DoubleSpinBox),
      quadWidget(new QuadVariableWidget),
      variableWidget(new TableWidget),
      boneWeightArrayWidget(new BoneWeightArrayUI()),
      stackLyt(new QStackedLayout),
      returnBoolPB(new QPushButton("Return To Parent")),
      returnIntPB(new QPushButton("Return To Parent")),
      returnDoublePB(new QPushButton("Return To Parent")),
      returnQuadPB(new QPushButton("Return To Parent")),
      typeSelector(new ComboBox),
      nameMapper(new QSignalMapper),
      valueMapper(new QSignalMapper)
{
    setTitle(title);
    //setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    stackLyt->addWidget(table);
    stackLyt->addWidget(variableWidget);
    stackLyt->addWidget(boneWeightArrayWidget);
    stackLyt->setCurrentIndex(TABLE_WIDGET);
    typeSelector->insertItems(0, types);
    buttonLyt->addWidget(addObjectPB, 1);
    buttonLyt->addWidget(typeSelector, 2);
    buttonLyt->addWidget(removeObjectPB, 1);
    //table->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    table->setColumnCount(3);
    table->setHorizontalHeaderLabels(headerLabels);
    table->setEditTriggers(QAbstractItemView::DoubleClicked);
    verLyt->addLayout(buttonLyt, 1);
    verLyt->addLayout(stackLyt, 10);
    variableWidget->setRowCount(4);
    variableWidget->setColumnCount(3);
    variableWidget->setCellWidget(0, 0, boolName);
    variableWidget->setCellWidget(0, 1, boolCB);
    variableWidget->setCellWidget(0, 2, returnBoolPB);
    variableWidget->setCellWidget(1, 0, intName);
    variableWidget->setCellWidget(1, 1, intSB);
    variableWidget->setCellWidget(1, 2, returnIntPB);
    variableWidget->setCellWidget(2, 0, doubleName);
    variableWidget->setCellWidget(2, 1, doubleSB);
    variableWidget->setCellWidget(2, 2, returnDoublePB);
    variableWidget->setCellWidget(3, 0, quadName);
    variableWidget->setCellWidget(3, 1, quadWidget);
    variableWidget->setCellWidget(3, 2, returnQuadPB);
    nameMapper->setMapping(boolName, 0);
    nameMapper->setMapping(intName, 1);
    nameMapper->setMapping(doubleName, 2);
    nameMapper->setMapping(quadName, 3);
    connect(boolName, SIGNAL(editingFinished()), nameMapper, SLOT(map()), Qt::UniqueConnection);
    connect(intName, SIGNAL(editingFinished()), nameMapper, SLOT(map()), Qt::UniqueConnection);
    connect(doubleName, SIGNAL(editingFinished()), nameMapper, SLOT(map()), Qt::UniqueConnection);
    connect(quadName, SIGNAL(editingFinished()), nameMapper, SLOT(map()), Qt::UniqueConnection);
    valueMapper->setMapping(boolCB, 0);
    valueMapper->setMapping(intSB, 1);
    valueMapper->setMapping(doubleSB, 2);
    valueMapper->setMapping(quadWidget, 3);
    connect(boolCB, SIGNAL(released()), valueMapper, SLOT(map()), Qt::UniqueConnection);
    connect(intSB, SIGNAL(editingFinished()), valueMapper, SLOT(map()), Qt::UniqueConnection);
    connect(doubleSB, SIGNAL(editingFinished()), valueMapper, SLOT(map()), Qt::UniqueConnection);
    connect(quadWidget, SIGNAL(editingFinished()), valueMapper, SLOT(map()), Qt::UniqueConnection);
    setLayout(verLyt);
    connect(removeObjectPB, SIGNAL(pressed()), this, SLOT(removeVariable()), Qt::UniqueConnection);
    connect(addObjectPB, SIGNAL(pressed()), this, SLOT(addVariable()), Qt::UniqueConnection);
    connect(nameMapper, SIGNAL(mapped(int)), this, SLOT(renameSelectedVariable(int)), Qt::UniqueConnection);
    connect(valueMapper, SIGNAL(mapped(int)), this, SLOT(setVariableValue(int)), Qt::UniqueConnection);
    connect(table, SIGNAL(cellClicked(int,int)), this, SLOT(viewVariable(int,int)), Qt::UniqueConnection);
    connect(returnBoolPB, SIGNAL(released()), this, SLOT(returnToTable()), Qt::UniqueConnection);
    connect(returnIntPB, SIGNAL(released()), this, SLOT(returnToTable()), Qt::UniqueConnection);
    connect(returnDoublePB, SIGNAL(released()), this, SLOT(returnToTable()), Qt::UniqueConnection);
    connect(returnQuadPB, SIGNAL(released()), this, SLOT(returnToTable()), Qt::UniqueConnection);
    connect(boneWeightArrayWidget, SIGNAL(returnToParent()), this, SLOT(returnToTable()), Qt::UniqueConnection);
    connect(table, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(setVariableName(QTableWidgetItem*)), Qt::UniqueConnection);
}

void CharacterPropertiesUI::setVariableValue(int type){
    if (loadedData){
        auto index = table->currentRow();
        switch (type){
        case VARIABLE_TYPE_BOOL:
            loadedData->setWordVariableValueAt(index, boolCB->isChecked()); break;
        case VARIABLE_TYPE_INT32:
            loadedData->setWordVariableValueAt(index, intSB->value()); break;
        case VARIABLE_TYPE_REAL:
            loadedData->setWordVariableValueAt(index, doubleSB->value()); break;
        case VARIABLE_TYPE_POINTER:
            loadedData->setWordVariableValueAt(index, intSB->value()); break;
        case VARIABLE_TYPE_VECTOR4:
        case VARIABLE_TYPE_QUATERNION:
            loadedData->setQuadVariableValueAt(index, quadWidget->value()); break;
        }
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::renameSelectedVariable(int type){
    if (loadedData){
        QString newName;
        switch (type){
        case VARIABLE_TYPE_BOOL:
            newName = boolName->text(); break;
        case VARIABLE_TYPE_INT32:
            newName = intName->text(); break;
        case VARIABLE_TYPE_REAL:
            newName = doubleName->text(); break;
        case VARIABLE_TYPE_VECTOR4:
        case VARIABLE_TYPE_QUATERNION:
            newName = quadName->text(); break;
        }
        table->item(table->currentRow(), 0)->setText(newName);
        loadedData->setVariableNameAt(table->currentRow(), newName);
        emit variableNameChanged(newName, table->currentRow());
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::setVariableName(QTableWidgetItem *item){
    if (item && item->text() != "" && loadedData){
        auto column = table->column(item);
        (!column) ? loadedData->setCharacterPropertyNameAt(table->row(item), item->text()) : NULL;
    }else{
        LogFile::writeToLog("CharacterPropertiesUI::setVariableName(): error!!");
    }
}

void CharacterPropertiesUI::removeVariableFromTable(int row){
    (row < table->rowCount() && row >= 0) ? table->removeRow(row) : LogFile::writeToLog("CharacterPropertiesUI::removeVariableFromTable(): Invalid row selected!!");
}

void CharacterPropertiesUI::loadVariable(CheckBox *variableWid){
    if (loadedData){
        disconnect(variableWid, 0, this, 0);
        auto index = table->currentRow();
        boolName->setText(loadedData->getCharacterPropertyNameAt(index));
        variableWid->setChecked(loadedData->getWordVariableValueAt(index));
        hideOtherVariables(0);
        connect(variableWid, SIGNAL(released()), this, SLOT(setVariableValue()), Qt::UniqueConnection);
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::loadVariable(SpinBox *variableWid){
    if (loadedData){
        disconnect(variableWid, 0, this, 0);
        auto index = table->currentRow();
        intName->setText(loadedData->getCharacterPropertyNameAt(index));
        variableWid->setValue(loadedData->getWordVariableValueAt(index));
        hideOtherVariables(1);
        connect(variableWid, SIGNAL(editingFinished()), this, SLOT(setVariableValue()), Qt::UniqueConnection);
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::loadVariable(DoubleSpinBox *variableWid){
    if (loadedData){
        disconnect(variableWid, 0, this, 0);
        auto index = table->currentRow();
        doubleName->setText(loadedData->getCharacterPropertyNameAt(index));
        variableWid->setValue(loadedData->getWordVariableValueAt(index));
        hideOtherVariables(2);
        connect(variableWid, SIGNAL(editingFinished()), this, SLOT(setVariableValue()), Qt::UniqueConnection);
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::loadVariable(QuadVariableWidget *variableWid){
    if (loadedData){
        disconnect(variableWid, 0, this, 0);
        bool ok;
        auto index = table->currentRow();
        quadName->setText(loadedData->getCharacterPropertyNameAt(index));
        variableWid->setValue(loadedData->getQuadVariable(index, &ok));
        hideOtherVariables(3);
        connect(variableWid, SIGNAL(editingFinished()), this, SLOT(setVariableValue()), Qt::UniqueConnection);
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::hideOtherVariables(int indexToView){
    for (auto i = 0; i < variableWidget->rowCount(); i++){
        (i == indexToView) ? variableWidget->setRowHidden(i, false) : variableWidget->setRowHidden(i, true);
    }
}

void CharacterPropertiesUI::viewVariable(int row, int column){
    if (column == 2){
        if (loadedData){
            auto item = table->item(row, 1);
            auto type = item->text();
            if (type == "BOOL"){
                loadVariable(boolCB);
            }else if (type == "INT32"){
                loadVariable(intSB);
            }else if (type == "REAL"){
                loadVariable(doubleSB);
            }else if (type == "VECTOR4"){
                loadVariable(quadWidget);
            }else if (type == "QUATERNION"){
                loadVariable(quadWidget);
            }else if (type == "POINTER"){
                boneWeightArrayWidget->loadData(loadedData->getVariantVariable(row));
                stackLyt->setCurrentIndex(BONE_WEIGHTS_WIDGET);
                return;
            }
            stackLyt->setCurrentIndex(VARIABLE_WIDGET);
        }else{
            LogFile::writeToLog("CharacterPropertiesUI::viewVariable(): loadedData is nullptr!!");
        }
    }
}

void CharacterPropertiesUI::returnToTable(){
    stackLyt->setCurrentIndex(TABLE_WIDGET);
}

void CharacterPropertiesUI::addVariableToTable(const QString & name, const QString & type){
    auto row = table->rowCount();
    table->setRowCount(row + 1);
    table->setItem(row, 0, new QTableWidgetItem(name));
    table->setItem(row, 1, new QTableWidgetItem(type));
    table->setItem(row, 2, new QTableWidgetItem("Edit"));
    (stackLyt->currentIndex() == VARIABLE_WIDGET) ? stackLyt->setCurrentIndex(TABLE_WIDGET) : NULL;
    table->setCurrentCell(row, 0);
    //emit variableAdded(name);
}

void CharacterPropertiesUI::loadData(HkxObject *data){
    if (data && data->getSignature() == HKB_CHARACTER_DATA){
        loadedData = static_cast<hkbCharacterData *>(data);
        auto header = table->horizontalHeader();
        header->setSectionResizeMode(QHeaderView::Stretch);
        auto varNames = loadedData->getCharacterPropertyNames();
        auto typeNames = loadedData->getCharacterPropertyTypenames();
        for (auto i = 0; i < varNames.size(); i++){
            auto row = table->rowCount();
            if (table->rowCount() > i){
                table->setRowHidden(i, false);
                (table->item(row, 0)) ? table->item(row, 0)->setText(varNames.at(i)) : table->setItem(row, 0, new QTableWidgetItem(varNames.at(i)));
            }else{
                table->setRowCount(row + 1);
                table->setItem(row, 0, new QTableWidgetItem(varNames.at(i)));
                table->setItem(row, 1, new QTableWidgetItem(typeNames.at(i).section("_", -1, -1)));
                table->setItem(row, 2, new QTableWidgetItem("Edit"));
            }
        }
        for (auto j = varNames.size(); j < table->rowCount(); j++){
            table->setRowHidden(j, true);
        }
        header->setSectionResizeMode(QHeaderView::Interactive);
    }
}

void CharacterPropertiesUI::addVariable(){
    if (loadedData){
        auto addvariable = [&](hkVariableType type, const QString & typeofvar){
            loadedData->addVariable(type);
            addVariableToTable(loadedData->getLastCharacterPropertyName(), typeofvar);
            emit variableAdded(loadedData->getLastCharacterPropertyName());
        };
        auto type = typeSelector->currentIndex();
        switch (type){
        case VARIABLE_TYPE_BOOL:
            addvariable(hkVariableType::VARIABLE_TYPE_BOOL, "VARIABLE_TYPE_BOOL"); break;
        case VARIABLE_TYPE_INT32:
            addvariable(hkVariableType::VARIABLE_TYPE_INT32, "VARIABLE_TYPE_INT32"); break;
        case VARIABLE_TYPE_REAL:
            addvariable(hkVariableType::VARIABLE_TYPE_REAL, "VARIABLE_TYPE_REAL"); break;
        case VARIABLE_TYPE_POINTER:
            addvariable(hkVariableType::VARIABLE_TYPE_POINTER, "VARIABLE_TYPE_POINTER"); break;
        case VARIABLE_TYPE_VECTOR4:
            addvariable(hkVariableType::VARIABLE_TYPE_VECTOR4, "VARIABLE_TYPE_VECTOR4"); break;
        case VARIABLE_TYPE_QUATERNION:
            addvariable(hkVariableType::VARIABLE_TYPE_QUATERNION, "VARIABLE_TYPE_QUATERNION"); break;
        }
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }
}

void CharacterPropertiesUI::removeVariable(){
    //TO DO:
    //Need to check if variable is used in hkbExpressionCondition, hkbExpressionDataArray????
    //dont allow delection of iState var??
    //removing vars still bugged...
    /*if (loadedData){
        disconnect(removeObjectPB, SIGNAL(pressed()), this, SLOT(removeVariable()));
        auto index = table->currentRow();
        auto message = static_cast<BehaviorFile *>(loadedData->getParentFile())->isVariableReferenced(index);
        if (message == ""){
            loadedData->removeVariable(index);
            (index < table->rowCount()) ? table->removeRow(index) : NULL;
            (stackLyt->currentIndex() == VARIABLE_WIDGET) ? stackLyt->setCurrentIndex(TABLE_WIDGET) : NULL;
            static_cast<BehaviorFile *>(loadedData->getParentFile())->updateVariableIndices(index);
            emit variableRemoved(index);
            table->setFocus();
        }else{
            WARNING_MESSAGE(message);
        }
        connect(removeObjectPB, SIGNAL(pressed()), this, SLOT(removeVariable()), Qt::UniqueConnection);
    }else{
        LogFile::writeToLog("CharacterPropertiesUI: loadedData is nullptr!!");
    }*/
}

void CharacterPropertiesUI::setHkDataUI(HkDataUI *ui){
    dataUI = ui;
}


text:
// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Squidex.Domain.Apps.Core;
using Squidex.Infrastructure.EventSourcing;

namespace Squidex.Domain.Apps.Events.Teams;

[EventType(nameof(TeamPlanChanged))]
public sealed class TeamPlanChanged : TeamEvent
{
    public string PlanId { get; set; }

    public AssignedPlan ToPlan()
    {
        return new AssignedPlan(Actor, PlanId);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package reconciler

import (
	"fmt"

	"go.uber.org/zap"
)

func ExampleNewSemanticEqualityBuilder() {
	logger := zap.NewNop()

	builder := NewSemanticEqualityBuilder(logger.Sugar(), "ExampleType")
	fmt.Println("Initially equal:", builder.IsSemanticallyEqual())

	builder.Append("some.field", "a", "a")
	fmt.Println("After some.field:", builder.IsSemanticallyEqual())

	builder.Append("bad.field", "a", 1)
	fmt.Println("After bad.field:", builder.IsSemanticallyEqual())

	// Output: Initially equal: true
	// After some.field: true
	// After bad.field: false
}

func ExampleNewSemanticEqualityBuilder_logging() {
	logger := zap.NewExample()
	defer logger.Sync()

	NewSemanticEqualityBuilder(logger.Sugar(), "ExampleType").
		Append("some.field", "a", "a").
		Append("bad.field", "a", 1).
		IsSemanticallyEqual()

	// Output:
	// {"level":"debug","msg":"detected diff","type":"ExampleType","desired":"a","actual":1,"field":"bad.field"}
	//
}


text:
$(function() {

    // open modal popup for exporting charts to PNG/PDF

    $.get('/plugins/export-image/export-modal.twig', function(data) {
        $('body').append(data);

        $('a[href=#export-image]').click(function(e) {
            e.preventDefault();
            $('#dwExportChart').modal();
            return false;
        });

        $('.ratio-select .option').click(function(e) {
            var opt = $(e.target);
            opt = $(e.target).hasClass('option') ? opt : opt.parents('.option');
            opt.parent().data('value', opt.data('value'));
            $('.option', opt.parent()).removeClass('selected');
            opt.addClass('selected');
        });

        $('.btn-export-chart').click(function(e) {
            e.preventDefault();
            $.ajax({
                url: '/api/jobs/export_image/'+dw.backend.currentChart.get('id'),
                type: 'post',
                dataType: 'json',
                data: JSON.stringify({
                    ratio: $('.ratio-select').data('value'),
                    format: $('input[name=format]:checked').val()
                })
            }).done(function(resp) {
                $('#dwExportChart').modal('hide');
                var msg = $('#dwExportChart').data('mail-sent-message');
                msg = msg.replace('%d', '<b>'+resp.data+'</b>');
                dw.backend.logMessage(msg, '.messages');
            });
        });
    });

});


text:
#ifndef XTENSOR_FUNCTOR_VIEW_HPP
#define XTENSOR_FUNCTOR_VIEW_HPP

#include <algorithm>
#include <array>
#include <cstddef>
#include <type_traits>
#include <utility>

#include <xtl/xproxy_wrapper.hpp>

#include "xaccessible.hpp"
#include "xexpression.hpp"
#include "xiterator.hpp"
#include "xsemantic.hpp"
#include "xutils.hpp"

#include "xarray.hpp"
#include "xtensor.hpp"

namespace xt
{

    /************************************************
     * xfunctor_view and xfunctor_adaptor extension *
     ************************************************/

    namespace extension
    {
        template <class Tag, class F, class CT>
        struct xfunctor_view_base_impl;

        template <class F, class CT>
        struct xfunctor_view_base_impl<xtensor_expression_tag, F, CT>
        {
            using type = xtensor_empty_base;
        };

        template <class F, class CT>
        struct xfunctor_view_base
            : xfunctor_view_base_impl<xexpression_tag_t<CT>, F, CT>
        {
        };

        template <class F, class CT>
        using xfunctor_view_base_t = typename xfunctor_view_base<F, CT>::type;
    }

    /*************************************
     * xfunctor_applier_base declaration *
     *************************************/

    template <class F, class IT>
    class xfunctor_iterator;

    template <class F, class ST>
    class xfunctor_stepper;

    template <class D>
    class xfunctor_applier_base : private xaccessible<D>
    {
    public:

        using self_type = xfunctor_applier_base<D>;
        using inner_types = xcontainer_inner_types<D>;
        using xexpression_type = typename inner_types::xexpression_type;
        using undecay_expression = typename inner_types::undecay_expression;
        using functor_type = typename inner_types::functor_type;
        using accessible_base = xaccessible<D>;

        using extension_base = extension::xfunctor_view_base_t<functor_type, undecay_expression>;
        using expression_tag = typename extension_base::expression_tag;

        using value_type = typename functor_type::value_type;
        using reference = typename inner_types::reference;
        using const_reference = typename inner_types::const_reference;
        using pointer = typename functor_type::pointer;
        using const_pointer = typename functor_type::const_pointer;
        using size_type = typename inner_types::size_type;
        using difference_type = typename xexpression_type::difference_type;

        using shape_type = typename xexpression_type::shape_type;
        using strides_type = xtl::mpl::eval_if_t<has_strides<xexpression_type>,
                                                 detail::expr_strides_type<xexpression_type>,
                                                 get_strides_type<shape_type>>;
        using backstrides_type = xtl::mpl::eval_if_t<has_strides<xexpression_type>,
                                                     detail::expr_backstrides_type<xexpression_type>,
                                                     get_strides_type<shape_type>>;

        using inner_shape_type = typename xexpression_type::inner_shape_type;
        using inner_strides_type = xtl::mpl::eval_if_t<has_strides<xexpression_type>,
                                                       detail::expr_inner_strides_type<xexpression_type>,
                                                       get_strides_type<shape_type>>;
        using inner_backstrides_type = xtl::mpl::eval_if_t<has_strides<xexpression_type>,
                                                           detail::expr_inner_backstrides_type<xexpression_type>,
                                                           get_strides_type<shape_type>>;

        using bool_load_type = xt::bool_load_type<value_type>;

        static constexpr layout_type static_layout = xexpression_type::static_layout;
        static constexpr bool contiguous_layout = xexpression_type::contiguous_layout;

        using stepper = xfunctor_stepper<functor_type, typename xexpression_type::stepper>;
        using const_stepper = xfunctor_stepper<const functor_type, typename xexpression_type::const_stepper>;

        template <layout_type L>
        using layout_iterator = xfunctor_iterator<functor_type, typename xexpression_type::template layout_iterator<L>>;
        template <layout_type L>
        using const_layout_iterator = xfunctor_iterator<const functor_type, typename xexpression_type::template const_layout_iterator<L>>;

        template <layout_type L>
        using reverse_layout_iterator = xfunctor_iterator<functor_type, typename xexpression_type::template reverse_layout_iterator<L>>;
        template <layout_type L>
        using const_reverse_layout_iterator = xfunctor_iterator<const functor_type, typename xexpression_type::template const_reverse_layout_iterator<L>>;

        template <class S, layout_type L>
        using broadcast_iterator = xfunctor_iterator<functor_type, xiterator<typename xexpression_type::stepper, S, L>>;
        template <class S, layout_type L>
        using const_broadcast_iterator = xfunctor_iterator<functor_type, xiterator<typename xexpression_type::const_stepper, S, L>>;

        template <class S, layout_type L>
        using reverse_broadcast_iterator = xfunctor_iterator<functor_type, typename xexpression_type::template reverse_broadcast_iterator<S, L>>;
        template <class S, layout_type L>
        using const_reverse_broadcast_iterator = xfunctor_iterator<functor_type, typename xexpression_type::template const_reverse_broadcast_iterator<S, L>>;

        using linear_iterator = xfunctor_iterator<functor_type, typename xexpression_type::linear_iterator>;
        using const_linear_iterator = xfunctor_iterator<const functor_type, typename xexpression_type::const_linear_iterator>;
        using reverse_linear_iterator = xfunctor_iterator<functor_type, typename xexpression_type::reverse_linear_iterator>;
        using const_reverse_linear_iterator = xfunctor_iterator<const functor_type, typename xexpression_type::const_reverse_linear_iterator>;

        using iterator = xfunctor_iterator<functor_type, typename xexpression_type::iterator>;
        using const_iterator = xfunctor_iterator<const functor_type, typename xexpression_type::const_iterator>;
        using reverse_iterator = xfunctor_iterator<functor_type, typename xexpression_type::reverse_iterator>;
        using const_reverse_iterator = xfunctor_iterator<const functor_type, typename xexpression_type::const_reverse_iterator>;

        explicit xfunctor_applier_base(undecay_expression) noexcept;

        template <class Func, class E>
        xfunctor_applier_base(Func&&, E&&) noexcept;

        size_type size() const noexcept;
        const inner_shape_type& shape() const noexcept;
        const inner_strides_type& strides() const noexcept;
        const inner_backstrides_type& backstrides() const noexcept;
        using accessible_base::dimension;
        using accessible_base::shape;

        layout_type layout() const noexcept;
        bool is_contiguous() const noexcept;

        template <class... Args>
        reference operator()(Args... args);

        template <class... Args>
        reference unchecked(Args... args);

        template <class IT>
        reference element(IT first, IT last);

        template <class... Args>
        const_reference operator()(Args... args) const;

        template <class... Args>
        const_reference unchecked(Args... args) const;

        template <class IT>
        const_reference element(IT first, IT last) const;

        using accessible_base::at;
        using accessible_base::operator[];
        using accessible_base::periodic;
        using accessible_base::front;
        using accessible_base::back;

        using accessible_base::in_bounds;

        xexpression_type& expression() noexcept;
        const xexpression_type& expression() const noexcept;

        template <class S>
        bool broadcast_shape(S& shape, bool reuse_cache = false) const;

        template <class S>
        bool has_linear_assign(const S& strides) const;

        template <class FCT = functor_type>
        auto data_element(size_type i)
            -> decltype(std::declval<FCT>()(std::declval<undecay_expression>().data_element(i)))
        {
            return m_functor(m_e.data_element(i));
        }

        template <class FCT = functor_type>
        auto data_element(size_type i) const
            -> decltype(std::declval<FCT>()(std::declval<const undecay_expression>().data_element(i)))
        {
            return m_functor(m_e.data_element(i));
        }

        template <class FCT = functor_type>
        auto flat(size_type i)
            -> decltype(std::declval<FCT>()(std::declval<undecay_expression>().flat(i)))
        {
            return m_functor(m_e.flat(i));
        }

        template <class FCT = functor_type>
        auto flat(size_type i) const
            -> decltype(std::declval<FCT>()(std::declval<const undecay_expression>().flat(i)))
        {
            return m_functor(m_e.flat(i));
        }

        // The following functions are defined inline because otherwise signatures
        // don't match on GCC.
        template <class align, class requested_type = typename xexpression_type::value_type,
                  std::size_t N = xt_simd::simd_traits<requested_type>::size, class FCT = functor_type>
        auto load_simd(size_type i) const
            -> decltype(std::declval<FCT>().template proxy_simd_load<align, requested_type, N>(std::declval<undecay_expression>(), i))
        {
            return m_functor.template proxy_simd_load<align, requested_type, N>(m_e, i);
        }

        template <class align, class simd, class FCT = functor_type>
        auto store_simd(size_type i, const simd& e)
            -> decltype(std::declval<FCT>().template proxy_simd_store<align>(std::declval<undecay_expression>(), i, e))
        {
            return m_functor.template proxy_simd_store<align>(m_e, i, e);
        }

        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto begin() noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto end() noexcept;

        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto begin() const noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto end() const noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto cbegin() const noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto cend() const noexcept;

        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto rbegin() noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto rend() noexcept;

        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto rbegin() const noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto rend() const noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto crbegin() const noexcept;
        template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        auto crend() const noexcept;

        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        broadcast_iterator<S, L> begin(const S& shape) noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        broadcast_iterator<S, L> end(const S& shape) noexcept;

        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_broadcast_iterator<S, L> begin(const S& shape) const noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_broadcast_iterator<S, L> end(const S& shape) const noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_broadcast_iterator<S, L> cbegin(const S& shape) const noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_broadcast_iterator<S, L> cend(const S& shape) const noexcept;

        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        reverse_broadcast_iterator<S, L> rbegin(const S& shape) noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        reverse_broadcast_iterator<S, L> rend(const S& shape) noexcept;

        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_reverse_broadcast_iterator<S, L> rbegin(const S& shape) const noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_reverse_broadcast_iterator<S, L> rend(const S& shape) const noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_reverse_broadcast_iterator<S, L> crbegin(const S& shape) const noexcept;
        template <class S, layout_type L = XTENSOR_DEFAULT_TRAVERSAL>
        const_reverse_broadcast_iterator<S, L> crend(const S& shape) const noexcept;

        linear_iterator linear_begin() noexcept;
        linear_iterator linear_end() noexcept;

        const_linear_iterator linear_begin() const noexcept;
        const_linear_iterator linear_end() const noexcept;
        const_linear_iterator linear_cbegin() const noexcept;
        const_linear_iterator linear_cend() const noexcept;

        reverse_linear_iterator linear_rbegin() noexcept;
        reverse_linear_iterator linear_rend() noexcept;

        const_reverse_linear_iterator linear_rbegin() const noexcept;
        const_reverse_linear_iterator linear_rend() const noexcept;
        const_reverse_linear_iterator linear_crbegin() const noexcept;
        const_reverse_linear_iterator linear_crend() const noexcept;

        template <class S>
        stepper stepper_begin(const S& shape) noexcept;
        template <class S>
        stepper stepper_end(const S& shape, layout_type l) noexcept;
        template <class S>
        const_stepper stepper_begin(const S& shape) const noexcept;
        template <class S>
        const_stepper stepper_end(const S& shape, layout_type l) const noexcept;

    protected:

        undecay_expression m_e;
        functor_type m_functor;

    private:

        friend class xaccessible<D>;
        friend class xconst_accessible<D>;
    };

    template <class D, class T>
    struct has_simd_interface<xfunctor_applier_base<D>, T>
        : xtl::conjunction<has_simd_type<T>,
                           has_simd_interface<typename xfunctor_applier_base<D>::xexpression_type>,
                           detail::has_simd_interface_impl<xfunctor_applier_base<D>, T>>
    {
    };

    /********************************
     * xfunctor_view_temporary_type *
     ********************************/

    namespace detail
    {
        // TODO replace with xexpression_for_shape ...
        template <class F, class S, layout_type L>
        struct functorview_temporary_type_impl
        {
            using type = xarray<typename F::value_type, L>;
        };

        template <class F, class T, std::size_t N, layout_type L>
        struct functorview_temporary_type_impl<F, std::array<T, N>, L>
        {
            using type = xtensor<typename F::value_type, N, L>;
        };
    }

    template <class F, class E>
    struct xfunctor_view_temporary_type
    {
        using type = typename detail::functorview_temporary_type_impl<F, typename E::shape_type, E::static_layout>::type;
    };

    /*****************************
     * xfunctor_view declaration *
     *****************************/

    template <class F, class CT>
    class xfunctor_view;

    template <class F, class CT>
    struct xcontainer_inner_types<xfunctor_view<F, CT>>
    {
        using xexpression_type = std::decay_t<CT>;
        using undecay_expression = CT;
        using functor_type = std::decay_t<F>;
        using reference = decltype(std::declval<F>()(std::declval<xexpression_type>()()));
        using const_reference = decltype(std::declval<F>()(std::declval<const xexpression_type>()()));
        using size_type = typename xexpression_type::size_type;
        using temporary_type = typename xfunctor_view_temporary_type<F, xexpression_type>::type;
    };

    template <class F, class CT, class T>
    struct has_simd_interface<xfunctor_view<F, CT>, T>
        : has_simd_interface<xfunctor_applier_base<xfunctor_view<F, CT>>, T>
    {
    };

    /**
     * @class xfunctor_view
     * @brief View of an xexpression .
     *
     * The xfunctor_view class is an expression addressing its elements by applying a functor to the
     * corresponding element of an underlying expression. Unlike e.g. xgenerator, an xfunctor_view is
     * an lvalue. It is used e.g. to access real and imaginary parts of complex expressions.
     *
     * xfunctor_view has a view semantics and can be used on any expression.
     * For a similar feature with a container semantics, one can use \ref xfunctor_adaptor.
     *
     * xfunctor_view is not meant to be used directly, but through helper functions such
     * as \ref real or \ref imag.
     *
     * @tparam F the functor type to be applied to the elements of specified expression.
     * @tparam CT the closure type of the \ref xexpression type underlying this view
     *
     * @sa real, imag
     */
    template <class F, class CT>
    class xfunctor_view : public xfunctor_applier_base<xfunctor_view<F, CT>>,
                          public xview_semantic<xfunctor_view<F, CT>>,
                          public extension::xfunctor_view_base_t<F, CT>
    {
    public:

        using self_type = xfunctor_view<F, CT>;
        using semantic_base = xview_semantic<self_type>;

        // constructors
        using xfunctor_applier_base<self_type>::xfunctor_applier_base;

        template <class E>
        self_type& operator=(const xexpression<E>& e);

        template <class E>
        disable_xexpression<E, self_type>& operator=(const E& e);

        template <class E>
        using rebind_t = xfunctor_view<F, E>;

        template <class E>
        rebind_t<E> build_functor_view(E&& e) const;

    private:

        using temporary_type = typename xcontainer_inner_types<self_type>::temporary_type;
        void assign_temporary_impl(temporary_type&& tmp);
        friend class xview_semantic<self_type>;
        friend class xaccessible<self_type>;
    };

    /********************************
     * xfunctor_adaptor declaration *
     ********************************/

    template <class F, class CT>
    class xfunctor_adaptor;

    template <class F, class CT>
    struct xcontainer_inner_types<xfunctor_adaptor<F, CT>>
    {
        using xexpression_type = std::decay_t<CT>;
        using undecay_expression = CT;
        using functor_type = std::decay_t<F>;
        using reference = typename functor_type::reference;
        using const_reference = typename functor_type::const_reference;
        using size_type = typename xexpression_type::size_type;
        using temporary_type = typename xfunctor_view_temporary_type<F, xexpression_type>::type;
    };

    template <class F, class CT, class T>
    struct has_simd_interface<xfunctor_adaptor<F, CT>, T>
        : has_simd_interface<xfunctor_applier_base<xfunctor_adaptor<F, CT>>, T>
    {
    };

    /**
     * @class xfunctor_adaptor
     * @brief Adapt a container with a functor, forwarding methods such as resize / reshape.
     *
     * xfunctor_adaptor has a container semantics and can only be used with containers.
     * For a similar feature with a view semantics, one can use \ref xfunctor_view.
     *
     * @tparam F the functor type to be applied to the elements of specified expression.
     * @tparam CT the closure type of the \ref xexpression type underlying this view
     *
     * @sa xfunctor_view
     */
    template <class F, class CT>
    class xfunctor_adaptor : public xfunctor_applier_base<xfunctor_adaptor<F, CT>>,
                             public xcontainer_semantic<xfunctor_adaptor<F, CT>>,
                             public extension::xfunctor_view_base_t<F, CT>
    {
    public:

        using self_type = xfunctor_adaptor<F, CT>;
        using semantic_base = xcontainer_semantic<self_type>;
        using xexpression_type = std::decay_t<CT>;
        using base_type = xfunctor_applier_base<self_type>;
        using shape_type = typename base_type::shape_type;
        using strides_type = typename xexpression_type::strides_type;
        // constructors
        using xfunctor_applier_base<self_type>::xfunctor_applier_base;

        template <class E>
        self_type& operator=(const xexpression<E>& e);

        template <class E>
        disable_xexpression<E, self_type>& operator=(const E& e);

        template <class S = shape_type>
        auto resize(S&& shape, bool force = false);

        template <class S = shape_type>
        auto resize(S&& shape, layout_type l);

        template <class S = shape_type>
        auto resize(S&& shape, const strides_type& strides);

        template <class S = shape_type>
        auto & reshape(S&& shape, layout_type layout = base_type::static_layout) &;

    private:

        using temporary_type = typename xcontainer_inner_types<self_type>::temporary_type;
        void assign_temporary_impl(temporary_type&& tmp);
        friend class xcontainer_semantic<self_type>;
        friend class xaccessible<self_type>;
    };

    /*********************************
     * xfunctor_iterator declaration *
     *********************************/

    template <class R>
    struct xproxy_inner_types
    {
        using reference = R;
        using pointer = std::add_pointer_t<std::remove_reference_t<R>>;
    };

    namespace detail
    {
        template <class F, class IT>
        struct xfunctor_invoker
        {
            using type = decltype(std::declval<F>()(*(std::declval<IT>())));
        };

        template <class F, class IT>
        using xfunctor_invoker_t = typename xfunctor_invoker<F, IT>::type;
    }

    template <class F, class IT>
    class xfunctor_iterator : public xtl::xrandom_access_iterator_base<xfunctor_iterator<F, IT>,
                                                                       typename std::decay_t<F>::value_type,
                                                                       typename std::iterator_traits<IT>::difference_type,
                                                                       typename xproxy_inner_types<detail::xfunctor_invoker_t<F, IT>>::pointer,
                                                                       typename xproxy_inner_types<detail::xfunctor_invoker_t<F, IT>>::reference>
    {
    public:

        using functor_type = F;
        using subiterator_traits = std::iterator_traits<IT>;

        using proxy_inner = xproxy_inner_types<detail::xfunctor_invoker_t<F, IT>>;
        using value_type = typename functor_type::value_type;
        using reference = typename proxy_inner::reference;
        using pointer = typename proxy_inner::pointer;
        using difference_type = typename subiterator_traits::difference_type;
        using iterator_category = typename subiterator_traits::iterator_category;

        using self_type = xfunctor_iterator<F, IT>;

        xfunctor_iterator(const IT&, functor_type*);

        self_type& operator++();
        self_type& operator--();

        self_type& operator+=(difference_type n);
        self_type& operator-=(difference_type n);

        difference_type operator-(xfunctor_iterator rhs) const;

        reference operator*() const;
        pointer operator->() const;

        bool equal(const xfunctor_iterator& rhs) const;
        bool less_than(const xfunctor_iterator& rhs) const;

    private:

        IT m_it;
        functor_type* p_functor;
    };

    template <class F, class IT>
    bool operator==(const xfunctor_iterator<F, IT>& lhs,
                    const xfunctor_iterator<F, IT>& rhs);

    template <class F, class IT>
    bool operator<(const xfunctor_iterator<F, IT>& lhs,
                   const xfunctor_iterator<F, IT>& rhs);

    /********************************
     * xfunctor_stepper declaration *
     ********************************/

    template <class F, class ST>
    class xfunctor_stepper
    {
    public:

        using functor_type = F;

        using proxy_inner = xproxy_inner_types<detail::xfunctor_invoker_t<F, ST>>;
        using value_type = typename functor_type::value_type;
        using reference = typename proxy_inner::reference;
        using pointer = std::remove_reference_t<reference>*;
        using size_type = typename ST::size_type;
        using difference_type = typename ST::difference_type;

        using shape_type = typename ST::shape_type;

        xfunctor_stepper() = default;
        xfunctor_stepper(const ST&, functor_type*);

        reference operator*() const;

        void step(size_type dim);
        void step_back(size_type dim);
        void step(size_type dim, size_type n);
        void step_back(size_type dim, size_type n);
        void reset(size_type dim);
        void reset_back(size_type dim);

        void to_begin();
        void to_end(layout_type);

    private:

        ST m_stepper;
        functor_type* p_functor;
    };

    /****************************************
     * xfunctor_applier_base implementation *
     ****************************************/

    /**
     * @name Constructors
     */
    //@{

    /**
     * Constructs an xfunctor_applier_base expression wrappering the specified \ref xexpression.
     *
     * @param e the underlying expression
     */
    template <class D>
    inline xfunctor_applier_base<D>::xfunctor_applier_base(undecay_expression e) noexcept
        : m_e(e), m_functor(functor_type())
    {
    }

    /**
    * Constructs an xfunctor_applier_base expression wrappering the specified \ref xexpression.
    *
    * @param func the functor to be applied to the elements of the underlying expression.
    * @param e the underlying expression
    */
    template <class D>
    template <class Func, class E>
    inline xfunctor_applier_base<D>::xfunctor_applier_base(Func&& func, E&& e) noexcept
        : m_e(std::forward<E>(e)), m_functor(std::forward<Func>(func))
    {
    }
    //@}

    /**
     * @name Size and shape
     */
    /**
     * Returns the size of the expression.
     */
    template <class D>
    inline auto xfunctor_applier_base<D>::size() const noexcept -> size_type
    {
        return m_e.size();
    }

    /**
     * Returns the shape of the expression.
     */
    template <class D>
    inline auto xfunctor_applier_base<D>::shape() const noexcept -> const inner_shape_type&
    {
        return m_e.shape();
    }

    /**
     * Returns the strides of the expression.
     */
    template <class D>
    inline auto xfunctor_applier_base<D>::strides() const noexcept -> const inner_strides_type&
    {
        return m_e.strides();
    }

    /**
     * Returns the backstrides of the expression.
     */
    template <class D>
    inline auto xfunctor_applier_base<D>::backstrides() const noexcept -> const inner_backstrides_type&
    {
        return m_e.backstrides();
    }

    /**
     * Returns the layout_type of the expression.
     */
    template <class D>
    inline layout_type xfunctor_applier_base<D>::layout() const noexcept
    {
        return m_e.layout();
    }

    template <class D>
    inline bool xfunctor_applier_base<D>::is_contiguous() const noexcept
    {
        return m_e.is_contiguous();
    }
    //@}

    /**
     * @name Data
     */
    /**
     * Returns a reference to the element at the specified position in the expression.
     * @param args a list of indices specifying the position in the function. Indices
     * must be unsigned integers, the number of indices should be equal or greater than
     * the number of dimensions of the expression.
     */
    template <class D>
    template <class... Args>
    inline auto xfunctor_applier_base<D>::operator()(Args... args) -> reference
    {
        XTENSOR_TRY(check_index(shape(), args...));
        XTENSOR_CHECK_DIMENSION(shape(), args...);
        return m_functor(m_e(args...));
    }

    /**
     * Returns a reference to the element at the specified position in the expression.
     * @param args a list of indices specifying the position in the expression. Indices
     * must be unsigned integers, the number of indices must be equal to the number of
     * dimensions of the expression, else the behavior is undefined.
     *
     * @warning This method is meant for performance, for expressions with a dynamic
     * number of dimensions (i.e. not known at compile time). Since it may have
     * undefined behavior (see parameters), operator() should be preferred whenever
     * it is possible.
     * @warning This method is NOT compatible with broadcasting, meaning the following
     * code has undefined behavior:
     * \code{.cpp}
     * xt::xarray<double> a = {{0, 1}, {2, 3}};
     * xt::xarray<double> b = {0, 1};
     * auto fd = a + b;
     * double res = fd.unchecked(0, 1);
     * \endcode
     */
    template <class D>
    template <class... Args>
    inline auto xfunctor_applier_base<D>::unchecked(Args... args) -> reference
    {
        return m_functor(m_e.unchecked(args...));
    }

    /**
     * Returns a reference to the element at the specified position in the expression.
     * @param first iterator starting the sequence of indices
     * @param last iterator ending the sequence of indices
     * The number of indices in the sequence should be equal to or greater
     * than the number of dimensions of the function.
     */
    template <class D>
    template <class IT>
    inline auto xfunctor_applier_base<D>::element(IT first, IT last) -> reference
    {
        XTENSOR_TRY(check_element_index(shape(), first, last));
        return m_functor(m_e.element(first, last));
    }

    /**
     * Returns a constant reference to the element at the specified position in the expression.
     * @param args a list of indices specifying the position in the function. Indices
     * must be unsigned integers, the number of indices should be equal or greater than
     * the number of dimensions of the expression.
     */
    template <class D>
    template <class... Args>
    inline auto xfunctor_applier_base<D>::operator()(Args... args) const -> const_reference
    {
        XTENSOR_TRY(check_index(shape(), args...));
        XTENSOR_CHECK_DIMENSION(shape(), args...);
        return m_functor(m_e(args...));
    }

    /**
     * Returns a constant reference to the element at the specified position in the expression.
     * @param args a list of indices specifying the position in the expression. Indices
     * must be unsigned integers, the number of indices must be equal to the number of
     * dimensions of the expression, else the behavior is undefined.
     *
     * @warning This method is meant for performance, for expressions with a dynamic
     * number of dimensions (i.e. not known at compile time). Since it may have
     * undefined behavior (see parameters), operator() should be prefered whenever
     * it is possible.
     * @warning This method is NOT compatible with broadcasting, meaning the following
     * code has undefined behavior:
     * \code{.cpp}
     * xt::xarray<double> a = {{0, 1}, {2, 3}};
     * xt::xarray<double> b = {0, 1};
     * auto fd = a + b;
     * double res = fd.uncheked(0, 1);
     * \endcode
     */
    template <class D>
    template <class... Args>
    inline auto xfunctor_applier_base<D>::unchecked(Args... args) const -> const_reference
    {
        return m_functor(m_e.unchecked(args...));
    }

    /**
     * Returns a constant reference to the element at the specified position in the expression.
     * @param first iterator starting the sequence of indices
     * @param last iterator ending the sequence of indices
     * The number of indices in the sequence should be equal to or greater
     * than the number of dimensions of the function.
     */
    template <class D>
    template <class IT>
    inline auto xfunctor_applier_base<D>::element(IT first, IT last) const -> const_reference
    {
        XTENSOR_TRY(check_element_index(shape(), first, last));
        return m_functor(m_e.element(first, last));
    }

    /**
     * Returns a reference to the underlying expression of the view.
     */
    template <class D>
    inline auto xfunctor_applier_base<D>::expression() noexcept -> xexpression_type&
    {
        return m_e;
    }

    /**
     * Returns a consttant reference to the underlying expression of the view.
     */
    template <class D>
    inline auto xfunctor_applier_base<D>::expression() const noexcept -> const xexpression_type&
    {
        return m_e;
    }
    //@}

    /**
     * @name Broadcasting
     */
    //@{
    /**
     * Broadcast the shape of the function to the specified parameter.
     * @param shape the result shape
     * @param reuse_cache boolean for reusing a previously computed shape
     * @return a boolean indicating whether the broadcasting is trivial
     */
    template <class D>
    template <class S>
    inline bool xfunctor_applier_base<D>::broadcast_shape(S& shape, bool reuse_cache) const
    {
        return m_e.broadcast_shape(shape, reuse_cache);
    }

    /**
    * Checks whether the xfunctor_applier_base can be linearly assigned to an expression
    * with the specified strides.
    * @return a boolean indicating whether a linear assign is possible
    */
    template <class D>
    template <class S>
    inline bool xfunctor_applier_base<D>::has_linear_assign(const S& strides) const
    {
        return m_e.has_linear_assign(strides);
    }
    //@}

    /**
     * @name Iterators
     */
    //@{
    /**
     * Returns an iterator to the first element of the expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::begin() noexcept
    {
        return xfunctor_iterator<functor_type, decltype(m_e.template begin<L>())>
            (m_e.template begin<L>(), &m_functor);
    }

    /**
     * Returns an iterator to the element following the last element
     * of the expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::end() noexcept
    {
        return xfunctor_iterator<functor_type, decltype(m_e.template end<L>())>
            (m_e.template end<L>(), &m_functor);
    }

    /**
     * Returns a constant iterator to the first element of the expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::begin() const noexcept
    {
        return this->template cbegin<L>();
    }

    /**
     * Returns a constant iterator to the element following the last element
     * of the expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::end() const noexcept
    {
        return this->template cend<L>();
    }

    /**
     * Returns a constant iterator to the first element of the expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::cbegin() const noexcept
    {
        return xfunctor_iterator<const functor_type, decltype(m_e.template cbegin<L>())>
            (m_e.template cbegin<L>(), &m_functor);
    }

    /**
     * Returns a constant iterator to the element following the last element
     * of the expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::cend() const noexcept
    {
        return xfunctor_iterator<const functor_type, decltype(m_e.template cend<L>())>
            (m_e.template cend<L>(), &m_functor);
    }
    //@}

    /**
     * @name Broadcast iterators
     */
    //@{
    /**
     * Returns a constant iterator to the first element of the expression. The
     * iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::begin(const S& shape) noexcept -> broadcast_iterator<S, L>
    {
        return broadcast_iterator<S, L>(m_e.template begin<S, L>(shape), &m_functor);
    }

    /**
     * Returns a constant iterator to the element following the last element of the
     * expression. The iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::end(const S& shape) noexcept -> broadcast_iterator<S, L>
    {
        return broadcast_iterator<S, L>(m_e.template end<S, L>(shape), &m_functor);
    }

    /**
     * Returns a constant iterator to the first element of the expression. The
     * iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::begin(const S& shape) const noexcept -> const_broadcast_iterator<S, L>
    {
        return cbegin<S, L>(shape);
    }

    /**
     * Returns a constant iterator to the element following the last element of the
     * expression. The iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::end(const S& shape) const noexcept -> const_broadcast_iterator<S, L>
    {
        return cend<S, L>(shape);
    }

    /**
     * Returns a constant iterator to the first element of the expression. The
     * iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::cbegin(const S& shape) const noexcept -> const_broadcast_iterator<S, L>
    {
        return const_broadcast_iterator<S, L>(m_e.template cbegin<S, L>(shape), &m_functor);
    }

    /**
     * Returns a constant iterator to the element following the last element of the
     * expression. The iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::cend(const S& shape) const noexcept -> const_broadcast_iterator<S, L>
    {
        return const_broadcast_iterator<S, L>(m_e.template cend<S, L>(shape), &m_functor);
    }
    //@}

    /**
     * @name Reverse iterators
     */
    //@{
    /**
     * Returns an iterator to the first element of the reversed expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::rbegin() noexcept
    {
        return xfunctor_iterator<functor_type, decltype(m_e.template rbegin<L>())>
            (m_e.template rbegin<L>(), &m_functor);
    }

    /**
     * Returns an iterator to the element following the last element
     * of the reversed expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::rend() noexcept
    {
        return xfunctor_iterator<functor_type, decltype(m_e.template rend<L>())>
            (m_e.template rend<L>(), &m_functor);
    }

    /**
     * Returns a constant iterator to the first element of the reversed expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::rbegin() const noexcept
    {
        return this->template crbegin<L>();
    }

    /**
     * Returns a constant iterator to the element following the last element
     * of the reversed expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::rend() const noexcept
    {
        return this->template crend<L>();
    }

    /**
     * Returns a constant iterator to the first element of the reversed expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::crbegin() const noexcept
    {
        return xfunctor_iterator<const functor_type, decltype(m_e.template rbegin<L>())>
            (m_e.template rbegin<L>(), &m_functor);
    }

    /**
     * Returns a constant iterator to the element following the last element
     * of the reversed expression.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <layout_type L>
    inline auto xfunctor_applier_base<D>::crend() const noexcept
    {
        return xfunctor_iterator<const functor_type, decltype(m_e.template rend<L>())>
            (m_e.template rend<L>(), &m_functor);
    }
    //@}

    /**
     * @name Reverse broadcast iterators
     */
    /**
     * Returns an iterator to the first element of the expression. The
     * iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::rbegin(const S& shape) noexcept -> reverse_broadcast_iterator<S, L>
    {
        return reverse_broadcast_iterator<S, L>(m_e.template rbegin<S, L>(shape), &m_functor);
    }

    /**
     * Returns an iterator to the element following the last element of the
     * reversed expression. The iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::rend(const S& shape) noexcept -> reverse_broadcast_iterator<S, L>
    {
        return reverse_broadcast_iterator<S, L>(m_e.template rend<S, L>(shape), &m_functor);
    }

    /**
     * Returns a constant iterator to the first element of the reversed expression.
     * The iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::rbegin(const S& shape) const noexcept -> const_reverse_broadcast_iterator<S, L>
    {
        return crbegin<S, L>(shape);
    }

    /**
     * Returns a constant iterator to the element following the last element
     * of the reversed expression.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::rend(const S& /*shape*/) const noexcept -> const_reverse_broadcast_iterator<S, L>
    {
        return crend<S, L>();
    }

    /**
     * Returns a constant iterator to the first element of the reversed expression.
     * The iteration is broadcasted to the specified shape.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::crbegin(const S& /*shape*/) const noexcept -> const_reverse_broadcast_iterator<S, L>
    {
        return const_reverse_broadcast_iterator<S, L>(m_e.template crbegin<S, L>(), &m_functor);
    }

    /**
     * Returns a constant iterator to the element following the last element
     * of the reversed expression.
     * @param shape the shape used for broadcasting
     * @tparam S type of the \c shape parameter.
     * @tparam L order used for the traversal. Default value is \c XTENSOR_DEFAULT_TRAVERSAL.
     */
    template <class D>
    template <class S, layout_type L>
    inline auto xfunctor_applier_base<D>::crend(const S& shape) const noexcept -> const_reverse_broadcast_iterator<S, L>
    {
        return const_reverse_broadcast_iterator<S, L>(m_e.template crend<S, L>(shape), &m_functor);
    }
    //@}

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_begin() noexcept -> linear_iterator
    {
        return linear_iterator(m_e.linear_begin(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_end() noexcept -> linear_iterator
    {
        return linear_iterator(m_e.linear_end(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_begin() const noexcept -> const_linear_iterator
    {
        return const_linear_iterator(m_e.linear_begin(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_end() const noexcept -> const_linear_iterator
    {
        return const_linear_iterator(m_e.linear_end(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_cbegin() const noexcept -> const_linear_iterator
    {
        return const_linear_iterator(m_e.linear_cbegin(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_cend() const noexcept -> const_linear_iterator
    {
        return const_linear_iterator(m_e.linear_cend(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_rbegin() noexcept -> reverse_linear_iterator
    {
        return reverse_linear_iterator(m_e.linear_rbegin(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_rend() noexcept -> reverse_linear_iterator
    {
        return reverse_linear_iterator(m_e.linear_rend(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_rbegin() const noexcept -> const_reverse_linear_iterator
    {
        return const_reverse_linear_iterator(m_e.linear_rbegin(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_rend() const noexcept -> const_reverse_linear_iterator
    {
        return const_reverse_linear_iterator(m_e.linear_rend(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_crbegin() const noexcept -> const_reverse_linear_iterator
    {
        return const_reverse_linear_iterator(m_e.linear_crbegin(), &m_functor);
    }

    template <class D>
    inline auto xfunctor_applier_base<D>::linear_crend() const noexcept -> const_reverse_linear_iterator
    {
        return const_reverse_linear_iterator(m_e.linear_crend(), &m_functor);
    }

    /***************
     * stepper api *
     ***************/

    template <class D>
    template <class S>
    inline auto xfunctor_applier_base<D>::stepper_begin(const S& shape) noexcept -> stepper
    {
        return stepper(m_e.stepper_begin(shape), &m_functor);
    }

    template <class D>
    template <class S>
    inline auto xfunctor_applier_base<D>::stepper_end(const S& shape, layout_type l) noexcept -> stepper
    {
        return stepper(m_e.stepper_end(shape, l), &m_functor);
    }

    template <class D>
    template <class S>
    inline auto xfunctor_applier_base<D>::stepper_begin(const S& shape) const noexcept -> const_stepper
    {
        const xexpression_type& const_m_e = m_e;
        return const_stepper(const_m_e.stepper_begin(shape), &m_functor);
    }

    template <class D>
    template <class S>
    inline auto xfunctor_applier_base<D>::stepper_end(const S& shape, layout_type l) const noexcept -> const_stepper
    {
        const xexpression_type& const_m_e = m_e;
        return const_stepper(const_m_e.stepper_end(shape, l), &m_functor);
    }

    /********************************
     * xfunctor_view implementation *
     ********************************/

    /**
     * @name Extended copy semantic
     */
    //@{
    /**
     * The extended assignment operator.
     */
    template <class F, class CT>
    template <class E>
    inline auto xfunctor_view<F, CT>::operator=(const xexpression<E>& e) -> self_type&
    {
        bool cond = (e.derived_cast().shape().size() == this->dimension()) &&
                     std::equal(this->shape().begin(), this->shape().end(), e.derived_cast().shape().begin());
        if (!cond)
        {
            semantic_base::operator=(broadcast(e.derived_cast(), this->shape()));
        }
        else
        {
            semantic_base::operator=(e);
        }
        return *this;
    }
    //@}

    template <class F, class CT>
    template <class E>
    inline auto xfunctor_view<F, CT>::operator=(const E& e) -> disable_xexpression<E, self_type>&
    {
        std::fill(this->begin(), this->end(), e);
        return *this;
    }

    template <class F, class CT>
    inline void xfunctor_view<F, CT>::assign_temporary_impl(temporary_type&& tmp)
    {
        std::copy(tmp.cbegin(), tmp.cend(), this->begin());
    }

    template <class F, class CT>
    template <class E>
    inline auto xfunctor_view<F, CT>::build_functor_view(E&& e) const -> rebind_t<E>
    {
        return rebind_t<E>((this->m_functor), std::forward<E>(e));
    }

    /***********************************
     * xfunctor_adaptor implementation *
     ***********************************/

    /**
     * @name Extended copy semantic
     */
    //@{
    /**
     * The extended assignment operator.
     */
    template <class F, class CT>
    template <class E>
    inline auto xfunctor_adaptor<F, CT>::operator=(const xexpression<E>& e) -> self_type&
    {
        const auto& de = e.derived_cast();
        this->m_e.resize(de.shape());

        if (this->layout() == de.layout())
        {
            std::copy(de.linear_begin(), de.linear_end(), this->linear_begin());
        }
        else
        {
            // note: does this even select the current layout of *this* for iteration?
            std::copy(de.begin(), de.end(), this->begin());
        }

        return *this;
    }
    //@}

    template <class F, class CT>
    template <class S>
    auto xfunctor_adaptor<F, CT>::resize(S&& shape, bool force)
    {
        this->m_e.resize(std::forward<S>(shape), force);
    }

    template <class F, class CT>
    template <class S>
    auto xfunctor_adaptor<F, CT>::resize(S&& shape, layout_type l)
    {
        this->m_e.resize(std::forward<S>(shape), l);
    }

    template <class F, class CT>
    template <class S>
    auto xfunctor_adaptor<F, CT>::resize(S&& shape, const strides_type& strides)
    {
        this->m_e.resize(std::forward<S>(shape), strides);
    }

    template <class F, class CT>
    template <class S>
    auto & xfunctor_adaptor<F, CT>::reshape(S&& shape, layout_type layout) &
    {
        this->m_e.reshape(std::forward<S>(shape), layout);
        return *this;
    }

    /************************************
     * xfunctor_iterator implementation *
     ************************************/

    template <class F, class IT>
    xfunctor_iterator<F, IT>::xfunctor_iterator(const IT& it, functor_type* pf)
        : m_it(it), p_functor(pf)
    {
    }

    template <class F, class IT>
    inline auto xfunctor_iterator<F, IT>::operator++() -> self_type&
    {
        ++m_it;
        return *this;
    }

    template <class F, class IT>
    inline auto xfunctor_iterator<F, IT>::operator--() -> self_type&
    {
        --m_it;
        return *this;
    }

    template <class F, class IT>
    inline auto xfunctor_iterator<F, IT>::operator+=(difference_type n) -> self_type&
    {
        m_it += n;
        return *this;
    }

    template <class F, class IT>
    inline auto xfunctor_iterator<F, IT>::operator-=(difference_type n) -> self_type&
    {
        m_it -= n;
        return *this;
    }

    template <class F, class IT>
    inline auto xfunctor_iterator<F, IT>::operator-(xfunctor_iterator rhs) const -> difference_type
    {
        return m_it - rhs.m_it;
    }

    template <class F, class IT>
    auto xfunctor_iterator<F, IT>::operator*() const -> reference
    {
        return (*p_functor)(*m_it);
    }

    template <class F, class IT>
    auto xfunctor_iterator<F, IT>::operator->() const -> pointer
    {
        return &(operator*());
    }

    template <class F, class IT>
    auto xfunctor_iterator<F, IT>::equal(const xfunctor_iterator& rhs) const -> bool
    {
        return m_it == rhs.m_it;
    }

    template <class F, class IT>
    auto xfunctor_iterator<F, IT>::less_than(const xfunctor_iterator& rhs) const -> bool
    {
        return m_it < rhs.m_it;
    }

    template <class F, class IT>
    bool operator==(const xfunctor_iterator<F, IT>& lhs,
                    const xfunctor_iterator<F, IT>& rhs)
    {
        return lhs.equal(rhs);
    }

    template <class F, class IT>
    bool operator<(const xfunctor_iterator<F, IT>& lhs,
                   const xfunctor_iterator<F, IT>& rhs)
    {
        return !lhs.less_than(rhs);
    }

    /***********************************
     * xfunctor_stepper implementation *
     ***********************************/

    template <class F, class ST>
    xfunctor_stepper<F, ST>::xfunctor_stepper(const ST& stepper, functor_type* pf)
        : m_stepper(stepper), p_functor(pf)
    {
    }

    template <class F, class ST>
    auto xfunctor_stepper<F, ST>::operator*() const -> reference
    {
        return (*p_functor)(*m_stepper);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::step(size_type dim)
    {
        m_stepper.step(dim);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::step_back(size_type dim)
    {
        m_stepper.step_back(dim);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::step(size_type dim, size_type n)
    {
        m_stepper.step(dim, n);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::step_back(size_type dim, size_type n)
    {
        m_stepper.step_back(dim, n);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::reset(size_type dim)
    {
        m_stepper.reset(dim);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::reset_back(size_type dim)
    {
        m_stepper.reset_back(dim);
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::to_begin()
    {
        m_stepper.to_begin();
    }

    template <class F, class ST>
    void xfunctor_stepper<F, ST>::to_end(layout_type l)
    {
        m_stepper.to_end(l);
    }
}
#endif


text:
package com.indyzalab.appversioncontroller.version;

public class VersionConstant {

}


text:
package io.fabric8.mq.protocol.stomp;

import io.fabric8.mq.protocol.ProtocolException;
import org.apache.activemq.command.ActiveMQBytesMessage;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.transport.stomp.Stomp;
import org.apache.activemq.transport.stomp.StompFrame;
import org.apache.activemq.util.ByteArrayOutputStream;
import org.apache.activemq.util.ByteSequence;

import javax.jms.Destination;
import javax.jms.JMSException;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Implements ActiveMQ 4.0 translations
 */
public class LegacyFrameTranslator implements FrameTranslator {

    public ActiveMQMessage convertFrame(StompProtocolConverter converter, StompFrame command) throws JMSException, ProtocolException {
        final Map<?, ?> headers = command.getHeaders();
        final ActiveMQMessage msg;
        /*
         * To reduce the complexity of this method perhaps a Chain of Responsibility
         * would be a better implementation
         */
        if (headers.containsKey(Stomp.Headers.AMQ_MESSAGE_TYPE)) {
            String intendedType = (String) headers.get(Stomp.Headers.AMQ_MESSAGE_TYPE);
            if (intendedType.equalsIgnoreCase("text")) {
                ActiveMQTextMessage text = new ActiveMQTextMessage();
                try {
                    ByteArrayOutputStream bytes = new ByteArrayOutputStream(command.getContent().length + 4);
                    DataOutputStream data = new DataOutputStream(bytes);
                    data.writeInt(command.getContent().length);
                    data.write(command.getContent());
                    text.setContent(bytes.toByteSequence());
                    data.close();
                } catch (Throwable e) {
                    throw new ProtocolException("Text could not bet set: " + e, false, e);
                }
                msg = text;
            } else if (intendedType.equalsIgnoreCase("bytes")) {
                ActiveMQBytesMessage byteMessage = new ActiveMQBytesMessage();
                byteMessage.writeBytes(command.getContent());
                msg = byteMessage;
            } else {
                throw new ProtocolException("Unsupported message type '" + intendedType + "'", false);
            }
        } else if (headers.containsKey(Stomp.Headers.CONTENT_LENGTH)) {
            headers.remove(Stomp.Headers.CONTENT_LENGTH);
            ActiveMQBytesMessage bm = new ActiveMQBytesMessage();
            bm.writeBytes(command.getContent());
            msg = bm;
        } else {
            ActiveMQTextMessage text = new ActiveMQTextMessage();
            try {
                ByteArrayOutputStream bytes = new ByteArrayOutputStream(command.getContent().length + 4);
                DataOutputStream data = new DataOutputStream(bytes);
                data.writeInt(command.getContent().length);
                data.write(command.getContent());
                text.setContent(bytes.toByteSequence());
                data.close();
            } catch (Throwable e) {
                throw new ProtocolException("Text could not bet set: " + e, false, e);
            }
            msg = text;
        }
        Helper.copyStandardHeadersFromFrameToMessage(converter, command, msg, this);
        return msg;
    }

    public StompFrame convertMessage(StompProtocolConverter converter, ActiveMQMessage message) throws IOException, JMSException {
        StompFrame command = new StompFrame();
        command.setAction(Stomp.Responses.MESSAGE);
        Map<String, String> headers = new HashMap<>(25);
        command.setHeaders(headers);

        Helper.copyStandardHeadersFromMessageToFrame(converter, message, command, this);

        if (message.getDataStructureType() == ActiveMQTextMessage.DATA_STRUCTURE_TYPE) {

            if (!message.isCompressed() && message.getContent() != null) {
                ByteSequence msgContent = message.getContent();
                if (msgContent.getLength() > 4) {
                    byte[] content = new byte[msgContent.getLength() - 4];
                    System.arraycopy(msgContent.data, 4, content, 0, content.length);
                    command.setContent(content);
                }
            } else {
                ActiveMQTextMessage msg = (ActiveMQTextMessage) message.copy();
                String messageText = msg.getText();
                if (messageText != null) {
                    command.setContent(msg.getText().getBytes("UTF-8"));
                }
            }

        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {

            ActiveMQBytesMessage msg = (ActiveMQBytesMessage) message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int) msg.getBodyLength()];
            msg.readBytes(data);

            headers.put(Stomp.Headers.CONTENT_LENGTH, Integer.toString(data.length));
            command.setContent(data);
        }

        return command;
    }

    public String convertDestination(StompProtocolConverter converter, Destination d) {
        if (d == null) {
            return null;
        }
        ActiveMQDestination activeMQDestination = (ActiveMQDestination) d;
        String physicalName = activeMQDestination.getPhysicalName();

        String rc = converter.getCreatedTempDestinationName(activeMQDestination);
        if (rc != null) {
            return rc;
        }

        StringBuilder buffer = new StringBuilder();
        if (activeMQDestination.isQueue()) {
            if (activeMQDestination.isTemporary()) {
                buffer.append("/remote-temp-queue/");
            } else {
                buffer.append("/queue/");
            }
        } else {
            if (activeMQDestination.isTemporary()) {
                buffer.append("/remote-temp-topic/");
            } else {
                buffer.append("/topic/");
            }
        }
        buffer.append(physicalName);
        return buffer.toString();
    }

    public ActiveMQDestination convertDestination(StompProtocolConverter converter, String name, boolean forceFallback) throws ProtocolException {
        if (name == null) {
            return null;
        }

        // in case of space padding by a client we trim for the initial detection, on fallback use
        // the un-trimmed value.
        String originalName = name;
        name = name.trim();

        if (name.startsWith("/queue/")) {
            String qName = name.substring("/queue/".length(), name.length());
            return ActiveMQDestination.createDestination(qName, ActiveMQDestination.QUEUE_TYPE);
        } else if (name.startsWith("/topic/")) {
            String tName = name.substring("/topic/".length(), name.length());
            return ActiveMQDestination.createDestination(tName, ActiveMQDestination.TOPIC_TYPE);
        } else if (name.startsWith("/remote-temp-queue/")) {
            String tName = name.substring("/remote-temp-queue/".length(), name.length());
            return ActiveMQDestination.createDestination(tName, ActiveMQDestination.TEMP_QUEUE_TYPE);
        } else if (name.startsWith("/remote-temp-topic/")) {
            String tName = name.substring("/remote-temp-topic/".length(), name.length());
            return ActiveMQDestination.createDestination(tName, ActiveMQDestination.TEMP_TOPIC_TYPE);
        } else if (name.startsWith("/temp-queue/")) {
            return converter.createTempDestination(name, false);
        } else if (name.startsWith("/temp-topic/")) {
            return converter.createTempDestination(name, true);
        } else {
            if (forceFallback) {
                try {
                    ActiveMQDestination fallback = ActiveMQDestination.getUnresolvableDestinationTransformer().transform(originalName);
                    if (fallback != null) {
                        return fallback;
                    }
                } catch (JMSException e) {
                    throw new ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP destinations "
                                                    + "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/", false, e);
                }
            }
            throw new ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP destinations "
                                            + "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
        }
    }

}


text:
from flask import session

from indico.core import signals
from indico.core.db import db
from indico.modules.events.logs.models.entries import EventLogKind, EventLogRealm
from indico.modules.events.logs.util import make_diff_log
from indico.modules.events.models.events import EventType
from indico.modules.events.sessions import COORDINATOR_PRIV_SETTINGS, COORDINATOR_PRIV_TITLES, logger, session_settings
from indico.modules.events.sessions.models.blocks import SessionBlock
from indico.modules.events.sessions.models.sessions import Session
from indico.util.i18n import orig_string

def create_session(event, data):
    """
    Create a new session with the information passed in the `data` argument.
    """
    event_session = Session(event=event)
    event_session.populate_from_dict(data)
    db.session.flush()
    event.log(EventLogRealm.management, EventLogKind.positive, 'Sessions',
              f'Session "{event_session.title}" has been created', session.user,
              meta={'session_id': event_session.id})
    logger.info('Session %s created by %s', event_session, session.user)
    return event_session

def create_session_block(session_, data):
    block = SessionBlock(session=session_)
    block.populate_from_dict(data)
    db.session.flush()
    session_.event.log(EventLogRealm.management, EventLogKind.positive, 'Sessions',
                       'Session block "{}" for session "{}" has been created'
                       .format(block.title, session_.title), session.user,
                       meta={'session_block_id': block.id})
    logger.info("Session block %s created by %s", block, session.user)
    return block

def update_session(event_session, data):
    """Update a session based on the information in the `data`."""
    event_session.populate_from_dict(data)
    db.session.flush()
    signals.event.session_updated.send(event_session)
    event_session.event.log(EventLogRealm.management, EventLogKind.change, 'Sessions',
                            f'Session "{event_session.title}" has been updated', session.user,
                            meta={'session_id': event_session.id})
    logger.info('Session %s modified by %s', event_session, session.user)

def _delete_session_timetable_entries(event_session):
    for block in event_session.blocks:
        for contribution in block.contributions:
            if contribution.timetable_entry:
                db.session.delete(contribution.timetable_entry)
        if not block.timetable_entry:
            continue
        for child_block in block.timetable_entry.children:
            db.session.delete(child_block)
        db.session.delete(block.timetable_entry)

def delete_session(event_session):
    """Delete session from the event."""
    event_session.is_deleted = True
    for contribution in event_session.contributions[:]:
        contribution.session = None
    _delete_session_timetable_entries(event_session)
    signals.event.session_deleted.send(event_session)
    event_session.event.log(EventLogRealm.management, EventLogKind.negative, 'Sessions',
                            f'Session "{event_session.title}" has been deleted', session.user,
                            meta={'session_id': event_session.id})
    logger.info('Session %s deleted by %s', event_session, session.user)

def update_session_block(session_block, data):
    """Update a session block with data passed in the `data` argument."""
    from indico.modules.events.timetable.operations import update_timetable_entry

    start_dt = data.pop('start_dt', None)
    if start_dt is not None:
        session_block.timetable_entry.move(start_dt)
        update_timetable_entry(session_block.timetable_entry, {'start_dt': start_dt})
    session_block.populate_from_dict(data)
    db.session.flush()
    signals.event.session_block_updated.send(session_block)
    session_block.event.log(EventLogRealm.management, EventLogKind.change, 'Sessions',
                            f'Session block "{session_block.title}" has been updated', session.user,
                            meta={'session_block_id': session_block.id})
    logger.info('Session block %s modified by %s', session_block, session.user)

def delete_session_block(session_block):
    from indico.modules.events.contributions.operations import delete_contribution
    from indico.modules.events.timetable.operations import delete_timetable_entry
    session_ = session_block.session
    event = session_.event
    unschedule_contribs = session_.event.type_ == EventType.conference
    for contribution in session_block.contributions[:]:
        contribution.session_block = None
        if unschedule_contribs:
            delete_timetable_entry(contribution.timetable_entry, log=False)
        else:
            delete_contribution(contribution)
    for entry in session_block.timetable_entry.children[:]:
        delete_timetable_entry(entry, log=False)
    delete_timetable_entry(session_block.timetable_entry, log=False)
    signals.event.session_block_deleted.send(session_block)
    if session_block in session_.blocks:
        session_.blocks.remove(session_block)
    if not session_.blocks and session_.event.type != 'conference':
        delete_session(session_)
    db.session.flush()
    event.log(EventLogRealm.management, EventLogKind.negative, 'Sessions',
              f'Session block "{session_block.title}" has been deleted', session.user,
              meta={'session_block_id': session_block.id})
    logger.info('Session block %s deleted by %s', session_block, session.user)

def update_session_coordinator_privs(event, data):
    changes = {}
    for priv, enabled in data.items():
        setting = COORDINATOR_PRIV_SETTINGS[priv]
        if session_settings.get(event, setting) == enabled:
            continue
        session_settings.set(event, setting, enabled)
        changes[priv] = (not enabled, enabled)
    db.session.flush()
    logger.info('Session coordinator privs of event %r updated with %r by %r', event, data, session.user)
    if changes:
        log_fields = {priv: orig_string(title) for priv, title in COORDINATOR_PRIV_TITLES.items()}
        event.log(EventLogRealm.management, EventLogKind.change, 'Sessions', 'Coordinator privileges updated',
                  session.user, data={'Changes': make_diff_log(changes, log_fields)})


text:
@interface MoviesTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *synopsisLabel;
@property (weak, nonatomic) IBOutlet UIImageView *posterImgView;

@end


text:
import { Component, OnInit } from '@angular/core';
import { DataService, Person } from '../data.service';
import { Observable } from 'rxjs';

@Component({
    selector: 'data-source-backend-example',
    templateUrl: './data-source-backend-example.component.html',
    styleUrls: ['./data-source-backend-example.component.scss']
})
export class DataSourceBackendExampleComponent implements OnInit {

    people$: Observable<Person[]>;
    selectedPersonId = '5a15b13c36e7a7f00cf0d7cb';

    constructor(private dataService: DataService) {
    }

    ngOnInit() {
        this.people$ = this.dataService.getPeople();
    }

}


text:
var Game = {};

Game.Manager = function() {
  var ew = this._enjinWorld = new EnJin.World({
    renderer: new EnJin.CanvasRenderer(
      document.querySelector('canvas'),
      1524, 1143
    ),
    debug: true,
    pixelRendering: true
  });

  ew.addImage('playerSprite', 'assets/spritesheet_players.png');
  ew.addImage('groundSprite', 'assets/spritesheet_ground.png');
  ew.addSound('playerJump', 'jump.mp3', 0.5);

  this._startLoadingScrene();

  this._playerPrefs = {
    testFrameCount: 0
  };

  function onWindowResize() {
    ew
      .getRenderer()
        .scaleTo(window.innerWidth, window.innerHeight);
  }

  window.addEventListener('resize', onWindowResize);
  onWindowResize();

  window.addEventListener('keydown', function(){
    if(ew.inputs.key['80']) {
      if(!ew.isPaused()) {
        ew.setPaused(true);
      }
      else {
        ew.setPaused(false);
      }
    }
  });

  // first scene init
  new Game.MainMenu(this);
};

Game.Manager.prototype = {
  getEnjinWorld: function() {
    return this._enjinWorld;
  },
  getImages: function() {
    return this._images;
  },
  getSounds: function() {
    return this._sounds;
  },
  getPlayerPrefs: function() {
    return this._playerPrefs;
  },
  _startLoadingScrene: function() {
    var enjinWorld = this._enjinWorld,
        renderer = enjinWorld.getRenderer(),
        width = renderer.getWidth(),
        height = renderer.getHeight(),
        images = enjinWorld.getImages(),
        sounds = enjinWorld.getSounds(),
        preloadInterval;

    renderer.setFont('Arial', 32);
    renderer.textAlign('center');

    preloadInterval = setInterval(function(){
      var il = enjinWorld.getImagesLoaded(),
          it = Object.keys(images).length,
          sl = enjinWorld.getSoundsLoaded(),
          st = Object.keys(sounds).length;

      renderer.setColor(0, 0, 0);
      renderer.fillRect(0, 0, width, height);
      renderer.setColor(155, 216, 205);
      renderer.fillText('Loading...', width/2, height/2);
      renderer.fillText('Images: ' + il + ' / ' + it, width / 2, height - 140);
      renderer.fillText('Sounds: ' + sl + ' / ' + st, width / 2, height - 100);

      if(il === it && sl === st) {
        enjinWorld.init();
        clearInterval(preloadInterval);
      }
    }, 100);
  }
};


text:
package pt.caixamagica.versions.debian;

import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Jorge Simões
 */
public final class DebianVersionComparator implements Comparator<DebianVersion> {

    @Override
    public int compare(DebianVersion v1, DebianVersion v2) {
        // compare epoch
        int diff = (int) (v1.getEpoch() - v2.getEpoch());
        if (diff != 0)
            return diff;

        // compare upstream version
        diff = compare(v1.getUpstreamVersion().getVersion(), v2.getUpstreamVersion().getVersion());
        if (diff != 0)
            return diff;

        diff = v1.getUpstreamVersion().getQualifier() != null && v2.getUpstreamVersion().getQualifier() != null
                ? compare(v1.getUpstreamVersion().getQualifier(), v2.getUpstreamVersion().getQualifier())
                : v1.getUpstreamVersion().getQualifier() != null ? -1
                : v2.getUpstreamVersion().getQualifier() != null ? 1 : 0;
        if (diff != 0)
            return diff;

        diff = v1.getUpstreamVersion().getUpgrade() != null && v2.getUpstreamVersion().getUpgrade() != null
                ? compare(v1.getUpstreamVersion().getUpgrade(), v2.getUpstreamVersion().getUpgrade())
                : v1.getUpstreamVersion().getUpgrade() != null ? 1
                : v2.getUpstreamVersion().getUpgrade() != null ? -1 : 0;
        if (diff != 0)
            return diff;

        // compare revision
        if (v1.getDebianRevision() == null || v2.getDebianRevision() == null) {
            diff = v1.getDebianRevision() != null ? 1 : v2.getDebianRevision() != null ? -1 : 0;
            return diff;
        }

        diff = compare(v1.getDebianRevision().getRevision(), v2.getDebianRevision().getRevision());
        if (diff != 0)
            return diff;

        diff = v1.getDebianRevision().getRelease() != null && v2.getDebianRevision().getRelease() != null
                ? v1.getDebianRevision().getRelease().compareTo(v2.getDebianRevision().getRelease())
                : v1.getDebianRevision().getRelease() != null ? -1
                : v2.getDebianRevision().getRelease() != null ? 1 : 0;

        return diff;
    }

    static int compare(String v1, String v2) {
        Pattern pattern = Pattern.compile("(\\d+|\\p{L}+|[^\\p{LD}]+)");
        Matcher matcher1 = pattern.matcher(v1),
                matcher2 = pattern.matcher(v2);
        boolean matched1 = matcher1.find(),
                matched2 = matcher2.find();
        while (matched1 && matched2) {
            int diff = compareNumber(matcher1.group(), matcher2.group());
            if (diff != 0)
                return diff;
            matched1 = matcher1.find();
            matched2 = matcher2.find();
        }
        return matched1 ? 1 : matched2 ? -1 : 0;
    }

    private static int compareNumber(String v1, String v2) {
        if (isNumeric(v1) && isNumeric(v2)) return Long.signum(Long.parseLong(v1) - Long.parseLong(v2));
        return isNumeric(v1) ? -1 : isNumeric(v2) ? 1
                : !isAlpha(v1) && isAlpha(v2) ? 1 : isAlpha(v1) && !isAlpha(v2) ? -1
                : v1.compareTo(v2);
    }

    private static boolean isAlpha(String string) { return string.matches("\\p{Alpha}*"); }
    private static boolean isNumeric(String string) { return string.matches("\\d+"); }

}


text:
package com.koch.ambeth.util.collections;

import com.koch.ambeth.util.IPrintable;
import com.koch.ambeth.util.StringBuilderUtil;

public class SetEntry<K> implements ISetEntry<K>, IPrintable {
	protected final int hash;

	protected SetEntry<K> nextEntry;

	protected final K key;

	public SetEntry(int hash, K key, SetEntry<K> nextEntry) {
		this.hash = hash;
		this.key = key;
		this.nextEntry = nextEntry;
	}

	@Override
	public boolean isValid() {
		return true;
	}

	@Override
	public K getKey() {
		return key;
	}

	@Override
	public int getHash() {
		return hash;
	}

	@Override
	public SetEntry<K> getNextEntry() {
		return nextEntry;
	}

	public void setNextEntry(SetEntry<K> nextEntry) {
		this.nextEntry = nextEntry;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		toString(sb);
		return sb.toString();
	}

	@Override
	public void toString(StringBuilder sb) {
		StringBuilderUtil.appendPrintable(sb, getKey());
	}
}


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>Data Base Tools</title>

	Data Base Tools

 Classes para acesso a bancos de dados via AdodbPhp.