<commit_before>package mark.activation;

import mark.detection.DetectionAgentInterface;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import mark.core.Subject;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

/**
 *
 * @author <NAME>
 */
public class DetectionAgentProfile {

    /**
     * The label attached to the evidence produced by this detection agent.
     * Ex: evidence.http.frequency.1week or aggregation
     */
    public String label;

    /**
     * The label that will trigger this detection agent.
     * Ex: http frequency could be triggered by data.http and aggregation could
     * be triggered by evidence.
     */
    public String trigger_label;

    /**
     * The class of the detection agent to trigger.
     */
    public String class_name;

    private static final Yaml PARSER = new Yaml(
            new Constructor(DetectionAgentProfile.class));

    /**
     * Read a detection agent profile from a YAML file.
     * @param file
     * @return
     * @throws FileNotFoundException if the file does not exist
     */
    public static final DetectionAgentProfile fromFile(final File file)
            throws FileNotFoundException {
        return DetectionAgentProfile.fromInputStream(new FileInputStream(file));
    }

    /**
     * Read a detection agent profile from an input stream (a resource file).
     * @param input
     * @return
     */
    public static final DetectionAgentProfile fromInputStream(
            final InputStream input) {
        return PARSER.loadAs(input, DetectionAgentProfile.class);
    }

    /**
     * Instantiate a detection agent for the provided subject.
     * @param subject
     * @return
     * @throws ClassNotFoundException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    final DetectionAgentInterface getTaskFor(final Subject subject)
            throws ClassNotFoundException, InstantiationException,
            IllegalAccessException {
        // Create analysis task
        DetectionAgentInterface new_task =
                (DetectionAgentInterface)
                Class.forName(class_name)
                .newInstance();

        new_task.setSubject(subject);
        new_task.setLabel(label);
        new_task.setInputLabel(trigger_label);

        return new_task;
    }

    /**
     * Test if the provided label should trigger this detection agent.
     * return trigger_label.startsWith(label)
     * @param label
     * @return
     */
    boolean match(String label) {
        return this.trigger_label.startsWith(label);
    }

}
<commit_msg>Style corrections<commit_after>package mark.activation;

import mark.detection.DetectionAgentInterface;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import mark.core.Subject;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

/**
 *
 * @author <NAME>
 */
public class DetectionAgentProfile {

    /**
     * The label attached to the evidence produced by this detection agent.
     * Ex: evidence.http.frequency.1week or aggregation
     */
    public String label;

    /**
     * The label that will trigger this detection agent.
     * Ex: http frequency could be triggered by data.http and aggregation could
     * be triggered by evidence.
     */
    public String trigger_label;

    /**
     * The class of the detection agent to trigger.
     */
    public String class_name;

    private static final Yaml PARSER = new Yaml(
            new Constructor(DetectionAgentProfile.class));

    /**
     * Read a detection agent profile from a YAML file.
     * @param file
     * @return
     * @throws FileNotFoundException if the file does not exist
     */
    public static final DetectionAgentProfile fromFile(final File file)
            throws FileNotFoundException {
        return DetectionAgentProfile.fromInputStream(new FileInputStream(file));
    }

    /**
     * Read a detection agent profile from an input stream (a resource file).
     * @param input
     * @return
     */
    public static final DetectionAgentProfile fromInputStream(
            final InputStream input) {
        return PARSER.loadAs(input, DetectionAgentProfile.class);
    }

    /**
     * Instantiate a detection agent for the provided subject.
     * @param subject
     * @return
     * @throws ClassNotFoundException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    final DetectionAgentInterface getTaskFor(final Subject subject)
            throws ClassNotFoundException, InstantiationException,
            IllegalAccessException {
        // Create analysis task
        DetectionAgentInterface new_task =
                (DetectionAgentInterface)
                Class.forName(class_name)
                .newInstance();

        new_task.setSubject(subject);
        new_task.setLabel(label);
        new_task.setInputLabel(trigger_label);

        return new_task;
    }

    /**
     * Test if the provided label should trigger this detection agent.
     * return trigger_label.startsWith(label)
     * @param label
     * @return
     */
    boolean match(final String label) {
        return this.trigger_label.startsWith(label);
    }

}

{'fraction_non_alphanumeric': 0.07546468401486989, 'fraction_numerical': 0.0003717472118959108, 'mean_word_length': 2.6186953597848017, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3632456', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1346, 'n_words': 410}