<commit_before>package stexfires.io.htmltable;

import stexfires.core.Record;
import stexfires.core.message.RecordMessage;
import stexfires.util.LineSeparator;

import java.nio.charset.Charset;
import java.nio.charset.CodingErrorAction;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;

/**
 * @author <NAME>
 * @since 0.1
 */
public final class HtmlTableFileSpec {

    private final Charset charset;

    private final LineSeparator lineSeparator;
    private final String beforeTable;
    private final String afterTable;
    private final List<RecordMessage<Record>> recordMessages;
    private final CodingErrorAction codingErrorAction;

    @SafeVarargs
    public HtmlTableFileSpec(Charset charset, LineSeparator lineSeparator,
                             String beforeTable, String afterTable,
                             CodingErrorAction codingErrorAction,
                             RecordMessage<Record>... recordMessages) {
        Objects.requireNonNull(charset);
        Objects.requireNonNull(lineSeparator);
        Objects.requireNonNull(codingErrorAction);
        this.charset = charset;
        this.lineSeparator = lineSeparator;
        this.beforeTable = beforeTable;
        this.afterTable = afterTable;
        this.recordMessages = Collections.unmodifiableList(Arrays.asList(recordMessages));
        this.codingErrorAction = codingErrorAction;
    }

    public Charset getCharset() {
        return charset;
    }

    public LineSeparator getLineSeparator() {
        return lineSeparator;
    }

    public String getBeforeTable() {
        return beforeTable;
    }

    public String getAfterTable() {
        return afterTable;
    }

    public int recordMessagesSize() {
        return recordMessages.size();
    }

    public Stream<RecordMessage<Record>> streamOfRecordMessages() {
        return recordMessages.stream();
    }

    public CodingErrorAction getCodingErrorAction() {
        return codingErrorAction;
    }

}

<commit_msg>Refactor and enhance HtmlTableFileSpec<commit_after>package stexfires.io.htmltable;

import stexfires.core.Record;
import stexfires.core.message.RecordMessage;
import stexfires.util.LineSeparator;

import java.nio.charset.Charset;
import java.nio.charset.CodingErrorAction;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;

/**
 * @author <NAME>
 * @since 0.1
 */
public final class HtmlTableFileSpec {

    public static final CodingErrorAction DEFAULT_CODING_ERROR_ACTION = CodingErrorAction.REPORT;

    private final Charset charset;
    private final CodingErrorAction codingErrorAction;

    private final LineSeparator lineSeparator;
    private final String beforeTable;
    private final String afterTable;
    private final List<RecordMessage<Record>> recordMessages;

    @SafeVarargs
    public HtmlTableFileSpec(Charset charset, CodingErrorAction codingErrorAction,
                             LineSeparator lineSeparator,
                             String beforeTable, String afterTable,
                             RecordMessage<Record>... recordMessages) {
        Objects.requireNonNull(charset);
        Objects.requireNonNull(codingErrorAction);
        Objects.requireNonNull(lineSeparator);
        Objects.requireNonNull(recordMessages);
        this.charset = charset;
        this.codingErrorAction = codingErrorAction;
        this.lineSeparator = lineSeparator;
        this.beforeTable = beforeTable;
        this.afterTable = afterTable;
        this.recordMessages = Collections.unmodifiableList(Arrays.asList(recordMessages));
    }

    public static HtmlTableFileSpec write(Charset charset,
                                          LineSeparator lineSeparator,
                                          String beforeTable, String afterTable,
                                          RecordMessage<Record>... recordMessages) {
        return new HtmlTableFileSpec(charset, DEFAULT_CODING_ERROR_ACTION,
                lineSeparator,
                beforeTable, afterTable,
                recordMessages);
    }

    public static HtmlTableFileSpec write(Charset charset, CodingErrorAction codingErrorAction,
                                          LineSeparator lineSeparator,
                                          String beforeTable, String afterTable,
                                          RecordMessage<Record>... recordMessages) {
        return new HtmlTableFileSpec(charset, codingErrorAction,
                lineSeparator,
                beforeTable, afterTable,
                recordMessages);
    }

    public HtmlTableFile file(Path path) {
        return new HtmlTableFile(path, this);
    }

    public Charset getCharset() {
        return charset;
    }

    public CodingErrorAction getCodingErrorAction() {
        return codingErrorAction;
    }

    public LineSeparator getLineSeparator() {
        return lineSeparator;
    }

    public String getBeforeTable() {
        return beforeTable;
    }

    public String getAfterTable() {
        return afterTable;
    }

    public int recordMessagesSize() {
        return recordMessages.size();
    }

    public Stream<RecordMessage<Record>> streamOfRecordMessages() {
        return recordMessages.stream();
    }

}


{'fraction_non_alphanumeric': 0.07040176925912274, 'fraction_numerical': 0.0007371913011426465, 'mean_word_length': 2.5540275049115913, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '5010101', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1336, 'n_words': 300}