<commit_before>package stsc.common.algorithms;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

import stsc.common.storage.SignalsStorage;
import stsc.common.trading.Broker;

/**
 * <<<<<<< HEAD End of day execution. Execution characterize description of future instance of algorithm with defined {@link AlgorithmConfiguration}.
 */
public class EodExecution implements Cloneable, Execution<EodAlgorithm> {

	private final String executionName;
	private final String algorithmName;
	private final Class<? extends EodAlgorithm> algorithmType;

	private final MutableAlgorithmConfiguration algorithmSettings;

	public static Class<? extends EodAlgorithm> generateAlgorithm(final String algorithmName) throws BadAlgorithmException {
		try {
			Class<?> classType = Class.forName(algorithmName);
			return classType.asSubclass(EodAlgorithm.class);
		} catch (ClassNotFoundException e) {
			throw new BadAlgorithmException("Algorithm class '" + algorithmName + "' was not found: " + e.toString());
		}
	}

	public EodExecution(String executionName, String algorithmName, MutableAlgorithmConfiguration algorithmSettings) throws BadAlgorithmException {
		this(executionName, generateAlgorithm(algorithmName), algorithmSettings);
	}

	public EodExecution(String executionName, Class<? extends EodAlgorithm> algorithmType, MutableAlgorithmConfiguration algorithmSettings) {
		this.executionName = executionName;
		this.algorithmName = algorithmType.getName();
		this.algorithmType = algorithmType;
		this.algorithmSettings = algorithmSettings;
	}

	@Override
	public String getExecutionName() {
		return executionName;
	}

	@Override
	public String getAlgorithmName() {
		return algorithmName;
	}

	@Override
	public Class<? extends EodAlgorithm> getAlgorithmType() {
		return algorithmType;
	}

	public EodAlgorithm getInstance(Broker broker, SignalsStorage signals) throws BadAlgorithmException {
		try {
			final EodAlgorithmInit init = new EodAlgorithmInit(executionName, signals, algorithmSettings, broker);

			final Class<?>[] constructorParameters = { EodAlgorithmInit.class };
			final Constructor<? extends EodAlgorithm> constructor = algorithmType.getConstructor(constructorParameters);
			final Object[] params = { init };

			final EodAlgorithm algo = constructor.newInstance(params);
			return algo;
		} catch (NoSuchMethodException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', constructor was not found: " + e.toString());
		} catch (SecurityException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', constructor could not be called: " + e.toString());
		} catch (InstantiationException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', instantiation exception: " + e.toString());
		} catch (IllegalAccessException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', instantiation impossible due to illegal access: " + e.toString());
		} catch (IllegalArgumentException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', illegal arguments: " + e.toString());
		} catch (InvocationTargetException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', invocation target exception: " + e.toString());
		}
	}

	public void stringHashCode(StringBuilder sb) {
		sb.append(executionName).append(algorithmName);
		algorithmSettings.stringHashCode(sb);
	}

	@Override
	public MutableAlgorithmConfiguration getSettings() {
		return algorithmSettings;
	}

	@Override
	public EodExecution clone() {
		return new EodExecution(executionName, algorithmType, algorithmSettings.clone());
	}

	@Override
	public String toString() {
		return executionName + ".loadLine = " + algorithmType.getSimpleName() + "( " + algorithmSettings.toString() + " )";
	}

}
<commit_msg>deleted <<<<< HEAD mark from EodExecution<commit_after>package stsc.common.algorithms;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

import stsc.common.storage.SignalsStorage;
import stsc.common.trading.Broker;

/**
 * End of day execution. Execution characterize description of future instance of algorithm with defined {@link AlgorithmConfiguration}.
 */
public class EodExecution implements Cloneable, Execution<EodAlgorithm> {

	private final String executionName;
	private final String algorithmName;
	private final Class<? extends EodAlgorithm> algorithmType;

	private final MutableAlgorithmConfiguration algorithmSettings;

	public static Class<? extends EodAlgorithm> generateAlgorithm(final String algorithmName) throws BadAlgorithmException {
		try {
			Class<?> classType = Class.forName(algorithmName);
			return classType.asSubclass(EodAlgorithm.class);
		} catch (ClassNotFoundException e) {
			throw new BadAlgorithmException("Algorithm class '" + algorithmName + "' was not found: " + e.toString());
		}
	}

	public EodExecution(String executionName, String algorithmName, MutableAlgorithmConfiguration algorithmSettings) throws BadAlgorithmException {
		this(executionName, generateAlgorithm(algorithmName), algorithmSettings);
	}

	public EodExecution(String executionName, Class<? extends EodAlgorithm> algorithmType, MutableAlgorithmConfiguration algorithmSettings) {
		this.executionName = executionName;
		this.algorithmName = algorithmType.getName();
		this.algorithmType = algorithmType;
		this.algorithmSettings = algorithmSettings;
	}

	@Override
	public String getExecutionName() {
		return executionName;
	}

	@Override
	public String getAlgorithmName() {
		return algorithmName;
	}

	@Override
	public Class<? extends EodAlgorithm> getAlgorithmType() {
		return algorithmType;
	}

	public EodAlgorithm getInstance(Broker broker, SignalsStorage signals) throws BadAlgorithmException {
		try {
			final EodAlgorithmInit init = new EodAlgorithmInit(executionName, signals, algorithmSettings, broker);

			final Class<?>[] constructorParameters = { EodAlgorithmInit.class };
			final Constructor<? extends EodAlgorithm> constructor = algorithmType.getConstructor(constructorParameters);
			final Object[] params = { init };

			final EodAlgorithm algo = constructor.newInstance(params);
			return algo;
		} catch (NoSuchMethodException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', constructor was not found: " + e.toString());
		} catch (SecurityException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', constructor could not be called: " + e.toString());
		} catch (InstantiationException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', instantiation exception: " + e.toString());
		} catch (IllegalAccessException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', instantiation impossible due to illegal access: " + e.toString());
		} catch (IllegalArgumentException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', illegal arguments: " + e.toString());
		} catch (InvocationTargetException e) {
			throw new BadAlgorithmException("Bad Algorithm '" + algorithmName + "', invocation target exception: " + e.toString());
		}
	}

	public void stringHashCode(StringBuilder sb) {
		sb.append(executionName).append(algorithmName);
		algorithmSettings.stringHashCode(sb);
	}

	@Override
	public MutableAlgorithmConfiguration getSettings() {
		return algorithmSettings;
	}

	@Override
	public EodExecution clone() {
		return new EodExecution(executionName, algorithmType, algorithmSettings.clone());
	}

	@Override
	public String toString() {
		return executionName + ".loadLine = " + algorithmType.getSimpleName() + "( " + algorithmSettings.toString() + " )";
	}

}

{'fraction_non_alphanumeric': 0.09831424527087891, 'fraction_numerical': 0.0, 'mean_word_length': 5.758260869565217, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 19, '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': '5896698', 'n_tokens_mistral': 2112, 'n_tokens_neox': 1949, 'n_words': 545}