<commit_before>class DataBinding {

    constructor(object: Atomic.Serializable, attrInfo: Atomic.AttributeInfo, widget: Atomic.UIWidget) {

        this.object = object;
        this.attrInfo = attrInfo;
        this.widget = widget;

    }

    static createBinding(object: Atomic.Serializable, attrInfo: Atomic.AttributeInfo): DataBinding {

        var widget: Atomic.UIWidget = null;

        var fd = new Atomic.UIFontDescription();
        fd.id = "Vera";
        fd.size = 11;

        var enumSource = null;

        if (attrInfo.type == Atomic.VAR_BOOL) {

            var box = new Atomic.UICheckBox();
            box.skinBg = "TBGreyCheckBox";
            widget = box;
        }
        else if (attrInfo.type == Atomic.VAR_INT) {

            if (attrInfo.enumNames.length) {

                enumSource = new Atomic.UISelectItemSource();

                for (var i in attrInfo.enumNames) {

                    enumSource.addItem(new Atomic.UISelectItem(attrInfo.enumNames[i], (Number(i) + 1).toString()));

                }

                var button = new Atomic.UIButton();
                button.fontDescription = fd;
                button.text = "Enum Value!";
                var lp = new Atomic.UILayoutParams();
                lp.width = 140;
                button.layoutParams = lp;

                widget = button;

            } else {

                var field = new Atomic.UIEditField();
                field.textAlign = Atomic.UI_TEXT_ALIGN_CENTER;
                field.fontDescription = fd;
                field.skinBg = "TBAttrEditorField";

                var lp = new Atomic.UILayoutParams();
                lp.width = 140;
                field.layoutParams = lp;

                widget = field;
            }

        } else if (attrInfo.type == Atomic.VAR_FLOAT) {

            var field = new Atomic.UIEditField();
            field.textAlign = Atomic.UI_TEXT_ALIGN_CENTER;
            field.fontDescription = fd;
            field.skinBg = "TBAttrEditorField";

            var lp = new Atomic.UILayoutParams();
            lp.width = 140;
            field.layoutParams = lp;

            widget = field;

        }
        else if (attrInfo.type == Atomic.VAR_STRING) {

            var field = new Atomic.UIEditField();
            field.textAlign = Atomic.UI_TEXT_ALIGN_LEFT;
            field.skinBg = "TBAttrEditorField";;
            field.fontDescription = fd;
            var lp = new Atomic.UILayoutParams();
            lp.width = 140;
            field.layoutParams = lp;

            widget = field;
        }
        else if (attrInfo.type == Atomic.VAR_VECTOR3 || attrInfo.type == Atomic.VAR_QUATERNION) {
            var layout = new Atomic.UILayout();
            widget = layout;
            layout.spacing = 0;

            var lp = new Atomic.UILayoutParams();
            lp.width = 100;

            for (var i = 0; i < 3; i++) {
                var select = new Atomic.UIInlineSelect();
                select.id = String(i + 1);
                select.fontDescription = fd;
                select.skinBg = "InspectorTextAttrName";
                select.setLimits(-10000000, 10000000);
                var editlp = new Atomic.UILayoutParams();
                editlp.minWidth = 60;
                select.editFieldLayoutParams = editlp;
                select.layoutParams = lp;
                layout.addChild(select);
            }

        } else if (attrInfo.type == Atomic.VAR_COLOR) {
            var layout = new Atomic.UILayout();
            widget = layout;
            layout.spacing = 0;

            var lp = new Atomic.UILayoutParams();
            lp.width = 70;

            for (var i = 0; i < 4; i++) {

                var select = new Atomic.UIInlineSelect();
                select.id = String(i + 1);
                select.fontDescription = fd;
                select.setLimits(-10000000, 10000000);
                select.layoutParams = lp;
                layout.addChild(select);
            }

        }

        if (widget) {

            var binding = new DataBinding(object, attrInfo, widget);
            binding.enumSource = enumSource;
            return binding;

        }

        return null;

    }

    setWidgetValueFromObject() {
        if (this.widgetLocked)
            return;

        this.widgetLocked = true;

        var attrInfo = this.attrInfo;
        var object = this.object;
        var widget = this.widget;

        if (attrInfo.type == Atomic.VAR_BOOL) {
            var value = object.getAttribute(attrInfo.name);
            widget.value = (value ? 1 : 0);
        }
        else if (attrInfo.type == Atomic.VAR_VECTOR3) {

            var value = object.getAttribute(attrInfo.name);

            for (var i = 0; i < 3; i++) {

                var select = widget.getWidget((i + 1).toString());
                if (select)
                    select.value = value[i];
            }

        }
        else if (attrInfo.type == Atomic.VAR_QUATERNION) {

            var value = object.getAttribute(attrInfo.name);

            for (var i = 0; i < 3; i++) {

                var select = widget.getWidget((i + 1).toString());
                if (select)
                    select.value = value[i];
            }

        }
        else if (attrInfo.type == Atomic.VAR_STRING) {
            var value = object.getAttribute(attrInfo.name);
            widget.text = value;
        }
        else if (attrInfo.type == Atomic.VAR_FLOAT) {
            var value = object.getAttribute(attrInfo.name);
            widget.text = value.toString();
        }
        else if (attrInfo.type == Atomic.VAR_INT) {
            var value = object.getAttribute(attrInfo.name);

            if (attrInfo.enumNames.length) {
                widget.text = attrInfo.enumNames[value];
            }
            else {
                widget.text = value.toString();
            }
        }
        else if (attrInfo.type == Atomic.VAR_COLOR) {

            var value = object.getAttribute(attrInfo.name);

            for (var i = 0; i < 4; i++) {<commit_msg>Prettier numbers<commit_after>class DataBinding {

    constructor(object: Atomic.Serializable, attrInfo: Atomic.AttributeInfo, widget: Atomic.UIWidget) {

        this.object = object;
        this.attrInfo = attrInfo;
        this.widget = widget;

    }

    static createBinding(object: Atomic.Serializable, attrInfo: Atomic.AttributeInfo): DataBinding {

        var widget: Atomic.UIWidget = null;

        var fd = new Atomic.UIFontDescription();
        fd.id = "Vera";
        fd.size = 11;

        var enumSource = null;

        if (attrInfo.type == Atomic.VAR_BOOL) {

            var box = new Atomic.UICheckBox();
            box.skinBg = "TBGreyCheckBox";
            widget = box;
        }
        else if (attrInfo.type == Atomic.VAR_INT) {

            if (attrInfo.enumNames.length) {

                enumSource = new Atomic.UISelectItemSource();

                for (var i in attrInfo.enumNames) {

                    enumSource.addItem(new Atomic.UISelectItem(attrInfo.enumNames[i], (Number(i) + 1).toString()));

                }

                var button = new Atomic.UIButton();
                button.fontDescription = fd;
                button.text = "Enum Value!";
                var lp = new Atomic.UILayoutParams();
                lp.width = 140;
                button.layoutParams = lp;

                widget = button;

            } else {

                var field = new Atomic.UIEditField();
                field.textAlign = Atomic.UI_TEXT_ALIGN_CENTER;
                field.fontDescription = fd;
                field.skinBg = "TBAttrEditorField";

                var lp = new Atomic.UILayoutParams();
                lp.width = 140;
                field.layoutParams = lp;

                widget = field;
            }

        } else if (attrInfo.type == Atomic.VAR_FLOAT) {

            var field = new Atomic.UIEditField();
            field.textAlign = Atomic.UI_TEXT_ALIGN_CENTER;
            field.fontDescription = fd;
            field.skinBg = "TBAttrEditorField";

            var lp = new Atomic.UILayoutParams();
            lp.width = 140;
            field.layoutParams = lp;

            widget = field;

        }
        else if (attrInfo.type == Atomic.VAR_STRING) {

            var field = new Atomic.UIEditField();
            field.textAlign = Atomic.UI_TEXT_ALIGN_LEFT;
            field.skinBg = "TBAttrEditorField";;
            field.fontDescription = fd;
            var lp = new Atomic.UILayoutParams();
            lp.width = 140;
            field.layoutParams = lp;

            widget = field;
        }
        else if (attrInfo.type == Atomic.VAR_VECTOR3 || attrInfo.type == Atomic.VAR_QUATERNION) {
            var layout = new Atomic.UILayout();
            widget = layout;
            layout.spacing = 0;

            var lp = new Atomic.UILayoutParams();
            lp.width = 100;

            for (var i = 0; i < 3; i++) {
                var select = new Atomic.UIInlineSelect();
                select.id = String(i + 1);
                select.fontDescription = fd;
                select.skinBg = "InspectorTextAttrName";
                select.setLimits(-10000000, 10000000);
                var editlp = new Atomic.UILayoutParams();
                editlp.minWidth = 60;
                select.editFieldLayoutParams = editlp;
                select.layoutParams = lp;
                layout.addChild(select);
            }

        } else if (attrInfo.type == Atomic.VAR_COLOR) {
            var layout = new Atomic.UILayout();
            widget = layout;
            layout.spacing = 0;

            var lp = new Atomic.UILayoutParams();
            lp.width = 70;

            for (var i = 0; i < 4; i++) {

                var select = new Atomic.UIInlineSelect();
                select.id = String(i + 1);
                select.fontDescription = fd;
                select.setLimits(-10000000, 10000000);
                select.layoutParams = lp;
                layout.addChild(select);
            }

        }

        if (widget) {

            var binding = new DataBinding(object, attrInfo, widget);
            binding.enumSource = enumSource;
            return binding;

        }

        return null;

    }

    setWidgetValueFromObject() {
        if (this.widgetLocked)
            return;

        this.widgetLocked = true;

        var attrInfo = this.attrInfo;
        var object = this.object;
        var widget = this.widget;

        if (attrInfo.type == Atomic.VAR_BOOL) {
            var value = object.getAttribute(attrInfo.name);
            widget.value = (value ? 1 : 0);
        }
        else if (attrInfo.type == Atomic.VAR_VECTOR3) {

            var value = object.getAttribute(attrInfo.name);

            for (var i = 0; i < 3; i++) {

                var select = widget.getWidget((i + 1).toString());
                if (select)
                    select.value = value[i];
            }

        }
        else if (attrInfo.type == Atomic.VAR_QUATERNION) {

            var value = object.getAttribute(attrInfo.name);

            for (var i = 0; i < 3; i++) {

                var select = widget.getWidget((i + 1).toString());
                if (select)
                    select.value = value[i];
            }

        }
        else if (attrInfo.type == Atomic.VAR_STRING) {
            var value = object.getAttribute(attrInfo.name);
            widget.text = value;
        }
        else if (attrInfo.type == Atomic.VAR_FLOAT) {
            var value = object.getAttribute(attrInfo.name);
            widget.text = parseFloat(value.toFixed(5)).toString();
        }
        else if (attrInfo.type == Atomic.VAR_INT) {
            var value = object.getAttribute(attrInfo.name);

            if (attrInfo.enumNames.length) {
                widget.text = attrInfo.enumNames[value];
            }
            else {
                widget.text = value.toString();
            }
        }
        else if (attrInfo.type == Atomic.VAR_COLOR) {

            var value = object.getAttribute(attrInfo.name);

            for (var i = 0; i < 4; i++) {
{'fraction_non_alphanumeric': 0.10440282569410218, 'fraction_numerical': 0.012239198291440776, 'mean_word_length': 1.4561226548315513, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6638760', 'n_tokens_mistral': 3602, 'n_tokens_neox': 3203, 'n_words': 743}