|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--koala.dynamicjava.interpreter.context.VariableContext
This class encapsulates the behaviour of Java scopes.
| Inner Class Summary | |
protected static class |
VariableContext.AbstractVariable
To store the variables |
protected class |
VariableContext.Constant
To store the constants |
protected static class |
VariableContext.Link
To store one scope |
protected static class |
VariableContext.LinkFactory
To manage the creation of scopes and links |
protected static class |
VariableContext.Scope
A table which maps a string with an object |
protected static class |
VariableContext.Variable
To store the variables |
| Field Summary | |
protected VariableContext.Scope |
cscope
The current scope for variables |
protected VariableContext.Scope |
scope
The current scope |
protected VariableContext.Link |
scopes
The scopes |
| Constructor Summary | |
VariableContext()
Creates a new context initialized with an empty initial scope |
|
VariableContext(java.util.Set entries)
Creates a new context initialized with the given entries defined in the initial scope. |
|
| Method Summary | |
void |
define(java.lang.String name,
java.lang.Object value)
Defines a new variable in the current scope |
void |
defineConstant(java.lang.String name,
java.lang.Object value)
Defines a new constant variable in the current scope |
void |
defineVariables(java.util.Set vars)
Defines the given variables |
void |
enterScope()
Enters a scope |
void |
enterScope(java.util.Set entries)
Enters a scope and defines the given entries to null. |
java.lang.Object |
get(java.lang.String name)
Returns the value of a variable with the given name |
java.util.Map |
getConstants()
Creates a map that contains the constants in this context |
java.util.Set |
getCurrentScopeVariableNames()
Returns the current scope variables (strings) in a set |
java.util.Set |
getCurrentScopeVariables()
Returns the current scope variables in a set |
boolean |
isDefinedVariable(java.lang.String name)
Tests whether an entry is defined in this context |
boolean |
isFinal(java.lang.String name)
Tests whether a variable is final in this context |
java.util.Set |
leaveScope()
Leaves the current scope |
void |
set(java.lang.String name,
java.lang.Object value)
Sets the value of a defined variable |
void |
setConstant(java.lang.String name,
java.lang.Object value)
Sets the value of a constant variable in the current scope |
void |
setVariable(java.lang.String name,
java.lang.Object value)
Sets the value of a variable in the current scope |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected VariableContext.Link scopes
protected VariableContext.Scope scope
protected VariableContext.Scope cscope
| Constructor Detail |
public VariableContext()
public VariableContext(java.util.Set entries)
entries - a set of string| Method Detail |
public void enterScope()
enterScope in interface SimpleContextpublic void enterScope(java.util.Set entries)
enterScope in interface SimpleContextentries - a set of stringpublic void defineVariables(java.util.Set vars)
defineVariables in interface SimpleContextpublic java.util.Set leaveScope()
leaveScope in interface SimpleContextpublic java.util.Set getCurrentScopeVariables()
getCurrentScopeVariables in interface SimpleContextpublic java.util.Set getCurrentScopeVariableNames()
getCurrentScopeVariableNames in interface SimpleContextpublic boolean isDefinedVariable(java.lang.String name)
isDefinedVariable in interface SimpleContextname - the name of the entrypublic boolean isFinal(java.lang.String name)
isFinal in interface SimpleContextname - the name of the entryjava.lang.IllegalStateException - if the variable is not defined
public void define(java.lang.String name,
java.lang.Object value)
define in interface SimpleContextname - the name of the new entryvalue - the value of the entryjava.lang.IllegalStateException - if the variable is already defined
public void defineConstant(java.lang.String name,
java.lang.Object value)
defineConstant in interface SimpleContextname - the name of the new entryvalue - the value of the entryjava.lang.IllegalStateException - if the variable is already definedpublic java.lang.Object get(java.lang.String name)
get in interface SimpleContextname - the name of the value to getjava.lang.IllegalStateException - if the variable is not defined
public void set(java.lang.String name,
java.lang.Object value)
set in interface SimpleContextname - the name of the entryvalue - the value of the entryjava.lang.IllegalStateException - if the variable is not defined or is final
public void setConstant(java.lang.String name,
java.lang.Object value)
setConstant in interface SimpleContextname - the name of the entryvalue - the value of the entry
public void setVariable(java.lang.String name,
java.lang.Object value)
setVariable in interface SimpleContextname - the name of the entryvalue - the value of the entrypublic java.util.Map getConstants()
getConstants in interface SimpleContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||