InvocationLocation.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.InvocationLocationIF;
import edu.udel.cis.vsl.tass.model.IF.scope.LocalScopeIF;
import edu.udel.cis.vsl.tass.model.impl.statement.InvocationStatement;

public class InvocationLocation extends Location implements
		InvocationLocationIF {

	private InvocationStatement statement = null;

	public InvocationLocation(LocalScopeIF scope) {
		super(scope, LocationKind.INVOCATION);
	}

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

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

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