<commit_before>package nl.mpi.kinnate.entityindexer;

import java.util.ArrayList;
import java.util.Arrays;
import javax.xml.bind.annotation.XmlElement;

/**
 *  Document   : IndexerParam
 *  Created on : Apr 13, 2011, 3:24:44 PM
 *  Author     : <NAME>
 */
public class IndexerParam {

    IndexerParameters indexerParameters;
    @XmlElement(name = "kin:PathEntry")
    private String[][] valuesArray;
    private String[] availableValuesArray = null;

    public IndexerParam() {
    }

    public IndexerParam(IndexerParameters indexerParametersLocal, String[][] valuesArrayLocal) {
        indexerParameters = indexerParametersLocal;
        valuesArray = valuesArrayLocal;
    }

    public void setValues(String[][] valuesArrayLocal) {
        valuesArray = valuesArrayLocal;
//        IndexerParameters.this.relevantEntityData = null;
        // cause the entity index and entity collection to update based on the new indexer values
        indexerParameters.valuesChanged = true;
    }

    public void setValue(String parameterString, String valueString) {
        ArrayList<String[]> tempArrayList = new ArrayList<String[]>(Arrays.asList(valuesArray));
        for (String[] currentEntry : valuesArray) {
            if (currentEntry[0].equals(parameterString)) {
                currentEntry[1] = valueString;
            }
        }
        setValues(tempArrayList.toArray(new String[][]{}));
        // cause the entity index and entity collection to update based on the new indexer values
        indexerParameters.valuesChanged = true;
    }

    public void removeValue(String valueToRemove) {
        ArrayList<String[]> tempArrayList = new ArrayList<String[]>(Arrays.asList(valuesArray));
        for (String[] currentEntry : valuesArray) {
            if (currentEntry[0].equals(valueToRemove)) {
                tempArrayList.remove(currentEntry); // todo: will array list remove use the value of the array or the pointer to the array?????
            }
        }
        setValues(tempArrayList.toArray(new String[][]{}));
        // cause the entity index and entity collection to update based on the new indexer values
        indexerParameters.valuesChanged = true;
    }

    public String[][] getValues() {
        return valuesArray;
    }

    public void setAvailableValues(String[] availableValuesArrayLocal) {
        availableValuesArray = availableValuesArrayLocal;
    }

    public String[] getAvailableValues() {
        return availableValuesArray;
    }
}
<commit_msg>Added the use of jaxb to save the current settings used to generate the graph in the graph svg file. Added the use of jaxb to load indexersettings and kin parameters from the svg. Separated Index Parameters into a separate class.<commit_after>package nl.mpi.kinnate.entityindexer;

import java.util.ArrayList;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *  Document   : IndexerParam
 *  Created on : Apr 13, 2011, 3:24:44 PM
 *  Author     : <NAME>
 */
public class IndexerParam {

    IndexerParameters indexerParameters;
    @XmlElement(name = "IndexerParam", namespace = "http://mpi.nl/tla/kin")
    private ArrayList<ParameterElement> parametersList;
    @XmlTransient
    private String[] availableValuesArray = null;

    public IndexerParam() {
    }

    public IndexerParam(IndexerParameters indexerParametersLocal, String[][] valuesArrayLocal) {
        indexerParameters = indexerParametersLocal;
        parametersList = new ArrayList<ParameterElement>();
        for (String[] currentValue : valuesArrayLocal) {
            parametersList.add(new ParameterElement(currentValue));
        }
    }

    public void setValues(String[][] valuesArrayLocal) {
        parametersList.clear();
        for (String[] currentValue : valuesArrayLocal) {
            parametersList.add(new ParameterElement(currentValue[0], currentValue[1]));
        }
//        IndexerParameters.this.relevantEntityData = null;
        // cause the entity index and entity collection to update based on the new indexer values
        indexerParameters.valuesChanged = true;
    }

    public void setValue(String parameterString, String valueString) {
        // cause the entity index and entity collection to update based on the new indexer values
        indexerParameters.valuesChanged = true;
        for (ParameterElement currentEntry : parametersList) {
            if (currentEntry.xpathString.equals(parameterString)) {
                currentEntry.selectedValue = valueString;
                return;
            }
        }
        // if the value has not been found then add it
        parametersList.add(new ParameterElement(parameterString, valueString));
    }

    public void removeValue(String pathToRemove) {
        for (ParameterElement currentEntry : parametersList) {
            if (currentEntry.getXpathString().equals(pathToRemove)) {
                parametersList.remove(currentEntry);
            }
        }
        // cause the entity index and entity collection to update based on the new indexer values
        indexerParameters.valuesChanged = true;
    }

    public ParameterElement[] getValues() {
        return parametersList.toArray(new ParameterElement[]{});
    }

    public void setAvailableValues(String[] availableValuesArrayLocal) {
        availableValuesArray = availableValuesArrayLocal;
    }

    public String[] getAvailableValues() {
        return availableValuesArray;
    }
}

{'fraction_non_alphanumeric': 0.08614710713633875, 'fraction_numerical': 0.004927906552290564, 'mean_word_length': 3.0682999257609502, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '372573', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1358, 'n_words': 388}