AssignmentLocation.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.AssignmentLocationIF;
import edu.udel.cis.vsl.tass.model.IF.scope.LocalScopeIF;
import edu.udel.cis.vsl.tass.model.impl.statement.AssignmentStatement;
public class AssignmentLocation extends Location implements
AssignmentLocationIF {
private AssignmentStatement statement = null;
public AssignmentLocation(LocalScopeIF scope) {
super(scope, LocationKind.ASSIGNMENT);
}
public void setStatement(AssignmentStatement statement) {
if (this.statement != null)
throw new RuntimeException("Assignment statement already set!");
if (statement == null)
throw new NullPointerException("statement is null");
this.statement = statement;
super.addOutgoing(statement);
}
@Override
public AssignmentStatement statement() {
return statement;
}
@Override
public void complete() throws SyntaxException {
if (statement == null)
throw new SyntaxException(this,
"no statement for this assignment location");
super.complete();
}
}