<commit_before>package de.is24.deadcode4j;

import javassist.ClassPool;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static com.google.common.collect.Maps.newHashMap;
import static com.google.common.collect.Sets.newHashSet;

/**
 * The <code>CodeContext</code> is central access point for convenient analysis tools,
 * It provides the capability to {@link #addAnalyzedClass(String) report the existence of code} and
 * {@link #addDependencies(String, java.util.Collection) the dependencies of it}.
 *
 * @since 1.0.2
 */
public class CodeContext {

    private final ClassLoader classLoader;
    private final ClassPool classPool;
    private final Set<String> analyzedClasses = newHashSet();
    private final Map<String, Set<String>> dependencyMap = newHashMap();

    public CodeContext(@Nonnull ClassLoader classLoader, @Nonnull ClassPool classPool) {
        this.classLoader = classLoader;
        this.classPool = classPool;
    }

    @Nonnull
    public ClassLoader getClassLoader() {
        return classLoader;
    }

    @Nonnull
    public ClassPool getClassPool() {
        return classPool;
    }

    /**
     * Report code dependencies.
     *
     * @param   depender
     *          the depending entity, e.g. a class or a more conceptual entity like Spring XML files or a web.xml;
     *          the latter should somehow be marked as such, e.g. "_Spring_"
     * @param   dependees
     *          the classes being depended upon
     * @since 1.0.2
     */
    public void addDependencies(@Nonnull String depender, @Nonnull Collection<String> dependees) {
        Set<String> existingDependees = dependencyMap.get(depender);
        if (existingDependees == null) {
            existingDependees = new HashSet<String>();
            dependencyMap.put(depender, existingDependees);
        }
        existingDependees.addAll(dependees);
    }

    /**
     * Report the existence of a class.
     *
     * @since 1.0.2
     */
    public void addAnalyzedClass(@Nonnull String clazz) {
        this.analyzedClasses.add(clazz);
    }

    /**
     * Computes the {@link AnalyzedCode} based on the reports being made via {@link #addAnalyzedClass(String)} and<commit_msg>refactor main file loop: javadoc formatted<commit_after>package de.is24.deadcode4j;

import javassist.ClassPool;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static com.google.common.collect.Maps.newHashMap;
import static com.google.common.collect.Sets.newHashSet;

/**
 * The <code>CodeContext</code> is central access point for convenient analysis tools,
 * It provides the capability to {@link #addAnalyzedClass(String) report the existence of code} and
 * {@link #addDependencies(String, java.util.Collection) the dependencies of it}.
 *
 * @since 1.0.2
 */
public class CodeContext {

    private final ClassLoader classLoader;
    private final ClassPool classPool;
    private final Set<String> analyzedClasses = newHashSet();
    private final Map<String, Set<String>> dependencyMap = newHashMap();

    public CodeContext(@Nonnull ClassLoader classLoader, @Nonnull ClassPool classPool) {
        this.classLoader = classLoader;
        this.classPool = classPool;
    }

    @Nonnull
    public ClassLoader getClassLoader() {
        return classLoader;
    }

    @Nonnull
    public ClassPool getClassPool() {
        return classPool;
    }

    /**
     * Report code dependencies.
     *
     * @param depender  the depending entity, e.g. a class or a more conceptual entity like Spring XML files or a web.xml;
     *                  the latter should somehow be marked as such, e.g. "_Spring_"
     * @param dependees the classes being depended upon
     * @since 1.0.2
     */
    public void addDependencies(@Nonnull String depender, @Nonnull Collection<String> dependees) {
        Set<String> existingDependees = dependencyMap.get(depender);
        if (existingDependees == null) {
            existingDependees = new HashSet<String>();
            dependencyMap.put(depender, existingDependees);
        }
        existingDependees.addAll(dependees);
    }

    /**
     * Report the existence of a class.
     *
     * @since 1.0.2
     */
    public void addAnalyzedClass(@Nonnull String clazz) {
        this.analyzedClasses.add(clazz);
    }

    /**
     * Computes the {@link AnalyzedCode} based on the reports being made via {@link #addAnalyzedClass(String)} and
{'fraction_non_alphanumeric': 0.09339457567804024, 'fraction_numerical': 0.005249343832020997, 'mean_word_length': 3.0504871567759078, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1783892', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1261, 'n_words': 378}