<commit_before>package protocols;

import io.InvalidTagException;
import protocols.Protocol;
import protocols.implementations.BGPProtocol;

import java.util.HashMap;
import java.util.Map;

public class Protocols {

    // maps the tags to the protocols available
    private static Map<String, Protocol> protocols = new HashMap<>();

    // --- Edit under this line to add more protocols ---------------------------------------------------------------

    /**
     * Sets up the set of protocols available by associating a tag with a protocol.
     */
    static {
        protocol("BGP", new BGPProtocol());
    }

    // --- Stop editing from now on ---------------------------------------------------------------------------------

    // --- PUBLIC INTERFACE -----------------------------------------------------------------------------------------

    /**
     * Parses the tag and returns the respective protocol instance.
     * @param tag tag to be parsed.
     * @return protocol instance corresponding to the given tag.
     */
    public static Protocol getProtocol(String tag) throws InvalidTagException {
        Protocol protocol = protocols.get(tag);

        if (protocol == null) {
            throw new InvalidTagException(tag, "the protocol tag is not valid");
        }<commit_msg>added the D1R1 protocol to the list of available protocols<commit_after>package protocols;

import io.InvalidTagException;
import protocols.implementations.BGPProtocol;
import protocols.implementations.D1R1Protocol;

import java.util.HashMap;
import java.util.Map;

public class Protocols {

    // maps the tags to the protocols available
    private static Map<String, Protocol> protocols = new HashMap<>();

    // --- Edit under this line to add more protocols ---------------------------------------------------------------

    /**
     * Sets up the set of protocols available by associating a tag with a protocol.
     */
    static {
        protocol("BGP", new BGPProtocol());
        protocol("D1R1", new D1R1Protocol());
    }

    // --- Stop editing from now on ---------------------------------------------------------------------------------

    // --- PUBLIC INTERFACE -----------------------------------------------------------------------------------------

    /**
     * Parses the tag and returns the respective protocol instance.
     * @param tag tag to be parsed.
     * @return protocol instance corresponding to the given tag.
     */
    public static Protocol getProtocol(String tag) throws InvalidTagException {
        Protocol protocol = protocols.get(tag);

        if (protocol == null) {
            throw new InvalidTagException(tag, "the protocol tag is not valid");
        }
{'fraction_non_alphanumeric': 0.24401913875598086, 'fraction_numerical': 0.002944423997055576, 'mean_word_length': 1.5401869158878505, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7561759', 'n_tokens_mistral': 597, 'n_tokens_neox': 563, 'n_words': 226}