<commit_before>package de.uka.ipd.sdq.beagle.core.evaluableexpressions;

/**
 * Expression that executes an if-then-else-statement based on its contained expressions.
 * 
 * @author <NAME>
 */
public class IfThenElseExpression implements EvaluableExpression {

	/**
	 * Get expression contained in if-statement.
	 * 
	 * @return if-Expression
	 */
	public EvaluableExpression getIfExpression() {
		return null;
	}

	/**
	 * Set the {@link EvaluableExpression} to be contained in the if statement.
	 *
	 * @param ifExpression The {@link EvaluableExpression} to be contained in the if
	 *            statement.
	 */
	public void setIfExpression(final EvaluableExpression ifExpression) {
	}

	/**
	 * Get expression contained in else-statement.
	 * 
	 * @return else-Expression
	 */
	public EvaluableExpression getElseExpression() {
		return null;
	}

	/**
	 * Set the {@link EvaluableExpression} to be contained in the else-statement.
	 *
	 * @param elseExpression The {@link EvaluableExpression} to be contained in the
	 *            else-statement.
	 */
	public void setElseExpression(final EvaluableExpression elseExpression) {
	}

	/**
	 * Get expression contained in then-statement.
	 * 
	 * @return then-expression
	 */
	public EvaluableExpression getThenExpression() {
		return null;
	}

	/**
	 * Set the {@link EvaluableExpression} to be contained in the then-statement.
	 *
	 * @param thenExpression The {@link EvaluableExpression} to be contained in the
	 *            then-statement.
	 */
	public void setThenExpression(final EvaluableExpression thenExpression) {
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see de.uka.ipd.sdq.beagle.core.expressions.EvaluableExpression#receive(de.uka.sdq.
	 * beagle. core.expressions.EvaluableExpressionVisitor)
	 */
	@Override
	public void receive(final EvaluableExpressionVisitor visitor) {

	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * de.uka.ipd.sdq.beagle.core.expressions.EvaluableExpression#evaluate(de.uka.sdq.
	 * beagle. core.expressions.EvaluableVariableAssignment)
	 */
	@Override
	public double evaluate(final EvaluableVariableAssignment variableAssignments) {
		return 0;
	}

}<commit_msg>implemented if-then-else expression<commit_after>package de.uka.ipd.sdq.beagle.core.evaluableexpressions;

/**
 * Expression that executes an if-then-else-statement based on its contained expressions.
 * 
 * @author <NAME>
 */
public class IfThenElseExpression implements EvaluableExpression {

	/**
	 * The expression containing the if-statement.
	 */
	private EvaluableExpression ifStatement;

	/**
	 * The expression containing the else-statement.
	 */
	private EvaluableExpression elseStatement;

	/**
	 * The expression containing the then-statement.
	 */
	private EvaluableExpression thenStatement;

	/**
	 * Builds an expression which returns .
	 *
	 * @param ifStatement The expression which contains the if-statement.
	 * 
	 * @param thenStatement The expression which contains the then-statement.
	 * @param elseStatement The expression which contains the else-statement.
	 */
	public IfThenElseExpression(final EvaluableExpression ifStatement, final EvaluableExpression thenStatement,
		final EvaluableExpression elseStatement) {
		this.ifStatement = ifStatement;
		this.elseStatement = elseStatement;
		this.thenStatement = thenStatement;

	}

	/**
	 * Get expression contained in if-statement.
	 * 
	 * @return if-Expression
	 */
	public EvaluableExpression getIfStatement() {
		return this.ifStatement;
	}

	/**
	 * Get expression contained in else-statement.
	 * 
	 * @return else-Expression
	 */
	public EvaluableExpression getElseStatement() {
		return this.elseStatement;
	}

	/**
	 * Get expression contained in then-statement.
	 * 
	 * @return then-expression
	 */
	public EvaluableExpression getThenStatement() {
		return this.thenStatement;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see de.uka.ipd.sdq.beagle.core.expressions.EvaluableExpression#receive(de.uka.sdq.
	 * beagle. core.expressions.EvaluableExpressionVisitor)
	 */
	@Override
	public void receive(final EvaluableExpressionVisitor visitor) {
		visitor.visit(this);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * de.uka.ipd.sdq.beagle.core.expressions.EvaluableExpression#evaluate(de.uka.sdq.
	 * beagle. core.expressions.EvaluableVariableAssignment)
	 */
	@Override
	public double evaluate(final EvaluableVariableAssignment variableAssignments) {
		if (this.ifStatement.evaluate(variableAssignments) == 0) {
			return this.thenStatement.evaluate(variableAssignments);
		} else {
			return this.elseStatement.evaluate(variableAssignments);
		}
	}

}
{'fraction_non_alphanumeric': 0.09982448442299253, 'fraction_numerical': 0.00043878894251864854, 'mean_word_length': 3.8707264957264957, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6126969', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1264, 'n_words': 316}