ProcessScope.java
package edu.udel.cis.vsl.tass.model.impl.scope;
import edu.udel.cis.vsl.tass.model.IF.FunctionIF;
import edu.udel.cis.vsl.tass.model.IF.ProcessIF;
import edu.udel.cis.vsl.tass.model.IF.SyntaxException;
import edu.udel.cis.vsl.tass.model.IF.scope.ModelScopeIF;
import edu.udel.cis.vsl.tass.model.IF.scope.ProcessScopeIF;
import edu.udel.cis.vsl.tass.model.IF.variable.ProcessVariableIF;
public class ProcessScope extends Scope implements ProcessScopeIF {
private ProcessIF process;
public ProcessScope(ProcessIF process) {
super(process.model().scope(), ScopeKind.PROCESS, process.model(),
"global scope for " + process);
this.process = process;
}
@Override
public ProcessIF process() {
return process;
}
@Override
public ScopeKind kind() {
return ScopeKind.PROCESS;
}
/**
* The variables in this scope are assigned ID numbers 0, 1, 2, ..., at
* completion time. This method returns the variable with the given ID.
*/
@Override
public ProcessVariableIF variableWithId(int id) {
return (ProcessVariableIF) super.variableWithId(id);
}
/**
* Returns the variable in this scope with the given name, or null if there
* isn't one.
*/
@Override
public ProcessVariableIF variableWithName(String name) {
return (ProcessVariableIF) super.variableWithName(name);
}
/**
* The parent scope, i.e., the scope directly containing this one. Null if
* this is the shared scope.
*/
@Override
public ModelScopeIF parent() {
return (ModelScopeIF) super.parent();
}
@Override
public void addFunction(FunctionIF function) throws SyntaxException {
super.addFunction(function);
}
public void addVariable(ProcessVariableIF variable) throws SyntaxException {
super.addVariable(variable);
}
}