public class ScopeChain extends Object
| Constructor and Description |
|---|
ScopeChain()
Constructs an empty scope chain without any known scopes.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key)
This method checks if the given
key does exists within the scope chain. |
boolean |
currentScopeContainsVariable(String variableName)
Checks if the current scope contains a variable without then looking up the scope chain.
|
ScopeChain |
deepCopy()
Creates a deep copy of the ScopeChain.
|
Object |
get(String key)
Retrieves a variable from the scope chain, starting at the current scope and working it's way
up all visible scopes.
|
List<Scope> |
getGlobalScopes() |
void |
popScope()
Pops the most recent scope from the scope chain.
|
void |
pushLocalScope()
Adds a new local scope to the scope chain
|
void |
pushScope()
Adds an empty non-local scope to the scope chain
|
void |
pushScope(Map<String,Object> map)
Adds a new non-local scope to the scope chain
|
void |
put(String key,
Object value)
Adds a variable to the current scope.
|
void |
set(String key,
Object value)
Sets the value of a variable in the first scope in the chain that already contains the
variable; adds a variable to the current scope if an existing variable is not found.
|
public ScopeChain()
public ScopeChain deepCopy()
This will construct a new scope chain and new scopes but it will continue to have references to the original user-provided variables. This is why it is important for the user to only provide thread-safe variables when using the "parallel" tag.
public void pushScope()
public void pushScope(Map<String,Object> map)
map - The known variables of this scope.public void pushLocalScope()
public void popScope()
public void put(String key, Object value)
key - The name of the variablevalue - The value of the variablepublic Object get(String key)
key - The name of the variablepublic boolean containsKey(String key)
key does exists within the scope chain.key - the for which the the check should be executed for.true when the key does exists or false when the given key does not
exists.public boolean currentScopeContainsVariable(String variableName)
variableName - The name of the variablepublic void set(String key, Object value)
key - The name of the variablevalue - The value of the variableCopyright © 2018. All rights reserved.