SendLocation.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.SendLocationIF;
import edu.udel.cis.vsl.tass.model.IF.scope.LocalScopeIF;
import edu.udel.cis.vsl.tass.model.IF.statement.SendStatementIF;

public class SendLocation extends Location implements SendLocationIF {

	private SendStatementIF statement = null;

	public SendLocation(LocalScopeIF scope) {
		super(scope, LocationKind.SEND);
	}

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

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

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