|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectaspoev.interpreter.runtime.ExecutionEnvironment
The runtime environment of the interpreter - this includes variable resolution, scoping, maintianing the 'this' object, etc.. If the interpreter ever has a question concerning the state of program execution, it queries this object. The execution environment also stores variables that are passed as arguments. Runtime stack structure: [ ] <- scope ( '{, }' delineated) (holds HashMaps for [ ] variable storage /lookup) [ ] [ ][ ][ ][ ] <- methodStack (delineated by method invocation, return) [ ] [ ] <- objectStack (delineated by object control flow)
| Field Summary | |
protected java.util.Stack |
argumentStack
|
protected static java.util.HashMap |
globalFrame
|
protected static java.util.HashMap |
knownClasses
|
protected aspoev.interpreter.runtime.ObjectStack |
objectStack
|
protected java.util.HashMap |
staticFrame
|
| Constructor Summary | |
ExecutionEnvironment()
|
|
| Method Summary | |
boolean |
cflow(MetaObject object)
If this object is somewhere in the call stack. |
boolean |
cflow(MetaObject object,
java.lang.String methodName)
If this object calls this method somewhere in the call stack. |
boolean |
cflow(java.lang.String methodName)
If this method is somewhere in the callstack. |
boolean |
cflow(TypeReferenceElement type)
If this type is somewhere in the call stack. |
boolean |
cflow(TypeReferenceElement type,
java.lang.String methodName)
If this type calls this method somewhere in the call stack. |
void |
declareGlobalVariable(TypeReferenceElement type,
java.lang.String handle)
Declares a variable of the specified type and handle that is globally visible. |
void |
declareGlobalVariable(TypeReferenceElement type,
VariableReferenceElement reference)
Declares a variable of the specified type and handle that is globally visible. |
void |
declareGlobalVariable(VariableDeclarationElement varDecl)
Declares a variable of the specified type and handle that is globally visible. |
void |
declareStaticVariable(TypeReferenceElement type,
VariableReferenceElement reference)
Declares a variable which is static in this execution environment. |
void |
declareStaticVariable(VariableDeclarationElement variable)
|
VariableDeclarationElement |
declareVariable(TypeReferenceElement type,
java.lang.String variableName)
Declares a variable of the specified type and name. |
VariableDeclarationElement |
declareVariable(TypeReferenceElement type,
VariableReferenceElement reference)
Declares a variable of the specified type and name. |
void |
declareVariable(VariableDeclarationElement localVariable)
Adds the newly declared variable to the current stack frame. |
java.lang.String |
getCurrentNameSpace()
Returns the name space of the currently executing object. |
aspoev.interpreter.runtime.MethodStackFrame |
getCurrentStackFrame()
Returns the current method frame. |
protected VariableDeclarationElement |
getLocalVariable(VariableReferenceElement handle)
|
java.lang.String |
getNextNameSpace(java.lang.String nameSpace)
Returns the next name space in teh execution stack. |
int |
getNumArguments()
Returns the number of arguments currently in the argument stack. |
TypeReferenceElement |
getVariableType(VariableReferenceElement reference)
Returns the type of the most visible variable with the given handle. |
java.lang.Object |
getVariableValue(java.lang.String variableName)
Returns the vale of the value of the given name. |
java.lang.Object |
getVariableValue(VariableReferenceElement reference)
|
protected void |
initEnvironment()
|
DatabaseObject |
peekCurrent()
Basically getThis(). |
java.lang.Object |
popArgument()
Removes an argument from the argument stack. |
DatabaseObject |
popCurrent()
Push current and pop current methods maintain the 'this' object in the call stack. |
aspoev.interpreter.runtime.MethodStackFrame |
popMethodFrame()
Method return - pops a method frame from the method execution stack. |
ScopeFrame |
popScope()
|
void |
printEnvironment()
Prints a visual of the object stack and method stack. |
void |
pushArgument(java.lang.Object args)
Semantics of passing arguments - push them onto the argument stack, the executing method will then pop them off. |
void |
pushCurrent(DatabaseObject current)
Makes the specified object the currently executing object. |
void |
pushMethodFrame(java.lang.String methodName)
Method invocation - pushes a method frame on the method execution stack. |
void |
pushScope()
Pushes scope. |
void |
pushScope(ScopeFrame scope)
Pushes the specified scope. |
protected java.lang.Object |
setClassVariable(VariableReferenceElement reference,
java.lang.Object newValue)
|
protected java.lang.Object |
setLocalVariable(VariableDeclarationElement decl,
java.lang.Object newValue)
|
java.lang.Object |
setStaticVariableValue(VariableReferenceElement reference,
java.lang.Object newValue)
Sets the value of a statically declared variable to the specified value. |
java.lang.Object |
setVariableValue(java.lang.String variableName,
java.lang.Object newValue)
Sets the variable specified to the value specified. |
java.lang.Object |
setVariableValue(VariableReferenceElement reference,
java.lang.Object newValue)
Sets the variable specified to the value specified. |
protected void |
typeCheck(TypeReferenceElement varType,
java.lang.Object newValue)
|
boolean |
within(MetaObject object)
If this object is currently executing. |
boolean |
within(MetaObject object,
java.lang.String methodName)
If this object is executing this method. |
boolean |
within(java.lang.String methodName)
If this method is currently executing. |
boolean |
within(TypeReferenceElement type)
If any object of this type is currently executing. |
boolean |
within(TypeReferenceElement type,
java.lang.String methodName)
If this type is executing this method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static java.util.HashMap knownClasses
protected java.util.HashMap staticFrame
protected static java.util.HashMap globalFrame
protected aspoev.interpreter.runtime.ObjectStack objectStack
protected java.util.Stack argumentStack
| Constructor Detail |
public ExecutionEnvironment()
| Method Detail |
protected void initEnvironment()
public boolean within(MetaObject object)
public boolean within(TypeReferenceElement type)
public boolean within(java.lang.String methodName)
public boolean within(MetaObject object,
java.lang.String methodName)
public boolean within(TypeReferenceElement type,
java.lang.String methodName)
public boolean cflow(MetaObject object)
public boolean cflow(TypeReferenceElement type)
public boolean cflow(java.lang.String methodName)
public boolean cflow(MetaObject object,
java.lang.String methodName)
public boolean cflow(TypeReferenceElement type,
java.lang.String methodName)
public VariableDeclarationElement declareVariable(TypeReferenceElement type,
java.lang.String variableName)
public VariableDeclarationElement declareVariable(TypeReferenceElement type,
VariableReferenceElement reference)
public void declareVariable(VariableDeclarationElement localVariable)
public void declareGlobalVariable(TypeReferenceElement type,
java.lang.String handle)
public void declareGlobalVariable(TypeReferenceElement type,
VariableReferenceElement reference)
public void declareGlobalVariable(VariableDeclarationElement varDecl)
public void declareStaticVariable(TypeReferenceElement type,
VariableReferenceElement reference)
public void declareStaticVariable(VariableDeclarationElement variable)
public java.lang.String getCurrentNameSpace()
public aspoev.interpreter.runtime.MethodStackFrame getCurrentStackFrame()
public java.lang.String getNextNameSpace(java.lang.String nameSpace)
public int getNumArguments()
public TypeReferenceElement getVariableType(VariableReferenceElement reference)
public java.lang.Object getVariableValue(java.lang.String variableName)
public java.lang.Object getVariableValue(VariableReferenceElement reference)
protected VariableDeclarationElement getLocalVariable(VariableReferenceElement handle)
public void pushCurrent(DatabaseObject current)
public DatabaseObject popCurrent()
public DatabaseObject peekCurrent()
public void pushArgument(java.lang.Object args)
public java.lang.Object popArgument()
public void pushMethodFrame(java.lang.String methodName)
public aspoev.interpreter.runtime.MethodStackFrame popMethodFrame()
public void pushScope(ScopeFrame scope)
public void pushScope()
public ScopeFrame popScope()
public java.lang.Object setStaticVariableValue(VariableReferenceElement reference,
java.lang.Object newValue)
public java.lang.Object setVariableValue(java.lang.String variableName,
java.lang.Object newValue)
public java.lang.Object setVariableValue(VariableReferenceElement reference,
java.lang.Object newValue)
protected java.lang.Object setClassVariable(VariableReferenceElement reference,
java.lang.Object newValue)
protected java.lang.Object setLocalVariable(VariableDeclarationElement decl,
java.lang.Object newValue)
protected void typeCheck(TypeReferenceElement varType,
java.lang.Object newValue)
public void printEnvironment()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||