<commit_before>package com.github.dreamhead.moco.recorder;

import static com.github.dreamhead.moco.Moco.template;
import static com.github.dreamhead.moco.Moco.text;
import static com.github.dreamhead.moco.Moco.with;

public class RecorderConfigurations {
    private RecorderGroup group;
    private RecorderTape tape;
    private RecorderIdentifier identifier;
    private ReplayModifier modifier;

    public static RecorderConfigurations create(final Iterable<RecorderConfig> configs) {
        RecorderConfigurations configurations = new RecorderConfigurations();

        for (RecorderConfig config : configs) {
            if (config.isFor(RecorderConfig.GROUP)) {
                configurations.group = (RecorderGroup) config;
            } else if (config.isFor(RecorderConfig.TAPE)) {
                configurations.tape = (RecorderTape) config;
            } else if (config.isFor(RecorderConfig.IDENTIFIER)) {
                configurations.identifier = (RecorderIdentifier) config;
            } else if (config.isFor(RecorderConfig.MODIFIER)) {
                configurations.modifier = (ReplayModifier)config;
            } else {
                throw new IllegalArgumentException("Unknown recorder config:" + config);
            }
        }

        return configurations;
    }

    public final RecorderRegistry getRecorderRegistry() {
        if (group != null) {
            return RecorderRegistry.registryOf(group.getName(), getRecordFactory());
        }

        return RecorderRegistry.defaultRegistry();<commit_msg>extracted add recorder config to configurations<commit_after>package com.github.dreamhead.moco.recorder;

import static com.github.dreamhead.moco.Moco.template;
import static com.github.dreamhead.moco.Moco.text;
import static com.github.dreamhead.moco.Moco.with;

public class RecorderConfigurations {
    private RecorderGroup group;
    private RecorderTape tape;
    private RecorderIdentifier identifier;
    private ReplayModifier modifier;

    public static RecorderConfigurations create(final Iterable<RecorderConfig> configs) {
        RecorderConfigurations configurations = new RecorderConfigurations();

        for (RecorderConfig config : configs) {
            addConfig(configurations, config);
        }

        return configurations;
    }

    private static void addConfig(final RecorderConfigurations configurations,
                                  final RecorderConfig config) {
        if (config.isFor(RecorderConfig.GROUP)) {
            configurations.group = (RecorderGroup) config;
        } else if (config.isFor(RecorderConfig.TAPE)) {
            configurations.tape = (RecorderTape) config;
        } else if (config.isFor(RecorderConfig.IDENTIFIER)) {
            configurations.identifier = (RecorderIdentifier) config;
        } else if (config.isFor(RecorderConfig.MODIFIER)) {
            configurations.modifier = (ReplayModifier) config;
        } else {
            throw new IllegalArgumentException("Unknown recorder config:" + config);
        }
    }

    public final RecorderRegistry getRecorderRegistry() {
        if (group != null) {
            return RecorderRegistry.registryOf(group.getName(), getRecordFactory());
        }

        return RecorderRegistry.defaultRegistry();
{'fraction_non_alphanumeric': 0.08274809160305344, 'fraction_numerical': 0.0, 'mean_word_length': 2.9709090909090907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1468316', 'n_tokens_mistral': 843, 'n_tokens_neox': 824, 'n_words': 182}