<commit_before>package spark;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;

/**
 * This objects represent the parameters sent on a Http Request. <br>
 * Parses parameters keys like in Sinatra. <br>
 * <br>
 * For a querystring like: <br>
 * user[name]=federico&#38;user[lastname]=dayan
 * <br>
 * <br>
 * We get would get a structure like: <br>
 * user : {name: federico, lastname: dayan}
 * <br>
 * <br>
 * That is:<br>
 * queryParamsMapInstance.get("user").get("name").value(); <br>
 * queryParamsMapInstance.get("user").get("lastname").value();
 * <br><br>
 * It is null safe, meaning that if a key does not exist, it does not throw NullPointerException
 * , it just returns null.
 *
 * @author fddayan
 */
public class QueryParamsMap {

    private static final QueryParamsMap NULL = new NullQueryParamsMap();

    private static final Pattern KEY_PATTERN = Pattern.compile("\\A[\\[\\]]*([^\\[\\]]+)\\]*");

    /**
     * Holds the nested keys
     */
    private Map<String, QueryParamsMap> queryMap = new HashMap<String, QueryParamsMap>();

    /**
     * Value(s) for this key
     */
    private String[] values;

    /**
     * Creates a new QueryParamsMap from and HttpServletRequest. <br>
     * Parses the parameters from request.getParameterMap() <br>
     * No need to decode, since HttpServletRequest does it for us.
     *
     * @param request the servlet request
     */<commit_msg>Add a doc comment<commit_after>package spark;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;

/**
 * This objects represent the parameters sent on a Http Request. <br>
 * Parses parameters keys like in Sinatra. <br>
 * <br>
 * For a querystring like: <br>
 * user[name]=federico&#38;user[lastname]=dayan
 * <br>
 * <br>
 * We get would get a structure like: <br>
 * user : {name: federico, lastname: dayan}
 * <br>
 * <br>
 * That is:<br>
 * queryParamsMapInstance.get("user").get("name").value(); <br>
 * queryParamsMapInstance.get("user").get("lastname").value();
 * <br><br>
 * It is null safe, meaning that if a key does not exist, it does not throw NullPointerException
 * , it just returns null.
 *
 * @author fddayan
 */
public class QueryParamsMap {

    private static final QueryParamsMap NULL = new NullQueryParamsMap();

    /**
     * Pattern for parsing the key of querystring
     */
    private static final Pattern KEY_PATTERN = Pattern.compile("\\A[\\[\\]]*([^\\[\\]]+)\\]*");

    /**
     * Holds the nested keys
     */
    private Map<String, QueryParamsMap> queryMap = new HashMap<String, QueryParamsMap>();

    /**
     * Value(s) for this key
     */
    private String[] values;

    /**
     * Creates a new QueryParamsMap from and HttpServletRequest. <br>
     * Parses the parameters from request.getParameterMap() <br>
     * No need to decode, since HttpServletRequest does it for us.
     *
     * @param request the servlet request
     */
{'fraction_non_alphanumeric': 0.13869537682077265, 'fraction_numerical': 0.001266624445851805, 'mean_word_length': 3.4243697478991595, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '1444813', 'n_tokens_mistral': 979, 'n_tokens_neox': 962, 'n_words': 306}