IfThenElseStatementNode.java

package edu.udel.cis.vsl.tass.ast.impl.statement;

import edu.udel.cis.vsl.tass.ast.IF.expression.ExpressionNodeIF;
import edu.udel.cis.vsl.tass.ast.IF.statement.IfThenElseStatementNodeIF;
import edu.udel.cis.vsl.tass.ast.IF.statement.StatementNodeIF;

/**
 * An if...then...else... statement.
 * 
 * @author Timothy K. Zirkel (zirkel)
 * 
 */
public class IfThenElseStatementNode extends StatementNode implements
		IfThenElseStatementNodeIF {
	private ExpressionNodeIF condition;
	private StatementNodeIF trueBranch;
	private StatementNodeIF falseBranch;

	public IfThenElseStatementNode(long id) {
		super(id);
	}
	
	/**
	 * The parameter condition is the if condition. The trueBranch and
	 * falseBranch parameters are the statements in the true and false branches
	 * of the condtion.
	 */
	public IfThenElseStatementNode(long id, ExpressionNodeIF condition,
			StatementNodeIF trueBranch, StatementNodeIF falseBranch) {
		super(id);
		this.condition = condition;
		this.trueBranch = trueBranch;
		this.falseBranch = falseBranch;
	}

	@Override
	public ExpressionNodeIF condition() {
		return condition;
	}

	@Override
	public StatementNodeIF trueBranch() {
		return trueBranch;
	}

	@Override
	public StatementNodeIF falseBranch() {
		return falseBranch;
	}

	@Override
	public void setCondition(ExpressionNodeIF condition) {
		this.condition = condition;
	}

	@Override
	public void setTrueBranch(StatementNodeIF trueBranch) {
		this.trueBranch = trueBranch;
	}

	@Override
	public void setFalseBranch(StatementNodeIF falseBranch) {
		this.falseBranch = falseBranch;
	}

}