<commit_before>class SuplerForm {
    private options: RenderOptions;
    private idCounter: number = 0;

    constructor(private container: HTMLDivElement, customOptions: any) {
        this.options = new DefaultRenderOptions();
        Util.copyProperties(this.options, customOptions);
    }

    render(formJson) {
        this.container.innerHTML = this.formFromJson(formJson);
    }

    formFromJson(formJson) {
        var fields = formJson.fields;
        var html = "";
        Util.foreach(fields, (field, fieldJson) => {
            html += this.fieldFromJson(field, fieldJson) + "\n";
        });

        return html;
    }

    fieldFromJson(fieldName, fieldJson) {
        var fieldOptions = { "class": "form-control", "supler:fieldType": fieldJson.type, "supler:multiple": fieldJson.multiple };
        var id = this.nextId();

        switch(fieldJson.type) {
            case "string":
                return this.stringFieldFromJson(id, fieldName, fieldJson, fieldOptions);

            case "integer":
                return this.options.renderIntegerField(fieldJson.label, id, fieldName, fieldJson.value, fieldOptions);

            case "subform":
                return this.subformFieldFromJson(id, fieldName, fieldJson);

            default:
                return "";
        }
    }

    stringFieldFromJson(id, fieldName, fieldJson, fieldOptions) {
        if (fieldJson.possible_values) {
            if (fieldJson.multiple) {
                return "";
            } else {
                return this.options.renderSingleChoiceSelectField(fieldJson.label, id, fieldName, fieldJson.value,
                    fieldJson.possible_values, fieldOptions);
            }
        } else {
            return this.options.renderStringField(fieldJson.label, id, fieldName, fieldJson.value, fieldOptions);
        }
    }

    subformFieldFromJson(id, fieldName, fieldJson) {
        var html = "";
        html += HtmlUtil.renderTag("fieldset", {"id": id, "name": fieldName }, false);
        html += "\n";
        html += "<legend>" + fieldJson.label + "</legend>\n";

        if (fieldJson.multiple) {
            for (var i in fieldJson.value) {
                html += HtmlUtil.renderTag("div", {
                    "class": "well",
                    "supler:fieldType": "subform",
                    "supler:fieldName": fieldName,
                    "supler:multiple": fieldJson.multiple }, false);
                html += this.formFromJson(fieldJson.value[i]);
                html += "</div>\n";
            }
        } else {

        }

        html += "</fieldset>\n";
        return html;
    }

    getValue() {
        return new ReadFormValues().getValueFrom(this.container);
    }

    nextId() {
        this.idCounter += 1;
        return "id" + this.idCounter;
    }
}
<commit_msg>Making things private<commit_after>class SuplerForm {
    private options: RenderOptions;
    private idCounter: number = 0;

    constructor(private container: HTMLDivElement, customOptions: any) {
        this.options = new DefaultRenderOptions();
        Util.copyProperties(this.options, customOptions);
    }

    render(formJson) {
        this.container.innerHTML = this.formFromJson(formJson);
    }

    private formFromJson(formJson) {
        var fields = formJson.fields;
        var html = "";
        Util.foreach(fields, (field, fieldJson) => {
            html += this.fieldFromJson(field, fieldJson) + "\n";
        });

        return html;
    }

    private fieldFromJson(fieldName, fieldJson) {
        var fieldOptions = { "class": "form-control", "supler:fieldType": fieldJson.type, "supler:multiple": fieldJson.multiple };
        var id = this.nextId();

        switch(fieldJson.type) {
            case "string":
                return this.stringFieldFromJson(id, fieldName, fieldJson, fieldOptions);

            case "integer":
                return this.options.renderIntegerField(fieldJson.label, id, fieldName, fieldJson.value, fieldOptions);

            case "subform":
                return this.subformFieldFromJson(id, fieldName, fieldJson);

            default:
                return "";
        }
    }

    private stringFieldFromJson(id, fieldName, fieldJson, fieldOptions) {
        if (fieldJson.possible_values) {
            if (fieldJson.multiple) {
                return "";
            } else {
                return this.options.renderSingleChoiceSelectField(fieldJson.label, id, fieldName, fieldJson.value,
                    fieldJson.possible_values, fieldOptions);
            }
        } else {
            return this.options.renderStringField(fieldJson.label, id, fieldName, fieldJson.value, fieldOptions);
        }
    }

    private subformFieldFromJson(id, fieldName, fieldJson) {
        var html = "";
        html += HtmlUtil.renderTag("fieldset", {"id": id, "name": fieldName }, false);
        html += "\n";
        html += "<legend>" + fieldJson.label + "</legend>\n";

        if (fieldJson.multiple) {
            for (var i in fieldJson.value) {
                html += HtmlUtil.renderTag("div", {
                    "class": "well",
                    "supler:fieldType": "subform",
                    "supler:fieldName": fieldName,
                    "supler:multiple": fieldJson.multiple }, false);
                html += this.formFromJson(fieldJson.value[i]);
                html += "</div>\n";
            }
        } else {

        }

        html += "</fieldset>\n";
        return html;
    }

    getValue() {
        return new ReadFormValues().getValueFrom(this.container);
    }

    private nextId() {
        this.idCounter += 1;
        return "id" + this.idCounter;
    }
}

{'fraction_non_alphanumeric': 0.12140350877192982, 'fraction_numerical': 0.0007017543859649122, 'mean_word_length': 1.9848167539267016, 'pattern_counts': {'":': 24, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3722809', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1515, 'n_words': 313}