<commit_before>package com.grayben.riskExtractor.htmlScorer.nodeVisitor;

import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import org.jsoup.nodes.Element;

import java.util.*;

/**
 * Created by beng on 5/01/2016.
 */
class AnnotatedElementTreeAssembler {

    enum Configuration {
        MIXED_TREE
    }

    //input fields
    private List<Element> elementsToAttach;
    private Configuration configuration;

    private Set<Scorer<Element>> elementScorers;

    //output fields
    private AnnotatedElement rootAnnotation;

    public AnnotatedElement getRootAnnotation() {
        return rootAnnotation;
    }
    //internal working fields
    private Random random;
    private Element currentElement;

    private HashMap<String, Integer> currentIsolatedScores;
    private AnnotatedElement parentAnnotation;

    private HashMap<String, Integer> parentCumulativeScores;
    private AnnotatedElement childAnnotation;


    private HashMap<String, Integer> childCumulativeScores;

    AnnotatedElementTreeAssembler(
            List<Element> elementsToAttach,
            Configuration configuration,
            Set<Scorer<Element>> elementScorers
    ) {

        validateInitParams(elementsToAttach, configuration, elementScorers);
        this.elementsToAttach = elementsToAttach;
        this.configuration = configuration;
        this.elementScorers = elementScorers;
        this.random = new Random(System.currentTimeMillis());
        initialiseMaps();
        //setup the first parent/child AnnotatedElement pair
        plantSeedling();
        assembleInTree();
    }

    private void validateInitParams(
            List<Element> elements,
            Configuration configuration,
            Set<Scorer<Element>> elementScorers
    ) {
        if (elements == null) {<commit_msg>Make AnnotatedElementTreeAssembler public<commit_after>package com.grayben.riskExtractor.htmlScorer.nodeVisitor;

import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import org.jsoup.nodes.Element;

import java.util.*;

/**
 * Created by beng on 5/01/2016.
 */
public class AnnotatedElementTreeAssembler {

    public enum Configuration {
        MIXED_TREE
    }

    //input fields
    private List<Element> elementsToAttach;
    private Configuration configuration;

    private Set<Scorer<Element>> elementScorers;

    //output fields
    private AnnotatedElement rootAnnotation;

    public AnnotatedElement getRootAnnotation() {
        return rootAnnotation;
    }
    //internal working fields
    private Random random;
    private Element currentElement;

    private HashMap<String, Integer> currentIsolatedScores;
    private AnnotatedElement parentAnnotation;

    private HashMap<String, Integer> parentCumulativeScores;
    private AnnotatedElement childAnnotation;


    private HashMap<String, Integer> childCumulativeScores;

    public AnnotatedElementTreeAssembler(
            List<Element> elementsToAttach,
            Configuration configuration,
            Set<Scorer<Element>> elementScorers
    ) {

        validateInitParams(elementsToAttach, configuration, elementScorers);
        this.elementsToAttach = elementsToAttach;
        this.configuration = configuration;
        this.elementScorers = elementScorers;
        this.random = new Random(System.currentTimeMillis());
        initialiseMaps();
        //setup the first parent/child AnnotatedElement pair
        plantSeedling();
        assembleInTree();
    }

    private void validateInitParams(
            List<Element> elements,
            Configuration configuration,
            Set<Scorer<Element>> elementScorers
    ) {
        if (elements == null) {
{'fraction_non_alphanumeric': 0.07222373065435786, 'fraction_numerical': 0.0038012489818083084, 'mean_word_length': 3.2151029748283753, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '1700125', 'n_tokens_mistral': 997, 'n_tokens_neox': 938, 'n_words': 217}