AllocateLocation.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.AllocateLocationIF;
import edu.udel.cis.vsl.tass.model.IF.scope.LocalScopeIF;
import edu.udel.cis.vsl.tass.model.IF.statement.AllocateStatementIF;

public class AllocateLocation extends Location implements AllocateLocationIF {

	private AllocateStatementIF statement = null;

	public AllocateLocation(LocalScopeIF scope) {
		super(scope, LocationKind.ALLOCATE);
	}

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

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

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