|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.problets.domain.model.implement.ActivationRecord
public class ActivationRecord
Creates and maintains the activation record for a Scope object. The activation record holds the name of this scope object, a list of variables, pointers, and nested scope objects, as well as a static link to parent scope object.
| Constructor Summary | |
|---|---|
ActivationRecord(ActivationRecord parentActivationRecord,
Scope inScope)
Initializes the vectors to hold the variables and pointers in this scope; initializes the vector to hold the activation records of embedded scopes; save a reference to the scope of which this is the activation record; saves a reference to the activation record of the parent scope, and adds self as a child of parent's activation record, if one exists |
|
| Method Summary | |
|---|---|
void |
add(ActivationRecord activationRecord)
Adds an embedded scope's activationRecord as a child of this activationRecord |
void |
cast(ActivationRecord partial)
Sets all the variables in this activation record that are also in partial as declared and all the rest as not declared. |
ActivationRecord |
deepClone()
Clones this activation record, as well as its variables and pointers, but NOT embedded scopes |
void |
explainProcess(RunEnv runEnv,
Behavior behavior,
java.lang.String statement,
int event,
int lineNumber)
Explains the event that occurs during the execution of statement on line lineNumber |
void |
getAllChildReferences(java.util.Vector referenceList)
Provides reference to the activation records of all the embedded scopes |
void |
getAllPointeeReferences(java.util.Vector referenceList)
Provides reference to all the anonymous objects pointed to by pointers in this activation record |
void |
getAllVariableReferences(java.util.Vector referenceList)
Provides reference to all the variables and pointers in this activation record |
ActivationRecord |
getParent()
Returns a reference to the activation record of the static parent |
PtrModel |
getPointer(int index,
boolean searchParents,
boolean searchChildren)
Returns a reference to the pointer of given index by searching this activation record, followed by activation records of ancestral scopes, followed by the activation records of nested scopes searchParents = false; searchChildren = false; Only check this scope object for the variable searchParents = false; searchChildren = true; NOT LIKELY USAGE - except when the procedure calls itself recursively when the flags are true & true searchParents = true; searchChildren = false; Check this scope object, and all its ancestors searchParents = true; searchChildren = true; Check this scope object, its static parents and children - Used to create buggy code. |
Scope |
getScopeModel()
Returns a reference to the Scope of which this is the activation record |
AbstractVarModel |
getVariable(int index,
boolean searchParents,
boolean searchChildren)
Returns a reference to the variable of given index by searching this activation record, followed by activation records of ancestral scopes, followed by the activation records of nested scopes searchParents = false; searchChildren = false; Only check this scope object for the variable searchParents = false; searchChildren = true; NOT LIKELY USAGE - except when the procedure calls itself recursively when the flags are true & true searchParents = true; searchChildren = false; Check this scope object, and all its ancestors searchParents = true; searchChildren = true; Check this scope object, its static parents and children - Used to create buggy code. |
boolean |
hasChildren()
Returns true if this activation record has descendant activation records corresponding to embedded scopes |
boolean |
isEmpty()
Returns true if no variables or pointers have been declared in this activation record, and false otherwise. |
static void |
main(java.lang.String[] args)
|
void |
print()
Prints the name of the scope corresponding to this activation record, name of the parent scope, followe by all the variables and pointers in this scope |
void |
replaceChild(ActivationRecord replacement)
If an activation record exists for the scope for which the replacement activation record parameter has been provided, replaces the old activation record with the new replacement. |
void |
setPointer(PtrModel pointer,
int index)
Inserts a pointer to the activation record at the given index |
void |
setStaticLink(ActivationRecord activationRecord)
Sets the passed parameter as the parent of this activation record |
void |
setVariable(AbstractVarModel variable,
int index)
Inserts a variable to the activation record at the given index |
ActivationRecord |
shallowClone()
Clones this activation record, but not its variables, pointers or embedded scopes |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ActivationRecord(ActivationRecord parentActivationRecord,
Scope inScope)
parentActivationRecord - ActivationRecord of the parent scope, destination of this ActivationRecord's static linkinScope - Scope of which this is the activation record| Method Detail |
|---|
public ActivationRecord shallowClone()
public ActivationRecord deepClone()
public PtrModel getPointer(int index,
boolean searchParents,
boolean searchChildren)
index - - integer index of the pointer, e.g., 1 in P1searchParents - - boolean value specifying whether activation records of ancestor scopes should be searched if the pointer does not exist in this activation record - used to look for nonlocal referencing environmentsearchChildren - - boolean value specifying whether activation records of embedded scopes should be searched if the pointer does not exist in this activation record - used to support generation of INcorrect code, not used for correct code
public AbstractVarModel getVariable(int index,
boolean searchParents,
boolean searchChildren)
index - - integer index of the variable, e.g., 1 in V1searchParents - - boolean value specifying whether activation records of ancestor scopes should be searched if the variable does not exist in this activation record - used to look for nonlocal referencing environmentsearchChildren - - boolean value specifying whether activation records of embedded scopes should be searched if the variable does not exist in this activation record - used to support generation of INcorrect code, not used for correct code
public ActivationRecord getParent()
public Scope getScopeModel()
public void getAllVariableReferences(java.util.Vector referenceList)
referenceList - Vector to which references of all the variables and pointers in this activation record are addedpublic void getAllPointeeReferences(java.util.Vector referenceList)
referenceList - Vector to which references of all the pointee objects of pointers in this activation record are addedpublic void getAllChildReferences(java.util.Vector referenceList)
referenceList - Vector to which references of the activation records of all the embedded scopes are addedpublic boolean hasChildren()
public boolean isEmpty()
public void cast(ActivationRecord partial)
public void add(ActivationRecord activationRecord)
activationRecord - ActivationRecord of the embedded scopepublic void replaceChild(ActivationRecord replacement)
replacement - ActivationRecord of an embedded scope that will either replace the old ActivationRecord (if one exists) for the same embedded scope, or be added as a child of this ActivationRecord
public void setPointer(PtrModel pointer,
int index)
pointer - - PtrModel object to be inserted into the activation recordindex - - Integer index where the pointer is to be inserted into the activation record
public void setVariable(AbstractVarModel variable,
int index)
pointer - - AbstractVarModel object to be inserted into the activation recordindex - - Integer index where the variable is to be inserted into the activation recordpublic void setStaticLink(ActivationRecord activationRecord)
activationRecord - ActivationRecord of the static parent
public void explainProcess(RunEnv runEnv,
Behavior behavior,
java.lang.String statement,
int event,
int lineNumber)
runEnv - RunEnv or the running environment for execution, including data stack, heap, input, output and code stackbehavior - Behavior of the executed program, including explanation, errors, output, dataTrace and controlTracestatement - Substring of the template corresponding to the next statement being executedevent - Integer representing one of the events described in DomainModel that occurs during the execution of the statementlineNumber - Integer indicating the line number of this statement in the overall programpublic void print()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||