Package edu.udel.cis.vsl.civl.model.IF
Interface Scope
-
- All Superinterfaces:
Sourceable
public interface Scope extends Sourceable
A scope. A scope contains the variables exclusive to this scope and references to any subscopes.
Maintainer: Stephen Siegel (siegel)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddChild(Scope child)voidaddFunction(CIVLFunction function)voidaddVariable(Variable variable)A new variable in this scope.java.util.Set<Scope>children()voidcomplete()Variablecontains(Variable variable)If a variable is already included in this scope, return the included variable.booleancontainsVariable(java.lang.String name)CIVLFunctionfunction()IdentifierfunctionName()CIVLFunctiongetFunction(int fid)CIVLFunctiongetFunction(Identifier name)CIVLFunctiongetFunction(java.lang.String name)intgetVid(Variable staticVariable)booleanhasVariable()booleanhasVariableWtPointer()intid()booleanisDescendantOf(Scope anc)Return true if the scope is a descendant of the scope ancModelmodel()intnumFunctions()intnumVariables()Scopeparent()voidprint(java.lang.String prefix, java.io.PrintStream out, boolean isDebug)Print the scope and all children.voidsetChildren(java.util.Set<Scope> children)voidsetFunction(CIVLFunction function)voidsetParent(Scope parent)voidsetVariables(java.util.Set<Variable> variables)Variablevariable(int vid)Get the variable at the specified array index.Variablevariable(Identifier name)Get the variable associated with an identifier.Variablevariable(java.lang.String name)Variable[]variables()Important notice: Never ever modify the variable!java.util.Collection<Variable>variablesWithPointers()A variable contains a pointer type if it is of type PointerType, if it is an array with elements containing pointer type, or if it is a struct with fields containing pointer type.java.util.Collection<Variable>variablesWithProcrefs()A variables has a "procRefType" if it is of type Process, if it is an array with element of procRefType, or if it is a struct with fields of procRefType.java.util.Collection<Variable>variablesWithScoperefs()A variables has a "scopeRefType" if it is of type Scope, if it is an array with element of scopeRefType, if it is a struct with fields of scopeRefType, or if it contains a pointer.java.util.Collection<Variable>variablesWithStaterefs()A variables has a "$state" type, if it is of type $state, if it is an array with element of type $state, or if it is a struct with fields of type $state.java.util.Collection<Variable>varsNeedSymbolicConstant()A variable whose type is not a primitive type.-
Methods inherited from interface edu.udel.cis.vsl.civl.model.IF.Sourceable
getSource, setCIVLSource
-
-
-
-
Method Detail
-
parent
Scope parent()
- Returns:
- The containing scope of this scope. If this is the top-most scope, returns null.
-
variables
Variable[] variables()
Important notice: Never ever modify the variable!
- Returns:
- The set of variables contained in this scope. The iterator over the returned set will iterate in variable ID order.
-
numVariables
int numVariables()
- Returns:
- The number of variables contained in this scope.
-
numFunctions
int numFunctions()
- Returns:
- The number of functions contained in this scope.
-
id
int id()
- Returns:
- The id of this scope. This id is unique within the model.
-
children
java.util.Set<Scope> children()
- Returns:
- The scopes contained by this scope.
-
model
Model model()
- Returns:
- The model to which this scope belongs.
-
setParent
void setParent(Scope parent)
- Parameters:
parent- The containing scope of this scope.
-
setVariables
void setVariables(java.util.Set<Variable> variables)
- Parameters:
variables- The set of variables contained in this scope.
-
setChildren
void setChildren(java.util.Set<Scope> children)
- Parameters:
children- The scopes contained by this scope.
-
addChild
void addChild(Scope child)
- Parameters:
A- new scope contained by this scope.
-
addVariable
void addVariable(Variable variable)
A new variable in this scope.
-
contains
Variable contains(Variable variable)
If a variable is already included in this scope, return the included variable. Otherwise return null.- Parameters:
variable- The variable which is being checked.- Returns:
- included variable iff variable already exists in this scope, null otherwise.
-
variable
Variable variable(Identifier name)
Get the variable associated with an identifier. If this scope does not contain such a variable, parent scopes will be recursively checked.- Parameters:
name- The identifier for the variable.- Returns:
- The model representation of the variable in this scope hierarchy, or null if not found.
-
variable
Variable variable(int vid)
Get the variable at the specified array index.- Parameters:
vid- The index of the variable. Should be in the range [0,numVariable()-1].- Returns:
- The variable at the index.
-
setFunction
void setFunction(CIVLFunction function)
- Parameters:
function- The function containing this scope.
-
function
CIVLFunction function()
- Returns:
- The function containing this scope.
-
functionName
Identifier functionName()
- Returns:
- The identifier of the function containing this scope.
-
variablesWithProcrefs
java.util.Collection<Variable> variablesWithProcrefs()
A variables has a "procRefType" if it is of type Process, if it is an array with element of procRefType, or if it is a struct with fields of procRefType.- Returns:
- A collection of the variables in this scope with a procRefType.
-
variablesWithStaterefs
java.util.Collection<Variable> variablesWithStaterefs()
A variables has a "$state" type, if it is of type $state, if it is an array with element of type $state, or if it is a struct with fields of type $state.- Returns:
- A collection of the variables in this scope with a type $state.
-
variablesWithScoperefs
java.util.Collection<Variable> variablesWithScoperefs()
A variables has a "scopeRefType" if it is of type Scope, if it is an array with element of scopeRefType, if it is a struct with fields of scopeRefType, or if it contains a pointer.- Returns:
- A collection of the variables in this scope with a scopeRefType.
-
variablesWithPointers
java.util.Collection<Variable> variablesWithPointers()
A variable contains a pointer type if it is of type PointerType, if it is an array with elements containing pointer type, or if it is a struct with fields containing pointer type.- Returns:
- A collection of the variables in this scope containing pointer types.
-
varsNeedSymbolicConstant
java.util.Collection<Variable> varsNeedSymbolicConstant()
A variable whose type is not a primitive type.- Returns:
- A collection of the variables in this scope containing pointer types.
-
print
void print(java.lang.String prefix, java.io.PrintStream out, boolean isDebug)Print the scope and all children.- Parameters:
prefix- String prefix to print on each lineout- The PrintStream to use for printing.isDebug- True iff the debugging option is enabled, when more information will be printed, such as if a variable is purely local
-
getVid
int getVid(Variable staticVariable)
-
isDescendantOf
boolean isDescendantOf(Scope anc)
Return true if the scope is a descendant of the scope anc- Parameters:
des-anc-- Returns:
- true or false
-
containsVariable
boolean containsVariable(java.lang.String name)
-
variable
Variable variable(java.lang.String name)
-
addFunction
void addFunction(CIVLFunction function)
-
getFunction
CIVLFunction getFunction(Identifier name)
-
getFunction
CIVLFunction getFunction(java.lang.String name)
-
getFunction
CIVLFunction getFunction(int fid)
-
complete
void complete()
-
hasVariable
boolean hasVariable()
-
hasVariableWtPointer
boolean hasVariableWtPointer()
-
-