<commit_before>package eu.ydp.empiria.player.client.module.expression;

import static eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult.VALUES_NOT_SET;
import static eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult.CORRECT;
import static eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult.WRONG;

import com.google.inject.Inject;

import eu.ydp.empiria.player.client.module.expression.model.ExpressionBean;
import eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult;

public class ExpressionEvaluationController {

	@Inject
	private ExpressionValidator expressionValidator;
	
	@Inject
	private ExpressionCreator expressionCreator;
	
	@Inject
	private ExpressionEvaluator expressionEvaluator;
	
	
	public ExpressionEvaluationResult evaluateExpression(ExpressionBean expressionBean){
		
		ExpressionEvaluationResult evaluationResult = VALUES_NOT_SET;
		
		boolean allResponsesAreNotEmpty = validateExpressionAgainstNotEmpty(expressionBean);		
		if (allResponsesAreNotEmpty) {
			String expression = prepareExpression(expressionBean);
			evaluationResult = checkExpression(expression);
		}
		return evaluationResult;
	}

	private ExpressionEvaluationResult checkExpression(String expression) {
		boolean checkResult = expressionEvaluator.evaluate(expression);
		return (checkResult) ? CORRECT : WRONG;
	}

	private boolean validateExpressionAgainstNotEmpty(ExpressionBean expressionBean) {
		return expressionValidator.isAllResponsesAreNotEmpty(expressionBean);
	}

	private String prepareExpression(ExpressionBean expressionBean) {
		expressionCreator = new ExpressionCreator();
		return expressionCreator.getExpression(expressionBean);
	}	
}<commit_msg>Changes during review issue YPUB-5322<commit_after>package eu.ydp.empiria.player.client.module.expression;

import static eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult.VALUES_NOT_SET;
import static eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult.CORRECT;
import static eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult.WRONG;

import com.google.inject.Inject;

import eu.ydp.empiria.player.client.module.expression.model.ExpressionBean;
import eu.ydp.empiria.player.client.module.expression.model.ExpressionEvaluationResult;

public class ExpressionEvaluationController {

	@Inject
	private ExpressionValidator expressionValidator;
	
	@Inject
	private ExpressionCreator expressionCreator;
	
	@Inject
	private ExpressionEvaluator expressionEvaluator;
	
	
	public ExpressionEvaluationResult evaluateExpression(ExpressionBean expressionBean){
		
		ExpressionEvaluationResult evaluationResult = VALUES_NOT_SET;
		
		boolean allResponsesAreNotEmpty = validateExpressionAgainstNotEmpty(expressionBean);		
		if (allResponsesAreNotEmpty) {
			String expression = prepareExpression(expressionBean);
			evaluationResult = checkExpression(expression);
		}
		return evaluationResult;
	}

	private ExpressionEvaluationResult checkExpression(String expression) {
		boolean checkResult = expressionEvaluator.evaluate(expression);
		return (checkResult) ? CORRECT : WRONG;
	}

	private boolean validateExpressionAgainstNotEmpty(ExpressionBean expressionBean) {
		return expressionValidator.isAllResponsesAreNotEmpty(expressionBean);
	}

	private String prepareExpression(ExpressionBean expressionBean) {
		return expressionCreator.getExpression(expressionBean);
	}	
}
{'fraction_non_alphanumeric': 0.07136764287745237, 'fraction_numerical': 0.0011373329542223485, 'mean_word_length': 7.181395348837209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1797576', 'n_tokens_mistral': 998, 'n_tokens_neox': 911, 'n_words': 155}