<commit_before>package com.indeed.proctor.service;

import com.google.common.collect.Maps;
import com.indeed.proctor.common.Identifiers;
import com.indeed.proctor.common.model.TestType;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * Converts a RawQueryParameters into the correct types for easy usage.
 *
 * This is mostly cleaning up parameters and types to work with determineTestBuckets.
 */
public class ConvertedIdentifyParameters {
    final private Map<String, Object> context;
    final private Identifiers identifiers;
    final private List<String> test;

    public ConvertedIdentifyParameters(final RawQueryParameters raw)
    {
        // TODO: Actually convert to appropriate types
        context = Collections.<String, Object>unmodifiableMap(raw.getContext());

        // Convert every key in the identifiers to its matching enum type.
        final Map<TestType, String> identMap = Maps.newHashMap();
        for (final Map.Entry<String, String> e : raw.getIdentifiers().entrySet())
        {
            identMap.put(TestType.valueOf(e.getKey()), e.getValue());
        }
        identifiers = new Identifiers(identMap);

        test = raw.getTest();
    }

    public Map<String, Object> getContext() {
        return context;
    }

    public Identifiers getIdentifiers() {
        return identifiers;
    }

    public List<String> getTest() {
        return test;
    }
}<commit_msg>Add TODOs about some details I'm not sure about.<commit_after>package com.indeed.proctor.service;

import com.google.common.collect.Maps;
import com.indeed.proctor.common.Identifiers;
import com.indeed.proctor.common.model.TestType;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * Converts a RawQueryParameters into the correct types for easy usage.
 *
 * This is mostly cleaning up parameters and types to work with determineTestBuckets.
 */
public class ConvertedIdentifyParameters {
    final private Map<String, Object> context;
    final private Identifiers identifiers;
    final private List<String> test;

    public ConvertedIdentifyParameters(final RawQueryParameters raw)
    {
        // TODO: Actually convert to appropriate types
        // TODO: Tests with rules that cause a test to be skipped don't show up in output at all. Is this good?
        context = Collections.<String, Object>unmodifiableMap(raw.getContext());

        // Convert every key in the identifiers to its matching enum type.
        final Map<TestType, String> identMap = Maps.newHashMap();
        for (final Map.Entry<String, String> e : raw.getIdentifiers().entrySet())
        {
            identMap.put(TestType.valueOf(e.getKey()), e.getValue());
        }
        // TODO: what is this random parameter for and should it be true or false?
        identifiers = new Identifiers(identMap);

        test = raw.getTest();
    }

    public Map<String, Object> getContext() {
        return context;
    }

    public Identifiers getIdentifiers() {
        return identifiers;
    }

    public List<String> getTest() {
        return test;
    }
}
{'fraction_non_alphanumeric': 0.09294871794871795, 'fraction_numerical': 0.0, 'mean_word_length': 3.128306878306878, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1920543', 'n_tokens_mistral': 851, 'n_tokens_neox': 830, 'n_words': 263}