<commit_before>/***************************************************************************
* Copyright (c) 2017, <NAME> and <NAME>                     *
*                                                                          *
* Distributed under the terms of the BSD 3-Clause License.                 *
*                                                                          *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XWIDGETS_NUMBER_HPP
#define XWIDGETS_NUMBER_HPP

#include "xwidget.hpp"

namespace xw
{
    /***********************
     * xnumber declaration *
     ***********************/

    template <class D>
    struct xnumber_traits;

    template <class D>
    class xnumber : public xwidget<D>
    {
    public:

        using base_type = xwidget<D>;
        using derived_type = D;

        xeus::xjson get_state() const;
        void apply_patch(const xeus::xjson&);

        using value_type = typename xnumber_traits<derived_type>::value_type;

        XPROPERTY(std::string, derived_type, description);

        XPROPERTY(value_type, derived_type, value);
        XPROPERTY(value_type, derived_type, min);
        XPROPERTY(value_type, derived_type, max, value_type(100));

    protected:

        xnumber();
        using base_type::base_type;

    private:

        void set_defaults();
    };

    /**************************
     * xnumber implementation *
     **************************/

    template <class D>
    inline xeus::xjson xnumber<D>::get_state() const
    {
        xeus::xjson state = base_type::get_state();

        XOBJECT_SET_PATCH_FROM_PROPERTY(value, state);
        XOBJECT_SET_PATCH_FROM_PROPERTY(min, state);
        XOBJECT_SET_PATCH_FROM_PROPERTY(max, state);

        return state;
    }

    template <class D>
    inline void xnumber<D>::apply_patch(const xeus::xjson& patch)
    {
        base_type::apply_patch(patch);

        XOBJECT_SET_PROPERTY_FROM_PATCH(value, patch);
        XOBJECT_SET_PROPERTY_FROM_PATCH(min, patch);
        XOBJECT_SET_PROPERTY_FROM_PATCH(max, patch);
    }

    template <class D>
    inline xnumber<D>::xnumber()
        : base_type()
    {
        set_defaults();
    }
<commit_msg>Add missing description update<commit_after>/***************************************************************************
* Copyright (c) 2017, <NAME> and <NAME>                     *
*                                                                          *
* Distributed under the terms of the BSD 3-Clause License.                 *
*                                                                          *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XWIDGETS_NUMBER_HPP
#define XWIDGETS_NUMBER_HPP

#include "xwidget.hpp"

namespace xw
{
    /***********************
     * xnumber declaration *
     ***********************/

    template <class D>
    struct xnumber_traits;

    template <class D>
    class xnumber : public xwidget<D>
    {
    public:

        using base_type = xwidget<D>;
        using derived_type = D;

        xeus::xjson get_state() const;
        void apply_patch(const xeus::xjson&);

        using value_type = typename xnumber_traits<derived_type>::value_type;

        XPROPERTY(std::string, derived_type, description);

        XPROPERTY(value_type, derived_type, value);
        XPROPERTY(value_type, derived_type, min);
        XPROPERTY(value_type, derived_type, max, value_type(100));

    protected:

        xnumber();
        using base_type::base_type;

    private:

        void set_defaults();
    };

    /**************************
     * xnumber implementation *
     **************************/

    template <class D>
    inline xeus::xjson xnumber<D>::get_state() const
    {
        xeus::xjson state = base_type::get_state();

        XOBJECT_SET_PATCH_FROM_PROPERTY(value, state);
        XOBJECT_SET_PATCH_FROM_PROPERTY(min, state);
        XOBJECT_SET_PATCH_FROM_PROPERTY(max, state);
        XOBJECT_SET_PATCH_FROM_PROPERTY(description, state);

        return state;
    }

    template <class D>
    inline void xnumber<D>::apply_patch(const xeus::xjson& patch)
    {
        base_type::apply_patch(patch);

        XOBJECT_SET_PROPERTY_FROM_PATCH(value, patch);
        XOBJECT_SET_PROPERTY_FROM_PATCH(min, patch);
        XOBJECT_SET_PROPERTY_FROM_PATCH(max, patch);
        XOBJECT_SET_PROPERTY_FROM_PATCH(description, patch);
    }

    template <class D>
    inline xnumber<D>::xnumber()
        : base_type()
    {
        set_defaults();
    }

{'fraction_non_alphanumeric': 0.18746041798606713, 'fraction_numerical': 0.0033776651889381466, 'mean_word_length': 2.4634502923976607, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5872666', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1269, 'n_words': 265}