StandardReceiveLocation.java

package edu.udel.cis.vsl.tass.model.impl.location;

import edu.udel.cis.vsl.tass.model.IF.SyntaxException;
import edu.udel.cis.vsl.tass.model.IF.location.StandardReceiveLocationIF;
import edu.udel.cis.vsl.tass.model.IF.scope.LocalScopeIF;
import edu.udel.cis.vsl.tass.model.IF.statement.ReceiveStatementIF;

public class StandardReceiveLocation extends Location implements
		StandardReceiveLocationIF {

	private ReceiveStatementIF statement = null;

	public StandardReceiveLocation(LocalScopeIF scope) {
		super(scope, LocationKind.RECEIVE);
	}

	public void setStatement(ReceiveStatementIF statement) {
		if (this.statement != null)
			throw new RuntimeException("Receive statement already set!");
		if (statement == null)
			throw new NullPointerException("statement is null");
		this.statement = statement;
		super.addOutgoing(statement);
	}

	@Override
	public ReceiveStatementIF statement() {
		return statement;
	}

	@Override
	public void complete() throws SyntaxException {
		if (statement == null)
			throw new SyntaxException(this,
					"statement for this receive location is null");
		super.complete();
	}
}