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