<commit_before>package com.photon.phresco.plugins.util;

import java.io.File;
import java.io.IOException;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;

import com.photon.phresco.exception.PhrescoException;
import com.photon.phresco.plugins.model.Mojos;
import com.photon.phresco.plugins.model.Mojos.Mojo;
import com.photon.phresco.plugins.model.Mojos.Mojo.Configuration;

public class MojoProcessor {

	private Mojos mojos;
	
	private File file;
	
	public MojoProcessor(File infoFile) throws PhrescoException {
        try {
    		if(infoFile.exists()){
    			JAXBContext jaxbContext = JAXBContext.newInstance(Mojos.class);
    			Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
    			mojos = (Mojos) jaxbUnmarshaller.unmarshal(infoFile);
    		} else {
    			infoFile.createNewFile();
    			mojos = new Mojos();
    		}
    		file = infoFile;
        } catch (JAXBException e) {
            throw new PhrescoException(e);
        } catch (IOException e) {
            throw new PhrescoException(e);
        }
	}
	
	public Configuration getConfiguration(String goal) {
		if(mojos.getMojo() != null) {
			List<Mojo> mojoList = mojos.getMojo();
			for (Mojo mojo : mojoList) {
					if(mojo.getGoal().equals(goal)) {
						return mojo.getConfiguration();
					}
			}
		}
	    return null;
	}
	
	public String getImplementationClassName(String goal) {
		if(mojos.getMojo() != null) {
			List<Mojo> mojoList = mojos.getMojo();
			for (Mojo mojo : mojoList) {
				if(mojo.getGoal().equals(goal)) {
				return mojo.getImplementation();
				}
			}
		}
		return "";
	}
	
	
	public void save() throws PhrescoException {
        try {
    		JAXBContext jaxbContext = JAXBContext.newInstance(Mojos.class);
    		Marshaller marshal = jaxbContext.createMarshaller();
    		marshal.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    		marshal.marshal(mojos, file);
        } catch (JAXBException e) {
            throw new PhrescoException(e);
        }
	}
}<commit_msg>written getParameter() method<commit_after>package com.photon.phresco.plugins.util;

import java.io.File;
import java.io.IOException;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;

import com.photon.phresco.exception.PhrescoException;
import com.photon.phresco.plugins.model.Mojos;
import com.photon.phresco.plugins.model.Mojos.Mojo;
import com.photon.phresco.plugins.model.Mojos.Mojo.Configuration;
import com.photon.phresco.plugins.model.Mojos.Mojo.Configuration.Parameters.Parameter;

public class MojoProcessor {

	private Mojos mojos;
	
	private File file;
	
	public MojoProcessor(File infoFile) throws PhrescoException {
        try {
    		if(infoFile.exists()){
    			JAXBContext jaxbContext = JAXBContext.newInstance(Mojos.class);
    			Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
    			mojos = (Mojos) jaxbUnmarshaller.unmarshal(infoFile);
    		} else {
    			infoFile.createNewFile();
    			mojos = new Mojos();
    		}
    		file = infoFile;
        } catch (JAXBException e) {
            throw new PhrescoException(e);
        } catch (IOException e) {
            throw new PhrescoException(e);
        }
	}
	
	public Configuration getConfiguration(String goal) {
		if(mojos.getMojo() != null) {
			List<Mojo> mojoList = mojos.getMojo();
			for (Mojo mojo : mojoList) {
					if(mojo.getGoal().equals(goal)) {
						return mojo.getConfiguration();
					}
			}
		}
	    return null;
	}
	
	public String getImplementationClassName(String goal) {
		if(mojos.getMojo() != null) {
			List<Mojo> mojoList = mojos.getMojo();
			for (Mojo mojo : mojoList) {
				if(mojo.getGoal().equals(goal)) {
				return mojo.getImplementation();
				}
			}
		}
		return "";
	}
	
	public Parameter getParameter(String goal, String key) {
		Configuration configuration = getConfiguration(goal);
		if(configuration != null) {
			List<Parameter> parameters = configuration.getParameters().getParameter();
			for (Parameter parameter : parameters) {
					if(parameter.getKey().equals(key)) {
						return parameter;
					}
			}
		}
		return null; 
	}
	
	
	public void save() throws PhrescoException {
        try {
    		JAXBContext jaxbContext = JAXBContext.newInstance(Mojos.class);
    		Marshaller marshal = jaxbContext.createMarshaller();
    		marshal.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    		marshal.marshal(mojos, file);
        } catch (JAXBException e) {
            throw new PhrescoException(e);
        }
	}
}
{'fraction_non_alphanumeric': 0.11282051282051282, 'fraction_numerical': 0.0, 'mean_word_length': 3.2748858447488582, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '828331', 'n_tokens_mistral': 1746, 'n_tokens_neox': 1605, 'n_words': 277}